JettonWallet is a class that contains methods to work with transferring and burning Jettons.
Methods return Cell in output and this cell can be setted like message body in Wallet.CreateTransferMessage .
You can find tutorials of message sending in one of the wallet topics.
To create jetton transfer request, you can use JettonWallet.CreateTransferRequest :
// define the address of the jetton master contract and jetton wallet ownerAddress jettonMasterContract =newAddress("/* jetton contract address */");Address address =newAddress("/* jetton wallet owner */");// get the jetton wallet address using TonClient: TonSdk.ClientAddress jettonWallet =awaittonclient.Jetton.GetWalletAddress(jettonMasterContract, address);// create transfer optionsJettonTransferOptions options =newJettonTransferOptions(){ Amount =newCoins(100),// jetton amount to send, for ex 100 jettons Destination =newAddress("/* receiver wallet address */") // receiver};// create a message body for the jetton transferCell jettonTransfer =JettonWallet.CreateTransferRequest(options);// create a transfer message for the walletExternalInMessage message =wallet.CreateTransferMessage(new[]{newWalletTransfer { Message =newInternalMessage(new() { Info =newIntMsgInfo(new() { Dest = jettonWallet, Value =newCoins(0.1) // amount in TONs to send }), Body = jettonTransfer }), Mode =1 }}, seqno).Sign(mnemonic.Keys.PrivateKey);// get message cellCell cell =message.Cell;// send this message via TonClient,// for example, await tonClient.SendBoc(cell);
To create jetton burn request, you can use JettonWallet.CreateBurnRequest :
// define the address of the jetton master contract and jetton wallet ownerAddress jettonMasterContract =newAddress("/* jetton contract address */");Address address =newAddress("/* jetton wallet owner */");// get the jetton wallet address using TonClient: TonSdk.ClientAddress jettonWallet =awaittonclient.Jetton.GetWalletAddress(jettonMasterContract, address);// create burn optionsJettonBurnOptions options =newJettonBurnOptions(){ Amount =newCoins(1000),// jetton amount to burn, for ex 1000 jettons};// create a message body for the jetton burnCell jettonBurn =JettonWallet.CreateBurnRequest(options);// create a transfer message for the walletExternalInMessage message =wallet.CreateTransferMessage(new[]{newWalletTransfer { Message =newInternalMessage(new() { Info =newIntMsgInfo(new() { Dest = jettonWallet, Value =newCoins(0.1) // amount in TONs to send }), Body = jettonBurn }), Mode =1 }}, seqno).Sign(mnemonic.Keys.PrivateKey);// get message cellCell cell =message.Cell;// send this message via TonClient,// for example, await tonClient.SendBoc(cell);
You can find moreJettonTransferOptions and JettonBurnOptionshere.