I want to query the transactions based on a message from my wallet. Background of it is that I am accepting payments from my shop bot and do split payments to the seller. So before I do the split, I want to check if there hsa been a transaction before that is an outgoing tx with message of "split $orderUID"
From the testnet toncenter API I can see this data is saved in my transactions in the out_msgs (just noticed the out_msgs are arrays where in_msg is a single object)
Jan 6, 2023, 1:18 PM
Curerntly I just get the latest 1k transactions and loop though it until I find the string. But this is not a good practice at all and may suffer in processing speed and may be not reliable at all when there are more transactions out of the limit scope.
But I am not sure, if there is a "query by data" method as the docs don't have anything about it.
But I am not sure, if there is a "query by data" method as the docs don't have anything about it.
Jan 6, 2023, 1:20 PM
You can calculate the hash of your external message and then use it to find the transaction in the Blockchain via the Index API.
Jan 6, 2023, 7:47 PM
Would that be something like hash my message to data and lookup for that on the api? Have you a link to the index api or how can I access it?
Jan 6, 2023, 7:49 PM
https://toncenter.com/api/index/
Jan 6, 2023, 7:55 PM
Can you calculate hash of message before it's minted on chain?
Jan 6, 2023, 7:58 PM
Nice, I didn't know that docs exists. Thought only the /api one was available as there was no further access.
I guess in my case it would be the endpoint /getTransactionByInMessageHash
I guess in my case it would be the endpoint /getTransactionByInMessageHash
Jan 6, 2023, 7:58 PM
I'm talking about the external message.
Jan 6, 2023, 7:59 PM
There was a method tha does the job on the TonClient I think to convert the message to data hash, need to lookup on that, too.
Jan 6, 2023, 7:59 PM