I did something like this to get tx hash, But i want to decode whole tx. Can anyone share me some example how to did it.

const bocCell = tonweb.boc.Cell.oneFromBoc(tonweb.utils.base64ToBytes(res));
const hash = tonweb.utils.bytesToBase64(await bocCell.hash());
console.log("Transaction Hash:", hash);

Jan 21, 2024, 10:39 AM
wdym?
Hi


const transaction = await connectWalletUI.sendTransaction({
messages: [
{
address: jettonData.toString(true, true, true),
amount: toNano(0.05).toString(),
payload: tonweb.utils.bytesToBase64(jettonsTranferMessage),
},
],
network:
clientEnv.NEXT_PUBLIC_TON_NETWORK === 'main'
? CHAIN.MAINNET
: CHAIN.TESTNET,
validUntil: Math.floor(Date.now() / 1000) + 120, // 120 sec
})



this is my code and it says it's expired in telegram wallet but i have set the valid to 120s
if you want to get the transaction data you can use https://toncenter.com/api/index/ api and use getTransactionByInMessageHash

the hash you get is not the transaction it's the message hash
Jan 21, 2024, 10:52 AM
I want to verify tx is success or failed?
Jan 21, 2024, 11:35 AM
There's no clear-cut definition of "success" / "failure", is there? Especially with token swaps or whatever.
Jan 21, 2024, 11:37 AM
contract deployment of nft item
Jan 21, 2024, 11:37 AM
for deployment you can use prebuilt await waitForDeploy(CONTRACT_ADDRESS) if you are using blueprint framework, or you can get an idea of how to do it by checking this function.
Jan 21, 2024, 11:42 AM
i am not using blueprint
Jan 21, 2024, 11:42 AM
I wrote a function to confirm the transaction on my backend
I send the boc to the backend

And then get hash and confirm it using the destination and the amount
I will send you asap
Jan 21, 2024, 11:44 AM
Thanks in advance
Jan 21, 2024, 11:44 AM
use try-catch and try get nft_data, if success item deployed if not try it again every 2 sec for 10 sec until success else return deployment failure


there is a sample code that can help:
https://t.me/tondev_eng/42153
Jan 21, 2024, 11:48 AM
i am using tonconnect/ui-react to send transfer
.sendDeploy(sender, toNano("0.05"))
sender: {
send: async (args: SenderArguments) => {
const stateInit: StateInit = {
code: args.init?.code,
data : args.init?.data

}
const initCell = beginCell().store(storeStateInit(stateInit)).endCell();
tonConnectUI.sendTransaction({
messages: [
{
address: args.to.toString(),
amount: args.value.toString(),
payload: args.body?.toBoc().toString("base64"),
stateInit: initCell.toBoc().toString("base64")
},
],
validUntil: Date.now() + 5 * 60 * 1000,
});
}
},
Jan 21, 2024, 12:12 PM
good, next line try get_nft_data if it returns the value you expect, deployment success, else retry after 2 seconds, 5 times (10s) is enough to catch transaction success or not
Jan 21, 2024, 12:14 PM

© 2024 Draquery.com All rights reserved.