# TxInfosQuery

jigu.query.txinfo.TxInfosQuery

A sequence of TxInfos objects with additional querying capacities. For illustration, we will use the code example from Soju testnet:

from jigu import Terra
soju = Terra("soju-0013", "https://soju-lcd.terra.dev")

block = soju.block(50326)
txs = block.txs # TxsInfosQuery

# Sequence interoperability

TxInfosQuery[int, slice]

You can index or iterate over a TxInfosQuery just as if it were a list of TxInfo. If you take a slice, it will recursively return another TxInfosQuery.

txs[0] # -> TxInfo
txs[0:5] # -> TxInfosQuery

for tx in txs:
    tx._pp

# Access messages collectively

TxInfosQuery.msgs

The main transactional content inside TxInfo is in the messages. Rather than having to process each transaction individually to access all of the messages, TxInfosQuery provides direct access to each message in order, through a MsgInfosQuery that spans the sequence of messages in the set of transactions.

txs.msgs[0] # first message in first transaction
txs.msgs[-1] # last message in last transaction
txs.msgs.types
# {'oracle/MsgExchangeRateVote': 28, 'oracle/MsgExchangeRatePrevote': 28}

# Property Value

MsgInfosQuery

Queryable sequence of all messages.

Updated on: 3/10/2020, 11:13:44 AM