const walletContract = client.open(wallet);
// console.log(walletContract);
const seqno = await walletContract.getSeqno();
console.log(seqno);
// return;
const tx = await walletContract.createTransfer({
secretKey: key.secretKey,
seqno: seqno,
messages: [
internal({
to: "EQA4V9tF4lY2S_J-sEQR7aUj9IwW-Ou2vJQlCn--2DLOLR5e",
value: "0.05", // 0.05 TON
body: "Hello", // optional comment
bounce: false,
})
]
});
console.log(tx);
const signedtx = sign(tx,key.secretKey);
const tr = await client.sendFile(signedtx)
console.log(tr);
whats wrong in this
Nov 23, 2023, 9:45 AM
You don't need to replace tx with signedtx: tx is already signed for that matter, and even if it wasn't you were signing message incorrectly.
Nov 23, 2023, 9:49 AM
so what can be a solution here @pcrafter
Nov 23, 2023, 9:50 AM
await walletContract.sendTransfer({
// all of those parameters, starting with secretKey
});
// all of those parameters, starting with secretKey
});
Nov 23, 2023, 9:52 AM
but i want to create sign the transactions in two steps
then send]
send(provider: ContractProvider, message: Cell): Promise;
what is provider hers
is it the ton client or
clinet.provider()
ok then how do i send this signed tx @pcrafter without sendTransfer
Nov 23, 2023, 9:59 AM
Automatically provided.
await walletContract.send(tx);
And you won't be able to create and sign transfer separately because wallet contracts and signing procedures for them are different.
Nov 23, 2023, 10:00 AM
ok
then how do we create an arbitrary transaction not just send and then sign it and send it to network
sendFile method of ton client can send any buffer to a network, then why do it doesnt send a buffer signed by the sign function of ton/crypto
Nov 23, 2023, 10:15 AM
"sign transaction" is meaningless in TON.
You can create an external message and send it;
this message is delivered to a contract, usually wallet contract, which parses it;
signatures are checked on that level.
this message is delivered to a contract, usually wallet contract, which parses it;
signatures are checked on that level.
Nov 23, 2023, 12:13 PM
And how do we get transaction hash of a transaction
So you mean you sign a message when you create it there is no way to create a message then sign it separately?
I just went through the SDK I saw there was a sign function too which takes Cells and produces an buffer
Hopefully signed transaction
And when I tried to send that it gave me invalid bag of cells
Nov 23, 2023, 12:33 PM