@subql/node-ethereum 6.2.1 → 6.2.2-1

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/configure/SubqueryProject.js +7 -0
  4. package/dist/configure/SubqueryProject.js.map +1 -1
  5. package/dist/utils/project.d.ts +14 -1
  6. package/dist/utils/project.js +100 -0
  7. package/dist/utils/project.js.map +1 -1
  8. package/dist/utils/string.d.ts +8 -0
  9. package/dist/utils/string.js +202 -1
  10. package/dist/utils/string.js.map +1 -1
  11. package/package.json +4 -3
  12. package/dist/blockchain.service.test.d.ts +0 -1
  13. package/dist/blockchain.service.test.js +0 -27
  14. package/dist/blockchain.service.test.js.map +0 -1
  15. package/dist/ethereum/api.ethereum.test.d.ts +0 -1
  16. package/dist/ethereum/api.ethereum.test.js +0 -266
  17. package/dist/ethereum/api.ethereum.test.js.map +0 -1
  18. package/dist/ethereum/api.service.ethereum.test.d.ts +0 -1
  19. package/dist/ethereum/api.service.ethereum.test.js +0 -91
  20. package/dist/ethereum/api.service.ethereum.test.js.map +0 -1
  21. package/dist/ethereum/ethers/celo/celo-ws-provider.spec.d.ts +0 -1
  22. package/dist/ethereum/ethers/celo/celo-ws-provider.spec.js +0 -33
  23. package/dist/ethereum/ethers/celo/celo-ws-provider.spec.js.map +0 -1
  24. package/dist/ethereum/ethers/json-rpc-batch-provider.spec.d.ts +0 -1
  25. package/dist/ethereum/ethers/json-rpc-batch-provider.spec.js +0 -63
  26. package/dist/ethereum/ethers/json-rpc-batch-provider.spec.js.map +0 -1
  27. package/dist/ethereum/ethers/op/op-provider.spec.d.ts +0 -1
  28. package/dist/ethereum/ethers/op/op-provider.spec.js +0 -32
  29. package/dist/ethereum/ethers/op/op-provider.spec.js.map +0 -1
  30. package/dist/indexer/dictionary/utils.spec.d.ts +0 -1
  31. package/dist/indexer/dictionary/utils.spec.js +0 -101
  32. package/dist/indexer/dictionary/utils.spec.js.map +0 -1
  33. package/dist/indexer/dictionary/v1/ethDictionaryV1.spec.d.ts +0 -1
  34. package/dist/indexer/dictionary/v1/ethDictionaryV1.spec.js +0 -519
  35. package/dist/indexer/dictionary/v1/ethDictionaryV1.spec.js.map +0 -1
  36. package/dist/indexer/dictionary/v2/ethDictionaryV2.spec.d.ts +0 -1
  37. package/dist/indexer/dictionary/v2/ethDictionaryV2.spec.js +0 -585
  38. package/dist/indexer/dictionary/v2/ethDictionaryV2.spec.js.map +0 -1
  39. package/dist/indexer/dictionary/v2/utils.spec.d.ts +0 -1
  40. package/dist/indexer/dictionary/v2/utils.spec.js +0 -92
  41. package/dist/indexer/dictionary/v2/utils.spec.js.map +0 -1
  42. package/dist/indexer/unfinalizedBlocks.service.spec.d.ts +0 -1
  43. package/dist/indexer/unfinalizedBlocks.service.spec.js +0 -169
  44. package/dist/indexer/unfinalizedBlocks.service.spec.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ethDictionaryV1.spec.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v1/ethDictionaryV1.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;AAEnC,gDAA8C;AAC9C,0DAI+B;AAC/B,qCAAwC;AAKxC,uDAG2B;AAE3B,MAAM,UAAU,GAAgC;IAC9C;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,uCAAsB,CAAC,OAAO;QACpC,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE;gBACR;oBACE,OAAO,EAAE,cAAc;oBACvB,IAAI,EAAE,oCAAmB,CAAC,KAAK;oBAC/B,MAAM,EAAE;wBACN,MAAM,EAAE,CAAC,qCAAqC,CAAC;qBAChD;iBACF;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,uCAAsB,CAAC,OAAO;QAC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G,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE;aAC1B,CAAC;YAE9B,MAAM,UAAU,GAAG,IAAA,+CAA6B,EAAC,oBAAoB,CAAC,CAAC;YAEvE,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;gBACzB;oBACE,UAAU,EAAE;wBACV;4BACE,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,SAAS;4BAClB,KAAK,EACH,oEAAoE;yBACvE;qBACF;oBACD,MAAM,EAAE,SAAS;iBAClB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { NodeConfig } from '@subql/node-core';\nimport {\n EthereumDatasourceKind,\n EthereumHandlerKind,\n SubqlRuntimeDatasource,\n} from '@subql/types-ethereum';\nimport { GraphQLSchema } from 'graphql';\nimport {\n EthereumProjectDsTemplate,\n SubqueryProject,\n} from '../../../configure/SubqueryProject';\nimport {\n buildDictionaryV1QueryEntries,\n EthDictionaryV1,\n} from './ethDictionaryV1';\n\nconst mockTempDs: EthereumProjectDsTemplate[] = [\n {\n name: 'ERC721',\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleERC721',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: ['Transfer(address, address, uint256)'],\n },\n },\n ],\n },\n },\n {\n name: 'ERC1155',\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleERC1155',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: [\n 'TransferSingle(address, address, address, uint256, uint256)',\n ],\n },\n },\n ],\n },\n },\n];\nfunction testSubqueryProject(\n endpoint: string,\n ds: any,\n mockTempDs,\n): SubqueryProject {\n return {\n network: {\n endpoint,\n chainId: '1',\n },\n dataSources: ds as any,\n id: 'test',\n root: './',\n schema: new GraphQLSchema({}),\n templates: mockTempDs as any,\n } as any;\n}\n\ndescribe('Eth Dictionary V1', () => {\n it('Can resovle chain aliases', async () => {\n (EthDictionaryV1.prototype as any).init = jest.fn();\n const dictionary = await EthDictionaryV1.create(\n {\n network: { chainId: '336', dictionary: 'https://foo.bar' } as any,\n } as any,\n new NodeConfig({} as any, true),\n '',\n );\n\n expect((dictionary as any).chainId).toBe(\n '0xf1cf9022c7ebb34b162d5b5e34e705a5a740b2d0ecc1009fb89023e62a488108',\n );\n\n jest.clearAllMocks();\n });\n});\n\ndescribe('buildDictionaryV1QueryEntries', () => {\n describe('Log filters', () => {\n it('Build filter for !null', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleLog',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: [\n 'Transfer(address, address, uint256)',\n undefined,\n undefined,\n '!null',\n ],\n },\n },\n ],\n },\n };\n const result = buildDictionaryV1QueryEntries([ds]);\n\n expect(result).toEqual([\n {\n entity: 'evmLogs',\n conditions: [\n {\n field: 'address',\n matcher: 'equalTo',\n value: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n {\n field: 'topics0',\n value:\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n matcher: 'equalTo',\n },\n {\n field: 'topics3',\n value: false,\n matcher: 'isNull',\n },\n ],\n },\n ]);\n });\n });\n\n describe('Transaction filters', () => {\n it('Build a filter for contract creation transactions', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransaction',\n kind: EthereumHandlerKind.Call,\n filter: {\n to: null,\n },\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n\n expect(result).toEqual([\n {\n entity: 'evmTransactions',\n conditions: [{ field: 'to', matcher: 'isNull', value: true }],\n },\n ]);\n });\n\n it('Build a filter with include ds option and contract address', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmTransactions',\n conditions: [\n {\n field: 'to',\n matcher: 'equalTo',\n value: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n { field: 'func', matcher: 'equalTo', value: '0x095ea7b3' },\n ],\n },\n ]);\n });\n\n it('If ds option and filter both provide contract address, it should use ds options one', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Call,\n filter: {\n to: '0xabcde',\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmTransactions',\n conditions: [\n {\n field: 'to',\n matcher: 'equalTo',\n value: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n { field: 'func', matcher: 'equalTo', value: '0x095ea7b3' },\n ],\n },\n ]);\n });\n\n it('If ds option provide contract address, it should use ds options \"address\"', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmTransactions',\n conditions: [\n {\n field: 'to',\n matcher: 'equalTo',\n value: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n { field: 'func', matcher: 'equalTo', value: '0x095ea7b3' },\n ],\n },\n ]);\n });\n\n it('If filter provide contract address, it should use filter \"to\"', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Call,\n filter: {\n to: '0xabcde',\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmTransactions',\n conditions: [\n {\n field: 'to',\n matcher: 'equalTo',\n value: '0xabcde',\n },\n { field: 'func', matcher: 'equalTo', value: '0x095ea7b3' },\n ],\n },\n ]);\n });\n\n it('Creates a valid filter with a single event handler that has 0 filters but a contract address', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n address: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Event,\n },\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Call,\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmLogs',\n conditions: [\n {\n field: 'address',\n matcher: 'equalTo',\n value: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n ],\n },\n {\n entity: 'evmTransactions',\n conditions: [\n {\n field: 'to',\n matcher: 'equalTo',\n value: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n },\n ],\n },\n ]);\n });\n\n it('builds a filter when theres a block handler with modulo filter', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransfer',\n kind: EthereumHandlerKind.Call,\n filter: {\n to: '0xabcde',\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n {\n handler: 'handleBlock',\n kind: EthereumHandlerKind.Block,\n filter: {\n modulo: 200,\n },\n },\n ],\n },\n };\n\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmTransactions',\n conditions: [\n {\n field: 'to',\n matcher: 'equalTo',\n value: '0xabcde',\n },\n { field: 'func', matcher: 'equalTo', value: '0x095ea7b3' },\n ],\n },\n ]);\n });\n });\n\n describe('Correct dictionary query with dynamic ds', () => {\n it('Build correct erc1155 transfer single query', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleDyanmicDs',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: [\n 'TransferSingle(address, address, address, uint256, uint256)',\n ],\n },\n },\n ],\n },\n };\n const result = buildDictionaryV1QueryEntries([ds]);\n expect(result).toEqual([\n {\n entity: 'evmLogs',\n conditions: [\n {\n field: 'topics0',\n value:\n '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62',\n matcher: 'equalTo',\n },\n ],\n },\n ]);\n });\n\n it('Builds a groupded query for multiple dynamic ds', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleDyanmicDs',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: [\n 'TransferMultiple(address, address, address, uint256, uint256)',\n ],\n },\n },\n ],\n },\n };\n\n const duplicateDataSources = [\n { ...mockTempDs[0], options: { address: 'address1' } },\n { ...mockTempDs[0], options: { address: 'address2' } },\n { ...mockTempDs[1], options: { address: 'address3' } },\n ];\n\n const dataSources = [ds, ...duplicateDataSources];\n\n const queryEntry = buildDictionaryV1QueryEntries(dataSources);\n\n expect(queryEntry).toEqual([\n {\n conditions: [\n {\n field: 'topics0',\n matcher: 'equalTo',\n value:\n '0xeb9b7dd0d144caae51d14067d0d112bc1839fbf62e856fca78f6b4d9bfb51962',\n },\n ],\n entity: 'evmLogs',\n },\n {\n conditions: [\n {\n field: 'address',\n matcher: 'in',\n value: ['address1', 'address2'],\n },\n {\n field: 'topics0',\n matcher: 'equalTo',\n value:\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n },\n ],\n entity: 'evmLogs',\n },\n {\n conditions: [\n {\n field: 'address',\n matcher: 'equalTo',\n value: 'address3',\n },\n {\n field: 'topics0',\n matcher: 'equalTo',\n value:\n '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62',\n },\n ],\n entity: 'evmLogs',\n },\n ]);\n });\n\n it('Drops the address if multiple datasources have the same filters, but one without an address', () => {\n const duplicateDataSources = [\n { ...mockTempDs[0], options: { address: 'address1' } },\n { ...mockTempDs[0], options: { address: 'address2' } },\n { ...mockTempDs[0], options: { address: undefined } },\n ] as SubqlRuntimeDatasource[];\n\n const queryEntry = buildDictionaryV1QueryEntries(duplicateDataSources);\n\n expect(queryEntry).toEqual([\n {\n conditions: [\n {\n field: 'topics0',\n matcher: 'equalTo',\n value:\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n },\n ],\n entity: 'evmLogs',\n },\n ]);\n });\n });\n});\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,585 +0,0 @@
1
- "use strict";
2
- // Copyright 2020-2025 SubQuery Pte Ltd authors & contributors
3
- // SPDX-License-Identifier: GPL-3.0
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const common_ethereum_1 = require("@subql/common-ethereum");
9
- const node_core_1 = require("@subql/node-core");
10
- const types_ethereum_1 = require("@subql/types-ethereum");
11
- const eventemitter2_1 = __importDefault(require("eventemitter2"));
12
- const ethereum_1 = require("../../../ethereum");
13
- const ethDictionaryV2_1 = require("./ethDictionaryV2");
14
- const DEFAULT_DICTIONARY = 'https://ethereum.node.subquery.network/public';
15
- const HTTP_ENDPOINT = 'https://ethereum.rpc.subquery.network/public';
16
- const mockDs = [
17
- {
18
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
19
- assets: new Map(),
20
- startBlock: 19217803,
21
- mapping: {
22
- file: './dist/index.js',
23
- handlers: [
24
- {
25
- handler: 'handleTransaction',
26
- kind: types_ethereum_1.EthereumHandlerKind.Call,
27
- filter: {
28
- function: 'approve(address spender, uint256 rawAmount)',
29
- },
30
- },
31
- {
32
- handler: 'handleLog',
33
- kind: types_ethereum_1.EthereumHandlerKind.Event,
34
- filter: {
35
- topics: [
36
- 'Transfer(address indexed from, address indexed to, uint256 amount)',
37
- ],
38
- },
39
- },
40
- ],
41
- },
42
- },
43
- ];
44
- const templateTs = {
45
- name: 'template',
46
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
47
- assets: new Map(),
48
- options: {
49
- abi: 'erc20',
50
- // address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
51
- },
52
- // startBlock: 1,
53
- mapping: {
54
- file: '',
55
- handlers: [
56
- {
57
- handler: 'handleLog',
58
- kind: types_ethereum_1.EthereumHandlerKind.Event,
59
- filter: {
60
- topics: ['Transfer(address, address, uint256)'],
61
- },
62
- },
63
- ],
64
- },
65
- };
66
- // tx to is null
67
- const mockDs2 = [
68
- {
69
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
70
- assets: new Map(),
71
- startBlock: 19217803,
72
- mapping: {
73
- file: './dist/index.js',
74
- handlers: [
75
- {
76
- handler: 'handleTransaction',
77
- kind: types_ethereum_1.EthereumHandlerKind.Call,
78
- filter: {
79
- to: null,
80
- },
81
- },
82
- ],
83
- },
84
- processor: { file: '' },
85
- },
86
- ];
87
- const nodeConfig = new node_core_1.NodeConfig({
88
- subquery: 'eth-starter',
89
- subqueryName: 'eth-starter',
90
- dictionaryTimeout: 10,
91
- networkEndpoint: { [HTTP_ENDPOINT]: {} },
92
- networkDictionary: [DEFAULT_DICTIONARY],
93
- });
94
- function makeBlockHeightMap(mockDs) {
95
- const m = new Map();
96
- mockDs.forEach((ds, index, dataSources) => {
97
- m.set(ds.startBlock || 1, dataSources.slice(0, index + 1));
98
- });
99
- return new node_core_1.BlockHeightMap(m);
100
- }
101
- // enable this once dictionary v2 is online
102
- describe('eth dictionary v2', () => {
103
- let ethDictionaryV2;
104
- let ethApi;
105
- const dsMap = makeBlockHeightMap(mockDs);
106
- beforeAll(async () => {
107
- ethApi = new ethereum_1.EthereumApi(HTTP_ENDPOINT, 1, new eventemitter2_1.default());
108
- ethDictionaryV2 = await ethDictionaryV2_1.EthDictionaryV2.create(DEFAULT_DICTIONARY, nodeConfig, { network: { chainId: '1' } }, ethApi);
109
- }, 10000);
110
- beforeEach(() => {
111
- ethDictionaryV2.updateQueriesMap(dsMap);
112
- });
113
- it('converts ds to v2 dictionary queries', () => {
114
- const query = ethDictionaryV2.queriesMap.get(19217803);
115
- expect(query.logs.length).toBe(1);
116
- expect(query.transactions.length).toBe(1);
117
- });
118
- it('query response match with entries', async () => {
119
- const ethBlocks = (await ethDictionaryV2.getData(19217803, ethDictionaryV2._metadata.end, 2));
120
- expect(ethBlocks.batchBlocks.map((b) => b.block.number)).toStrictEqual([
121
- 19217803, 19217804,
122
- ]);
123
- const ethBlock19217803 = ethBlocks.batchBlocks[0].block;
124
- const ethBlock19217804 = ethBlocks.batchBlocks[1].block;
125
- expect(ethBlock19217803.number).toBe(19217803);
126
- expect(ethBlock19217804.number).toBe(19217804);
127
- // Sighash of approval tx
128
- expect(ethBlock19217803.transactions.filter((tx) => tx.input.indexOf('0x095ea7b3') === 0).length).toBe(4);
129
- // Run the same filters on an RPC block to compare results
130
- const rpcBlock19217804 = await ethApi.fetchBlock(19217804);
131
- const rpcLogs19217804 = [
132
- ...rpcBlock19217804.block.transactions
133
- .filter((tx) => tx.input.indexOf('0x095ea7b3') === 0)
134
- .flatMap((tx) => tx.logs),
135
- ...rpcBlock19217804.block.logs.filter((l) => l.topics[0] ===
136
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'),
137
- ];
138
- expect(ethBlock19217804.logs.length).toBe(rpcLogs19217804.length);
139
- // This matches with dictionaryQueryEntries[0].topics
140
- expect(ethBlock19217804.logs[0].topics).toContain('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef');
141
- }, 10000);
142
- // Geth currently throwing errors with this request
143
- it.skip('is able to get transaction with field to is null', async () => {
144
- const dsMap = makeBlockHeightMap(mockDs2);
145
- ethDictionaryV2.updateQueriesMap(dsMap);
146
- const { conditions } = ethDictionaryV2.getQueryConditions(19217803, ethDictionaryV2._metadata.end);
147
- expect(conditions).toEqual({ transactions: [{ to: [null] }] });
148
- const ethBlocks = (await ethDictionaryV2.getData(19217803, ethDictionaryV2._metadata.end, 1));
149
- const { hash, transactions } = ethBlocks.batchBlocks[0].block;
150
- expect(hash).toBe('0xa9ba70126240a8418739a103527860948a2be32de2eb9a8f590591faa174c08b');
151
- // https://etherscan.io/tx/0x57e8cd9483cb5d308151372b0cf33fdc615999283c80ee3c28e94f074dda61f1
152
- expect(transactions.find((tx) => tx.hash ===
153
- '0x57e8cd9483cb5d308151372b0cf33fdc615999283c80ee3c28e94f074dda61f1')).toBeDefined();
154
- });
155
- it('is able to query with not null topics', async () => {
156
- /**
157
- * Dictionary v1 supported filtering logs where a topic was null or not null.
158
- * V2 doesn't yet support this but we should still be able to make a dictionary query that gets relevant logs.
159
- * It will just include events that will be filtered out later.
160
- * */
161
- const ds = {
162
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
163
- assets: new Map(),
164
- options: {
165
- abi: 'erc20',
166
- },
167
- startBlock: 19476187,
168
- mapping: {
169
- file: '',
170
- handlers: [
171
- {
172
- handler: 'handleLog',
173
- kind: types_ethereum_1.EthereumHandlerKind.Event,
174
- filter: {
175
- topics: [
176
- 'Transfer(address, address, uint256)',
177
- undefined,
178
- undefined,
179
- common_ethereum_1.NOT_NULL_FILTER,
180
- ],
181
- },
182
- },
183
- ],
184
- },
185
- };
186
- const dsMap = makeBlockHeightMap([ds]);
187
- ethDictionaryV2.updateQueriesMap(dsMap);
188
- const { conditions } = ethDictionaryV2.getQueryConditions(19476187, ethDictionaryV2._metadata.end);
189
- expect(conditions).toEqual({
190
- logs: [
191
- {
192
- address: [],
193
- topics0: [
194
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
195
- ],
196
- topics3: [],
197
- },
198
- ],
199
- });
200
- const ethBlocks = (await ethDictionaryV2.getData(19476187, ethDictionaryV2._metadata.end, 2));
201
- const { hash, logs } = ethBlocks.batchBlocks[0].block;
202
- expect(hash).toEqual('0xa798861151ed58ad67d80d1cf61dc30e65d003bc958e99a7969a05a67e69e0b2');
203
- const log = logs.find((l) => l.logIndex === 184);
204
- expect(log).toBeDefined();
205
- expect(log.transactionHash).toEqual('0x5491f3f4b7ca6cc81f992a17e19bc9bafff408518c643c5a254de44b5a7b6d72');
206
- // Uncomment this when not null filter supported
207
- // expect(logs.filter(l => !l.topics[3]).length).toEqual(6) // There are 6 events with no topic3
208
- }, 100000);
209
- it('returns a lastBufferedHeight if there are no block results', async () => {
210
- const ds = {
211
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
212
- assets: new Map(),
213
- options: {
214
- abi: 'erc20',
215
- address: '0x30baa3ba9d7089fd8d020a994db75d14cf7ec83b',
216
- },
217
- startBlock: 18723210,
218
- mapping: {
219
- file: '',
220
- handlers: [
221
- {
222
- handler: 'handleLog',
223
- kind: types_ethereum_1.EthereumHandlerKind.Event,
224
- filter: {
225
- topics: ['Transfer(address, address, uint256)'],
226
- },
227
- },
228
- ],
229
- },
230
- };
231
- const dsMap = makeBlockHeightMap([ds]);
232
- ethDictionaryV2.updateQueriesMap(dsMap);
233
- const res = await ethDictionaryV2.getData(18723210, 18733210, 100);
234
- expect(res?.batchBlocks.length).toEqual(0);
235
- expect(res?.lastBufferedHeight).toEqual(18733210);
236
- }, 10_000);
237
- });
238
- describe('buildDictionaryV2QueryEntry', () => {
239
- it('Build filter for !null', () => {
240
- const ds = {
241
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
242
- assets: new Map(),
243
- options: {
244
- abi: 'erc20',
245
- address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
246
- },
247
- startBlock: 1,
248
- mapping: {
249
- file: '',
250
- handlers: [
251
- {
252
- handler: 'handleLog',
253
- kind: types_ethereum_1.EthereumHandlerKind.Event,
254
- filter: {
255
- topics: [
256
- 'Transfer(address, address, uint256)',
257
- undefined,
258
- undefined,
259
- common_ethereum_1.NOT_NULL_FILTER,
260
- ],
261
- },
262
- },
263
- ],
264
- },
265
- };
266
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)([ds]);
267
- expect(result).toEqual({
268
- logs: [
269
- {
270
- address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
271
- topics0: [
272
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
273
- ],
274
- topics3: [],
275
- },
276
- ],
277
- });
278
- });
279
- it('Build filter tx filter', () => {
280
- const ds = {
281
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
282
- assets: new Map(),
283
- options: {
284
- abi: 'erc20',
285
- address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
286
- },
287
- startBlock: 1,
288
- mapping: {
289
- file: '',
290
- handlers: [
291
- {
292
- handler: 'handleTx',
293
- kind: types_ethereum_1.EthereumHandlerKind.Call,
294
- filter: {
295
- function: 'setminimumStakingAmount(uint256 amount)',
296
- },
297
- },
298
- ],
299
- },
300
- };
301
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)([ds]);
302
- expect(result).toEqual({
303
- transactions: [
304
- {
305
- to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
306
- data: ['0x7ef9ea98'],
307
- },
308
- ],
309
- });
310
- });
311
- it('Creates a valid filter with a single event handler that has 0 filters but a contract address', () => {
312
- const ds = {
313
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
314
- assets: new Map(),
315
- options: {
316
- abi: 'erc20',
317
- address: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
318
- },
319
- startBlock: 1,
320
- mapping: {
321
- file: '',
322
- handlers: [
323
- {
324
- handler: 'handleTransfer',
325
- kind: types_ethereum_1.EthereumHandlerKind.Event,
326
- },
327
- {
328
- handler: 'handleTransfer',
329
- kind: types_ethereum_1.EthereumHandlerKind.Call,
330
- },
331
- ],
332
- },
333
- };
334
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)([ds]);
335
- expect(result).toEqual({
336
- transactions: [
337
- {
338
- to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
339
- },
340
- ],
341
- logs: [
342
- {
343
- address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
344
- },
345
- ],
346
- });
347
- });
348
- it('build query entries for multiple ds', () => {
349
- const ds = [
350
- {
351
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
352
- startBlock: 3327417,
353
- options: {
354
- abi: 'EnsRegistry',
355
- address: '0x314159265dd8dbb310642f98f50c066173c1259b',
356
- },
357
- assets: new Map(),
358
- mapping: {
359
- file: './dist/index.js',
360
- handlers: [
361
- // one duplicate one
362
- {
363
- kind: types_ethereum_1.EthereumHandlerKind.Event,
364
- handler: 'handleTransferOldRegistry',
365
- filter: {
366
- topics: ['Transfer(bytes32,address)'],
367
- },
368
- },
369
- {
370
- kind: types_ethereum_1.EthereumHandlerKind.Event,
371
- handler: 'handleTransferOldRegistry',
372
- filter: {
373
- topics: ['Transfer(bytes32,address)'],
374
- },
375
- },
376
- {
377
- kind: types_ethereum_1.EthereumHandlerKind.Event,
378
- handler: 'handleNewOwnerOldRegistry',
379
- filter: {
380
- topics: ['NewOwner(bytes32,bytes32,address)'],
381
- },
382
- },
383
- ],
384
- },
385
- },
386
- {
387
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
388
- startBlock: 3327417,
389
- options: {
390
- abi: 'Resolver',
391
- },
392
- assets: new Map(),
393
- mapping: {
394
- file: './dist/index.js',
395
- handlers: [
396
- {
397
- kind: types_ethereum_1.EthereumHandlerKind.Event,
398
- handler: 'handleABIChanged',
399
- filter: {
400
- topics: ['ABIChanged(bytes32,uint256)'],
401
- },
402
- },
403
- {
404
- kind: types_ethereum_1.EthereumHandlerKind.Event,
405
- handler: 'handleAddrChanged',
406
- filter: {
407
- topics: ['AddrChanged(bytes32,address)'],
408
- },
409
- },
410
- {
411
- kind: types_ethereum_1.EthereumHandlerKind.Event,
412
- handler: 'handleMulticoinAddrChanged',
413
- filter: {
414
- topics: ['AddressChanged(bytes32,uint256,bytes)'],
415
- },
416
- },
417
- {
418
- kind: types_ethereum_1.EthereumHandlerKind.Event,
419
- handler: 'handleAuthorisationChanged',
420
- filter: {
421
- topics: ['AuthorisationChanged(bytes32,address,address,bool)'],
422
- },
423
- },
424
- ],
425
- },
426
- },
427
- ];
428
- const queryEntry = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)(ds);
429
- // Total 7 handlers were given, 1 is duplicate
430
- expect(queryEntry.logs.length).toBe(6);
431
- });
432
- it('should unique QueryEntry for duplicate dataSources', () => {
433
- const ds = {
434
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
435
- assets: new Map(),
436
- options: {
437
- abi: 'erc20',
438
- address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
439
- },
440
- startBlock: 1,
441
- mapping: {
442
- file: '',
443
- handlers: [
444
- {
445
- handler: 'handleLog',
446
- kind: types_ethereum_1.EthereumHandlerKind.Event,
447
- filter: {
448
- topics: ['Transfer(address, address, uint256)'],
449
- },
450
- },
451
- {
452
- handler: 'handleLogSame',
453
- kind: types_ethereum_1.EthereumHandlerKind.Event,
454
- filter: {
455
- topics: ['Transfer(address, address, uint256)'],
456
- },
457
- },
458
- {
459
- handler: 'handleTx',
460
- kind: types_ethereum_1.EthereumHandlerKind.Call,
461
- filter: {
462
- function: 'setminimumStakingAmount(uint256 amount)',
463
- from: 'mockAddress',
464
- },
465
- },
466
- {
467
- handler: 'handleTxSame',
468
- kind: types_ethereum_1.EthereumHandlerKind.Call,
469
- filter: {
470
- function: 'setminimumStakingAmount(uint256 amount)',
471
- from: 'mockAddress',
472
- },
473
- },
474
- ],
475
- },
476
- };
477
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)([ds]);
478
- expect(result).toEqual({
479
- logs: [
480
- {
481
- address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
482
- topics0: [
483
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
484
- ],
485
- },
486
- ],
487
- transactions: [
488
- {
489
- from: ['mockaddress'],
490
- to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
491
- data: ['0x7ef9ea98'],
492
- },
493
- ],
494
- });
495
- });
496
- it('should group a small number of dynamic ds', () => {
497
- const ds = [];
498
- for (let i = 0; i < 10; i++) {
499
- // Bad nodejs types
500
- const tmp = global.structuredClone(templateTs);
501
- (tmp.options.address = `0x${i}`), ds.push(tmp);
502
- }
503
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)(ds);
504
- expect(result).toEqual({
505
- logs: [
506
- {
507
- address: [
508
- '0x0',
509
- '0x1',
510
- '0x2',
511
- '0x3',
512
- '0x4',
513
- '0x5',
514
- '0x6',
515
- '0x7',
516
- '0x8',
517
- '0x9',
518
- ],
519
- topics0: [
520
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
521
- ],
522
- },
523
- ],
524
- });
525
- });
526
- it('should remove address filter with large number of dynamic ds', () => {
527
- const ds = [];
528
- for (let i = 0; i < 200; i++) {
529
- // Bad nodejs types
530
- const tmp = global.structuredClone(templateTs);
531
- (tmp.options.address = `0x${i}`), ds.push(tmp);
532
- }
533
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)(ds);
534
- expect(result).toEqual({
535
- logs: [
536
- {
537
- address: [],
538
- topics0: [
539
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
540
- ],
541
- },
542
- ],
543
- });
544
- });
545
- it('builds a filter when theres a block handler with modulo filter', () => {
546
- const ds = {
547
- kind: types_ethereum_1.EthereumDatasourceKind.Runtime,
548
- assets: new Map(),
549
- options: {
550
- abi: 'erc20',
551
- address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
552
- },
553
- startBlock: 1,
554
- mapping: {
555
- file: '',
556
- handlers: [
557
- {
558
- handler: 'handleBlock',
559
- kind: types_ethereum_1.EthereumHandlerKind.Block,
560
- filter: {
561
- modulo: 100,
562
- },
563
- },
564
- {
565
- handler: 'handleTx',
566
- kind: types_ethereum_1.EthereumHandlerKind.Call,
567
- filter: {
568
- function: 'setminimumStakingAmount(uint256 amount)',
569
- },
570
- },
571
- ],
572
- },
573
- };
574
- const result = (0, ethDictionaryV2_1.buildDictionaryV2QueryEntry)([ds]);
575
- expect(result).toEqual({
576
- transactions: [
577
- {
578
- to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],
579
- data: ['0x7ef9ea98'],
580
- },
581
- ],
582
- });
583
- });
584
- });
585
- //# sourceMappingURL=ethDictionaryV2.spec.js.map