Add ETH RPC API to watcher server (#535)

* Add ETH RPC API to watcher server

* Add eth_call API handler

* Add error handling to eth_call handler

* Parse block tag in eth_call handler

* Add a flag to enable ETH RPC server

* Fix lint errors

* Update block tag parsing
This commit is contained in:
prathamesh0
2024-09-13 12:44:00 +05:30
committed by GitHub
parent ea5ff93e21
commit b46d8816b5
9 changed files with 241 additions and 6 deletions
+7 -1
View File
@@ -2,7 +2,7 @@
import assert from 'assert';
import { DeepPartial, FindConditions, FindManyOptions } from 'typeorm';
import { providers } from 'ethers';
import { ethers } from 'ethers';
import {
IndexerInterface,
@@ -28,6 +28,8 @@ import { GetStorageAt, getStorageValue, MappingKey, StorageLayout } from '@cerc-
export class Indexer implements IndexerInterface {
_getStorageAt: GetStorageAt;
_storageLayoutMap: Map<string, StorageLayout> = new Map();
_contractMap: Map<string, ethers.utils.Interface> = new Map();
eventSignaturesMap: Map<string, string[]> = new Map();
constructor (ethClient: EthClient, storageLayoutMap?: Map<string, StorageLayout>) {
@@ -50,6 +52,10 @@ export class Indexer implements IndexerInterface {
return this._storageLayoutMap;
}
get contractMap (): Map<string, ethers.utils.Interface> {
return this._contractMap;
}
async init (): Promise<void> {
return undefined;
}