Loading...
Loading...
SIP-009 NFT operations on Stacks L2 — list NFT holdings, get token metadata, transfer NFTs, get token owner, get collection information, and get transfer history. Transfer operations require an unlocked wallet.
npx skill4agent add aibtcdev/skills nftbun run wallet/wallet.ts unlockbun run nft/nft.ts <subcommand> [options]bun run nft/nft.ts get-holdings [--address <addr>] [--contract-id <id>] [--limit <n>] [--offset <n>]--address--contract-id--limit--offset{
"address": "SP2...",
"network": "mainnet",
"total": 5,
"nfts": [
{ "collection": "SP2....nft-contract::my-nft", "tokenId": "u1" },
{ "collection": "SP2....nft-contract::my-nft", "tokenId": "u2" }
]
}bun run nft/nft.ts get-metadata --contract-id <id> --token-id <n>--contract-idSP2....my-nft--token-id{
"contractId": "SP2....my-nft",
"tokenId": 1,
"network": "mainnet",
"metadata": {
"name": "My NFT #1",
"description": "...",
"image": "https://..."
}
}bun run nft/nft.ts transfer --contract-id <id> --token-id <n> --recipient <addr> [--fee low|medium|high|<microStx>]--contract-id--token-id--recipient--fee{
"success": true,
"txid": "abc123...",
"from": "SP2...",
"recipient": "SP3...",
"contractId": "SP2....my-nft",
"tokenId": 1,
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/abc123...?chain=mainnet"
}bun run nft/nft.ts get-owner --contract-id <id> --token-id <n>--contract-id--token-id{
"contractId": "SP2....my-nft",
"tokenId": 1,
"network": "mainnet",
"owner": "SP2..."
}bun run nft/nft.ts get-collection-info --contract-id <id>--contract-id{
"network": "mainnet",
"contractId": "SP2....my-nft",
"name": "my-nft",
"totalSupply": 10000,
"functions": ["transfer", "get-owner", "get-last-token-id", "get-token-uri"]
}bun run nft/nft.ts get-history --contract-id <id> [--limit <n>] [--offset <n>]--contract-id--limit--offset{
"contractId": "SP2....my-nft",
"network": "mainnet",
"total": 150,
"events": [
{
"sender": "SP2...",
"recipient": "SP3...",
"tokenId": "u1",
"txId": "abc123...",
"blockHeight": 150000
}
]
}SP<deployer-address>.<contract-name>