Reputation: 183
How can I retrieve a list of transaction information and their respective id (txhash).
I have a State and retrieve information with Query, but I need the transaction ID (txhash) for each transaction.
Use Kotlin.
Upvotes: 0
Views: 213
Reputation: 2548
The query returns a StateAndRef
which is as the name implies:
StateRef
: Every state is a result of a transaction, but the transaction might have produced multiple states (outputs); so the unique "identity" (or state ref) of a state is the combination of the transaction Id and the index of that state in the list of transaction's outputs (so if your transaction with Id XYZ had 3 outputs, and your state was the second output; the StateRef
would be XYZ, 1
).Anyway, to answer your question; if you have a StateAndRef myStateAndRef
, then you can get the transaction Id with myStateAndRef.getRef().getTxhash()
.
Upvotes: 3