mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-12 02:27:31 +00:00
Use block number for eth_call in rpc-eth-client (#435)
* Update subgraph readme to run fill before job-runner * Fix getContractEntitiesMap incase of template data sources * Use rpcSupportsBlockHashParam flag to use blockNumber for rpc client eth_call * Fix optional baseFeePerGas in rpc-eth-client * Fix graph-node tests after changes * Remove completed TODO
This commit is contained in:
@@ -221,6 +221,7 @@ export interface ServerConfig {
|
||||
|
||||
p2p: P2PConfig;
|
||||
|
||||
// TODO: Move flag to config upstream.ethServer
|
||||
// Flag to specify whether RPC endpoint supports block hash as block tag parameter
|
||||
// https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block
|
||||
rpcSupportsBlockHashParam: boolean;
|
||||
|
||||
@@ -151,7 +151,12 @@ export const getContractEntitiesMap = (dataSources: any[]): Map<string, string[]
|
||||
// Populate contractEntitiesMap using data sources from subgraph
|
||||
dataSources.forEach((dataSource: any) => {
|
||||
const { source: { address: contractAddress }, mapping: { entities } } = dataSource;
|
||||
contractEntitiesMap.set(ethers.utils.getAddress(contractAddress), entities as string[]);
|
||||
|
||||
// TODO: Handle template data source
|
||||
// TODO: Avoid mapping subgraph entities to contract address in watcher state
|
||||
if (contractAddress) {
|
||||
contractEntitiesMap.set(ethers.utils.getAddress(contractAddress), entities as string[]);
|
||||
}
|
||||
});
|
||||
|
||||
return contractEntitiesMap;
|
||||
|
||||
@@ -550,7 +550,7 @@ export const toEntityValue = async (instanceExports: any, entityInstance: any, d
|
||||
// Check if the entity property is nullable.
|
||||
// No need to set the property if the value is null as well.
|
||||
if (isNullable && value === null) {
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
|
||||
const entityValue = await formatEntityValue(instanceExports, subgraphValue, type, value, isArray);
|
||||
|
||||
@@ -52,7 +52,7 @@ export interface StateStatus {
|
||||
|
||||
export type ResultState = {
|
||||
block: {
|
||||
cid: string;
|
||||
cid: string | null;
|
||||
hash: string;
|
||||
number: number;
|
||||
timestamp: number;
|
||||
@@ -66,7 +66,7 @@ export type ResultState = {
|
||||
|
||||
export type ResultEvent = {
|
||||
block: {
|
||||
cid: string;
|
||||
cid: string | null;
|
||||
hash: string;
|
||||
number: number;
|
||||
timestamp: number;
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface StateDataMeta {
|
||||
},
|
||||
ethBlock: {
|
||||
cid: {
|
||||
'/': string
|
||||
'/': string | null
|
||||
},
|
||||
num: number
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export enum StateKind {
|
||||
|
||||
export interface BlockProgressInterface {
|
||||
id: number;
|
||||
cid: string;
|
||||
cid: string | null;
|
||||
blockHash: string;
|
||||
parentHash: string;
|
||||
blockNumber: number;
|
||||
|
||||
Reference in New Issue
Block a user