You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import "@stdlib/deploy";
import "./google";
message MyTransfer {
amount: Int as coins;
}
contract InitiateJettonTransfer with Deployable {
masterAddress: Address;
recipientAddress: Address;
// Initialize with the master contract address, the recipient, and the amount of Jettons
init(master: Address, recipient: Address){
self.masterAddress = master;
self.recipientAddress = recipient;
}
fun getJettonWalletAddress(user: Address): Address {
let walletInit: StateInit = initOf JettonDefaultWallet(user, self.masterAddress);
return contractAddress(walletInit);
}
// Method to initiate the transfer of Jettons
receive(msg: MyTransfer){
let senderWallet: Address = self.getJettonWalletAddress(sender());
// Construct the TokenTransfer message using the provided message type
let transferMessage: TokenTransfer = TokenTransfer{
queryId: 0, // Set query ID to 0
amount: msg.amount, // The amount of Jettons to transfer
destination: self.recipientAddress, // Destination address for Jettons
response_destination: myAddress(), // Response destination (optional)
custom_payload: null, // No custom payload
forward_ton_amount: 0, // Forward TON amount (optional, set to 0)
forward_payload: emptySlice() // Empty forward payload (optional)
};
// Send the transfer message to the sender's wallet
send(SendParameters{
to: senderWallet,
value: ton("0.05"), // Gas fee
bounce: true,
body: transferMessage.toCell() // Convert the message to a Cell and send it
}
);
}
}
The text was updated successfully, but these errors were encountered:
import "@stdlib/deploy";
import "./google";
message MyTransfer {
amount: Int as coins;
}
contract InitiateJettonTransfer with Deployable {
masterAddress: Address;
recipientAddress: Address;
// Initialize with the master contract address, the recipient, and the amount of Jettons
init(master: Address, recipient: Address){
self.masterAddress = master;
self.recipientAddress = recipient;
}
}
The text was updated successfully, but these errors were encountered: