init_transfer

@mount("ft4.crosschain.init_transfer") operation init_transfer(recipient_id: byte_array, asset_id: byte_array, amount: big_integer, hops: list<byte_array>, deadline: integer)(source)

Initializes a crosschain transfer, which is a transfer that goes to a different blockchain on the Chromia network.

Since this chain cannot communicate with any other chain, it is up to the client to perform the necessary steps to complete this transfer. Furthermore, this chain will not validate if the sender is allowed to send assets to the target chain or if the recipient account exists, meaning that when the client tries to apply the transfer on the target chain, it might not be accepted. Should that happen, the sender can recall their transfer after the deadline has expired.

Must be signed by an auth descriptor with accounts.auth_flags.TRANSFER

The functionality provided by init_transfer can be modified by extending before_init_transfer and after_init_transfer

Throws "TRANSFER EXPIRED"` if deadline is a past timestamp

Throws "MISSING ASSET" if the asset does not exist on this chain

Throws if additional conditions provided through extensions of before_init_transfer and after_init_transfer are not satisfied

Throws if the first transfer is misconfigured. Common cases are:

  • hops[0] is:

    • equal to the sender account ID

    • this blockchain's RID

    • the ID of an account on this chain which is not a blockchain account

  • amount is:

    • not in the accepted range (0, 2^256) (exclusive)

    • higher than the account's balance

  • sender account ID is equal to this chain's ID

Requires the Transfer flag to be present on the auth descriptor that authorizes this operation.

Parameters

recipient_id

the account that will receive the transfers on the final chain

asset_id

the ID of the asset that is being transferred

amount

the amount that is being transferred

hops

an array of all the blockchain rids which this transfer needs to go through in order to reach the recipient on the target chain, which will be the last entry in the array. The rid of this blockchain must not be included in the array.

deadline

Time in milliseconds for which this transfer is valid, if the transfer were not completed within this deadline, it will be possible for the sender to recall it.

See also

core.crosschain.before_init_transfer

to add custom logic before this operation

core.crosschain.after_init_transfer

to add custom logic after this operation

core.crosschain.applied_transfers

to know more about the crosschain transfer workflow

core.crosschain.ACCOUNT_TYPE_BLOCKCHAIN

for more info on blockchain account entities