It depends on many factors.
-
You have included the
initState
(that is the code and data of the wallet or smart contract) alongside your transaction. In this case the smart contract is deployed first, and then it handles the incoming message. This is similar to sending the transaction to an initialized account. -
No
initState
, andbounce
flag is set. In this case, the message cannot be delivered to a smart contract and the message will be bounced back to the sender. After subtracting the consumed gas, the rest of the amount is returned back. -
No
initState
, andbounce
flag is unset. In this case, the message cannot be delivered, but it will not bounce back to the sender, and the sent amount will be accounted for the reciving address, essentially increasing its balance.
In fact, one way to deploy a wallet, is to send some TON to its address (which is not initialized yet) with the bounce
flag unset. After this step, the owner can deploy and initialize the wallet using the funds at the current unintialized address. This step usually happens on the first withdraw operation.
Wallets usually check the state of the target address and if it's not initialized, they unset the bounce
flag, so that it's not returned.