Package Logo
injective_common
injective-common@v0.2.3
README

Injective Foundational Modules

The Injective Foundational modules are Substreams modules extracting common data from the Injective blockchain.

Getting the substreams package

From Substreams.dev

https://substreams.dev/streamingfast/injective-common/

Building it yourself

Protobuf definitions bundle

The required protobuf modules are referenced in buf.yaml and bundled in generated-buf-build.binpb

If you want to add more, you will need a (free) API token to access https://buf.build The make command will automatically run the appropriate buf build command if needed.

Generate rust protobuf bindings

make protogen

Build Substreams modules

make build

Run Substreams

You will need an API key to access the streamingfast servers, see https://substreams.streamingfast.io

substreams run -e mainnet.injective.streamingfast.io:443 substreams.yaml filtered_events -p filtered_events='type:injective.peggy.v1.EventDepositClaim' -s 9600 -t 9700
substreams run -e testnet.injective.streamingfast.io:443 substreams.yaml filtered_events -p filtered_events='type:injective.exchange.v1beta1.EventCancelSpotOrder' -s 27751658 -t +10

Package it as .spkg

  • optionally bump the version number in substreams.yaml
make package

Modules

all_events

The all_events module reads from the sf.cosmos.type.v2.Block source and outputs a list of all events in the block, Some events are at the block level, others appear inside the transactions. The latter will include the transaction hash.

filtered_events

The filtered_events module allows a reduction of the all_events output, only matching the events that match the requested type or include the attribute keys. It pre-filters blocks using the index_events module for efficiency.

Use with parameters, ex:

substreams run [...] -p filtered_events="(type:message && attr:action) || (type:wasm && attr:_contract_address)"

filtered_event_groups

The filtered_event_groups module reads from all_events and applies a filter on the event types and attribute keys, outputting all the events from transactions that have at least one event matching the filter. It pre-filters blocks using the index_events module for efficiency.

Use with the same parameters as the filtered_events module.

all_transactions

The all_transactions module extracts all the transactions from the Injective blockchain, providing useful information, such as messages, signatures or events.

Some message types are parsed from their "Any" type into the the corresponding type of an enum. See ./proto/cosmos/v1/transactions.proto to see the ones that are supported. The other types will still be shown as protobuf "Any" type.

filtered_trx_by_events

The filtered_trx_by_events modules reads from all_transactions and applies a filter on the event types and attribute keys, outputting the complete transactions that have at least one event matching the filter. It pre-filters blocks using the index_events module for efficiency.

Use with the same parameters as the filtered_events module.

filtered_events_by_attribute_value

The filtered_events_by_attribute_value module reads from all_events and applies a filter on the event types, attribute keys and values, only outputting the events that match the filter.

Use with parameters, ex:

substreams run [...] -p filtered_events_by_attribute_value="type:wasm && attr:_contract_address:inj1v77y5ttah96dc9qkcpc88ad7rce8n88e99t3m5"

For an optimized experience, we recommend importing this module in your own substreams.yaml, overloading the 'blockFilter' with a custom query to index_events, with the use parameter. See an example

filtered_event_groups_by_attribute_value

The filtered_events_groups_by_attribute_value module reads from all_events and applies a filter on the event types, attribute keys and values, outputting all the events from transactions that have at least one event matching the filter.

Use with the same parameters as the filtered_events_by_attribute_value module.

For an optimized experience, we recommend importing this module in your own substreams.yaml, overloading the 'blockFilter' with a custom query to index_events, with the use parameter. See an example

filtered_trx_by_events_attribute_value

The filtered_trx_by_events_attribute_value module reads from all_events and applies a filter on the event types, attribute keys and values, outputting the complete transactions that have at least one event matching the filter.

Use with the same parameters as the filtered_events_by_attribute_value module.

For an optimized experience, we recommend importing this module in your own substreams.yaml, overloading the 'blockFilter' with a custom query to index_events, with the use parameter. See an example

)
Documentation
Modules
Maps icon
Maps

map
all_events

af388f364dc6433d5770f22a23b66143ce940a1e
map all_events (
blocksf.cosmos.type.v2.Block
)  -> sf.substreams.cosmos.v1.EventList

