There's some great examples of how to use subxt to listen to all events.
Polkadot-js events screen seem to show events grouped by the extrinsic that created them. Can I do the same in rust?
(if not subxt is there an alternative way?)
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityThere's some great examples of how to use subxt to listen to all events.
Polkadot-js events screen seem to show events grouped by the extrinsic that created them. Can I do the same in rust?
(if not subxt is there an alternative way?)
The logic in subxt will map through in a similar way.
The EventRecord struct contains a Phase enum where ApplyExtrinsic(u32)
refers to the index of the extrinsic in the block.
So the way to map it is -
phase
is not ApplyExtrinsic
, it doesn't map to a transaction, e.g. it is a system eventphase
is ApplyExtrinsic
, get the index from this valueclient.rpc().subscribe_blocks()
(but maybe we need to add that not uncommon usecase to the subxt examples!)