i try do transfer my created Jetton, but transfer failed with 705 error. i try many methods, but all of this not working. Link transaction on blockchain: When getting transaction to jetton wallet its canceled with exit code 705. I cant find this error code on docs
const jettonMasterAddress = Address.parse(mint);
const userAddress = Address.parse(payer);
const mnemonicsString = process.env.MNEMONICS;
if (!mnemonicsString) {
throw new Error("MNEMONICS not found in environment variables");
}
const keyPair = await mnemonicToWalletKey(mnemonicsString.split(" "));
const jettonMaster = client.open(JettonMaster.create(jettonMasterAddress));
const senderJettonWalletAddress = await jettonMaster.getWalletAddress(
userAddress
);
console.log("Public Key:", keyPair.publicKey.toString());
const wallet = WalletContractV4.create({
workchain: 0,
publicKey: keyPair.publicKey,
});
const contract = client.open(wallet);
const state = await client.getContractState(wallet.address);
const { init } = contract;
const contractDeployed = await client.isContractDeployed(
Address.parse(wallet.address.toString())
);
let neededInit: null | typeof init = null;
if (init && !contractDeployed) {
neededInit = init;
}
console.log("Состояние кошелька:", state);
console.log(contract.address);
const secretKey = keyPair.secretKey;
for (const recipient of recipients) {
try {
const destinationAddress = Address.parse(recipient);
const recaddress = await jettonMaster.getWalletAddress(destinationAddress);
const jettonTransferBody = beginCell()
.storeUint(0xf8a7ea5, 32) // Operation ID
.storeUint(0, 64) // Query ID
.storeCoins(lamports) // Amount to transfer
.storeAddress(destinationAddress) // Recipient address
.storeAddress(destinationAddress) // Sender address
.storeUint(0, 1) // No forward payload
.storeCoins(toNano("0.1")) // Forward amount
.storeUint(0, 1) // No custom payload
.endCell();
const seqno = await contract.getSeqno();
console.log("Current seqno:", seqno);
const internalMessage = internal({
to: senderJettonWalletAddress.toString(),
value: toNano("0.1"),
bounce: true,
body: jettonTransferBody,
});
const body = wallet.createTransfer({
seqno,
secretKey,
messages: [internalMessage],
});
const externalMessage = external({
to: wallet.address,
init: neededInit,
body: body,
});
const externalMessageCell = beginCell()
.store(storeMessage(externalMessage))
.endCell();
const signedTransaction = externalMessageCell.toBoc();
const hash = externalMessageCell.hash().toString("hex");
await client.sendFile(signedTransaction);
const simulationResult = await client.simulate(externalMessageCell.toBoc());
console.log("Simulation Result:", simulationResult);
console.log(`Transfer succesful: ${hash}`);
} catch (error) {
console.error(`Transfer error: ${recipient}`, error);
}
}
res.json({
status: "success",
message: "All TX is succesful.",
});
Please help
I try change address places forward amount. change messages. create external and without external message
i try do transfer my created Jetton, but transfer failed with 705 error. i try many methods, but all of this not working. Link transaction on blockchain: https://tonviewer.com/transaction/e6db98156ef6ca3102ea5c3182db2f5afff5319e5b5462a58159802919120baa When getting transaction to jetton wallet its canceled with exit code 705. I cant find this error code on docs
const jettonMasterAddress = Address.parse(mint);
const userAddress = Address.parse(payer);
const mnemonicsString = process.env.MNEMONICS;
if (!mnemonicsString) {
throw new Error("MNEMONICS not found in environment variables");
}
const keyPair = await mnemonicToWalletKey(mnemonicsString.split(" "));
const jettonMaster = client.open(JettonMaster.create(jettonMasterAddress));
const senderJettonWalletAddress = await jettonMaster.getWalletAddress(
userAddress
);
console.log("Public Key:", keyPair.publicKey.toString());
const wallet = WalletContractV4.create({
workchain: 0,
publicKey: keyPair.publicKey,
});
const contract = client.open(wallet);
const state = await client.getContractState(wallet.address);
const { init } = contract;
const contractDeployed = await client.isContractDeployed(
Address.parse(wallet.address.toString())
);
let neededInit: null | typeof init = null;
if (init && !contractDeployed) {
neededInit = init;
}
console.log("Состояние кошелька:", state);
console.log(contract.address);
const secretKey = keyPair.secretKey;
for (const recipient of recipients) {
try {
const destinationAddress = Address.parse(recipient);
const recaddress = await jettonMaster.getWalletAddress(destinationAddress);
const jettonTransferBody = beginCell()
.storeUint(0xf8a7ea5, 32) // Operation ID
.storeUint(0, 64) // Query ID
.storeCoins(lamports) // Amount to transfer
.storeAddress(destinationAddress) // Recipient address
.storeAddress(destinationAddress) // Sender address
.storeUint(0, 1) // No forward payload
.storeCoins(toNano("0.1")) // Forward amount
.storeUint(0, 1) // No custom payload
.endCell();
const seqno = await contract.getSeqno();
console.log("Current seqno:", seqno);
const internalMessage = internal({
to: senderJettonWalletAddress.toString(),
value: toNano("0.1"),
bounce: true,
body: jettonTransferBody,
});
const body = wallet.createTransfer({
seqno,
secretKey,
messages: [internalMessage],
});
const externalMessage = external({
to: wallet.address,
init: neededInit,
body: body,
});
const externalMessageCell = beginCell()
.store(storeMessage(externalMessage))
.endCell();
const signedTransaction = externalMessageCell.toBoc();
const hash = externalMessageCell.hash().toString("hex");
await client.sendFile(signedTransaction);
const simulationResult = await client.simulate(externalMessageCell.toBoc());
console.log("Simulation Result:", simulationResult);
console.log(`Transfer succesful: ${hash}`);
} catch (error) {
console.error(`Transfer error: ${recipient}`, error);
}
}
res.json({
status: "success",
message: "All TX is succesful.",
});
Please help
I try change address places forward amount. change messages. create external and without external message
You can look up the error in sources: it means "not_owner".
I'd recommend to refer to that repo to implement transfer correctly: see sendTransfer
implementation. It seems that you are trying to explicitly send something to your wallet first instead of sending to your jetton wallet directly, which is probably the source of the issue. Even if you don't use Blueprint, try to replicate the implementation for your environment, should be much easier to debug as they have autotests that illustrate the correct usage.