### Install Dependencies Source: https://github.com/openbuilders/notcoin-contract/blob/main/README.md Run this command to install the necessary project dependencies. ```bash npm install ``` -------------------------------- ### Run Tests Source: https://github.com/openbuilders/notcoin-contract/blob/main/README.md Use this command to execute the test suite for the Notcoin contracts. ```bash npm run test ``` -------------------------------- ### Compile Contracts Source: https://github.com/openbuilders/notcoin-contract/blob/main/README.md Execute this command to compile the smart contracts for the Notcoin project. ```bash npm run build ``` -------------------------------- ### Full Lifecycle Test for Notcoin Jetton Source: https://context7.com/openbuilders/notcoin-contract/llms.txt This snippet demonstrates bootstrapping a sandboxed blockchain, deploying contracts, minting, transferring, and burning tokens in a single test flow. It requires @ton/sandbox, @ton/core, @ton/blueprint, and @ton/test-utils. ```typescript import { Blockchain } from '@ton/sandbox'; import { Cell, toNano, beginCell } from '@ton/core'; import { JettonWallet } from '../wrappers/JettonWallet'; import { jettonContentToCell, JettonMinter } from '../wrappers/JettonMinter'; import { compile } from '@ton/blueprint'; import { Op, Errors } from '../wrappers/JettonConstants'; import '@ton/test-utils'; describe('Notcoin Jetton lifecycle', () => { it('deploy → mint → transfer → burn', async () => { const blockchain = await Blockchain.create(); const deployer = await blockchain.treasury('deployer'); const user = await blockchain.treasury('user'); const walletCodeRaw = await compile('JettonWallet'); const minterCode = await compile('JettonMinter'); // Register wallet code as TVM library const libs = beginCell() .storeDictDirect( new Map([[ BigInt(`0x${walletCodeRaw.hash().toString('hex')}`), walletCodeRaw ]]) ).endCell(); blockchain.libs = libs; const libCell = new Cell({ exotic: true, bits: beginCell().storeUint(2,8).storeBuffer(walletCodeRaw.hash()).endCell().bits, refs: [] }); const minter = blockchain.openContract( JettonMinter.createFromConfig( { admin: deployer.address, wallet_code: libCell, jetton_content: jettonContentToCell({ uri: 'https://example.com/meta.json' }) }, minterCode ) ); // Deploy const deployResult = await minter.sendDeploy(deployer.getSender(), toNano('10')); expect(deployResult.transactions).toHaveTransaction({ deploy: true, success: true }); // Mint 1000 tokens to deployer await minter.sendMint(deployer.getSender(), deployer.address, toNano('1000'), null, null, null, toNano('0.05'), toNano('1')); expect(await minter.getTotalSupply()).toBe(toNano('1000')); // Transfer 100 tokens to user const deployerWallet = blockchain.openContract( JettonWallet.createFromAddress(await minter.getWalletAddress(deployer.address)) ); const transferResult = await deployerWallet.sendTransfer( deployer.getSender(), toNano('0.2'), toNano('100'), user.address, deployer.address, null, toNano('0.05'), null ); expect(transferResult.transactions).toHaveTransaction({ op: Op.internal_transfer, success: true }); // Burn 50 tokens from user const userWallet = blockchain.openContract( JettonWallet.createFromAddress(await minter.getWalletAddress(user.address)) ); await userWallet.sendBurn(user.getSender(), toNano('0.1'), toNano('50'), user.address, null); expect(await minter.getTotalSupply()).toBe(toNano('950')); expect(await userWallet.getJettonBalance()).toBe(toNano('50')); }); }); ``` -------------------------------- ### Deploy JettonMinter Contract Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Constructs and deploys a new JettonMinter instance. Requires an admin address, wallet code cell, and jetton content. Use `sendDeploy` to fund the contract and deploy it on-chain. ```typescript import { toNano } from '@ton/core'; import { JettonMinter } from './wrappers/JettonMinter'; import { compile, NetworkProvider } from '@ton/blueprint'; import { jettonWalletCodeFromLibrary } from './wrappers/ui-utils'; export async function run(provider: NetworkProvider) { const jettonWalletCodeRaw = await compile('JettonWallet'); // Wrap raw code in a TVM library reference cell const jettonWalletCode = jettonWalletCodeFromLibrary(jettonWalletCodeRaw); const minter = provider.open( JettonMinter.createFromConfig( { admin: provider.sender().address!, wallet_code: jettonWalletCode, jetton_content: { uri: 'https://example.com/notcoin.json' }, }, await compile('JettonMinter'), ), ); // Sends op::top_up to deploy; attach 0.5 TON to cover storage await minter.sendDeploy(provider.sender(), toNano('0.5')); console.log('Minter deployed at', minter.address.toString()); } ``` -------------------------------- ### Deploy or Run Script Source: https://github.com/openbuilders/notcoin-contract/blob/main/README.md This command deploys contracts or runs other scripts using the blueprint tool. Specify Toncenter API details for testnet deployment. ```bash npx blueprint run ``` ```bash yarn blueprint run ``` ```bash npx blueprint run --custom https://testnet.toncenter.com/api/v2/ --custom-version v2 --custom-type testnet --custom-key ``` -------------------------------- ### JettonMinter — Deploy the minter contract Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Constructs a new minter instance from an admin address, wallet code cell, and jetton content. The result is passed to a NetworkProvider to deploy it on-chain with `sendDeploy`, which sends a `top_up` message to fund the contract. ```APIDOC ## JettonMinter.createFromConfig ### Description Constructs a new minter instance from an admin address, wallet code cell, and jetton content. Pass the result to a `NetworkProvider` to deploy it on-chain with `sendDeploy`, which sends a `top_up` message to fund the contract with the specified TON value. ### Method `createFromConfig` (constructor-like function) ### Parameters - `config` (object) - Configuration for the minter: - `admin` (Address) - The admin address for the minter. - `wallet_code` (Cell) - The TVM library cell reference for the Jetton Wallet code. - `jetton_content` (object) - Metadata for the jetton: - `uri` (string) - URI pointing to the jetton content. - `code` (Cell) - The compiled code for the `JettonMinter` contract. ### Usage Example ```typescript import { toNano } from '@ton/core'; import { JettonMinter } from './wrappers/JettonMinter'; import { compile, NetworkProvider } from '@ton/blueprint'; import { jettonWalletCodeFromLibrary } from './wrappers/ui-utils'; export async function run(provider: NetworkProvider) { const jettonWalletCodeRaw = await compile('JettonWallet'); // Wrap raw code in a TVM library reference cell const jettonWalletCode = jettonWalletCodeFromLibrary(jettonWalletCodeRaw); const minter = provider.open( JettonMinter.createFromConfig( { admin: provider.sender().address!, wallet_code: jettonWalletCode, jetton_content: { uri: 'https://example.com/notcoin.json' }, }, await compile('JettonMinter'), ), ); // Sends op::top_up to deploy; attach 0.5 TON to cover storage await minter.sendDeploy(provider.sender(), toNano('0.5')); console.log('Minter deployed at', minter.address.toString()); } ``` ## JettonMinter.sendDeploy ### Description Sends a `top_up` message to fund the contract with the specified TON value for deployment. ### Method `sendDeploy` ### Parameters - `provider` (NetworkProvider) - The network provider instance. - `value` (BigInt) - The amount of TON to attach for deployment and storage. ### Usage Example (See `JettonMinter.createFromConfig` example above) ``` -------------------------------- ### Discover Jetton Wallet Address (TEP-89) Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `sendDiscovery` to request a wallet address from the minter. The minter responds with `take_wallet_address`. Set `include_address` to `true` to echo the owner address. ```typescript import { JettonMinter } from './wrappers/JettonMinter'; import { Address, toNano } from '@ton/core'; import { Op } from './wrappers/JettonConstants'; async function discoverWallet(minter: JettonMinter, sender: any) { const owner = Address.parse('EQD...'); // On-chain method: triggers take_wallet_address response message await minter.sendDiscovery(sender, owner, true, toNano('0.1')); // Off-chain shortcut (no transaction needed): const walletAddr = await minter.getWalletAddress(owner); console.log('Wallet address:', walletAddr.toString()); // Op codes for parsing responses: // Op.provide_wallet_address = 0x2c76b973 // Op.take_wallet_address = 0xd1735400 } ``` -------------------------------- ### JettonMinter.sendChangeAdmin / sendClaimAdmin Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Manages the two-step admin transfer process. `sendChangeAdmin` proposes a new admin, and `sendClaimAdmin` is called by the new admin to finalize the transfer. `sendDropAdmin` irrevocably removes the admin. ```APIDOC ## JettonMinter.sendChangeAdmin / sendClaimAdmin — Two-step admin transfer Admin rights transfer uses a propose-then-claim pattern. `sendChangeAdmin` sets the pending `transfer_admin` field; `sendClaimAdmin` must be called from the new admin's account to complete the handover. `sendDropAdmin` irrevocably sets admin to `addr_none` — there is no recovery. ### Method POST (or equivalent transaction) ### Endpoint /sendChangeAdmin /sendClaimAdmin /sendDropAdmin ### Description - `sendChangeAdmin`: Proposes a new admin address for the minter contract. - `sendClaimAdmin`: Completes the admin transfer by claiming the proposed role. - `sendDropAdmin`: Irrevocably removes the admin role from the contract. ### Parameters #### sendChangeAdmin - **newAdminAddress** (Address) - The address of the proposed new admin. #### sendClaimAdmin (No explicit parameters beyond sender context) #### sendDropAdmin (No explicit parameters beyond sender context) ### Request Example (Illustrative, actual calls involve transaction signing) ```typescript // Propose new admin await minter.sendChangeAdmin(currentAdminSender, newAdminAddress); // New admin claims role await minter.sendClaimAdmin(newAdminSender); // Drop admin role await minter.sendDropAdmin(currentAdminSender); ``` ``` -------------------------------- ### Query Jetton Minter State Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `getJettonData` to retrieve total supply, mintable status, admin address, content, and wallet code. Convenience wrappers are available for specific data points. Ensure `JettonMinter` and `Address` are imported. ```typescript import { JettonMinter } from './wrappers/JettonMinter'; import { Address } from '@ton/core'; async function inspectMinter(minter: JettonMinter) { const data = await minter.getJettonData(); console.log('Total supply :', data.totalSupply.toString()); // bigint (nanotons) console.log('Mintable :', data.mintable); // boolean console.log('Admin :', data.adminAddress?.toString()); // Address | null // Resolve a user's wallet address on-chain const userAddr = Address.parse('EQD...'); const walletAddr = await minter.getWalletAddress(userAddr); console.log('User wallet :', walletAddr.toString()); // Pending next admin (set by sendChangeAdmin, cleared by sendClaimAdmin) const nextAdmin = await minter.getNextAdminAddress(); console.log('Next admin :', nextAdmin?.toString() ?? 'none'); } ``` -------------------------------- ### Transfer Jetton Minter Admin Role Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Implement a two-step admin transfer process using `sendChangeAdmin` to propose and `sendClaimAdmin` to finalize. `sendDropAdmin` irrevocably removes the admin. Ensure necessary senders and addresses are provided. ```typescript import { JettonMinter } from './wrappers/JettonMinter'; import { Address } from '@ton/core'; async function transferAdmin( minter: JettonMinter, currentAdminSender: any, newAdminSender: any, newAdminAddress: Address, ) { // Step 1: current admin proposes new admin await minter.sendChangeAdmin(currentAdminSender, newAdminAddress); console.log('Next admin set to:', await minter.getNextAdminAddress()); // Step 2: new admin claims the role await minter.sendClaimAdmin(newAdminSender); console.log('Admin is now :', (await minter.getAdminAddress())?.toString()); // --- Irreversible: drop admin entirely --- // await minter.sendDropAdmin(currentAdminSender); // console.log('Admin:', await minter.getAdminAddress()); // null } ``` -------------------------------- ### JettonMinter.sendDiscovery Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Sends a provide_wallet_address request to the minter to resolve a deterministic wallet address for a given owner. The minter responds with take_wallet_address. ```APIDOC ## JettonMinter.sendDiscovery ### Description Sends a `provide_wallet_address` request to the minter. The minter responds with `take_wallet_address`, returning the deterministic wallet address for the queried owner. Set `include_address` to `true` to echo the owner address back. ### Method `sendDiscovery(sender: any, owner: Address, include_address: boolean, value: bigint)` ### Parameters - `sender`: The sender of the transaction. - `owner`: The owner address for which to discover the wallet. - `include_address`: Boolean to include the owner address in the response. - `value`: The amount of TON to send with the transaction. ``` -------------------------------- ### Transfer Jettons Between Wallets Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `sendTransfer` to move jettons from one wallet to another. The `value` must cover gas, forward fees, and optional `forward_ton_amount`. A `forwardPayload` can trigger a `transfer_notification` at the destination. ```typescript import { JettonWallet } from './wrappers/JettonWallet'; import { JettonMinter } from './wrappers/JettonMinter'; import { Address, beginCell, toNano } from '@ton/core'; async function transferExample( minter: JettonMinter, senderAddr: Address, senderTonSender: any, ) { const recipientAddr = Address.parse('EQD...'); const walletAddr = await minter.getWalletAddress(senderAddr); const wallet = JettonWallet.createFromAddress(walletAddr); const forwardPayload = beginCell() .storeUint(0x12345678, 32) // custom op for recipient DApp .endCell(); await wallet.sendTransfer( senderTonSender, // TON sender (must be wallet owner) toNano('0.17'), // attached TON (covers gas + fwd fees) toNano('10'), // jetton amount to send recipientAddr, // jetton destination senderAddr, // excess TON response address null, // custom payload (null = none) toNano('0.05'), // forward_ton_amount (triggers notification) forwardPayload, // forwarded to recipient contract ); } ``` -------------------------------- ### Estimate TON Transaction Fees with gasUtils Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `gasUtils` to read live fee parameters from blockchain config and compute accurate gas, forward, and storage fees. Ensure you have the necessary imports for `Blockchain` and the gas utility functions. ```typescript import { getGasPrices, getMsgPrices, getStoragePrices, computeGasFee, computeFwdFees, calcStorageFee, StorageStats, } from './gasUtils'; async function feeEstimationExample() { const blockchain = await Blockchain.create(); // Read live fee params from workchain 0 const gasPrices = getGasPrices(blockchain.config, 0); const msgPrices = getMsgPrices(blockchain.config, 0); const storagePrices = getStoragePrices(blockchain.config); // Gas cost for an operation consuming 10 000 gas units const gasCost = computeGasFee(gasPrices, 10_000n); console.log('Gas cost (10k units):', gasCost.toString(), 'nanoTON'); // Forward fee for a message with 3 cells and 1000 bits const fwdFee = computeFwdFees(msgPrices, 3n, 1000n); console.log('Forward fee:', fwdFee.toString(), 'nanoTON'); // 5-year storage fee for a jetton wallet (1033 bits, 3 cells) const walletStats = new StorageStats(1033, 3); const fiveYears = BigInt(5 * 365 * 24 * 3600); const storageFee = calcStorageFee(storagePrices, walletStats, fiveYears); console.log('5yr storage fee:', storageFee.toString(), 'nanoTON'); } ``` -------------------------------- ### Upgrade Jetton Minter Code and Data Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Atomically upgrade the minter's code and data using `sendUpgrade`. This operation can only be performed by the admin. Always test upgrades on testnet first. Ensure `Cell`, `beginCell`, `toNano`, `JettonMinter`, `jettonMinterConfigFullToCell`, `compile`, and `jettonWalletCodeFromLibrary` are imported. ```typescript import { Cell, beginCell, toNano } from '@ton/core'; import { JettonMinter, jettonMinterConfigFullToCell } from './wrappers/JettonMinter'; import { compile } from '@ton/blueprint'; import { jettonWalletCodeFromLibrary } from './wrappers/ui-utils'; async function upgradeExample(minter: JettonMinter, adminSender: any) { // Compile latest minter code const newCode = await compile('JettonMinter'); // Build new data preserving supply, admin, and wallet code const newData = jettonMinterConfigFullToCell({ supply: await minter.getTotalSupply(), admin: await minter.getAdminAddress(), transfer_admin: null, wallet_code: jettonWalletCodeFromLibrary(await compile('JettonWallet')), jetton_content: { uri: 'https://example.com/notcoin-v2.json' }, }); await minter.sendUpgrade( adminSender, newCode, newData, toNano('0.1'), // attached TON for gas 0, // query_id ); console.log('Upgrade sent — verify on testnet before mainnet!'); } ``` -------------------------------- ### Mint Jettons to an Address Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Issues new jettons to a specified recipient's wallet. Only the current admin can call this function. `forward_ton_amount` triggers a transfer notification, and `total_ton_amount` is the TON value attached to the internal transfer. ```typescript import { Address, toNano } from '@ton/core'; import { JettonMinter } from './wrappers/JettonMinter'; async function mintExample(minter: JettonMinter, sender: any) { const recipient = Address.parse('EQD...'); // Mint 1000 tokens (assuming 9 decimals → toNano represents 1e9 units) await minter.sendMint( sender, // Sender (must be admin) recipient, // Recipient address toNano('1000'), // Jetton amount null, // from address (null = minter itself) recipient, // response address for excesses null, // custom payload toNano('0.05'), // forward_ton_amount (triggers transfer notification) toNano('0.1'), // total_ton_amount attached to internal transfer ); console.log('Total supply:', await minter.getTotalSupply()); // Expected: previous supply + toNano('1000') } ``` -------------------------------- ### Burn Jettons Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `sendBurn` to destroy jettons and send a `burn_notification` to the minter. The `value` must cover burn gas fees and the notification forward fee. Excess TON is returned to the `responseAddress`. ```typescript import { JettonWallet } from './wrappers/JettonWallet'; import { JettonMinter } from './wrappers/JettonMinter'; import { Address, toNano } from '@ton/core'; async function burnExample( minter: JettonMinter, ownerAddr: Address, ownerSender: any, ) { const walletAddr = await minter.getWalletAddress(ownerAddr); const wallet = JettonWallet.createFromAddress(walletAddr); const balanceBefore = await wallet.getJettonBalance(); console.log('Balance before burn:', balanceBefore.toString()); await wallet.sendBurn( ownerSender, // Must be wallet owner toNano('0.1'), // Attached TON (covers gas + burn_notification fwd) toNano('5'), // Amount to burn ownerAddr, // Excess TON response address null, // Custom payload ); const supplyAfter = await minter.getTotalSupply(); console.log('Total supply after burn:', supplyAfter.toString()); // Expected: previous supply - toNano('5') } ``` -------------------------------- ### Query Jetton Wallet Data Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `getWalletData` to retrieve the token balance, owner address, minter address, and wallet code cell. `getJettonBalance` is a shortcut that returns `0n` for inactive wallets. ```typescript import { JettonWallet } from './wrappers/JettonWallet'; import { JettonMinter } from './wrappers/JettonMinter'; import { Address } from '@ton/core'; async function walletInfo(minter: JettonMinter, ownerAddr: Address) { const walletAddr = await minter.getWalletAddress(ownerAddr); const wallet = JettonWallet.createFromAddress(walletAddr); // Safe balance check — returns 0n if wallet not yet deployed const balance = await wallet.getJettonBalance(); console.log('Jetton balance:', balance.toString()); // Full data (only works on active wallets) if (balance > 0n) { const data = await wallet.getWalletData(); console.log('Owner :', data.owner.toString()); console.log('Minter :', data.minter.toString()); } } ``` -------------------------------- ### JettonWallet.getWalletData Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Queries the wallet state, returning the token balance, owner address, minter address, and wallet code cell. getJettonBalance is a convenience shortcut. ```APIDOC ## JettonWallet.getWalletData ### Description Calls the `get_wallet_data` getter and returns the token balance, owner address, minter address, and wallet code cell. `getJettonBalance` is a convenience shortcut that returns `0n` for inactive (not-yet-deployed) wallets. ### Method `getWalletData(): Promise<{ balance: bigint, owner: Address, minter: Address, code: Cell }>` ### Returns An object containing the wallet's balance, owner address, minter address, and code cell. Returns `0n` for balance if the wallet is not yet deployed. ``` -------------------------------- ### JettonMinter.sendUpgrade Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Atomically replaces the contract code and data of the minter. This operation can only be invoked by the admin and requires careful testing on testnet before mainnet deployment. ```APIDOC ## JettonMinter.sendUpgrade — Upgrade minter code and data `sendUpgrade` atomically replaces both the contract code and data cells of the minter. Only the admin may invoke this. The contract performs no validation on the supplied cells — always test the upgrade on testnet first before mainnet. ### Method POST (or equivalent transaction) ### Endpoint /sendUpgrade ### Description Upgrades the JettonMinter contract with new code and data. ### Parameters - **newCode** (Cell) - The new code cell for the minter contract. - **newData** (Cell) - The new data cell for the minter contract. - **tonAmount** (toNano) - Attached TON for gas. - **queryId** (number) - Optional query ID. ### Request Example (Illustrative, actual calls involve transaction signing) ```typescript // Compile latest minter code const newCode = await compile('JettonMinter'); // Build new data preserving supply, admin, and wallet code const newData = jettonMinterConfigFullToCell({ supply: await minter.getTotalSupply(), admin: await minter.getAdminAddress(), transfer_admin: null, wallet_code: jettonWalletCodeFromLibrary(await compile('JettonWallet')), jetton_content: { uri: 'https://example.com/notcoin-v2.json' }, }); await minter.sendUpgrade( adminSender, newCode, newData, toNano('0.1'), // attached TON for gas 0, // query_id ); ``` ``` -------------------------------- ### JettonMinter.sendMint — Mint jettons to an address Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Issues new tokens to a specified address by sending an `internal_transfer` from the minter to the recipient's jetton wallet. This function can only be called by the current admin. ```APIDOC ## JettonMinter.sendMint ### Description Issues new tokens to `to` by sending an `internal_transfer` from the minter to the recipient's jetton wallet. Only the current admin may call this. `forward_ton_amount` controls how much TON is forwarded as a transfer notification to the recipient; `total_ton_amount` is the value attached to the internal transfer message. ### Method `sendMint` ### Parameters - `sender` (any) - The sender of the message, must be the current admin. - `recipient` (Address) - The address to which the jettons will be minted. - `jetton_amount` (BigInt) - The amount of jettons to mint. This value should be scaled according to the jetton's decimals (e.g., `toNano('1000')` for 1000 tokens with 9 decimals). - `from_address` (Address | null) - The source address for the jettons. `null` indicates the minter itself. - `response_address` (Address) - The address to send excess TON to. - `custom_payload` (Cell | null) - Optional custom payload for the transfer. - `forward_ton_amount` (BigInt) - The amount of TON to forward as a transfer notification to the recipient. - `total_ton_amount` (BigInt) - The total TON value attached to the internal transfer message. ### Request Example ```typescript import { Address, toNano } from '@ton/core'; import { JettonMinter } from './wrappers/JettonMinter'; async function mintExample(minter: JettonMinter, sender: any) { const recipient = Address.parse('EQD...'); // Mint 1000 tokens (assuming 9 decimals → toNano represents 1e9 units) await minter.sendMint( sender, // Sender (must be admin) recipient, // Recipient address toNano('1000'), // Jetton amount null, // from address (null = minter itself) recipient, // response address for excesses null, // custom payload toNano('0.05'), // forward_ton_amount (triggers transfer notification) toNano('0.1'), // total_ton_amount attached to internal transfer ); console.log('Total supply:', await minter.getTotalSupply()); // Expected: previous supply + toNano('1000') } ``` ### Response #### Success Response - `getTotalSupply()` (BigInt) - Returns the current total supply of jettons after minting. ``` -------------------------------- ### JettonMinter.getJettonData Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Queries the minter state to retrieve total supply, mintable flag, admin address, content cell, and wallet code. Convenience wrappers are available for specific data points. ```APIDOC ## JettonMinter.getJettonData — Query minter state `getJettonData` calls the `get_jetton_data` getter and returns total supply, mintable flag, admin address, content cell, and wallet code. Convenience wrappers `getTotalSupply`, `getAdminAddress`, and `getContent` each delegate to this method. ### Method GET (or equivalent query) ### Endpoint /getJettonData ### Response #### Success Response (200) - **totalSupply** (bigint) - Total supply in nanotons. - **mintable** (boolean) - Flag indicating if the jetton is mintable. - **adminAddress** (Address | null) - The current admin address or null if none. - **content** (Cell) - The content cell containing jetton metadata. - **walletCode** (Cell) - The code cell for jetton wallets. ``` -------------------------------- ### Update Jetton Metadata URL Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Use `sendChangeContent` to update the jetton's metadata URI. This function accepts either a `JettonMinterContent` object with a `uri` or a raw `Cell`. Only the admin can call this method. Ensure `JettonMinter` is imported. ```typescript import { JettonMinter } from './wrappers/JettonMinter'; async function updateMetadata(minter: JettonMinter, adminSender: any) { await minter.sendChangeContent(adminSender, { uri: 'https://example.com/notcoin-updated.json', }); // Verify const content = await minter.getContent(); console.log('New content cell hash:', content.hash().toString('hex')); } ``` -------------------------------- ### JettonMinter.sendChangeContent Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Updates the jetton's on-chain content pointer, which is a snake-encoded URI cell. Only the admin can call this method. It accepts either a `JettonMinterContent` object with a `uri` string or a raw `Cell`. ```APIDOC ## JettonMinter.sendChangeContent — Update metadata URL `sendChangeContent` replaces the jetton's on-chain content pointer (a snake-encoded URI cell). Only the admin can call this. Accepts either a `JettonMinterContent` object with a `uri` string or a raw `Cell`. ### Method POST (or equivalent transaction) ### Endpoint /sendChangeContent ### Description Updates the metadata URI for the jetton. ### Parameters - **newContent** (JettonMinterContent | Cell) - The new content, either an object with a `uri` or a raw `Cell`. ### Request Example (Illustrative, actual calls involve transaction signing) ```typescript await minter.sendChangeContent(adminSender, { uri: 'https://example.com/notcoin-updated.json', }); ``` ``` -------------------------------- ### JettonWallet.sendBurn Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Burns a specified amount of jettons from the caller's wallet, sending a burn notification to the minter to reduce the total supply. ```APIDOC ## JettonWallet.sendBurn ### Description Destroys `jetton_amount` tokens from the caller's wallet, sending a `burn_notification` to the minter which reduces total supply. The `value` must cover burn gas fee + burn notification forward fee. ### Method `sendBurn(sender: any, value: bigint, jetton_amount: bigint, responseAddress: Address, customPayload: Cell | null)` ### Parameters - `sender`: Must be the wallet owner. - `value`: Attached TON, covering gas and burn notification forward fees. - `jetton_amount`: The amount of jettons to burn. - `responseAddress`: The address to return excess TON to. - `customPayload`: Optional custom payload (null if none). ``` -------------------------------- ### Use TON Op/Error Codes from JettonConstants Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Import and use operation and error codes from `JettonConstants.ts` for constructing messages, parsing transactions, and writing test assertions. These constants are essential for contract interactions. ```typescript import { Op, Errors } from './wrappers/JettonConstants'; // Op codes used in message bodies console.log(Op.transfer.toString(16)); // f8a7ea5 console.log(Op.mint.toString(16)); // 642b7d07 console.log(Op.burn.toString(16)); // 595f07bc console.log(Op.upgrade.toString(16)); // 2508d66a console.log(Op.change_admin.toString(16)); // 6501f354 console.log(Op.claim_admin.toString(16)); // fb88e119 console.log(Op.drop_admin.toString(16)); // 7431f221 console.log(Op.change_metadata_url.toString(16)); // cb862902 console.log(Op.provide_wallet_address.toString(16));// 2c76b973 console.log(Op.top_up.toString(16)); // d372158c // Error codes thrown by contracts console.log(Errors.not_owner); // 73 — unauthorized action console.log(Errors.not_valid_wallet); // 74 — internal_transfer from non-wallet console.log(Errors.balance_error); // 47 — insufficient jetton balance console.log(Errors.not_enough_gas); // 48 — insufficient TON for gas console.log(Errors.wrong_workchain); // 333 — masterchain transfer attempt ``` -------------------------------- ### JettonWallet.sendTransfer Source: https://context7.com/openbuilders/notcoin-contract/llms.txt Transfers a specified amount of jettons from the sender's wallet to a recipient address. Supports optional forward payload for notifications. ```APIDOC ## JettonWallet.sendTransfer ### Description Moves `jetton_amount` tokens from the sender's wallet to the `to` address. The `value` parameter must cover gas + forward fees + optional `forward_ton_amount`. Excess TON is returned to `responseAddress`. Supply a `forwardPayload` cell to trigger a `transfer_notification` (op `0x7362d09c`) at the destination. ### Method `sendTransfer(sender: any, value: bigint, jetton_amount: bigint, to: Address, responseAddress: Address, customPayload: Cell | null, forward_ton_amount: bigint, forwardPayload: Cell | null)` ### Parameters - `sender`: The TON sender (must be the wallet owner). - `value`: The attached TON, covering gas and forward fees. - `jetton_amount`: The amount of jettons to send. - `to`: The jetton destination address. - `responseAddress`: The address to return excess TON to. - `customPayload`: Optional custom payload (null if none). - `forward_ton_amount`: The amount of TON to forward for notifications. - `forwardPayload`: A Cell containing the payload to be forwarded to the recipient contract. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.