create_transaction_iterator method
Transaction iterator uses robust iteration methods that guaranty that every transaction in the specified range isn't missed or iterated twice.
Iterated range can be reduced with some filters:
start_time– the bottom time range. Only transactions withnowmore or equal to this value are iterated. If this parameter is omitted then there is no bottom time edge, so all the transactions since zero state are iterated.end_time– the upper time range. Only transactions withnowless then this value are iterated. If this parameter is omitted then there is no upper time edge, so iterator never finishes.shard_filter– workchains and shard prefixes that reduce the set of interesting accounts. Account address conforms to the shard filter if it belongs to the filter workchain and the first bits of address match to the shard prefix. Only transactions with suitable account addresses are iterated.accounts_filter– set of account addresses whose transactions must be iterated. Note that accounts filter can conflict with shard filter so application must combine these filters carefully.
Iterated item is a JSON objects with transaction data. The minimal set of returned fields is:
id
account_addr
now
balance_delta(format:DEC)
bounce { bounce_type }
in_message {
id
value(format:DEC)
msg_type
src
}
out_messages {
id
value(format:DEC)
msg_type
dst
}
Application can request an additional fields in the result parameter.
Another parameter that affects on the returned fields is the include_transfers.
When this parameter is true the iterator computes and adds transfer field containing
list of the useful TransactionTransfer objects.
Each transfer is calculated from the particular message related to the transaction
and has the following structure:
- message – source message identifier.
- isBounced – indicates that the transaction is bounced, which means the value will be returned back to the sender.
- isDeposit – indicates that this transfer is the deposit (true) or withdraw (false).
- counterparty – account address of the transfer source or destination depending on
isDeposit. - value – amount of nano tokens transferred. The value is represented as a decimal string because the actual value can be more precise than the JSON number can represent. Application must use this string carefully – conversion to number can follow to loose of precision.
Application should call the remove_iterator when iterator is no longer required.
Implementation
Future<RegisteredIterator> create_transaction_iterator(
ParamsOfCreateTransactionIterator params) async {
final res = await _tonCore.request(
'net.create_transaction_iterator', params.toString());
return RegisteredIterator.fromMap(res);
}