import { Address, toNano, WalletContractV5R1, TonClient } from "@ton/ton";
import { mnemonicToPrivateKey } from "@ton/crypto";
import {
AssetsSDK,
createApi,
} from "@ton-community/assets-sdk";
async function main() {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
});
const MNEMONIC = process.env.MNEMONIC;
if (!MNEMONIC) throw new Error("Set MNEMONIC (space-separated words)");
const keyPair = await mnemonicToPrivateKey(MNEMONIC.split(" "));
const wallet = WalletContractV5R1.create({
workchain: 0,
publicKey: keyPair.publicKey,
});
const provider = client.provider(wallet.address);
const sender = wallet.sender(provider, keyPair.secretKey);
const NETWORK = "testnet";
const api = await createApi(NETWORK);
const sdk = AssetsSDK.create({
api,
sender,
});
const JETTON_WALLET_ADDR = Address.parse("JETTON_WALLET_ADDR"); // placeholder
const jetton = sdk.openJettonWallet(JETTON_WALLET_ADDR);
const RECEIVER_ADDRESS = Address.parse("RECEIVER_ADDRESS"); // placeholder
await jetton.sendBurn(sender, 1200000n);
}
void main();