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
Output | Sender | Metadata | Immutable Metadata | Tag | Immutable Issuer |
---|---|---|---|---|---|
Basic | x | x | x | ||
Alias | x | x | x | x | |
Foundry | x | x | |||
NFT | x | x | x | x | x |
Example Code
- Rust
- Typescript (Node.js)
- Python
- Create multiple NFT outputs using the
NftOutputBuilder
and use theNftOutputBuilder.add_feature
function to add the following features:
- Add the following immutable features:
IssuerFeature
as an immutable feature.
MetadataFeature
as an immutable feature.
- Create multiple NFT outputs with all possible features using the
Client.buildNftOutput()
function and add the following features:
- Add the following immutable features:
- Create multiple NFT outputs using the
Client.build_nft_output()
function and add the following features:
- Add the following immutable features:
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/outputs/features.rs
loading...
bindings/nodejs/examples/how_tos/outputs/features.ts
loading...
bindings/python/examples/how_tos/outputs/features.py
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"
}
]
}
]