Destroy an Alias Output
You can destroy an alias output by ID using the Account.destroy_alias(alias_id, options)
function. If the alias still owns any outputs when you try to destroy it, you will get an error.
Code Example
The following example will:
- Create an account manager.
- Get Alice's account which was created in the first guide.
- Get the account's balance.
- Destroy an alias output by id.
- Get the account's balance again to show the difference after step 4.
- Rust
- Nodejs
- Python
- Java
This example uses dotenv, which is not safe for use in production environments.
loading...
Before you run the example you should update the alias_id
to one available in your account.
Run the example by running the following command:
cargo run --example destroy_alias --release
This how to guide is not available in your language of choice at the moment. Please feel free to browse more examples which may suit your requirements.
This how to guide is not available in your language of choice at the moment. Please feel free to browse more examples which may suit your requirements.
loading...
Expected Output
- Rust
- Nodejs
- Python
- Java
Balancebeforedestroying: AccountBalance{
base_coin: BaseCoinBalance{
total: 109999491000,
available: 109999491000
},
required_storage_deposit: 3155000,
native_tokens: [
...
],
nfts: [
NftId(0x346cf240e9e56132295b0d648fde7037ad0b2e43a35c46668313e1be2970c08c),
NftId(0x79862038299b19b704c10da655afedd77c930278ae56f7a4cb9bca4bf6dd7313)
],
aliases: [
AliasId(0x0aa4fe362b61da2d4c11909162939c0fe20913e2edf5c12ea15cf92f6b36ef60),
],
[...]
}
Balanceafterdestroying: AccountBalance{
base_coin: BaseCoinBalance{
total: 109999491000,
available: 109999491000
},
required_storage_deposit: 3155000,
native_tokens: [
...
],
nfts: [
NftId(0x346cf240e9e56132295b0d648fde7037ad0b2e43a35c46668313e1be2970c08c),
NftId(0x79862038299b19b704c10da655afedd77c930278ae56f7a4cb9bca4bf6dd7313)
],
aliases: [
],
[...]
}
This how to guide is not available in your language of choice at the moment. Please feel free to browse more examples which may suit your requirements.
This how to guide is not available in your language of choice at the moment. Please feel free to browse more examples which may suit your requirements.
{
"payload": {
"type": 6,
"essence": {
"type": 1,
"networkId": "1856588631910923207",
"inputs": [
{
"type": 0,
"transactionId": "0xef3c9f8e8179e133f8207f3933039eaaf601f1f260b6116d7ca7c6711baa91a8",
"transactionOutputIndex": 0
}
],
"inputsCommitment": "0xebda3754c942e47e7dd0e9177ad24c2985b4db98009a58ee2417e69695c8afc5",
"outputs": [
{
"type": 3,
"amount": "103100",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0xcb89e7952f758942e4e623708ebd1512e11bd5b39abc53f082ef8a9c20ac760a"
}
}
]
}
]
},
"unlocks": [
{
"type": 0,
"signature": {
"type": 0,
"publicKey": "0x8deb59df30fdd61349c20987179b5e0268e34338f37841b816f62e66820dae6c",
"signature": "0x0740d0b4435c25c0b57d579c90d2dd1a197b18b95a9784a1fc04ce51e63b2f93f680ec3568751a8cae09eaf3f5ee4fad2543f3a6ada14501af091d94d103a70f"
}
}
]
},
"blockId": "0x3f86a22d6170b64a420562a8e31adcd515a6d2b15d0201f60e20fc037b9ec455",
"inclusionState": "Pending",
"timestamp": "1664966791558",
"transactionId": "0xf4f21680774c74ae44d3244aca8cc3fd0248930561de673032afb21b18b04e8e",
"networkId": "1856588631910923207",
"incoming": false
}