MCPcopy
hub / github.com/subquery/subql / fetchContractDeployHeight

Function fetchContractDeployHeight

packages/cli/src/utils/etherscan.ts:65–80  ·  view source on GitHub ↗
(
  address: string,
  chainId: number | string
)

Source from the content-addressed store, hash-verified

63 * @returns The block number where the contract was deployed, or undefined if not found.
64 */
65export async function fetchContractDeployHeight(
66 address: string,
67 chainId: number | string
68): Promise<number | undefined> {
69 const result = await runRequest<{blockNumber: string}[]>(chainId, {
70 module: 'contract',
71 action: 'getcontractcreation',
72 contractaddresses: address,
73 });
74
75 if (!result) {
76 return undefined;
77 }
78
79 return parseInt(result[0].blockNumber, 10);
80}

Callers 2

etherscan.spec.tsFile · 0.90
generateAdapterFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected