setFields(options)
Set the fields to be retrieved for data items of each supported type. The options object has the following structure:
true will cause the processor to populate the corresponding field of all data items of that type. Here is a definition of a data source that requests signatures and err fields for transactions and the data field for instructions:
augmentBlock() from @subsquid/solana-objects, signatures and err fields would be available both within the transaction items of the transactions iterable of block data and within the transaction items that provide parent transaction information for the instructions matching the addInstruction() data request:
Data item types and field selectors
All addresses and pubkeys are represented as base58-encoded strings.
- Fields that are always present regardless of the
setFields()call. - Fields that must be requested with
setFields().
Instruction
Instruction data items may have the following fields:
- Top level instructions get addresses
[0],[1], …,[N-1], where N is the number of top level instructions in the transaction. - An address of length 2 indicates an inner instruction directly called by one of the top level instructions. For example,
[3, 0]is the first inner instruction called by the fourth top level instruction. - Addresses of length 3 or more indicate inner instructions invoked by other inner instructions.
Transaction
Transaction data items may have the following fields:
LogMessage
LogMessage data items may have the following fields:
Balance
Balance data items may have the following fields:
Balance item describes a single account: pre is the account’s SOL balance before the transaction and post is its balance after it.
TokenBalance
Field selection for token balances data items is more nuanced, as depending on the subtype of the token balance some fields may beundefined. PostTokenBalance and PreTokenBalance both represent token balances, however PreTokenBalance will have postProgramId, postMint, postDecimals, postOwner and postAmount as undefined.
PostTokenBalance will have preProgramId, preMint, preDecimals, preOwner and preAmount as undefined.
TokenBalance data items may have the following fields:
Reward
Reward data items may have the following fields:
Block header
BlockHeader data items may have the following fields:
slot and parentSlot are not field names: use number for the Solana slot (also in setBlockRange() values) and parentNumber for the parent slot.
The stream converts Portal’s raw Solana block time from seconds to milliseconds. Pass timestamp directly to new Date(timestamp) without multiplying it by 1000.
A complete example
Complete example
Complete example