For the complete documentation index, see llms.txt. This page is also available as Markdown.

Account queries

An account is identified by two ids: account_id and dapp_id, the two halves of the address dapp_id::account_id. Both are bare 64-character hex, without 0: and without 0x. For a contract deployed by an external message the two are the same value.

The examples below query the Shellnet giver, 0000000000000000000000000000000000000000000000000000000000000000::1111111111111111111111111111111111111111111111111111111111111111, at https://shellnet.ackinacki.org/graphql, and the results are what it answered.

Get account info

To get account info including its state (BOC), data and code, use the following GraphQL query:

query {
  blockchain{
    account(
      account_id:"1111111111111111111111111111111111111111111111111111111111111111"
      dapp_id:"0000000000000000000000000000000000000000000000000000000000000000"
    ){
      info{
        address
        dapp_id
        acc_type
        balance
        last_paid
        last_trans_lt
        boc
        data
        code
        library
        data_hash
        code_hash
        library_hash
      }
    }
  }
}

Result (boc, data and code are shortened here):

address and dapp_id come back as bare hex ids: put them together as dapp_id::account_id to get the address tvm-cli takes.

Ask for balance(format: DEC) to read the balance as a decimal string instead of hex.

Get transactions within timestamp range

Use-cases

  • Paginate transactions to get both transactions and messages of account within the required timestamp range

  • Collect account transactions with detailed fees information

  • Collect account balance history by pre-processing balance_delta changes on your side

  • Query new account transactions to trigger some logic on your side

  • Optionally filter transactions by Aborted type or balance_delta value

  • Pull transactions for a period if your websocket subscription failed (use lastTransaction.chain_order field as after cursor ;-) )

Filter parameters

You can filter account transactions by these parameters:

Pagination parameters

Use cursor, {first, after} or {last, before} filters for pagination.

Let's paginate some account transactions from the very first one:

Result

Use endCursor field for further pagination and hasNextPage for identifying if more records exist.

Get messages within timestamp range

Use-cases:

  • get transfers that some account sent or received

  • get account's events

  • get external calls of an account

  • optionally filter messages by value amount

  • Pull messages for a period if your websocket subscription failed (use Message.chain_order field as after cursor ;-) )

In all these cases you need to paginate account messages with some filters applied. Lets see how to do it.

Filter parameters

You can filter messages by these parameters:

Pagination parameters

Use cursor, {first, after} or {last, before} filters for pagination.

Account transfers

Lets get first 2 transfers some account received or sent. So we need to get incoming and outcoming internal messages. We separated internal message type into 2 types: IntIn and IntOut for search convenience. This way it is possible also to get only deposits, and only withdrawals.

Result. We see that the next page exists, we can continue pagination.

src and dst inside a message are addresses in the 0:<account_id> form, the form ABI arguments take.

Account events

To get account events run this query.

The events field also takes an optional dst argument — an external address, to keep only the events sent to it.

Result

Then, by decoding the body of that message you can obtain the data attached to the event. You can parse it with SDK function abi.decode_message_body or use tvm-cli comand: For example:

As a result, you will get something approximately like this:

Account external calls

If you want to collect external calls of an account, filter by msg_type = ExtIn. Lets get the last external call:

Result

The boc field carries the whole message. Pass it to tvm-cli together with the contract ABI to see which function was called:

Last updated