Deploy an item with a wallet
To deploy an item from a wallet, send a message from the wallet to the collection contract.Prerequisites
- Node.js 22+
- Packages:
@ton/ton,@ton/core,@ton/crypto - A funded Testnet wallet mnemonic in the
MNEMONICenvironment variable - The sending wallet must be the collection owner; otherwise the collection rejects deployments
@ton/ton stack for TypeScript. These libraries provide interfaces to work with wallet contracts and compose messages.
<COLLECTION_ADDRESS>— the collection contract address.<RECIPIENT_ADDRESS>— the initial owner address for the new item.<ITEM_CONTENT>— item-specific content path or key (for example,0.json).
.storeUint(1, 32)— operation code1selects “deploy single item” in the reference collection contract. TEP-62 does not specify this opcode, so in custom implementations, this can differ..storeUint(0, 64)—query_id. Used for correlating responses with requests. It has no impact on deployment logic and0is a commonly used placeholder in cases where no extra logic relies on it..storeUint(nextItemIndex, 64)—item_index. Index of the item to deploy, obtained from the collection’sget_collection_dataget-method. See Return collection data..storeCoins(toNano("0.005"))— amount forwarded to the new item at deployment to cover its initial balance/fees. Adjust if extra item contract logic requires more.
op=1 consists of query_id, item_index, amount, and a reference to content. See the TL-B overview.
Verify
- In a block explorer, confirm the transaction for
<COLLECTION_ADDRESS>succeeded and inspect the transaction trace to see the internal message that deployed the item. - To verify via code: call
get_nft_address_by_index(<INDEX>)— where<INDEX>is the item index used in the deploy message (thenext_item_indexread fromget_collection_data) — on the collection to obtain the item address; then callget_nft_dataon the item and check that the owner is<RECIPIENT_ADDRESS>and the content is<ITEM_CONTENT>.
Deploy an item with a smart contract
To deploy an item from a smart contract, send a message from the contract to the collection contract.Prerequisites
- Enough Testnet funds on the calling contract to cover fees and attached value (for example, ≥ 0.02 TON)
<COLLECTION_ADDRESS>,<RECIPIENT_ADDRESS>,<INDEX>,<ITEM_CONTENT>- The calling contract must be the collection owner; otherwise the collection rejects deployments
Tolk
<COLLECTION_ADDRESS>— the collection contract address.<RECIPIENT_ADDRESS>— the initial owner address for the new item.<INDEX>— item’s index. Note that obtaining the actual index on-chain is not possible, so a smart contract that performs these deployments should handle that logic itself (for example, store the latest used index and increment it on each deployment).<ITEM_CONTENT>— item-specific content path or key (for example,0.json).
onInternalMessage for simplicity. It composes a message with hard-coded example values and sends that message to the collection contract.
Verify
- In a block explorer, confirm the transaction from the calling contract to
<COLLECTION_ADDRESS>succeeded and inspect the transaction trace to see the internal message that deployed the item. - To verify via code: call
get_nft_address_by_index(<INDEX>)on the collection to obtain the item address, then callget_nft_dataon the item and check that the owner is<RECIPIENT_ADDRESS>and the content is<ITEM_CONTENT>.