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.
We followed GraphQL best practices and implemented Relay Cursor Connections Specification for pagination for all list types. You can read more here https://relay.dev/graphql/connections.htm
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
get transfers between an account and some counterparty account
get account events to an external address
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.
We followed GraphQL best practices and implemented Relay Cursor Connections Specification for pagination for all list types. You can read more here https://relay.dev/graphql/connections.htm
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.
Account events
To get account events, we need to get Account's external outbound message. Their type is ExtOut.Body field contains ABI-encoded information with Event data. You can parse it with SDK function abi.decode_message_body.
Result
Account external calls
If you want to collect external calls of an account, filter by msg_type = ExtIn. Body field contains ABI-encoded information with Event data. You can parse it with SDK function abi.decode_message_body. Lets get the last external call:
Result
Transfers between 2 accounts
In this example we retrieve last 30 messages between elector contract and some validator wallet with value more than some number:
Result:
We see that previous page exists and can continue pagination.
Subscribe for accounts state updates (soon)
You can subscribe for accounts metadata updates: balances or/and last_trans_lt, for example Whenever account is updated, you will receive its data:
Subscribe for accounts transactions (soon)
You can subscribe for transactions of a list of accounts
Subscribe for accounts messages (soon)
You can subscribe for messages of a list of accounts.
You can even subscribe only for external outbound messages, like here: