Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Back to post

Revisions 5

one year ago
Daniil Sedov
219 × 6 Administrator
How can I wait for transaction to confirm using tonweb?
How can I wait for transaction to confirm using tonweb?
You can save transaction hash before sending it and then query Toncenter API method [getTransactionByInMessageHash](https://toncenter.com/api/index/#/default/get_transaction_by_in_message_hash_getTransactionByInMessageHash_get) to check if transaction with such hash was confirmed or not Example: ```js // Sleep function: const sleep = ms => new Promise(r => setTimeout(r, ms)) // `msg` is a Cell containing your external message // Convert message Cell to BOC String const boc = await msg.toBoc(false) // Calculate it's hash const hash = tonweb.utils.bytesToBase64(await msg.hash()) // Send message and run a loop until transaction with that hash confirms await tonweb.sendBoc(boc) var txs = [] while (txs.length == 0) { await sleep(1200) // some delay between API calls const resp = await fetch('https://toncenter.com/api/index/getTransactionByInMessageHash?&include_msg_body=false&msg_hash=' + encodeURIComponent(hash)) txs = await resp.json() } console.log('Done!') ```
You can save transaction hash before sending it and then query Toncenter API method [getTransactionByInMessageHash](https://toncenter.com/api/index/#/default/get_transaction_by_in_message_hash_getTransactionByInMessageHash_get) to check if transaction with such hash was confirmed or not Example: ```js // Sleep function: const sleep = ms => new Promise(r => setTimeout(r, ms)) ... // `msg` is a Cell containing your external message // Convert message Cell to BOC String const boc = await msg.toBoc(false) // Calculate it's hash const hash = tonweb.utils.bytesToBase64(await msg.hash()) // Send message and run a loop until transaction with that hash confirms await tonweb.sendBoc(boc) var txs = [] while (txs.length == 0) { await sleep(1200) // some delay between API calls const resp = await fetch('https://toncenter.com/api/index/getTransactionByInMessageHash?&include_msg_body=false&msg_hash=' + encodeURIComponent(hash)) txs = await resp.json() } console.log('Done!') ```
one year ago
Daniil Sedov
219 × 6 Administrator
How can I wait for transaction to confirm using tonweb?
How can I wait for transaction to confirm using tonweb?
You can save transaction hash before sending it and then query Toncenter API method [getTransactionByInMessageHash](https://toncenter.com/api/index/#/default/get_transaction_by_in_message_hash_getTransactionByInMessageHash_get) to check if transaction with such hash was confirmed or not Example: ```js // Sleep function: const sleep = ms => new Promise(r => setTimeout(r, ms)) ... // `msg` is a Cell containing your external message // Convert message Cell to BOC String const boc = await msg.toBoc(false) // Calculate it's hash const hash = tonweb.utils.bytesToBase64(await msg.hash()) // Send message and run a loop until transaction with that hash confirms await tonweb.sendBoc(boc) var txs = [] while (txs.length == 0) { await sleep(1200) // some delay between API calls const resp = await fetch('https://toncenter.com/api/index/getTransactionByInMessageHash?&include_msg_body=false&msg_hash=' + encodeURIComponent(hash)) txs = await resp.json() } console.log('Done!') ```
You can save transaction hash before sending it and then query Toncenter API method [getTransactionByInMessageHash](https://toncenter.com/api/index/#/default/get_transaction_by_in_message_hash_getTransactionByInMessageHash_get) to check if transaction with such hash was confirmed or not Example: ```js // Sleep function: const sleep = ms => new Promise(r => setTimeout(r, ms)) ... // `msg` is a Cell containing your external message // Convert Cell to BOC String const boc = await msg.toBoc(false) // Calculate it's hash const hash = tonweb.utils.bytesToBase64(await msg.hash()) // Send message and run a loop until transaction with that hash confirms await tonweb.sendBoc(boc) var txs = [] while (txs.length == 0) { await sleep(1200) // some delay between API calls const resp = await fetch('https://toncenter.com/api/index/getTransactionByInMessageHash?&include_msg_body=false&msg_hash=' + encodeURIComponent(hash)) txs = await resp.json() } console.log('Done!') ```
one year ago
Tal Kol
337 × 3 Administrator
How can I wait for transaction to confirm using tonweb?
How can I wait for transaction to confirm using tonweb?
You can save transaction hash before sending it and then query Toncenter API method [getTransactionByInMessageHash](https://toncenter.com/api/index/#/default/get_transaction_by_in_message_hash_getTransactionByInMessageHash_get) to check if transaction with such hash was confirmed or not Example: ```js // Sleep function: const sleep = ms => new Promise(r => setTimeout(r, ms)) ... // `msg` is a Cell containing your external message // Convert Cell to BOC String const boc = await msg.toBoc(false) // Calculate it's hash const hash = tonweb.utils.bytesToBase64(await msg.hash()) // Send message and run a loop until transaction with that hash confirms await tonweb.sendBoc(boc) var txs = [] while (txs.length == 0) { await sleep(1200) // some delay between API calls const resp = await fetch('https://toncenter.com/api/index/getTransactionByInMessageHash?&include_msg_body=false&msg_hash=' + encodeURIComponent(hash)) txs = await resp.json() } console.log('Done!') ```
A simple approach would be saving the user's last transaction and run a loop until the user's address will have new transactions. You can do it like that with tonweb: ```js // Get user's wallet address from TON wallet browser extension const address = (await ton.send('ton_requestAccounts'))[0] // Get user's last transaction hash using tonweb const lastTx = (await tonweb.getTransactions(address, 1))[0] const lastTxHash = lastTx.transaction_id.hash // Send your transaction await ton.send('ton_sendTransaction', [{ to: 'some address', value: '1000' }] ) // Run a loop until user's last tx hash changes var txHash = lastTxHash while (txHash == lastTxHash) { await sleep(1500) // some delay between API calls let tx = (await tonweb.getTransactions(address, 1))[0] txHash = tx.transaction_id.hash } console.log('Done!') ```
one year ago
Daniil Sedov
219 × 6 Administrator
How can I wait for transaction to confirm using tonweb?
How can I wait for transaction to confirm using tonweb?
A simple approach would be saving the user's last transaction and run a loop until the user's address will have new transactions. You can do it like that with tonweb: ```js // Get user's wallet address from TON wallet browser extension const address = (await ton.send('ton_requestAccounts'))[0] // Get user's last transaction hash using tonweb const lastTx = (await tonweb.getTransactions(address, 1))[0] const lastTxHash = lastTx.transaction_id.hash // Send your transaction await ton.send('ton_sendTransaction', [{ to: 'some address', value: '1000' }] ) // Run a loop until user's last tx hash changes var txHash = lastTxHash while (txHash == lastTxHash) { await sleep(1500) // some delay between API calls let tx = (await tonweb.getTransactions(address, 1))[0] txHash = tx.transaction_id.hash } console.log('Done!') ```
Simple approach would be saving last user's transaction and run a loop until user's address will have new transacations. You can do it like that with tonweb: ``` // Get user's wallet address from TON wallet browser extension const address = (await ton.send('ton_requestAccounts'))[0] // Get user's last transaction hash using tonweb const lastTx = (await tonweb.getTransactions(address, 1))[0] const lastTxHash = lastTx.transaction_id.hash // Send your transaction await ton.send('ton_sendTransaction', [{ to: 'some address', value: '1000' }] ) // Run a loop until user's last tx hash changes var txHash = lastTxHash while (txHash == lastTxHash) { await sleep(1500) // some delay between API calls let tx = (await tonweb.getTransactions(address, 1))[0] txHash = tx.transaction_id.hash } console.log('Done!') ```
one year ago
Original
Daniil Sedov
219 × 6 Administrator
How can I wait for transaction to confirm using tonweb?

Simple approach would be saving last user's transaction and run a loop until user's address will have new transacations. You can do it like that with tonweb: ``` // Get user's wallet address from TON wallet browser extension const address = (await ton.send('ton_requestAccounts'))[0] // Get user's last transaction hash using tonweb const lastTx = (await tonweb.getTransactions(address, 1))[0] const lastTxHash = lastTx.transaction_id.hash // Send your transaction await ton.send('ton_sendTransaction', [{ to: 'some address', value: '1000' }] ) // Run a loop until user's last tx hash changes var txHash = lastTxHash while (txHash == lastTxHash) { await sleep(1500) // some delay between API calls let tx = (await tonweb.getTransactions(address, 1))[0] txHash = tx.transaction_id.hash } console.log('Done!') ```