all_events reads from the sf.cosmos.type.v2.Block source and outputs a list of all events in the block. Some events are at the block level, others appear inside the transactions.

substreams gui injective-common@v0.2.3 all_events

map
filtered_events

93ead93ceeea68999e110c0daf1ff4c2eb84e11b
Default param : (type:message && attr:action) || (type:wasm && attr:_contract_address)

filtered_events reads from all_events and applies a filter on the event types and attribute keys, only outputing the events that match the filter. Example usage: (type:message && attr:action) || (type:wasm && attr:_contract_address)

substreams gui injective-common@v0.2.3 filtered_events

map
filtered_event_groups

1811b682893d6a017ac3cd348ba1b2ed59353090
Default param : type:wasm && attr:_contract_address

filtered_event_groups reads from all_events and applies a filter on the event types and attribute keys, outputing all the events from transactions that have at least one event matching the filter. Example usage: type:injective.peggy.v1.EventDepositClaim || (type:wasm && attr:_contract_address)

substreams gui injective-common@v0.2.3 filtered_event_groups

map
filtered_events_by_attribute_value

d9e577560372c73043582078406e72714ff14d43
map filtered_events_by_attribute_value (
paramsstring
)  -> sf.substreams.cosmos.v1.EventList
Default param : type:wasm && attr:_contract_address:inj1v77y5ttah96dc9qkcpc88ad7rce8n88e99t3m5

filtered_events_by_attribute_value reads from all_events and applies a filter on the event types, attribute keys and values, only outputing the events that match the filter. Example usage: "type:wasm && attr:_contract_address:inj1v77y5ttah96dc9qkcpc88ad7rce8n88e99t3m5"

To use this module with an index, import it and override it with the use: parameter, setting blockFilter.Query.String to a query that matches the event type and attribute keys only (ex: type:wasm && attr:_contract_address)

substreams gui injective-common@v0.2.3 filtered_events_by_attribute_value

map
filtered_event_groups_by_attribute_value

03c26a36ec3c90813ef04275fe98411a067a3d5f
map filtered_event_groups_by_attribute_value (
paramsstring
)  -> sf.substreams.cosmos.v1.EventList
Default param : type:wasm && attr:_contract_address:inj1v77y5ttah96dc9qkcpc88ad7rce8n88e99t3m5

filtered_events_groups_by_attribute_value reads from all_events and applies a filter on the event types, attribute keys and values, outputing all the events from transactions that have at least one event matching the filter. Example usage: "type:wasm && attr:_contract_address:inj1v77y5ttah96dc9qkcpc88ad7rce8n88e99t3m5"

To use this module with an index, import it and override it with the use: parameter, setting blockFilter.Query.String to a query that matches the event type and attribute keys only (ex: type:wasm && attr:_contract_address)

substreams gui injective-common@v0.2.3 filtered_event_groups_by_attribute_value
Block Indexes icon
Block Indexes

blockIndex
index_events

b7ac82905edb8a2b12cad1b6f29a6753083681e2

index_events sets the keys corresponding to all event 'types' and 'attribute keys' in the block ex: type:coin_received, type:injective.peggy.v1.EventDepositClaim, attr:action, attr:sender ... The attribute values are never indexed because they have a high cardinality and would be too expensive to index.

substreams gui injective-common@v0.2.3 index_events
Protobuf

Protobuf Docs Explorer

injective.auction.v1beta1
cosmwasm.wasm.v1
cosmos.upgrade.v1beta1
cosmos_proto
injective.crypto.v1beta1.ethsecp256k1
cosmos.tx.signing.v1beta1
sf.cosmos.type.v2
cosmos.slashing.v1beta1
ibc.core.client.v1
cosmos.bank.v1beta1
cosmos.evidence.v1beta1
cosmos.crypto.multisig.v1beta1
cosmos.msg.v1
cosmos.gov.v1beta1
injective.oracle.v1beta1
cosmos.crisis.v1beta1
cosmos.tx.v1beta1
cosmos.distribution.v1beta1
injective.peggy.v1
injective.wasmx.v1
gogoproto
amino
cosmos.authz.v1beta1
ibc.core.channel.v1
cosmos.base.v1beta1
injective.exchange.v1beta1