mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-09 01:04:07 +00:00
Add isFEVM flag in config to avoid filtering event logs by topics (#454)
* Pass upstream config to indexer instance * Add isFEVM flag and refactor watcher config fields * Codegen changes for indexer * Add missing getter in dummy indexer for graph-node tests
This commit is contained in:
@@ -23,17 +23,6 @@
|
||||
clearEntitiesCacheInterval = 1000
|
||||
|
||||
{{/if}}
|
||||
# Boolean to filter logs by contracts.
|
||||
filterLogsByAddresses = false
|
||||
|
||||
# Boolean to filter logs by topics.
|
||||
filterLogsByTopics = false
|
||||
|
||||
# Boolean to switch between modes of processing events when starting the server.
|
||||
# Setting to true will fetch filtered events and required blocks in a range of blocks and then process them.
|
||||
# Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head).
|
||||
useBlockRanges = true
|
||||
|
||||
# Max block range for which to return events in eventsInRange GQL query.
|
||||
# Use -1 for skipping check on block range.
|
||||
maxEventsBlockRange = 1000
|
||||
@@ -75,9 +64,17 @@
|
||||
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
|
||||
rpcProviderEndpoint = "http://127.0.0.1:8081"
|
||||
|
||||
# Flag to specify if rpc-eth-client should be used from RPC endpoint instead of ipld-eth-client (ipld-eth-server GQL client)
|
||||
# Boolean flag to specify if rpc-eth-client should be used for RPC endpoint instead of ipld-eth-client (ipld-eth-server GQL client)
|
||||
rpcClient = false
|
||||
|
||||
# Boolean flag to specify if rpcProviderEndpoint is an FEVM RPC endpoint
|
||||
isFEVM = false
|
||||
|
||||
# Boolean flag to filter event logs by contracts
|
||||
filterLogsByAddresses = false
|
||||
# Boolean flag to filter event logs by topics
|
||||
filterLogsByTopics = false
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
@@ -93,6 +90,11 @@
|
||||
prefetchBlocksInMem = true
|
||||
prefetchBlockCount = 10
|
||||
|
||||
# Boolean to switch between modes of processing events when starting the server.
|
||||
# Setting to true will fetch filtered events and required blocks in a range of blocks and then process them.
|
||||
# Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head).
|
||||
useBlockRanges = true
|
||||
|
||||
# Block range in which logs are fetched during historical blocks processing
|
||||
historicalLogsBlockRange = 2000
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ import {
|
||||
getResultEvent,
|
||||
DatabaseInterface,
|
||||
Clients,
|
||||
EthClient
|
||||
EthClient,
|
||||
UpstreamConfig
|
||||
} from '@cerc-io/util';
|
||||
{{#if (subgraphPath)}}
|
||||
import { GraphWatcher } from '@cerc-io/graph-node';
|
||||
@@ -89,6 +90,7 @@ export class Indexer implements IndexerInterface {
|
||||
_ethProvider: BaseProvider;
|
||||
_baseIndexer: BaseIndexer;
|
||||
_serverConfig: ServerConfig;
|
||||
_upstreamConfig: UpstreamConfig;
|
||||
{{#if (subgraphPath)}}
|
||||
_graphWatcher: GraphWatcher;
|
||||
{{/if}}
|
||||
@@ -105,15 +107,28 @@ export class Indexer implements IndexerInterface {
|
||||
_subgraphStateMap: Map<string, any>;
|
||||
|
||||
{{/if}}
|
||||
constructor (serverConfig: ServerConfig, db: DatabaseInterface, clients: Clients, ethProvider: BaseProvider, jobQueue: JobQueue{{#if (subgraphPath)}}, graphWatcher?: GraphWatcherInterface{{/if}}) {
|
||||
constructor (
|
||||
config: {
|
||||
server: ServerConfig;
|
||||
upstream: UpstreamConfig;
|
||||
},
|
||||
db: DatabaseInterface,
|
||||
clients: Clients,
|
||||
ethProvider: BaseProvider,
|
||||
jobQueue: JobQueue{{#if (subgraphPath)}},{{/if}}
|
||||
{{#if (subgraphPath)}}
|
||||
graphWatcher?: GraphWatcherInterface
|
||||
{{/if}}
|
||||
) {
|
||||
assert(db);
|
||||
assert(clients.ethClient);
|
||||
|
||||
this._db = db as Database;
|
||||
this._ethClient = clients.ethClient;
|
||||
this._ethProvider = ethProvider;
|
||||
this._serverConfig = serverConfig;
|
||||
this._baseIndexer = new BaseIndexer(this._serverConfig, this._db, this._ethClient, this._ethProvider, jobQueue);
|
||||
this._serverConfig = config.server;
|
||||
this._upstreamConfig = config.upstream;
|
||||
this._baseIndexer = new BaseIndexer(config, this._db, this._ethClient, this._ethProvider, jobQueue);
|
||||
{{#if (subgraphPath)}}
|
||||
assert(graphWatcher);
|
||||
this._graphWatcher = graphWatcher as GraphWatcher;
|
||||
@@ -163,6 +178,10 @@ export class Indexer implements IndexerInterface {
|
||||
return this._serverConfig;
|
||||
}
|
||||
|
||||
get upstreamConfig (): UpstreamConfig {
|
||||
return this._upstreamConfig;
|
||||
}
|
||||
|
||||
get storageLayoutMap (): Map<string, StorageLayout> {
|
||||
return this._storageLayoutMap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user