setFields(options)
Set the fields to be retrieved for data items of each supported type. The options object has the following structure:
origin) of all data items of that type (in this case Call). The field will be available in all data items of the type, including nested items. Suppose we used the processor defined above to subscribe to some calls as well as some events, and for each event we requested a parent call:
origin field would be available both within the call items retrieved due to .addCall() and within the call items that provide parent call information for the events:
false. For example, this code will not compile:
Data item types and field selectors
Here we describe the data item types as functions of the field selectors. InSubstrateBatchProcessor each field of a field selector maps to the eponymous field of its corresponding data item type. Item data fields are divided into three categories:
- Fields that are added independently of the
setFields()call. These are either fixed or depend on the related data retrieval flags (e.g.callfor events). - Fields that can be disabled by
setFields(). E.g. theargsfield will be fetched for calls by default, but can be disabled by settingargs: falsewithin thecallfield selector. - Fields that can be requested by
setFields(). E.g. thetipfield will only be available in extrinsics if theextrinsicfield selector setstip: true.
Call.getExtrinsic().
Events
Event data items may have the following fields:
The
topics field is not supported by every historical gateway dataset. Requesting it from an older archive can fail even though RPC ingestion supports it.Calls
Call data items may have the following fields:
Extrinsics
Extrinsic data items may have the following fields:
BlockHeader,Event,Call,
Block headers
BlockHeader data items may have the following fields:
Runtime is an internal type that tools like squid-substrate-typegen use for dealing with Substrate runtime versions. The curious may take a look at the definition here.
A complete example
FetchBalances.Transfer events and Balances.transfer_keep_alive calls along with their parent extrinsics. Enrich the extrinsics with hashes, fees and success flags: