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
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 to check if transaction with such hash was confirmed or not


// 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()

Posted 11 months ago
Edited 11 months ago
Daniil Sedov
219 × 6 Administrator

What if several transactions will be processed by the account between calls to the getTransactions()? You will probably match an incorrect transaction. You need to implement a more strict transaction matching for this to work reliably.

Slava Fomin   11 months ago Report

@<1485966303708581888|Slava Fomin> Yes you're right. I mentioned in the answer that it's just a simple approach. I'll update the answer now with more explanations

Daniil Sedov   11 months ago Report
0 Answers
11 months ago
11 months ago