import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isTonWallet } from '@dynamic-labs/ton';
const SendJettonButton = () => {
const { primaryWallet } = useDynamicContext();
const onSendJetton = async () => {
if (!primaryWallet || !isTonWallet(primaryWallet)) {
throw new Error('TON wallet not found');
}
// Send jettons using sendJetton
const transactionHash = await primaryWallet.sendJetton({
jettonMasterAddress: 'EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE',
recipientAddress: 'UQDrjaLahLkMB-hMCmkzOyBuHJ186Qg_CZQhrOhIPBr0oDkB',
jettonAmount: BigInt(1000000000), // Amount in base units (e.g., 1 token with 9 decimals)
forwardTonAmount: BigInt(10000000), // TON to forward with notification (0.01 TON)
forwardPayload: 'Hello!', // Optional comment/memo
});
console.log('Transaction hash:', transactionHash);
};
return <button onClick={onSendJetton}>Send Jetton</button>;
};