Skip to main content

Send Native Tokens

After you have created a native token, you can easily send it by calling the Account.send_native_tokens(params, options) function.

As with any output, you can set output unlock conditions. Keep in mind that if you set unlock conditions, whoever you send the native tokens to may need to claim them.

Example Code

  1. Instantiate a Wallet, get Alice's Account which was created in the first guide and sync it.
  2. Search the account's balance for a native token with a balance of at least SEND_NATIVE_TOKEN_AMOUNT.
sdk/examples/how_tos/native_tokens/send.rs
loading...
  1. Prepare the outputs for the transaction by creating a new SendNativeTokensParams.
sdk/examples/how_tos/native_tokens/send.rs
loading...
  1. Send the native tokens by calling the account.send_native_tokens() function.
sdk/examples/how_tos/native_tokens/send.rs
loading...

Full Example Code

sdk/examples/how_tos/native_tokens/send.rs
loading...

Expected Output

Balance before sending: 50
Transaction sent: 0x9a1ea93962b5d4ba3a27053f4727dcc95b29ee35dc85c43d9d6be4635ab10463
Block included: https://explorer.shimmer.network/testnet/block/0xb22cba455a3176ef62352f907b0fc5e5e49b4797563826141f8057cfa960a640
Balance after sending: 40