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 2

How to correct parse full message-graph for smart-contract call?
How to correct parse full message-graph for smart-contract call?
Hi everione I try to understand logic of work API v4. In general I have a aim to get full graph of messages for some smart-contract call. I use next algorithm: 0. I have a TonClient4 and my Address; 1. Get last block info: `const lastBlockInfo = await client.getLastBlock();` 2. Get account on this block: `const accountInfo = await client.getAccount(lastBlockInfo.last.seqno, address);` 3. Get account transactions: `const accountTransactions = await client.getAccountTransactions(address, BigInt(accountInfo.account.last.lt), Buffer.from(accountInfo.account.last.hash, 'base64'));` 4. From the list of transactions I get any transaction, for example this index=1: `const targetTransaction = accountTransactions[1]`; There is two fields: `targetTransaction.tx` and `targetTransaction.block`. In `targetTransaction.tx` field there is `targetTransaction.tx.inMessage` field. If type of this message is `internal`, I have to find "parent" message of this, message. But it looks that I have only address of source of this message and it logical time. So I need get list of transaction of source account and in this list find transaction which has outMessage with the same logical time. But for this I have to call `client.getAccount(???, targetTransaction.tx.inMessage.src)` - here ??? - it's a block number. Of course I can use `lastBlockInfo.last.seqno`, but it is not universal solution for historical messages. At first I thought, that I can use `targetTransaction.block.seqno`, but as I understud it's a number of block on `workchain=0`, but `getAccount` method requires block number on `workchain=-1`; I decided to check method getBlockByUtime: `const blockByTime = await client.getBlockByUtime(targetTransaction.tx.inMessage.info.createdAt);` In the result I see two shards: one for `workchain=0`, and one for `workchain=-1`. It seems that `seqno` from shard with `workchain=-1` can be used, but I surprised that for `workchain=0` I see block number not equal to `targetTransaction.block.seqno`, but previous one. So from this point I have a questions: 1. Is it realy so complicated to get parent message, or I missed some method or something else? 2. How much can I trust method `getBlockByUtime`? Is it possible that for some unix time I will (not get block)/(get next block)/(any options)? Thanks for your attention. I will be grateful for any help.
Hi everione I try to understand logic of work API v4. In general I have a aim to get full graph of messages for some smart-contract call. I use next algorithm: 0. I have a TonClient4 and my Address; 1. Get last block info: `const lastBlockInfo = await client.getLastBlock();` 2. Get account on this block: `const accountInfo = await client.getAccount(lastBlockInfo.last.seqno, address);` 3. Get account transactions: `const accountTransactions = await client.getAccountTransactions(address, BigInt(accountInfo.account.last.lt), Buffer.from(accountInfo.account.last.hash, 'base64'));` 4. From the list of transactions I get any transaction, for example this index=1: `const targetTransaction = accountTransactions[1]`; There is two fields: `targetTransaction.tx` and `targetTransaction.block`. In `targetTransaction.tx` field there is `targetTransaction.tx.inMessage` field. If type of this message is `internal`, I have to find "parent" message of this, message. But it looks that I have only address of source of this message and it logical time. So I need get list of transaction of source account and in this list find transaction which has outMessage with the same logical time. But for this I have to call `client.getAccount(???, targetTransaction.tx.inMessage.src)` - here ??? - it's a block number. Of course I can use `lastBlockInfo.last.seqno`, but it is not universal solution for historical messages. At first I thought, that I can use `targetTransaction.block.seqno`, but as I understud it's a number of block on `workchain=0`, but `getAccount` method requires block number on `workchain=-1`; I decided to check method getBlockByUtime: `const blockByTime = await client.getBlockByUtime(targetTransaction.tx.inMessage.info.createdAt);` In the result I see two shards: one for `workchain=0`, and one for `workchain=-1`. It seems that `seqno` from shard with `workchain=-1` can be used, but I surprised that for `workchain=0` I see block number not equal to `targetTransaction.block.seqno`, but previous one. So from this point I have a questions: 1. Is it realy so complicated to get parent message, or I missed some method or something else? 2. How much can I trust method `getBlockByUtime`? Is it possible that for some unix time I will (not get block)/(get next block)/(any options)? Thanks for your attention. I will be grateful for any help.
#ton-api-v4
#ton-v4-api
one year ago
Original
How to correct parse full message-graph for smart-contract call?

Hi everione I try to understand logic of work API v4. In general I have a aim to get full graph of messages for some smart-contract call. I use next algorithm: 0. I have a TonClient4 and my Address; 1. Get last block info: `const lastBlockInfo = await client.getLastBlock();` 2. Get account on this block: `const accountInfo = await client.getAccount(lastBlockInfo.last.seqno, address);` 3. Get account transactions: `const accountTransactions = await client.getAccountTransactions(address, BigInt(accountInfo.account.last.lt), Buffer.from(accountInfo.account.last.hash, 'base64'));` 4. From the list of transactions I get any transaction, for example this index=1: `const targetTransaction = accountTransactions[1]`; There is two fields: `targetTransaction.tx` and `targetTransaction.block`. In `targetTransaction.tx` field there is `targetTransaction.tx.inMessage` field. If type of this message is `internal`, I have to find "parent" message of this, message. But it looks that I have only address of source of this message and it logical time. So I need get list of transaction of source account and in this list find transaction which has outMessage with the same logical time. But for this I have to call `client.getAccount(???, targetTransaction.tx.inMessage.src)` - here ??? - it's a block number. Of course I can use `lastBlockInfo.last.seqno`, but it is not universal solution for historical messages. At first I thought, that I can use `targetTransaction.block.seqno`, but as I understud it's a number of block on `workchain=0`, but `getAccount` method requires block number on `workchain=-1`; I decided to check method getBlockByUtime: `const blockByTime = await client.getBlockByUtime(targetTransaction.tx.inMessage.info.createdAt);` In the result I see two shards: one for `workchain=0`, and one for `workchain=-1`. It seems that `seqno` from shard with `workchain=-1` can be used, but I surprised that for `workchain=0` I see block number not equal to `targetTransaction.block.seqno`, but previous one. So from this point I have a questions: 1. Is it realy so complicated to get parent message, or I missed some method or something else? 2. How much can I trust method `getBlockByUtime`? Is it possible that for some unix time I will (not get block)/(get next block)/(any options)? Thanks for your attention. I will be grateful for any help.
#ton-v4-api