Skip to main content

Features

The Stardust protocol introduced multiple new output features that allow you to add metadata, a sender (or issuer in the case of NFTs) or tag them by adding some small indexation data to the output.

Client in Wallet

If you are using a wallet you can always get the client by calling the client()/getClient()/get_client() method

Output Features

Different outputs can have different features. This table shows you which output has which features. You can find the output specs in TIP-018

OutputSenderMetadataImmutable MetadataTagImmutable Issuer
Basicxxx
Aliasxxxx
Foundryxx
NFTxxxxx

Example Code

  1. Create multiple NFT outputs using the NftOutputBuilder and use the NftOutputBuilder.add_feature function to add the following features:
sdk/examples/how_tos/outputs/features.rs
loading...
sdk/examples/how_tos/outputs/features.rs
loading...
sdk/examples/how_tos/outputs/features.rs
loading...
  1. Add the following immutable features:
sdk/examples/how_tos/outputs/features.rs
loading...
sdk/examples/how_tos/outputs/features.rs
loading...

Full Example Code

sdk/examples/how_tos/outputs/features.rs
loading...

Expected Output

[
{
"type": 6,
"amount": "49300",
"nftId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"features": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
]
},
{
"type": 6,
"amount": "49300",
"nftId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"immutableFeatures": [
{
"type": 1,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
]
},
{
"type": 6,
"amount": "47500",
"nftId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"features": [
{
"type": 2,
"data": "0x48656c6c6f2c20576f726c6421"
}
]
},
{
"type": 6,
"amount": "47500",
"nftId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"immutableFeatures": [
{
"type": 2,
"data": "0x48656c6c6f2c20576f726c6421"
}
]
},
{
"type": 6,
"amount": "47400",
"nftId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"features": [
{
"type": 3,
"tag": "0x48656c6c6f2c20576f726c6421"
}
]
}
]