Skip to main content

Request Funds to Alias/NFT wallet

Alias and NFT addresses play a significant role in decentralized systems, particularly in managing and identifying various assets. Unlike traditional addresses associated with specific user accounts, those addresses are specifically assigned to Alias and NFT outputs. These outputs have their own unique addresses, enabling them to hold their respective base tokens or any other native assets. This means that you could transfer ownership of all the assets controlled by the such an address by transferring its output.

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. Request the account's balance by calling the Account.sync() function. function.
sdk/examples/how_tos/alias_wallet/request_funds.rs
loading...
  1. Retrieve the Alias Id of the first AliasOutput related to Alice's account.
sdk/examples/how_tos/alias_wallet/request_funds.rs
loading...
  1. Retrieve the Alias address using the AliasAddress.to_bech32() function.
sdk/examples/how_tos/alias_wallet/request_funds.rs
loading...
  1. Request funds to the FAUCET_URL you defined in the .env file by calling the Client::utils::request_funds_from_faucet function.
sdk/examples/how_tos/alias_wallet/request_funds.rs
loading...

Full Example Code

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

Expected Output

Balance before requesting funds on alias address: 1000000000
Alias Id: 0x60ad63a97179af7012809279140aabe34eafe37ef912b9a5a33fc7f8c58a20a7
{"address":"rms1pps26cafw9u67uqjszf8j9q24035atlr0mu39wd95vlu07x93gs2wf8n29a","waitingRequests":1}

Balance after requesting funds on alias address: 2300000000