Skip to main content

Alias Wallet Transaction

Once you have requested funds from the faucet you are ready to send your first transaction from an alias account.

Alias or NFT as wallet

Although this How-To shows how to use an Alias as wallet, the same code can be applied for NFTs with minor changes

Online Faucet

You can request test funds from the Shimmer Testnet Faucet.

Example Code

The following example will:

  1. Instantiate a Wallet, get Alice's Account which was created in the first guide.
  2. Sync the account with the node to get the latest transactions by calling the Account.sync() function. Note how the SyncOptions for the Alias set AliasSyncOptions.basicOutputs to true.
sdk/examples/how_tos/alias_wallet/transaction.rs
loading...
sdk/examples/how_tos/alias_wallet/transaction.rs
loading...
  1. Retrieve the Alias Id of the first AliasOutput related to Alice's account.
sdk/examples/how_tos/alias_wallet/transaction.rs
loading...
  1. Retrieve the Alias' address using the Client.alias_id_to_bech32() function.
sdk/examples/how_tos/alias_wallet/transaction.rs
loading...
  1. Send 1 SMR to an address using the Account.send() function. Make sure to update the code sample to send to the address of your choice.
sdk/examples/how_tos/alias_wallet/transaction.rs
loading...

Full Example Code

sdk/examples/how_tos/alias_wallet/transaction.rs
loading...

Expected Output

Balance before sending funds from alias: 2000000000
Alias Id: 0x81df8f7e1ad625befebf1456cd0775a124b47a274061010e080bbf7c18593acc
Transaction with custom input: https://explorer.shimmer.network/testnet/transaction/0x0f2f72e09a3a9f9fc8cd1fd4e196c2d198580ec9c873efcf5d6d99809bd9e8f7
Balance after sending funds from alias: 1999000000