import {
type AppKit,
type Base64String,
// Single-call transfer
transferJetton,
// Two-step transfer: create a transaction object separately from sending it
createTransferJettonTransaction,
sendTransaction,
} from '@ton/appkit';
async function sendJetton(
/** Initialized AppKit instance */
kit: AppKit,
/** Recipient's TON wallet address as a string */
recipientAddress: string,
/**
* Jetton amount string in fractional units
* E.g., '0.1' or '1' jetton
*/
amount: string,
/** Jetton decimals to calculate raw unit amounts */
jettonDecimals: number = 6,
/** Jetton master (minter) contract address */
jettonAddress: string,
/** Optional comment string */
comment?: string,
) {
// Sign and send via TON Connect
const result = await transferJetton(kit, {
recipientAddress,
amount,
jettonDecimals,
jettonAddress,
...(comment && { comment }),
});
console.log('Transaction sent:', result.boc);
// Alternatively, build the transaction first with createTransferJettonTransaction,
// then pass the resulting object to the sendTransaction function.
}