Closed huangxok closed 5 months ago
resolution: ` import TonWeb from 'tonweb'
const result = await tonConnectUI.sendTransaction(transaction);
const bocCellBytes = await TonWeb.boc.Cell.oneFromBoc(TonWeb.utils.base64ToBytes(result.boc)).hash();
const hashBase64 = TonWeb.utils.bytesToBase64(bocCellBytes);
// hashBase64: vgDP5GJPUKL-Cv_wkUnurlgRF4P8brhSf5zhAGUtosM=
// https://tonscan.org/tx/by-msg-hash/vgDP5GJPUKL-Cv_wkUnurlgRF4P8brhSf5zhAGUtosM= `
https://github.com/ton-connect/sdk/issues/189#issuecomment-2176494132 the hasebase64 is in,how to get the out hash?
anthor way:
` import { Cell } from '@ton/core';
const transactionRes = await walletConnect.sendTransaction() const cell = Cell.fromBase64(transactionRes.boc) const buffer = cell.hash(); const hashHex = buffer.toString('hex'); // hashHex: 57123dffb9029bdaa9187b5d035737eea94a1b8c018e2ab1885f245eb95c6e30 // const hashBase64 = buffer.toString('base64');
thanks , been looking for this all over the internet !
thank you, my brother, I have been looking for this solution more then two hours
Your Question
the respose of tonconnectUI.sendTransaction()? I have read the document about tonconnectUI.sendTransaction method. the method return a boc. so what's the boc?
is it a message hash? how to analysis the boc?
`const transaction = { validUntil: Math.floor(Date.now() / 1000) + 60, // 60 sec messages: [ { address: "EQBBJBB3HagsujBqVfqeDUPJ0kXjgTPLWPFFffuNXNiJL0aA", amount: "20000000", // stateInit: "base64bocblahblahblah==" // just for instance. Replace with your transaction initState or remove }, { address: "EQDmnxDMhId6v1Ofg_h5KR5coWlFG6e86Ro3pc7Tq4CA0-Jn", amount: "60000000", // payload: "base64bocblahblahblah==" // just for instance. Replace with your transaction payload or remove } ] }
try { const result = await tonConnectUI.sendTransaction(transaction);
} catch (e) { console.error(e); }`
Context
No response
What have you tried so far?
No response
Relevant Code or Commands
No response
Documentation Check