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
- Rust
- Typescript (Node.js)
- Python
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide. - Request the account's balance by calling the
Account.sync()
function. function.
- Retrieve the Alias Id of the first
AliasOutput
related to Alice's account.
- Retrieve the Alias address using the
AliasAddress.to_bech32()
function.
- Request funds to the
FAUCET_URL
you defined in the.env
file by calling theClient::utils::request_funds_from_faucet
function.
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Request the account's balance by calling the
Account.sync()
function.
- Retrieve the Alias Id of the first
AliasOutput
related to Alice's account.
- Retrieve the Alias' address using the
Utils.aliasIdToBech32()
function.
- Request funds to the
FAUCET_URL
you defined in the.env
file by calling theClient.requestFundsFromFaucet()
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Request the account's balance by calling the
Account.sync()
function.
- Retrieve the Alias Id of the first
AliasOutput
related to Alice's account.
- Retrieve the
AliasAddress
using theUtils.alias_id_to_bech32()
function.
- Request funds to the
FAUCET_URL
you defined in the.env
file by calling theClient.request_funds_from_faucet
function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/alias_wallet/request_funds.rs
loading...
bindings/nodejs/examples/how_tos/alias_wallet/request-funds.ts
loading...
bindings/python/examples/how_tos/alias_wallet/request_funds.py
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