Open ljb943 opened 2 weeks ago
Hello @ljb943 , Thank you
You could try this way
import { TonConnectUI } from '@tonconnect/ui';
const tonConnect = new TonConnectUI({
manifestUrl: 'https://your-manifest-url.com/tonconnect-manifest.json',
});
async function sendTransaction() {
try {
const transactionPayload = {
validUntil: Math.floor(Date.now() / 1000) + 3600, // set the expiration time
messages: [
{
address: 'your-wallet-address',
amount: '100000000', // in nanotons
},
],
};
const response = await tonConnect.sendTransaction(transactionPayload);
// Assuming the response contains the transaction hash
const transactionHash = response.transactionHash;
console.log('Transaction Hash:', transactionHash);
} catch (error) {
console.error('Transaction failed:', error);
}
}
sendTransaction();
Hello @ljb943 , Thank you您好,谢谢
You could try this way你可以尝试这个方法
import { TonConnectUI } from '@tonconnect/ui'; const tonConnect = new TonConnectUI({ manifestUrl: 'https://your-manifest-url.com/tonconnect-manifest.json', }); async function sendTransaction() { try { const transactionPayload = { validUntil: Math.floor(Date.now() / 1000) + 3600, // set the expiration time messages: [ { address: 'your-wallet-address', amount: '100000000', // in nanotons }, ], }; const response = await tonConnect.sendTransaction(transactionPayload); // Assuming the response contains the transaction hash const transactionHash = response.transactionHash; console.log('Transaction Hash:', transactionHash); } catch (error) { console.error('Transaction failed:', error); } } sendTransaction();
Thank you very much. It was a huge help for me who just got in touch with ton
@itsalimanuel Hi, I'm sorry to bother you again, but I found from your example that the value of transactionHash is {"boc": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" hash} no trading, after my study I can only under the environment of nodejs parsing, not can resolve in a browser environment. Is there a method like ethersjs that can directly return the transaction hash? Thank you very much!
Hello author, first of all, thank you for your project, which is the simplest and easy to use ton package I have seen, but I have a doubt, that is, I want to get the transaction hash or boc when sendTransaction, but I don't know how to get it now.