@subql/node-ethereum 0.4.1-4 → 0.4.1-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,7 @@ const node_core_1 = require("@subql/node-core");
15
15
  const utils_1 = require("ethers/lib/utils");
16
16
  const project_1 = require("../utils/project");
17
17
  const block_ethereum_1 = require("./block.ethereum");
18
+ const safe_api_1 = __importDefault(require("./safe-api"));
18
19
  const utils_ethereum_1 = require("./utils.ethereum");
19
20
  // eslint-disable-next-line @typescript-eslint/no-var-requires
20
21
  const { version: packageVersion } = require('../../package.json');
@@ -145,7 +146,7 @@ class EthereumApi {
145
146
  }));
146
147
  }
147
148
  freezeApi(processor, blockContent) {
148
- processor.freeze(this.client, 'api');
149
+ processor.freeze(new safe_api_1.default(this.client, blockContent.blockHeight), 'api');
149
150
  }
150
151
  buildInterface(abiName, assets) {
151
152
  if (!assets[abiName]) {
@@ -1 +1 @@
1
- {"version":3,"file":"api.ethereum.js","sourceRoot":"","sources":["../../src/ethereum/api.ethereum.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;AAEtC,oDAA4B;AAC5B,4CAAoB;AAGpB,4CAA+C;AAE/C,wDAAqD;AACrD,wDAA8E;AAE9E,gDAA6C;AAS7C,4CAA0E;AAC1E,8CAAkD;AAClD,qDAAwD;AACxD,qDAI0B;AAE1B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,cAAc,CAAC,CAAC;AAEzC,KAAK,UAAU,UAAU,CACvB,EAA2B;IAE3B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,CAAC;KACX;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IAEvC,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,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H;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,OAAO,WAAW,CAAC;SACpB;IACH,CAAC;CACF;AAxOD,kCAwOC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport assert from 'assert';\nimport fs from 'fs';\nimport http from 'http';\nimport https from 'https';\nimport { Interface } from '@ethersproject/abi';\nimport { Block, TransactionReceipt } from '@ethersproject/abstract-provider';\nimport { BigNumber } from '@ethersproject/bignumber';\nimport { JsonRpcProvider, WebSocketProvider } from '@ethersproject/providers';\nimport { RuntimeDataSourceV0_2_0 } from '@subql/common-ethereum';\nimport { getLogger } from '@subql/node-core';\nimport {\n ApiWrapper,\n BlockWrapper,\n EthereumBlockWrapper,\n EthereumTransaction,\n EthereumResult,\n EthereumLog,\n} from '@subql/types-ethereum';\nimport { ConnectionInfo, hexDataSlice, hexValue } from 'ethers/lib/utils';\nimport { retryOnFailEth } from '../utils/project';\nimport { EthereumBlockWrapped } from './block.ethereum';\nimport {\n formatBlock,\n formatReceipt,\n formatTransaction,\n} from './utils.ethereum';\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: packageVersion } = require('../../package.json');\n\nconst logger = getLogger('api.ethereum');\n\nasync function loadAssets(\n ds: RuntimeDataSourceV0_2_0,\n): Promise<Record<string, string>> {\n if (!ds.assets) {\n return {};\n }\n const res: Record<string, string> = {};\n\n for (const [name, { file }] of Object.entries(ds.assets)) {\n try {\n res[name] = await fs.promises.readFile(file, { encoding: 'utf8' });\n } catch (e) {\n throw new Error(`Failed to load datasource asset ${file}`);\n }\n }\n\n return res;\n}\n\nexport class EthereumApi implements ApiWrapper<EthereumBlockWrapper> {\n private client: JsonRpcProvider;\n private genesisBlock: Record<string, any>;\n private contractInterfaces: Record<string, Interface> = {};\n private chainId: number;\n\n private endpointSupportsGetBlockReceipts = true;\n\n constructor(private endpoint: string) {\n const { hostname, pathname, port, protocol, searchParams } = new URL(\n endpoint,\n );\n\n const protocolStr = protocol.replace(':', '');\n\n logger.info(this.endpoint.split('?')[0]);\n if (protocolStr === 'https' || protocolStr === 'http') {\n const connection: ConnectionInfo = {\n url: this.endpoint.split('?')[0],\n headers: {\n 'User-Agent': `Subquery-Node ${packageVersion}`,\n },\n };\n searchParams.forEach((value, name, searchParams) => {\n (connection.headers as any)[name] = value;\n });\n this.client = new JsonRpcProvider(connection);\n } else if (protocolStr === 'ws' || protocolStr === 'wss') {\n this.client = new WebSocketProvider(this.endpoint);\n } else {\n throw new Error(`Unsupported protocol: ${protocol}`);\n }\n }\n\n async init(): Promise<void> {\n this.genesisBlock = await this.client.getBlock(0);\n\n this.chainId = (await this.client.getNetwork()).chainId;\n }\n\n async getFinalizedBlockHeight(): Promise<number> {\n return (await this.client.getBlock('finalized')).number;\n }\n\n async getBestBlockHeight(): Promise<number> {\n return (await this.client.getBlock('safe')).number;\n }\n\n getRuntimeChain(): string {\n return 'ethereum';\n }\n\n getChainId(): number {\n return this.chainId;\n }\n\n getGenesisHash(): string {\n return this.genesisBlock.hash;\n }\n\n getSpecName(): string {\n return 'ethereum';\n }\n\n async getBlockByHeightOrHash(heightOrHash: number | string): Promise<Block> {\n return this.client.getBlock(heightOrHash);\n }\n\n async getBlockPromise(num: number): Promise<any> {\n return retryOnFailEth(() =>\n this.client.send('eth_getBlockByNumber', [hexValue(num), true]),\n );\n }\n\n async getTransactionReceipt(\n transactionHash: string | Promise<string>,\n ): Promise<TransactionReceipt> {\n return retryOnFailEth<TransactionReceipt>(\n this.client.getTransactionReceipt.bind(this.client, transactionHash),\n );\n }\n async fetchBlock(num: number): Promise<EthereumBlockWrapper> {\n const block_promise = await this.getBlockPromise(num);\n\n const block = formatBlock(block_promise);\n block.stateRoot = this.client.formatter.hash(block.stateRoot);\n\n if (this.endpointSupportsGetBlockReceipts) {\n try {\n const rawReceipts: any[] = await this.client.send(\n 'eth_getBlockReceipts',\n [hexValue(block.number)],\n );\n\n const receipts = rawReceipts.map((receipt) =>\n formatReceipt(receipt, block),\n );\n\n const txs = block.transactions.map((tx) => {\n const transaction = formatTransaction(tx);\n transaction.receipt =\n receipts[BigNumber.from(transaction.transactionIndex).toNumber()];\n\n assert(\n transaction.hash === transaction.receipt.transactionHash,\n 'Failed to match receipt to transaction',\n );\n\n return transaction;\n });\n\n return new EthereumBlockWrapped(block, txs);\n } catch (e) {\n // Method not avaialble https://eips.ethereum.org/EIPS/eip-1474\n if (e?.error?.code === -32601) {\n logger.warn(\n `The endpoint doesn't support 'eth_getBlockReceipts', individual receipts will be fetched instead, this will greatly impact performance.`,\n );\n this.endpointSupportsGetBlockReceipts = false;\n\n // Should continue and use old method here\n } else {\n throw e;\n }\n }\n }\n\n const transactions = await Promise.all(\n block.transactions.map(async (tx) => {\n const transaction = formatTransaction(tx);\n const receipt = await this.getTransactionReceipt(tx.hash);\n transaction.receipt = formatReceipt(receipt, block);\n return transaction;\n }),\n );\n return new EthereumBlockWrapped(block, transactions);\n }\n\n async fetchBlocks(bufferBlocks: number[]): Promise<EthereumBlockWrapper[]> {\n return Promise.all(\n bufferBlocks.map(async (num) => {\n try {\n // Fetch Block\n return await this.fetchBlock(num);\n } catch (e) {\n // Wrap error from an axios error to fix issue with error being undefined\n const error = new Error(e.message);\n logger.error(error, `Failed to fetch block at height ${num}`);\n throw error;\n }\n }),\n );\n }\n\n freezeApi(processor: any, blockContent: BlockWrapper): void {\n processor.freeze(this.client, 'api');\n }\n\n private buildInterface(\n abiName: string,\n assets: Record<string, string>,\n ): Interface | undefined {\n if (!assets[abiName]) {\n throw new Error(`ABI named \"${abiName}\" not referenced in assets`);\n }\n\n // This assumes that all datasources have a different abi name or they are the same abi\n if (!this.contractInterfaces[abiName]) {\n // Constructing the interface validates the ABI\n try {\n let abiObj = JSON.parse(assets[abiName]);\n\n /*\n * Allows parsing JSON artifacts as well as ABIs\n * https://trufflesuite.github.io/artifact-updates/background.html#what-are-artifacts\n */\n if (!Array.isArray(abiObj) && abiObj.abi) {\n abiObj = abiObj.abi;\n }\n\n this.contractInterfaces[abiName] = new Interface(abiObj);\n } catch (e) {\n logger.error(`Unable to parse ABI: ${e.message}`);\n throw new Error('ABI is invalid');\n }\n }\n\n return this.contractInterfaces[abiName];\n }\n\n async parseLog<T extends EthereumResult = EthereumResult>(\n log: EthereumLog,\n ds: RuntimeDataSourceV0_2_0,\n ): Promise<EthereumLog<T> | EthereumLog> {\n try {\n if (!ds?.options?.abi) {\n logger.warn('No ABI provided for datasource');\n return log;\n }\n const iface = this.buildInterface(ds.options.abi, await loadAssets(ds));\n return {\n ...log,\n args: iface?.parseLog(log).args as T,\n };\n } catch (e) {\n logger.warn(`Failed to parse log data: ${e.message}`);\n return log;\n }\n }\n\n async parseTransaction<T extends EthereumResult = EthereumResult>(\n transaction: EthereumTransaction,\n ds: RuntimeDataSourceV0_2_0,\n ): Promise<EthereumTransaction<T> | EthereumTransaction> {\n try {\n if (!ds?.options?.abi) {\n logger.warn('No ABI provided for datasource');\n return transaction;\n }\n const assets = await loadAssets(ds);\n const iface = this.buildInterface(ds.options.abi, assets);\n const func = iface.getFunction(hexDataSlice(transaction.input, 0, 4));\n const args = iface.decodeFunctionData(func, transaction.input) as T;\n return {\n ...transaction,\n args,\n };\n } catch (e) {\n logger.warn(`Failed to parse transaction data: ${e.message}`);\n return transaction;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"api.ethereum.js","sourceRoot":"","sources":["../../src/ethereum/api.ethereum.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;AAEtC,oDAA4B;AAC5B,4CAAoB;AACpB,4CAA+C;AAE/C,wDAAqD;AACrD,wDAA8E;AAE9E,gDAA6C;AAS7C,4CAA0E;AAC1E,8CAAkD;AAClD,qDAAwD;AACxD,0DAAyC;AACzC,qDAI0B;AAE1B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GA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AM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,IAAA,oBAAY,EAAC,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACtE,MAAM,IAAI,GAAG,KAAK,CAAC,kBAAkB,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAM,CAAC;YACpE,uCACK,WAAW,KACd,IAAI,IACJ;SACH;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,OAAO,WAAW,CAAC;SACpB;IACH,CAAC;CACF;AA3OD,kCA2OC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport assert from 'assert';\nimport fs from 'fs';\nimport { Interface } from '@ethersproject/abi';\nimport { Block, TransactionReceipt } from '@ethersproject/abstract-provider';\nimport { BigNumber } from '@ethersproject/bignumber';\nimport { JsonRpcProvider, WebSocketProvider } from '@ethersproject/providers';\nimport { RuntimeDataSourceV0_2_0 } from '@subql/common-ethereum';\nimport { getLogger } from '@subql/node-core';\nimport {\n ApiWrapper,\n BlockWrapper,\n EthereumBlockWrapper,\n EthereumTransaction,\n EthereumResult,\n EthereumLog,\n} from '@subql/types-ethereum';\nimport { ConnectionInfo, hexDataSlice, hexValue } from 'ethers/lib/utils';\nimport { retryOnFailEth } from '../utils/project';\nimport { EthereumBlockWrapped } from './block.ethereum';\nimport SafeEthProvider from './safe-api';\nimport {\n formatBlock,\n formatReceipt,\n formatTransaction,\n} from './utils.ethereum';\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: packageVersion } = require('../../package.json');\n\nconst logger = getLogger('api.ethereum');\n\nasync function loadAssets(\n ds: RuntimeDataSourceV0_2_0,\n): Promise<Record<string, string>> {\n if (!ds.assets) {\n return {};\n }\n const res: Record<string, string> = {};\n\n for (const [name, { file }] of Object.entries(ds.assets)) {\n try {\n res[name] = await fs.promises.readFile(file, { encoding: 'utf8' });\n } catch (e) {\n throw new Error(`Failed to load datasource asset ${file}`);\n }\n }\n\n return res;\n}\n\nexport class EthereumApi implements ApiWrapper<EthereumBlockWrapper> {\n private client: JsonRpcProvider;\n private genesisBlock: Record<string, any>;\n private contractInterfaces: Record<string, Interface> = {};\n private chainId: number;\n\n private endpointSupportsGetBlockReceipts = true;\n\n constructor(private endpoint: string) {\n const { hostname, pathname, port, protocol, searchParams } = new URL(\n endpoint,\n );\n\n const protocolStr = protocol.replace(':', '');\n\n logger.info(this.endpoint.split('?')[0]);\n if (protocolStr === 'https' || protocolStr === 'http') {\n const connection: ConnectionInfo = {\n url: this.endpoint.split('?')[0],\n headers: {\n 'User-Agent': `Subquery-Node ${packageVersion}`,\n },\n };\n searchParams.forEach((value, name, searchParams) => {\n (connection.headers as any)[name] = value;\n });\n this.client = new JsonRpcProvider(connection);\n } else if (protocolStr === 'ws' || protocolStr === 'wss') {\n this.client = new WebSocketProvider(this.endpoint);\n } else {\n throw new Error(`Unsupported protocol: ${protocol}`);\n }\n }\n\n async init(): Promise<void> {\n this.genesisBlock = await this.client.getBlock(0);\n\n this.chainId = (await this.client.getNetwork()).chainId;\n }\n\n async getFinalizedBlockHeight(): Promise<number> {\n return (await this.client.getBlock('finalized')).number;\n }\n\n async getBestBlockHeight(): Promise<number> {\n return (await this.client.getBlock('safe')).number;\n }\n\n getRuntimeChain(): string {\n return 'ethereum';\n }\n\n getChainId(): number {\n return this.chainId;\n }\n\n getGenesisHash(): string {\n return this.genesisBlock.hash;\n }\n\n getSpecName(): string {\n return 'ethereum';\n }\n\n async getBlockByHeightOrHash(heightOrHash: number | string): Promise<Block> {\n return this.client.getBlock(heightOrHash);\n }\n\n async getBlockPromise(num: number): Promise<any> {\n return retryOnFailEth(() =>\n this.client.send('eth_getBlockByNumber', [hexValue(num), true]),\n );\n }\n\n async getTransactionReceipt(\n transactionHash: string | Promise<string>,\n ): Promise<TransactionReceipt> {\n return retryOnFailEth<TransactionReceipt>(\n this.client.getTransactionReceipt.bind(this.client, transactionHash),\n );\n }\n async fetchBlock(num: number): Promise<EthereumBlockWrapper> {\n const block_promise = await this.getBlockPromise(num);\n\n const block = formatBlock(block_promise);\n block.stateRoot = this.client.formatter.hash(block.stateRoot);\n\n if (this.endpointSupportsGetBlockReceipts) {\n try {\n const rawReceipts: any[] = await this.client.send(\n 'eth_getBlockReceipts',\n [hexValue(block.number)],\n );\n\n const receipts = rawReceipts.map((receipt) =>\n formatReceipt(receipt, block),\n );\n\n const txs = block.transactions.map((tx) => {\n const transaction = formatTransaction(tx);\n transaction.receipt =\n receipts[BigNumber.from(transaction.transactionIndex).toNumber()];\n\n assert(\n transaction.hash === transaction.receipt.transactionHash,\n 'Failed to match receipt to transaction',\n );\n\n return transaction;\n });\n\n return new EthereumBlockWrapped(block, txs);\n } catch (e) {\n // Method not avaialble https://eips.ethereum.org/EIPS/eip-1474\n if (e?.error?.code === -32601) {\n logger.warn(\n `The endpoint doesn't support 'eth_getBlockReceipts', individual receipts will be fetched instead, this will greatly impact performance.`,\n );\n this.endpointSupportsGetBlockReceipts = false;\n\n // Should continue and use old method here\n } else {\n throw e;\n }\n }\n }\n\n const transactions = await Promise.all(\n block.transactions.map(async (tx) => {\n const transaction = formatTransaction(tx);\n const receipt = await this.getTransactionReceipt(tx.hash);\n transaction.receipt = formatReceipt(receipt, block);\n return transaction;\n }),\n );\n return new EthereumBlockWrapped(block, transactions);\n }\n\n async fetchBlocks(bufferBlocks: number[]): Promise<EthereumBlockWrapper[]> {\n return Promise.all(\n bufferBlocks.map(async (num) => {\n try {\n // Fetch Block\n return await this.fetchBlock(num);\n } catch (e) {\n // Wrap error from an axios error to fix issue with error being undefined\n const error = new Error(e.message);\n logger.error(error, `Failed to fetch block at height ${num}`);\n throw error;\n }\n }),\n );\n }\n\n freezeApi(processor: any, blockContent: BlockWrapper): void {\n processor.freeze(\n new SafeEthProvider(this.client, blockContent.blockHeight),\n 'api',\n );\n }\n\n private buildInterface(\n abiName: string,\n assets: Record<string, string>,\n ): Interface | undefined {\n if (!assets[abiName]) {\n throw new Error(`ABI named \"${abiName}\" not referenced in assets`);\n }\n\n // This assumes that all datasources have a different abi name or they are the same abi\n if (!this.contractInterfaces[abiName]) {\n // Constructing the interface validates the ABI\n try {\n let abiObj = JSON.parse(assets[abiName]);\n\n /*\n * Allows parsing JSON artifacts as well as ABIs\n * https://trufflesuite.github.io/artifact-updates/background.html#what-are-artifacts\n */\n if (!Array.isArray(abiObj) && abiObj.abi) {\n abiObj = abiObj.abi;\n }\n\n this.contractInterfaces[abiName] = new Interface(abiObj);\n } catch (e) {\n logger.error(`Unable to parse ABI: ${e.message}`);\n throw new Error('ABI is invalid');\n }\n }\n\n return this.contractInterfaces[abiName];\n }\n\n async parseLog<T extends EthereumResult = EthereumResult>(\n log: EthereumLog,\n ds: RuntimeDataSourceV0_2_0,\n ): Promise<EthereumLog<T> | EthereumLog> {\n try {\n if (!ds?.options?.abi) {\n logger.warn('No ABI provided for datasource');\n return log;\n }\n const iface = this.buildInterface(ds.options.abi, await loadAssets(ds));\n return {\n ...log,\n args: iface?.parseLog(log).args as T,\n };\n } catch (e) {\n logger.warn(`Failed to parse log data: ${e.message}`);\n return log;\n }\n }\n\n async parseTransaction<T extends EthereumResult = EthereumResult>(\n transaction: EthereumTransaction,\n ds: RuntimeDataSourceV0_2_0,\n ): Promise<EthereumTransaction<T> | EthereumTransaction> {\n try {\n if (!ds?.options?.abi) {\n logger.warn('No ABI provided for datasource');\n return transaction;\n }\n const assets = await loadAssets(ds);\n const iface = this.buildInterface(ds.options.abi, assets);\n const func = iface.getFunction(hexDataSlice(transaction.input, 0, 4));\n const args = iface.decodeFunctionData(func, transaction.input) as T;\n return {\n ...transaction,\n args,\n };\n } catch (e) {\n logger.warn(`Failed to parse transaction data: ${e.message}`);\n return transaction;\n }\n }\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { Block, BlockTag, BlockWithTransactions, EventType, Filter, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse, Provider } from '@ethersproject/abstract-provider';
2
+ import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
3
+ import type { Network } from '@ethersproject/networks';
4
+ import type { Deferrable } from '@ethersproject/properties';
5
+ export default class SafeEthProvider extends Provider {
6
+ private baseApi;
7
+ private blockHeight;
8
+ constructor(baseApi: Provider, blockHeight: BlockTag | Promise<BlockTag>);
9
+ getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
10
+ getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
11
+ getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
12
+ getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
13
+ call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
14
+ getBlockWithTransactions(blockHashOrBlockTag: BlockTag | Promise<BlockTag>): Promise<BlockWithTransactions>;
15
+ getBlock(blockHashOrBlockTag: BlockTag | Promise<BlockTag>): Promise<Block>;
16
+ getTransaction(transactionHash: string): Promise<TransactionResponse>;
17
+ getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
18
+ getLogs(filter: Filter): Promise<Log[]>;
19
+ getBlockNumber(): Promise<number>;
20
+ getNetwork(): Promise<Network>;
21
+ getGasPrice(): Promise<BigNumber>;
22
+ estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
23
+ sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
24
+ resolveName(name: string | Promise<string>): Promise<string | null>;
25
+ lookupAddress(address: string | Promise<string>): Promise<string | null>;
26
+ on(eventName: EventType, listener: Listener): Provider;
27
+ once(eventName: EventType, listener: Listener): Provider;
28
+ emit(eventName: EventType, ...args: any[]): boolean;
29
+ listenerCount(eventName?: EventType): number;
30
+ listeners(eventName?: EventType): Listener[];
31
+ off(eventName: EventType, listener?: Listener): Provider;
32
+ removeAllListeners(eventName?: EventType): Provider;
33
+ waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
34
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ // Copyright 2020-2022 OnFinality Limited authors & contributors
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const abstract_provider_1 = require("@ethersproject/abstract-provider");
6
+ const node_core_1 = require("@subql/node-core");
7
+ const logger = (0, node_core_1.getLogger)('safe.api.ethereum');
8
+ class SafeEthProvider extends abstract_provider_1.Provider {
9
+ constructor(baseApi, blockHeight) {
10
+ super();
11
+ this.baseApi = baseApi;
12
+ this.blockHeight = blockHeight;
13
+ }
14
+ async getBalance(addressOrName, blockTag) {
15
+ if (blockTag)
16
+ logger.warn(`Provided parameter 'blockTag' will not be used`);
17
+ return this.baseApi.getBalance(addressOrName, this.blockHeight);
18
+ }
19
+ async getTransactionCount(addressOrName, blockTag) {
20
+ if (blockTag)
21
+ logger.warn(`Provided parameter 'blockTag' will not be used`);
22
+ return this.baseApi.getTransactionCount(addressOrName, this.blockHeight);
23
+ }
24
+ async getCode(addressOrName, blockTag) {
25
+ if (blockTag)
26
+ logger.warn(`Provided parameter 'blockTag' will not be used`);
27
+ return this.baseApi.getCode(addressOrName, this.blockHeight);
28
+ }
29
+ async getStorageAt(addressOrName, position, blockTag) {
30
+ if (blockTag)
31
+ logger.warn(`Provided parameter 'blockTag' will not be used`);
32
+ return this.baseApi.getStorageAt(addressOrName, position, this.blockHeight);
33
+ }
34
+ async call(transaction, blockTag) {
35
+ if (blockTag)
36
+ logger.warn(`Provided parameter 'blockTag' will not be used`);
37
+ return this.baseApi.call(transaction, this.blockHeight);
38
+ }
39
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
40
+ getBlockWithTransactions(blockHashOrBlockTag) {
41
+ throw new Error('Method `getBlockWithTransactions` not supported.');
42
+ }
43
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
44
+ getBlock(blockHashOrBlockTag) {
45
+ throw new Error('Method `getBlock` not supported.');
46
+ }
47
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
48
+ getTransaction(transactionHash) {
49
+ throw new Error('Method `getTransaction` not supported.');
50
+ }
51
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
52
+ getTransactionReceipt(transactionHash) {
53
+ throw new Error('Method `getTransactionReceipt` not supported.');
54
+ }
55
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
56
+ getLogs(filter) {
57
+ throw new Error('Method `getLogs` not supported.');
58
+ }
59
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
60
+ getBlockNumber() {
61
+ throw new Error('Method `getBlockNumber` not supported.');
62
+ }
63
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
64
+ getNetwork() {
65
+ throw new Error('Method `getNetwork` not supported.');
66
+ }
67
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
68
+ getGasPrice() {
69
+ throw new Error('Method `getGasPrice` not supported.');
70
+ }
71
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
72
+ estimateGas(transaction) {
73
+ throw new Error('Method `estimateGas` not supported.');
74
+ }
75
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
76
+ sendTransaction(signedTransaction) {
77
+ throw new Error('Method `sendTransaction` not supported.');
78
+ }
79
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
80
+ resolveName(name) {
81
+ throw new Error('Method `resolveName` not supported.');
82
+ }
83
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
84
+ lookupAddress(address) {
85
+ throw new Error('Method `lookupAddress` not supported.');
86
+ }
87
+ on(eventName, listener) {
88
+ throw new Error('Method `on` not supported.');
89
+ }
90
+ once(eventName, listener) {
91
+ throw new Error('Method `once` not supported.');
92
+ }
93
+ emit(eventName, ...args) {
94
+ throw new Error('Method `emit` not supported.');
95
+ }
96
+ listenerCount(eventName) {
97
+ throw new Error('Method `listenerCount` not supported.');
98
+ }
99
+ listeners(eventName) {
100
+ throw new Error('Method `listeners` not supported.');
101
+ }
102
+ off(eventName, listener) {
103
+ throw new Error('Method `off` not supported.');
104
+ }
105
+ removeAllListeners(eventName) {
106
+ throw new Error('Method `removeAllListeners` not supported.');
107
+ }
108
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
109
+ waitForTransaction(transactionHash, confirmations, timeout) {
110
+ throw new Error('Method `waitForTransaction` not supported.');
111
+ }
112
+ }
113
+ exports.default = SafeEthProvider;
114
+ //# sourceMappingURL=safe-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-api.js","sourceRoot":"","sources":["../../src/ethereum/safe-api.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;AAEtC,wEAY0C;AAI1C,gDAA6C;AAE7C,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,mBAAmB,CAAC,CAAC;AAE9C,MAAqB,eAAgB,SAAQ,4BAAQ;IACnD,YACU,OAAiB,EACjB,WAAyC;QAEjD,KAAK,EAAE,CAAC;QAHA,YAAO,GAAP,OAAO,CAAU;QACjB,gBAAW,GAAX,WAAW,CAA8B;IAGnD,CAAC;IAED,KAAK,CAAC,UAAU,CACd,aAAuC,EACvC,QAAuC;QAEvC,IAAI,QAAQ;YAAE,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,aAAuC,EACvC,QAAuC;QAEvC,IAAI,QAAQ;YAAE,MAAM,CAAC,IAAI,CAAC,gDAAgD,C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CAAC,CAAC;IACvD,CAAC;IACD,GAAG,CAAC,SAAoB,EAAE,QAAmB;QAC3C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,kBAAkB,CAAC,SAAqB;QACtC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IACD,qEAAqE;IACrE,kBAAkB,CAChB,eAAuB,EACvB,aAAsB,EACtB,OAAgB;QAEhB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;CACF;AApID,kCAoIC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n Block,\n BlockTag,\n BlockWithTransactions,\n EventType,\n Filter,\n Listener,\n Log,\n TransactionReceipt,\n TransactionRequest,\n TransactionResponse,\n Provider,\n} from '@ethersproject/abstract-provider';\nimport { BigNumber, BigNumberish } from '@ethersproject/bignumber';\nimport type { Network } from '@ethersproject/networks';\nimport type { Deferrable } from '@ethersproject/properties';\nimport { getLogger } from '@subql/node-core';\n\nconst logger = getLogger('safe.api.ethereum');\n\nexport default class SafeEthProvider extends Provider {\n constructor(\n private baseApi: Provider,\n private blockHeight: BlockTag | Promise<BlockTag>,\n ) {\n super();\n }\n\n async getBalance(\n addressOrName: string | Promise<string>,\n blockTag?: BlockTag | Promise<BlockTag>,\n ): Promise<BigNumber> {\n if (blockTag) logger.warn(`Provided parameter 'blockTag' will not be used`);\n return this.baseApi.getBalance(addressOrName, this.blockHeight);\n }\n\n async getTransactionCount(\n addressOrName: string | Promise<string>,\n blockTag?: BlockTag | Promise<BlockTag>,\n ): Promise<number> {\n if (blockTag) logger.warn(`Provided parameter 'blockTag' will not be used`);\n return this.baseApi.getTransactionCount(addressOrName, this.blockHeight);\n }\n\n async getCode(\n addressOrName: string | Promise<string>,\n blockTag?: BlockTag | Promise<BlockTag>,\n ): Promise<string> {\n if (blockTag) logger.warn(`Provided parameter 'blockTag' will not be used`);\n return this.baseApi.getCode(addressOrName, this.blockHeight);\n }\n\n async getStorageAt(\n addressOrName: string | Promise<string>,\n position: BigNumberish | Promise<BigNumberish>,\n blockTag?: BlockTag | Promise<BlockTag>,\n ): Promise<string> {\n if (blockTag) logger.warn(`Provided parameter 'blockTag' will not be used`);\n return this.baseApi.getStorageAt(addressOrName, position, this.blockHeight);\n }\n\n async call(\n transaction: Deferrable<TransactionRequest>,\n blockTag?: BlockTag | Promise<BlockTag>,\n ): Promise<string> {\n if (blockTag) logger.warn(`Provided parameter 'blockTag' will not be used`);\n\n return this.baseApi.call(transaction, this.blockHeight);\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getBlockWithTransactions(\n blockHashOrBlockTag: BlockTag | Promise<BlockTag>,\n ): Promise<BlockWithTransactions> {\n throw new Error('Method `getBlockWithTransactions` not supported.');\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getBlock(blockHashOrBlockTag: BlockTag | Promise<BlockTag>): Promise<Block> {\n throw new Error('Method `getBlock` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getTransaction(transactionHash: string): Promise<TransactionResponse> {\n throw new Error('Method `getTransaction` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt> {\n throw new Error('Method `getTransactionReceipt` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getLogs(filter: Filter): Promise<Log[]> {\n throw new Error('Method `getLogs` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getBlockNumber(): Promise<number> {\n throw new Error('Method `getBlockNumber` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getNetwork(): Promise<Network> {\n throw new Error('Method `getNetwork` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getGasPrice(): Promise<BigNumber> {\n throw new Error('Method `getGasPrice` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber> {\n throw new Error('Method `estimateGas` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n sendTransaction(\n signedTransaction: string | Promise<string>,\n ): Promise<TransactionResponse> {\n throw new Error('Method `sendTransaction` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n resolveName(name: string | Promise<string>): Promise<string | null> {\n throw new Error('Method `resolveName` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n lookupAddress(address: string | Promise<string>): Promise<string | null> {\n throw new Error('Method `lookupAddress` not supported.');\n }\n on(eventName: EventType, listener: Listener): Provider {\n throw new Error('Method `on` not supported.');\n }\n once(eventName: EventType, listener: Listener): Provider {\n throw new Error('Method `once` not supported.');\n }\n emit(eventName: EventType, ...args: any[]): boolean {\n throw new Error('Method `emit` not supported.');\n }\n listenerCount(eventName?: EventType): number {\n throw new Error('Method `listenerCount` not supported.');\n }\n listeners(eventName?: EventType): Listener[] {\n throw new Error('Method `listeners` not supported.');\n }\n off(eventName: EventType, listener?: Listener): Provider {\n throw new Error('Method `off` not supported.');\n }\n removeAllListeners(eventName?: EventType): Provider {\n throw new Error('Method `removeAllListeners` not supported.');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n waitForTransaction(\n transactionHash: string,\n confirmations?: number,\n timeout?: number,\n ): Promise<TransactionReceipt> {\n throw new Error('Method `waitForTransaction` not supported.');\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subql/node-ethereum",
3
- "version": "0.4.1-4",
3
+ "version": "0.4.1-5",
4
4
  "description": "",
5
5
  "author": "Ian He",
6
6
  "license": "Apache-2.0",
@@ -25,9 +25,9 @@
25
25
  "@nestjs/platform-express": "^8.2.6",
26
26
  "@nestjs/schedule": "^1.0.2",
27
27
  "@subql/common": "1.5.0",
28
- "@subql/common-ethereum": "0.2.2-3",
28
+ "@subql/common-ethereum": "0.2.2-4",
29
29
  "@subql/node-core": "1.8.1-2",
30
- "@subql/types-ethereum": "0.2.2-4",
30
+ "@subql/types-ethereum": "0.2.2-5",
31
31
  "@subql/utils": "1.3.2-1",
32
32
  "@subql/x-merkle-mountain-range": "2.0.0-0.1.2",
33
33
  "@willsoto/nestjs-prometheus": "^4.4.0",
@@ -74,5 +74,5 @@
74
74
  "/dist",
75
75
  "/bin"
76
76
  ],
77
- "stableVersion": "0.4.1-3"
77
+ "stableVersion": "0.4.1-4"
78
78
  }