Infuse an NFT

Infusion in Carbon is a transfer to the target NFT's Carbon address. RPC builds the infusion list by reading balances at that address.

Requirements

  • Target NFT Carbon address (32-byte hex).

  • Carbon token ID and instance IDs for infused NFTs, or carbon token ID and amount for fungible infusion.

  • Signatures: the owner of the infused assets must sign; with FeatureLevel max (NftInfuseWitness active), the target NFT owner must also sign.

Step 1: Resolve the target NFT Carbon address

getNFT returns carbonNftAddress for a target NFT identified by its symbol and Phantasma ID.

import { Bytes32, PhantasmaAPI, hexToBytes } from "phantasma-sdk-ts";

const rpc = new PhantasmaAPI("https://testnet.phantasma.info/rpc", null, "testnet");
const target = await rpc.getNFT("TGT", "1234", true);
const targetNftAddress = new Bytes32(hexToBytes(target.carbonNftAddress));

getTokenData returns the same data but is a deprecated alias of getNFT on the RPC side.

Option B: from mint result or carbon instance ID

If you already have the Carbon instance ID (from minting), build the address locally:

If you just minted the NFT, you can parse the result and use the returned Bytes32 address directly:

Step 2: Infuse NFTs (Carbon transfer)

For NFT infusion you must transfer the infused NFT instance(s) to the target NFT address. Carbon transfer uses carbon token IDs and carbon instance IDs (not the Phantasma NFT ID).

If you want to infuse multiple instances of the same token ID, use TxMsgTransferNonFungibleMulti. If you need multiple token IDs in a single transaction, use TxMsgCallMulti with TokenContract_Methods.TransferNonFungible (see token-deployment-frontend/src/lib/phantasma/infuse.ts).

Step 3: Infuse fungible tokens (Carbon transfer)

Fungible infusion is also a transfer to the target NFT address, but it uses TxMsgTransferFungible. amount is an integer in token base units.

Step 4: Verify infusion

getNFT returns an infusion list computed from balances at the target NFT address. For fungibles, key is the token ID and value is the amount. For NFTs, key is the token symbol and value is the infused NFT meta ID.

VM interop: Runtime.InfuseToken

If you need to infuse via the VM interop, use Runtime.InfuseToken with Phantasma IDs. nftId is the target NFT Phantasma ID and value is the infused NFT Phantasma ID.

Limitations (current behavior):

  • Currently, when the target token is an NFT, Runtime.InfuseToken only supports NFT infusion.

  • It does not currently support fungible infusion into an NFT. Use the Carbon transfer flow above for fungible infusion.

  • Runtime.TransferToken refuses to send NFTs to NFT addresses; NFT infusion must use Runtime.InfuseToken.

Last updated