transfer_to_recipient_id

function transfer_to_recipient_id(sender: account, recipient_id: byte_array, asset: asset, amount: big_integer)(source)

Transfers tokens to a certain recipient. If the recipient exists, a normal transfer will take place. Otherwise, if account creation on transfer is enabled, the account creation procedure will be started. Marked as Unsafe because it does not check whether the account authorized the transfer.

Throws if the required assets cannot be transferred. Common cases include:

  • the amount to transfer is not in the accepted range (0, 2^256) (exclusive)

  • some conditions added in development through transfer extensions (before_transfer or after_transfer) aren't met

  • the sender account's balance is lower than amount

Throws "INVALID RECIPIENT" if the recipient does not exist and is_create_on_internal_transfer_enabled returns false.

Can only be called from operations.

Parameters

sender

the account that started the transfer

recipient_id

the account that should receive the transfer or be created

asset

the asset that should be sent

amount

the amount to transfer