@subql/node-ethereum 4.7.3 → 4.7.4-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.
- package/CHANGELOG.md +3 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/app.module.js +9 -4
- package/dist/app.module.js.map +1 -1
- package/dist/configure/SubqueryProject.d.ts +3 -3
- package/dist/configure/SubqueryProject.js +1 -4
- package/dist/configure/SubqueryProject.js.map +1 -1
- package/dist/ethereum/api.ethereum.d.ts +4 -3
- package/dist/ethereum/api.ethereum.js +18 -5
- package/dist/ethereum/api.ethereum.js.map +1 -1
- package/dist/ethereum/api.ethereum.test.js.map +1 -1
- package/dist/ethereum/api.service.ethereum.d.ts +1 -1
- package/dist/ethereum/api.service.ethereum.js +11 -1
- package/dist/ethereum/api.service.ethereum.js.map +1 -1
- package/dist/ethereum/block.ethereum.d.ts +1 -1
- package/dist/ethereum/block.ethereum.js.map +1 -1
- package/dist/ethereum/ethers/celo/celo-provider.d.ts +54 -54
- package/dist/ethereum/ethers/celo/celo-ws-provider.spec.js.map +1 -1
- package/dist/ethereum/ethers/json-rpc-batch-provider.d.ts +2 -2
- package/dist/ethereum/ethers/json-rpc-batch-provider.js +4 -4
- package/dist/ethereum/ethers/json-rpc-batch-provider.js.map +1 -1
- package/dist/ethereum/ethers/json-rpc-batch-provider.spec.js.map +1 -1
- package/dist/ethereum/ethers/json-rpc-provider.js +3 -3
- package/dist/ethereum/ethers/json-rpc-provider.js.map +1 -1
- package/dist/ethereum/ethers/op/op-provider.d.ts +72 -72
- package/dist/ethereum/ethers/op/op-provider.spec.js +2 -2
- package/dist/ethereum/ethers/op/op-provider.spec.js.map +1 -1
- package/dist/ethereum/ethers/web/geturl.js +17 -14
- package/dist/ethereum/ethers/web/geturl.js.map +1 -1
- package/dist/ethereum/ethers/web/index.d.ts +1 -1
- package/dist/ethereum/ethers/web/index.js +18 -16
- package/dist/ethereum/ethers/web/index.js.map +1 -1
- package/dist/ethereum/ethers/web/types.d.ts +1 -1
- package/dist/ethereum/ethers/web/types.js.map +1 -1
- package/dist/ethereum/utils.ethereum.d.ts +3 -3
- package/dist/ethereum/utils.ethereum.js +1 -1
- package/dist/ethereum/utils.ethereum.js.map +1 -1
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js +1 -1
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
- package/dist/indexer/dictionary/v1/ethDictionaryV1.d.ts +2 -2
- package/dist/indexer/dictionary/v1/ethDictionaryV1.js +3 -1
- package/dist/indexer/dictionary/v1/ethDictionaryV1.js.map +1 -1
- package/dist/indexer/dictionary/v1/ethDictionaryV1.spec.js +1 -1
- package/dist/indexer/dictionary/v1/ethDictionaryV1.spec.js.map +1 -1
- package/dist/indexer/dictionary/v2/ethDictionaryV2.js +11 -6
- package/dist/indexer/dictionary/v2/ethDictionaryV2.js.map +1 -1
- package/dist/indexer/dictionary/v2/ethDictionaryV2.spec.js +2 -1
- package/dist/indexer/dictionary/v2/ethDictionaryV2.spec.js.map +1 -1
- package/dist/indexer/dictionary/v2/types.d.ts +1 -1
- package/dist/indexer/dictionary/v2/types.js.map +1 -1
- package/dist/indexer/dictionary/v2/utils.js +1 -3
- package/dist/indexer/dictionary/v2/utils.js.map +1 -1
- package/dist/indexer/dynamic-ds.service.js.map +1 -1
- package/dist/indexer/fetch.module.js +1 -13
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/indexer/fetch.service.d.ts +2 -2
- package/dist/indexer/fetch.service.js +5 -4
- package/dist/indexer/fetch.service.js.map +1 -1
- package/dist/indexer/indexer.manager.js.map +1 -1
- package/dist/indexer/project.service.test.js.map +1 -1
- package/dist/indexer/unfinalizedBlocks.service.js +3 -0
- package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
- package/dist/indexer/worker/worker-fetch.module.js +1 -14
- package/dist/indexer/worker/worker-fetch.module.js.map +1 -1
- package/dist/indexer/worker/worker.js.map +1 -1
- package/dist/indexer/worker/worker.module.js +1 -0
- package/dist/indexer/worker/worker.module.js.map +1 -1
- package/dist/init.js +1 -9
- package/dist/init.js.map +1 -1
- package/dist/utils/string.d.ts +1 -1
- package/dist/utils/string.js.map +1 -1
- package/package.json +7 -6
- package/dist/admin/admin.module.d.ts +0 -2
- package/dist/admin/admin.module.js +0 -25
- package/dist/admin/admin.module.js.map +0 -1
- package/dist/meta/meta.controller.d.ts +0 -21
- package/dist/meta/meta.controller.js +0 -37
- package/dist/meta/meta.controller.js.map +0 -1
- package/dist/meta/meta.module.d.ts +0 -2
- package/dist/meta/meta.module.js +0 -28
- package/dist/meta/meta.module.js.map +0 -1
- package/dist/meta/meta.service.d.ts +0 -24
- package/dist/meta/meta.service.js +0 -123
- package/dist/meta/meta.service.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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;QACpC,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE;gBACR;oBACE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K,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-2024 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 null,\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('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 'TransferSingle(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 '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62',\n },\n ],\n entity: 'evmLogs',\n },\n {\n conditions: [\n {\n field: 'address',\n matcher: 'equalTo',\n value: 'address1',\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: '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});\n"]}
|
|
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;QACpC,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE;gBACR;oBACE,OAAO,EAAE,eAAe;oBACxB,IAAI,EAAE,oCAAmB,CAAC,KAAK;oBAC/B,MAAM,EAAE;wBACN,MAAM,EAAE;4BACN,6DAA6D;yBAC9D;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AACF,SAAS,mBAAmB,CAC1B,QAAgB,EAChB,EA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AE,OAAO,EAAE,UAAU,EAAE,EAAE;aACvD,CAAC;YAEF,MAAM,WAAW,GAAG,CAAC,EAAE,EAAE,GAAG,oBAAoB,CAAC,CAAC;YAElD,MAAM,UAAU,GAAG,IAAA,+CAA6B,EAAC,WAAW,CAAC,CAAC;YAE9D,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;gBACD;oBACE,UAAU,EAAE;wBACV;4BACE,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,SAAS;4BAClB,KAAK,EAAE,UAAU;yBAClB;wBACD;4BACE,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,SAAS;4BAClB,KAAK,EACH,oEAAoE;yBACvE;qBACF;oBACD,MAAM,EAAE,SAAS;iBAClB;gBACD;oBACE,UAAU,EAAE;wBACV;4BACE,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,SAAS;4BAClB,KAAK,EAAE,UAAU;yBAClB;wBACD;4BACE,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,SAAS;4BAClB,KAAK,EACH,oEAAoE;yBACvE;qBACF;oBACD,MAAM,EAAE,SAAS;iBAClB;gBACD;oBACE,UAAU,EAAE;wBACV;4BACE,KAAK,EAAE,SAAS;4BAChB,OAAO,EAAE,SAAS;4BAClB,KAAK,EAAE,UAAU;yBAClB;wBACD;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-2024 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('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 'TransferSingle(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 '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62',\n },\n ],\n entity: 'evmLogs',\n },\n {\n conditions: [\n {\n field: 'address',\n matcher: 'equalTo',\n value: 'address1',\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: '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});\n"]}
|
|
@@ -17,7 +17,9 @@ function extractOptionAddresses(dsOptions) {
|
|
|
17
17
|
const queryAddressLimit = yargs_1.yargsOptions.argv['query-address-limit'];
|
|
18
18
|
const addressArray = [];
|
|
19
19
|
if (Array.isArray(dsOptions)) {
|
|
20
|
-
const addresses = dsOptions
|
|
20
|
+
const addresses = dsOptions
|
|
21
|
+
.map((option) => option.address)
|
|
22
|
+
.filter((address) => Boolean(address));
|
|
21
23
|
if (addresses.length > queryAddressLimit) {
|
|
22
24
|
logger.debug(`Addresses length: ${addresses.length} is exceeding limit: ${queryAddressLimit}. Consider increasing this value with the flag --query-address-limit `);
|
|
23
25
|
}
|
|
@@ -97,13 +99,13 @@ function eventFilterToDictionaryCondition(filter, dsOptions) {
|
|
|
97
99
|
return logConditions;
|
|
98
100
|
}
|
|
99
101
|
function sanitiseDictionaryConditions(dictionaryConditions) {
|
|
100
|
-
if (!dictionaryConditions.logs
|
|
102
|
+
if (!dictionaryConditions.logs?.length) {
|
|
101
103
|
delete dictionaryConditions.logs;
|
|
102
104
|
}
|
|
103
105
|
else {
|
|
104
106
|
dictionaryConditions.logs = (0, lodash_1.uniqBy)(dictionaryConditions.logs, (log) => JSON.stringify(log));
|
|
105
107
|
}
|
|
106
|
-
if (!dictionaryConditions.transactions
|
|
108
|
+
if (!dictionaryConditions.transactions?.length) {
|
|
107
109
|
delete dictionaryConditions.transactions;
|
|
108
110
|
}
|
|
109
111
|
else {
|
|
@@ -132,6 +134,7 @@ function buildDictionaryV2QueryEntry(dataSources) {
|
|
|
132
134
|
if (filter.from !== undefined ||
|
|
133
135
|
filter.to !== undefined ||
|
|
134
136
|
filter.function !== undefined) {
|
|
137
|
+
dictionaryConditions.transactions ??= [];
|
|
135
138
|
dictionaryConditions.transactions.push(callFilterToDictionaryCondition(filter, ds.options));
|
|
136
139
|
}
|
|
137
140
|
else {
|
|
@@ -141,6 +144,7 @@ function buildDictionaryV2QueryEntry(dataSources) {
|
|
|
141
144
|
}
|
|
142
145
|
case types_ethereum_1.EthereumHandlerKind.Event: {
|
|
143
146
|
const filter = handler.filter;
|
|
147
|
+
dictionaryConditions.logs ??= [];
|
|
144
148
|
if (ds.groupedOptions) {
|
|
145
149
|
dictionaryConditions.logs.push(eventFilterToDictionaryCondition(filter, ds.groupedOptions));
|
|
146
150
|
}
|
|
@@ -188,11 +192,12 @@ class EthDictionaryV2 extends node_core_1.DictionaryV2 {
|
|
|
188
192
|
convertResponseBlocks(data) {
|
|
189
193
|
try {
|
|
190
194
|
const blocks = (data.blocks || []).map((b) => (0, utils_2.rawBlockToEthBlock)(b, this.api));
|
|
195
|
+
if (!blocks.length) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
191
198
|
return {
|
|
192
199
|
batchBlocks: blocks,
|
|
193
|
-
lastBufferedHeight: blocks.length
|
|
194
|
-
? blocks[blocks.length - 1].block.number
|
|
195
|
-
: undefined,
|
|
200
|
+
lastBufferedHeight: blocks[blocks.length - 1].block.number,
|
|
196
201
|
};
|
|
197
202
|
}
|
|
198
203
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethDictionaryV2.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/ethDictionaryV2.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,gDAO0B;AAC1B,0DAO+B;AAC/B,mCAAgC;AAChC,8DAAmE;AAOnE,kDAAwE;AACxE,0CAA8C;AAC9C,oCAAuC;AAQvC,mCAA6C;AAE7C,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,eAAe,CAAC,CAAC;AAE1C,SAAS,sBAAsB,CAC7B,SAA0E;IAE1E,MAAM,iBAAiB,GAAG,oBAAY,CAAC,IAAI,CAAC,qBA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MAAM,GAA4B,CACrC,IAAI,CAAC,MAAwB,IAAI,EAAE,CACrC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,0BAAkB,EAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9C,OAAO;gBACL,WAAW,EAAE,MAAM;gBACnB,kBAAkB,EAAE,MAAM,CAAC,MAAM;oBAC/B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM;oBACxC,CAAC,CAAC,SAAS;aACd,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,kCAAkC,CAAC,CAAC;YACpD,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AAnED,0CAmEC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport {\n NodeConfig,\n DictionaryV2,\n RawDictionaryResponseData,\n DictionaryResponse,\n getLogger,\n IBlock,\n} from '@subql/node-core';\nimport {\n EthereumBlock,\n EthereumHandlerKind,\n EthereumLogFilter,\n EthereumTransactionFilter,\n SubqlDatasource,\n SubqlEthereumProcessorOptions,\n} from '@subql/types-ethereum';\nimport { uniqBy } from 'lodash';\nimport { EthereumNodeConfig } from '../../../configure/NodeConfig';\nimport {\n EthereumProjectDs,\n EthereumProjectDsTemplate,\n SubqueryProject,\n} from '../../../configure/SubqueryProject';\nimport { EthereumApi } from '../../../ethereum';\nimport { eventToTopic, functionToSighash } from '../../../utils/string';\nimport { yargsOptions } from '../../../yargs';\nimport { ethFilterDs } from '../utils';\nimport { GroupedEthereumProjectDs } from '../v1';\nimport {\n RawEthBlock,\n EthDictionaryV2QueryEntry,\n EthDictionaryTxConditions,\n EthDictionaryLogConditions,\n} from './types';\nimport { rawBlockToEthBlock } from './utils';\n\nconst MIN_FETCH_LIMIT = 200;\n\nconst logger = getLogger('dictionary-v2');\n\nfunction extractOptionAddresses(\n dsOptions: SubqlEthereumProcessorOptions | SubqlEthereumProcessorOptions[],\n): string[] {\n const queryAddressLimit = yargsOptions.argv['query-address-limit'];\n const addressArray: string[] = [];\n if (Array.isArray(dsOptions)) {\n const addresses = dsOptions.map((option) => option.address).filter(Boolean);\n\n if (addresses.length > queryAddressLimit) {\n logger.debug(\n `Addresses length: ${addresses.length} is exceeding limit: ${queryAddressLimit}. Consider increasing this value with the flag --query-address-limit `,\n );\n }\n if (addresses.length !== 0 && addresses.length <= queryAddressLimit) {\n addressArray.push(...addresses);\n }\n } else {\n if (dsOptions?.address) {\n addressArray.push(dsOptions.address.toLowerCase());\n }\n }\n return addressArray;\n}\n\nfunction callFilterToDictionaryCondition(\n filter: EthereumTransactionFilter,\n dsOptions: SubqlEthereumProcessorOptions,\n): EthDictionaryTxConditions {\n const txConditions: EthDictionaryTxConditions = {};\n const toArray = [];\n const fromArray = [];\n const funcArray = [];\n\n if (filter.from) {\n fromArray.push(filter.from.toLowerCase());\n }\n\n const assignTo = (value: string | null | undefined) => {\n if (value === null) {\n toArray.push(null);\n } else if (value !== undefined) {\n toArray.push(value.toLowerCase());\n }\n };\n\n const optionsAddresses = extractOptionAddresses(dsOptions);\n if (!optionsAddresses.length) {\n assignTo(filter.to);\n } else {\n if (filter.to || filter.to === null) {\n logger.warn(\n `TransactionFilter 'to' conflicts with 'address' in data source options, using data source option`,\n );\n }\n optionsAddresses.forEach(assignTo);\n }\n\n if (filter.function) {\n funcArray.push(functionToSighash(filter.function));\n }\n\n if (toArray.length !== 0) {\n txConditions.to = toArray;\n }\n if (fromArray.length !== 0) {\n txConditions.from = fromArray;\n }\n\n if (funcArray.length !== 0) {\n txConditions.data = funcArray;\n }\n\n return txConditions;\n}\n\nfunction eventFilterToDictionaryCondition(\n filter: EthereumLogFilter,\n dsOptions: SubqlEthereumProcessorOptions | SubqlEthereumProcessorOptions[],\n): EthDictionaryLogConditions {\n const logConditions: EthDictionaryLogConditions = {};\n logConditions.address = extractOptionAddresses(dsOptions);\n if (filter.topics) {\n for (let i = 0; i < Math.min(filter.topics.length, 4); i++) {\n const topic = filter.topics[i];\n if (!topic) {\n continue;\n }\n const field = `topics${i}`;\n // Initialized\n if (!logConditions[field]) {\n logConditions[field] = [];\n }\n if (topic === '!null') {\n logConditions[field] = []; // TODO, check if !null\n } else {\n logConditions[field].push(eventToTopic(topic));\n }\n }\n }\n return logConditions;\n}\n\nfunction sanitiseDictionaryConditions(\n dictionaryConditions: EthDictionaryV2QueryEntry,\n): EthDictionaryV2QueryEntry {\n if (!dictionaryConditions.logs.length) {\n delete dictionaryConditions.logs;\n } else {\n dictionaryConditions.logs = uniqBy(dictionaryConditions.logs, (log) =>\n JSON.stringify(log),\n );\n }\n\n if (!dictionaryConditions.transactions.length) {\n delete dictionaryConditions.transactions;\n } else {\n dictionaryConditions.transactions = uniqBy(\n dictionaryConditions.transactions,\n (tx) => JSON.stringify(tx),\n );\n }\n\n return dictionaryConditions;\n}\n\nexport function buildDictionaryV2QueryEntry(\n dataSources: GroupedEthereumProjectDs[],\n): EthDictionaryV2QueryEntry {\n const dictionaryConditions: EthDictionaryV2QueryEntry = {\n logs: [],\n transactions: [],\n };\n\n for (const ds of dataSources) {\n for (const handler of ds.mapping.handlers) {\n // No filters, cant use dictionary\n if (!handler.filter) return {};\n\n switch (handler.kind) {\n case EthereumHandlerKind.Block:\n if (handler.filter.modulo === undefined) {\n return {};\n }\n break;\n case EthereumHandlerKind.Call: {\n const filter = handler.filter as EthereumTransactionFilter;\n if (\n filter.from !== undefined ||\n filter.to !== undefined ||\n filter.function !== undefined\n ) {\n dictionaryConditions.transactions.push(\n callFilterToDictionaryCondition(filter, ds.options),\n );\n } else {\n // do nothing;\n }\n break;\n }\n case EthereumHandlerKind.Event: {\n const filter = handler.filter as EthereumLogFilter;\n if (ds.groupedOptions) {\n dictionaryConditions.logs.push(\n eventFilterToDictionaryCondition(filter, ds.groupedOptions),\n );\n } else if (ds.options?.address || filter.topics) {\n dictionaryConditions.logs.push(\n eventFilterToDictionaryCondition(filter, ds.options),\n );\n } else {\n // do nothing;\n }\n break;\n }\n default:\n }\n }\n }\n\n return sanitiseDictionaryConditions(dictionaryConditions);\n}\n\nexport class EthDictionaryV2 extends DictionaryV2<\n EthereumBlock,\n SubqlDatasource,\n EthDictionaryV2QueryEntry\n> {\n #skipTransactions: boolean;\n\n constructor(\n endpoint: string,\n nodeConfig: NodeConfig,\n project: SubqueryProject,\n private api: EthereumApi,\n ) {\n super(endpoint, project.network.chainId, nodeConfig);\n this.#skipTransactions = !!new EthereumNodeConfig(nodeConfig)\n .skipTransactions;\n }\n\n static async create(\n endpoint: string,\n nodeConfig: NodeConfig,\n project: SubqueryProject,\n api: EthereumApi,\n ): Promise<EthDictionaryV2> {\n const dictionary = new EthDictionaryV2(endpoint, nodeConfig, project, api);\n await dictionary.init();\n return dictionary;\n }\n\n buildDictionaryQueryEntries(\n dataSources: (EthereumProjectDs | EthereumProjectDsTemplate)[],\n ): EthDictionaryV2QueryEntry {\n const filteredDs = ethFilterDs(dataSources);\n return buildDictionaryV2QueryEntry(filteredDs);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async getData(\n startBlock: number,\n endBlock: number,\n limit: number = MIN_FETCH_LIMIT,\n ): Promise<DictionaryResponse<IBlock<EthereumBlock> | number> | undefined> {\n return super.getData(startBlock, endBlock, limit, {\n blockHeader: true,\n logs: { transaction: !this.#skipTransactions },\n transactions: { log: true },\n });\n }\n\n convertResponseBlocks<RFB = RawEthBlock>(\n data: RawDictionaryResponseData<RFB>,\n ): DictionaryResponse<IBlock<EthereumBlock>> | undefined {\n try {\n const blocks: IBlock<EthereumBlock>[] = (\n (data.blocks as RawEthBlock[]) || []\n ).map((b) => rawBlockToEthBlock(b, this.api));\n return {\n batchBlocks: blocks,\n lastBufferedHeight: blocks.length\n ? blocks[blocks.length - 1].block.number\n : undefined,\n };\n } catch (e) {\n logger.error(e, `Failed to handle block response}`);\n throw e;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ethDictionaryV2.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/ethDictionaryV2.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,gDAO0B;AAC1B,0DAO+B;AAC/B,mCAAgC;AAChC,8DAAmE;AAOnE,kDAAwE;AACxE,0CAA8C;AAC9C,oCAAuC;AAQvC,mCAA6C;AAE7C,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,eAAe,CAAC,CAAC;AAE1C,SAAS,sBAAsB,CAC7B,SAA2E;IAE3E,MAAM,iBAAiB,GAAG,oBAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnE,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC5B,MAAM,SAAS,GAAG,SAAS;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;aAC/B,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAE5D,IAAI,SAAS,CAAC,MAAM,GAAG,iBAAiB,EAAE;YACxC,MAAM,CAAC,KAAK,CACV,qBAAqB,SAAS,CAAC,MAAM,wBAAwB,iBAAiB,wEAAwE,CACvJ,CAAC;SACH;QACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,MAAM,IAAI,iBAAiB,EAAE;YACnE,YAAY,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;SACjC;KACF;SAAM;QACL,IAAI,SAAS,EAAE,OAAO,EAAE;YACtB,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;SACpD;KACF;IACD,OAAO,YAAY,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ifier: GPL-3.0\n\nimport {\n NodeConfig,\n DictionaryV2,\n RawDictionaryResponseData,\n DictionaryResponse,\n getLogger,\n IBlock,\n} from '@subql/node-core';\nimport {\n EthereumBlock,\n EthereumHandlerKind,\n EthereumLogFilter,\n EthereumTransactionFilter,\n SubqlDatasource,\n SubqlEthereumProcessorOptions,\n} from '@subql/types-ethereum';\nimport { uniqBy } from 'lodash';\nimport { EthereumNodeConfig } from '../../../configure/NodeConfig';\nimport {\n EthereumProjectDs,\n EthereumProjectDsTemplate,\n SubqueryProject,\n} from '../../../configure/SubqueryProject';\nimport { EthereumApi } from '../../../ethereum';\nimport { eventToTopic, functionToSighash } from '../../../utils/string';\nimport { yargsOptions } from '../../../yargs';\nimport { ethFilterDs } from '../utils';\nimport { GroupedEthereumProjectDs } from '../v1';\nimport {\n RawEthBlock,\n EthDictionaryV2QueryEntry,\n EthDictionaryTxConditions,\n EthDictionaryLogConditions,\n} from './types';\nimport { rawBlockToEthBlock } from './utils';\n\nconst MIN_FETCH_LIMIT = 200;\n\nconst logger = getLogger('dictionary-v2');\n\nfunction extractOptionAddresses(\n dsOptions?: SubqlEthereumProcessorOptions | SubqlEthereumProcessorOptions[],\n): string[] {\n const queryAddressLimit = yargsOptions.argv['query-address-limit'];\n const addressArray: string[] = [];\n if (Array.isArray(dsOptions)) {\n const addresses = dsOptions\n .map((option) => option.address)\n .filter((address): address is string => Boolean(address));\n\n if (addresses.length > queryAddressLimit) {\n logger.debug(\n `Addresses length: ${addresses.length} is exceeding limit: ${queryAddressLimit}. Consider increasing this value with the flag --query-address-limit `,\n );\n }\n if (addresses.length !== 0 && addresses.length <= queryAddressLimit) {\n addressArray.push(...addresses);\n }\n } else {\n if (dsOptions?.address) {\n addressArray.push(dsOptions.address.toLowerCase());\n }\n }\n return addressArray;\n}\n\nfunction callFilterToDictionaryCondition(\n filter: EthereumTransactionFilter,\n dsOptions?: SubqlEthereumProcessorOptions,\n): EthDictionaryTxConditions {\n const txConditions: EthDictionaryTxConditions = {};\n const toArray: (string | null)[] = [];\n const fromArray: string[] = [];\n const funcArray: string[] = [];\n\n if (filter.from) {\n fromArray.push(filter.from.toLowerCase());\n }\n\n const assignTo = (value: string | null | undefined) => {\n if (value === null) {\n toArray.push(null);\n } else if (value !== undefined) {\n toArray.push(value.toLowerCase());\n }\n };\n\n const optionsAddresses = extractOptionAddresses(dsOptions);\n if (!optionsAddresses.length) {\n assignTo(filter.to);\n } else {\n if (filter.to || filter.to === null) {\n logger.warn(\n `TransactionFilter 'to' conflicts with 'address' in data source options, using data source option`,\n );\n }\n optionsAddresses.forEach(assignTo);\n }\n\n if (filter.function) {\n funcArray.push(functionToSighash(filter.function));\n }\n\n if (toArray.length !== 0) {\n txConditions.to = toArray;\n }\n if (fromArray.length !== 0) {\n txConditions.from = fromArray;\n }\n\n if (funcArray.length !== 0) {\n txConditions.data = funcArray;\n }\n\n return txConditions;\n}\n\nfunction eventFilterToDictionaryCondition(\n filter: EthereumLogFilter,\n dsOptions?: SubqlEthereumProcessorOptions | SubqlEthereumProcessorOptions[],\n): EthDictionaryLogConditions {\n const logConditions: EthDictionaryLogConditions = {};\n logConditions.address = extractOptionAddresses(dsOptions);\n if (filter.topics) {\n for (let i = 0; i < Math.min(filter.topics.length, 4); i++) {\n const topic = filter.topics[i];\n if (!topic) {\n continue;\n }\n const field = `topics${i}`;\n // Initialized\n if (!logConditions[field]) {\n logConditions[field] = [];\n }\n if (topic === '!null') {\n logConditions[field] = []; // TODO, check if !null\n } else {\n logConditions[field].push(eventToTopic(topic));\n }\n }\n }\n return logConditions;\n}\n\nfunction sanitiseDictionaryConditions(\n dictionaryConditions: EthDictionaryV2QueryEntry,\n): EthDictionaryV2QueryEntry {\n if (!dictionaryConditions.logs?.length) {\n delete dictionaryConditions.logs;\n } else {\n dictionaryConditions.logs = uniqBy(dictionaryConditions.logs, (log) =>\n JSON.stringify(log),\n );\n }\n\n if (!dictionaryConditions.transactions?.length) {\n delete dictionaryConditions.transactions;\n } else {\n dictionaryConditions.transactions = uniqBy(\n dictionaryConditions.transactions,\n (tx) => JSON.stringify(tx),\n );\n }\n\n return dictionaryConditions;\n}\n\nexport function buildDictionaryV2QueryEntry(\n dataSources: GroupedEthereumProjectDs[],\n): EthDictionaryV2QueryEntry {\n const dictionaryConditions: EthDictionaryV2QueryEntry = {\n logs: [],\n transactions: [],\n };\n\n for (const ds of dataSources) {\n for (const handler of ds.mapping.handlers) {\n // No filters, cant use dictionary\n if (!handler.filter) return {};\n\n switch (handler.kind) {\n case EthereumHandlerKind.Block:\n if (handler.filter.modulo === undefined) {\n return {};\n }\n break;\n case EthereumHandlerKind.Call: {\n const filter = handler.filter as EthereumTransactionFilter;\n if (\n filter.from !== undefined ||\n filter.to !== undefined ||\n filter.function !== undefined\n ) {\n dictionaryConditions.transactions ??= [];\n dictionaryConditions.transactions.push(\n callFilterToDictionaryCondition(filter, ds.options),\n );\n } else {\n // do nothing;\n }\n break;\n }\n case EthereumHandlerKind.Event: {\n const filter = handler.filter as EthereumLogFilter;\n dictionaryConditions.logs ??= [];\n if (ds.groupedOptions) {\n dictionaryConditions.logs.push(\n eventFilterToDictionaryCondition(filter, ds.groupedOptions),\n );\n } else if (ds.options?.address || filter.topics) {\n dictionaryConditions.logs.push(\n eventFilterToDictionaryCondition(filter, ds.options),\n );\n } else {\n // do nothing;\n }\n break;\n }\n default:\n }\n }\n }\n\n return sanitiseDictionaryConditions(dictionaryConditions);\n}\n\nexport class EthDictionaryV2 extends DictionaryV2<\n EthereumBlock,\n SubqlDatasource,\n EthDictionaryV2QueryEntry\n> {\n #skipTransactions: boolean;\n\n constructor(\n endpoint: string,\n nodeConfig: NodeConfig,\n project: SubqueryProject,\n private api: EthereumApi,\n ) {\n super(endpoint, project.network.chainId, nodeConfig);\n this.#skipTransactions = !!new EthereumNodeConfig(nodeConfig)\n .skipTransactions;\n }\n\n static async create(\n endpoint: string,\n nodeConfig: NodeConfig,\n project: SubqueryProject,\n api: EthereumApi,\n ): Promise<EthDictionaryV2> {\n const dictionary = new EthDictionaryV2(endpoint, nodeConfig, project, api);\n await dictionary.init();\n return dictionary;\n }\n\n buildDictionaryQueryEntries(\n dataSources: (EthereumProjectDs | EthereumProjectDsTemplate)[],\n ): EthDictionaryV2QueryEntry {\n const filteredDs = ethFilterDs(dataSources);\n return buildDictionaryV2QueryEntry(filteredDs);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async getData(\n startBlock: number,\n endBlock: number,\n limit: number = MIN_FETCH_LIMIT,\n ): Promise<DictionaryResponse<IBlock<EthereumBlock> | number> | undefined> {\n return super.getData(startBlock, endBlock, limit, {\n blockHeader: true,\n logs: { transaction: !this.#skipTransactions },\n transactions: { log: true },\n });\n }\n\n convertResponseBlocks<RFB = RawEthBlock>(\n data: RawDictionaryResponseData<RFB>,\n ): DictionaryResponse<IBlock<EthereumBlock>> | undefined {\n try {\n const blocks: IBlock<EthereumBlock>[] = (\n (data.blocks as RawEthBlock[]) || []\n ).map((b) => rawBlockToEthBlock(b, this.api));\n\n if (!blocks.length) {\n return undefined;\n }\n return {\n batchBlocks: blocks,\n lastBufferedHeight: blocks[blocks.length - 1].block.number,\n };\n } catch (e: any) {\n logger.error(e, `Failed to handle block response}`);\n throw e;\n }\n }\n}\n"]}
|
|
@@ -81,6 +81,7 @@ const mockDs2 = [
|
|
|
81
81
|
},
|
|
82
82
|
],
|
|
83
83
|
},
|
|
84
|
+
processor: { file: '' },
|
|
84
85
|
},
|
|
85
86
|
];
|
|
86
87
|
const nodeConfig = new node_core_1.NodeConfig({
|
|
@@ -93,7 +94,7 @@ const nodeConfig = new node_core_1.NodeConfig({
|
|
|
93
94
|
function makeBlockHeightMap(mockDs) {
|
|
94
95
|
const m = new Map();
|
|
95
96
|
mockDs.forEach((ds, index, dataSources) => {
|
|
96
|
-
m.set(ds.startBlock, dataSources.slice(0, index + 1));
|
|
97
|
+
m.set(ds.startBlock || 1, dataSources.slice(0, index + 1));
|
|
97
98
|
});
|
|
98
99
|
return new node_core_1.BlockHeightMap(m);
|
|
99
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethDictionaryV2.spec.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/ethDictionaryV2.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;AAEnC,gDAK0B;AAC1B,0DAM+B;AAC/B,kEAA0C;AAM1C,gDAAgD;AAChD,oCAAuC;AACvC,uDAG2B;AAE3B,MAAM,kBAAkB,GAAG,+CAA+C,CAAC;AAC3E,MAAM,aAAa,GAAG,8CAA8C,CAAC;AACrE,MAAM,MAAM,GAAwB;IAClC;QACE,IAAI,EAAE,uCAAsB,CAAC,OAAO;QACpC,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE;gBACR;oBACE,OAAO,EAAE,mBAAmB;oBAC5B,IAAI,EAAE,oCAAmB,CAAC,IAAI;oBAC9B,MAAM,EAAE;wBACN,QAAQ,EAAE,6CAA6C;qBACxD;iBACF;gBACD;oBACE,OAAO,EAAE,WAAW;oBACpB,IAAI,EAAE,oCAAmB,CAAC,KAAK;oBAC/B,MAAM,EAAE;wBACN,MAAM,EAAE;4BACN,oEAAoE;yBACrE;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,UAAU,GAA8B;IAC5C,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,uCAAsB,CAAC,OAAO;IACpC,MAAM,EAAE,IAAI,GAAG,EAAE;IACjB,OAAO,EAAE;QACP,GAAG,EAAE,OAAO;QACZ,yDAAyD;KAC1D;IACD,iBAAiB;IACjB,OAAO,EAAE;QACP,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE;YACR;gBACE,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,oCAAmB,CAAC,KAAK;gBAC/B,MAAM,EAAE;oBACN,MAAM,EAAE,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MAAM,GAAG,IAAA,6CAA2B,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,YAAY,EAAE;gBACZ;oBACE,EAAE,EAAE,CAAC,4CAA4C,CAAC;oBAClD,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport {\n BlockHeightMap,\n DictionaryResponse,\n IBlock,\n NodeConfig,\n} from '@subql/node-core';\nimport {\n EthereumBlock,\n EthereumDatasourceKind,\n EthereumHandlerKind,\n SubqlDatasource,\n SubqlRuntimeDatasource,\n} from '@subql/types-ethereum';\nimport EventEmitter2 from 'eventemitter2';\nimport {\n EthereumProjectDs,\n EthereumProjectDsTemplate,\n SubqueryProject,\n} from '../../../configure/SubqueryProject';\nimport { EthereumApi } from '../../../ethereum';\nimport { ethFilterDs } from '../utils';\nimport {\n buildDictionaryV2QueryEntry,\n EthDictionaryV2,\n} from './ethDictionaryV2';\n\nconst DEFAULT_DICTIONARY = 'https://ethereum.node.subquery.network/public';\nconst HTTP_ENDPOINT = 'https://ethereum.rpc.subquery.network/public';\nconst mockDs: EthereumProjectDs[] = [\n {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 19217803,\n mapping: {\n file: './dist/index.js',\n handlers: [\n {\n handler: 'handleTransaction',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n {\n handler: 'handleLog',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: [\n 'Transfer(address indexed from, address indexed to, uint256 amount)',\n ],\n },\n },\n ],\n },\n },\n];\n\nconst templateTs: EthereumProjectDsTemplate = {\n name: 'template',\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: ['Transfer(address, address, uint256)'],\n },\n },\n ],\n },\n};\n\n// tx to is null\nconst mockDs2: EthereumProjectDs[] = [\n {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 19217803,\n mapping: {\n file: './dist/index.js',\n handlers: [\n {\n handler: 'handleTransaction',\n kind: EthereumHandlerKind.Call,\n filter: {\n to: null,\n },\n },\n ],\n },\n },\n];\n\nconst nodeConfig = new NodeConfig({\n subquery: 'eth-starter',\n subqueryName: 'eth-starter',\n dictionaryTimeout: 10,\n networkEndpoint: [HTTP_ENDPOINT],\n networkDictionary: [DEFAULT_DICTIONARY],\n});\n\nfunction makeBlockHeightMap(mockDs: SubqlDatasource[]): BlockHeightMap<any> {\n const m = new Map<number, any>();\n mockDs.forEach((ds, index, dataSources) => {\n m.set(ds.startBlock, dataSources.slice(0, index + 1));\n });\n return new BlockHeightMap(m);\n}\n\n// enable this once dictionary v2 is online\ndescribe('eth dictionary v2', () => {\n let ethDictionaryV2: EthDictionaryV2;\n\n const dsMap = makeBlockHeightMap(mockDs);\n\n beforeAll(async () => {\n ethDictionaryV2 = await EthDictionaryV2.create(\n DEFAULT_DICTIONARY,\n nodeConfig,\n { network: { chainId: '1' } } as SubqueryProject,\n new EthereumApi(HTTP_ENDPOINT, 1, new EventEmitter2()),\n );\n }, 10000);\n\n beforeEach(() => {\n ethDictionaryV2.updateQueriesMap(dsMap);\n });\n\n it('converts ds to v2 dictionary queries', () => {\n const query = (ethDictionaryV2 as any).queriesMap.get(19217803);\n expect(query.logs.length).toBe(1);\n expect(query.transactions.length).toBe(1);\n });\n\n it('query response match with entries', async () => {\n const ethBlocks = (await ethDictionaryV2.getData(\n 19217803,\n (ethDictionaryV2 as any)._metadata.end,\n 2,\n )) as DictionaryResponse<IBlock<EthereumBlock>>;\n\n expect(ethBlocks.batchBlocks.map((b) => b.block.number)).toStrictEqual([\n 19217803, 19217804,\n ]);\n\n const ethBlock19217803 = ethBlocks.batchBlocks[0].block;\n const ethBlock19217804 = ethBlocks.batchBlocks[1].block;\n\n expect(ethBlock19217803.number).toBe(19217803);\n expect(ethBlock19217804.number).toBe(19217804);\n\n // Sighash of approval tx\n expect(\n ethBlock19217803.transactions.filter(\n (tx) => tx.input.indexOf('0x095ea7b3') === 0,\n ).length,\n ).toBe(4);\n\n expect(ethBlock19217804.logs.length).toBe(233);\n\n // This matches with dictionaryQueryEntries[0].topics\n expect(ethBlock19217804.logs[0].topics).toContain(\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n );\n }, 10000);\n\n // Geth currently throwing errors with this request\n it.skip('is able to get transaction with field to is null', async () => {\n const dsMap = makeBlockHeightMap(mockDs2);\n ethDictionaryV2.updateQueriesMap(dsMap);\n\n const { conditions } = (ethDictionaryV2 as any).getQueryConditions(\n 19217803,\n (ethDictionaryV2 as any)._metadata.end,\n );\n\n expect(conditions).toEqual({ transactions: [{ to: [null] }] });\n\n const ethBlocks = (await ethDictionaryV2.getData(\n 19217803,\n (ethDictionaryV2 as any)._metadata.end,\n 1,\n )) as DictionaryResponse<IBlock<EthereumBlock>>;\n\n const { hash, transactions } = ethBlocks.batchBlocks[0].block;\n\n expect(hash).toBe(\n '0xa9ba70126240a8418739a103527860948a2be32de2eb9a8f590591faa174c08b',\n );\n\n // https://etherscan.io/tx/0x57e8cd9483cb5d308151372b0cf33fdc615999283c80ee3c28e94f074dda61f1\n expect(\n transactions.find(\n (tx) =>\n tx.hash ===\n '0x57e8cd9483cb5d308151372b0cf33fdc615999283c80ee3c28e94f074dda61f1',\n ),\n ).toBeDefined();\n });\n\n it('is able to query with not null topics', async () => {\n /**\n * Dictionary v1 supported filtering logs where a topic was null or not null.\n * V2 doesn't yet support this but we should still be able to make a dictionary query that gets relevant logs.\n * It will just include events that will be filtered out later.\n * */\n\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n },\n startBlock: 19476187,\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\n const dsMap = makeBlockHeightMap([ds]);\n ethDictionaryV2.updateQueriesMap(dsMap);\n\n const { conditions } = (ethDictionaryV2 as any).getQueryConditions(\n 19476187,\n (ethDictionaryV2 as any)._metadata.end,\n );\n\n expect(conditions).toEqual({\n logs: [\n {\n address: [],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n topics3: [],\n },\n ],\n });\n\n const ethBlocks = (await ethDictionaryV2.getData(\n 19476187,\n (ethDictionaryV2 as any)._metadata.end,\n 2,\n )) as DictionaryResponse<IBlock<EthereumBlock>>;\n\n const { hash, logs } = ethBlocks.batchBlocks[0].block;\n\n expect(hash).toEqual(\n '0xa798861151ed58ad67d80d1cf61dc30e65d003bc958e99a7969a05a67e69e0b2',\n );\n\n const log = logs.find((l) => l.logIndex === 184);\n expect(log).toBeDefined();\n expect(log.transactionHash).toEqual(\n '0x5491f3f4b7ca6cc81f992a17e19bc9bafff408518c643c5a254de44b5a7b6d72',\n );\n\n // Uncomment this when not null filter supported\n // expect(logs.filter(l => !l.topics[3]).length).toEqual(6) // There are 6 events with no topic3\n }, 100000);\n});\n\ndescribe('buildDictionaryV2QueryEntry', () => {\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 = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n logs: [\n {\n address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n topics3: [],\n },\n ],\n });\n });\n\n it('Build filter tx filter', () => {\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: 'handleTx',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n },\n },\n ],\n },\n };\n const result = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n transactions: [\n {\n to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n data: ['0x7ef9ea98'],\n },\n ],\n });\n });\n\n it('build query entries for multiple ds', () => {\n const ds: SubqlRuntimeDatasource[] = [\n {\n kind: EthereumDatasourceKind.Runtime,\n startBlock: 3327417,\n options: {\n abi: 'EnsRegistry',\n address: '0x314159265dd8dbb310642f98f50c066173c1259b',\n },\n assets: new Map(),\n mapping: {\n file: './dist/index.js',\n handlers: [\n // one duplicate one\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleTransferOldRegistry',\n filter: {\n topics: ['Transfer(bytes32,address)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleTransferOldRegistry',\n filter: {\n topics: ['Transfer(bytes32,address)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleNewOwnerOldRegistry',\n filter: {\n topics: ['NewOwner(bytes32,bytes32,address)'],\n },\n },\n ],\n },\n },\n {\n kind: EthereumDatasourceKind.Runtime,\n startBlock: 3327417,\n options: {\n abi: 'Resolver',\n },\n assets: new Map(),\n mapping: {\n file: './dist/index.js',\n handlers: [\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleABIChanged',\n filter: {\n topics: ['ABIChanged(bytes32,uint256)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleAddrChanged',\n filter: {\n topics: ['AddrChanged(bytes32,address)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleMulticoinAddrChanged',\n filter: {\n topics: ['AddressChanged(bytes32,uint256,bytes)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleAuthorisationChanged',\n filter: {\n topics: ['AuthorisationChanged(bytes32,address,address,bool)'],\n },\n },\n ],\n },\n },\n ];\n\n const queryEntry = buildDictionaryV2QueryEntry(ds);\n // Total 7 handlers were given, 1 is duplicate\n expect(queryEntry.logs.length).toBe(6);\n });\n\n it('should unique QueryEntry for duplicate dataSources', () => {\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: ['Transfer(address, address, uint256)'],\n },\n },\n {\n handler: 'handleLogSame',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: ['Transfer(address, address, uint256)'],\n },\n },\n {\n handler: 'handleTx',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n from: 'mockAddress',\n },\n },\n {\n handler: 'handleTxSame',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n from: 'mockAddress',\n },\n },\n ],\n },\n };\n const result = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n logs: [\n {\n address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n },\n ],\n transactions: [\n {\n from: ['mockaddress'],\n to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n data: ['0x7ef9ea98'],\n },\n ],\n });\n });\n\n it('should group a small number of dynamic ds', () => {\n const ds: SubqlRuntimeDatasource[] = [];\n\n for (let i = 0; i < 10; i++) {\n // Bad nodejs types\n const tmp = (global as any).structuredClone(templateTs);\n (tmp.options.address = `0x${i}`), ds.push(tmp);\n }\n\n const result = buildDictionaryV2QueryEntry(ethFilterDs(ds));\n\n expect(result).toEqual({\n logs: [\n {\n address: [\n '0x0',\n '0x1',\n '0x2',\n '0x3',\n '0x4',\n '0x5',\n '0x6',\n '0x7',\n '0x8',\n '0x9',\n ],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n },\n ],\n });\n });\n\n it('should remove address filter with large number of dynamic ds', () => {\n const ds: SubqlRuntimeDatasource[] = [];\n\n for (let i = 0; i < 200; i++) {\n // Bad nodejs types\n const tmp = (global as any).structuredClone(templateTs);\n (tmp.options.address = `0x${i}`), ds.push(tmp);\n }\n\n const result = buildDictionaryV2QueryEntry(ethFilterDs(ds));\n\n expect(result).toEqual({\n logs: [\n {\n address: [],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\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 address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleBlock',\n kind: EthereumHandlerKind.Block,\n filter: {\n modulo: 100,\n },\n },\n {\n handler: 'handleTx',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n },\n },\n ],\n },\n };\n const result = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n transactions: [\n {\n to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n data: ['0x7ef9ea98'],\n },\n ],\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"ethDictionaryV2.spec.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/ethDictionaryV2.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;AAEnC,gDAK0B;AAC1B,0DAM+B;AAC/B,kEAA0C;AAM1C,gDAAgD;AAChD,oCAAuC;AACvC,uDAG2B;AAE3B,MAAM,kBAAkB,GAAG,+CAA+C,CAAC;AAC3E,MAAM,aAAa,GAAG,8CAA8C,CAAC;AACrE,MAAM,MAAM,GAAwB;IAClC;QACE,IAAI,EAAE,uCAAsB,CAAC,OAAO;QACpC,MAAM,EAAE,IAAI,GAAG,EAAE;QACjB,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE;gBACR;oBACE,OAAO,EAAE,mBAAmB;oBAC5B,IAAI,EAAE,oCAAmB,CAAC,IAAI;oBAC9B,MAAM,EAAE;wBACN,QAAQ,EAAE,6CAA6C;qBACxD;iBACF;gBACD;oBACE,OAAO,EAAE,WAAW;oBACpB,IAAI,EAAE,oCAAmB,CAAC,KAAK;oBAC/B,MAAM,EAAE;wBACN,MAAM,EAAE;4BACN,oEAAoE;yBACrE;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,UAAU,GAA8B;IAC5C,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,uCAAsB,CAAC,OAAO;IACpC,MAAM,EAAE,IAAI,GAAG,EAAE;IACjB,OAAO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E;oBACR;wBACE,OAAO,EAAE,aAAa;wBACtB,IAAI,EAAE,oCAAmB,CAAC,KAAK;wBAC/B,MAAM,EAAE;4BACN,MAAM,EAAE,GAAG;yBACZ;qBACF;oBACD;wBACE,OAAO,EAAE,UAAU;wBACnB,IAAI,EAAE,oCAAmB,CAAC,IAAI;wBAC9B,MAAM,EAAE;4BACN,QAAQ,EAAE,yCAAyC;yBACpD;qBACF;iBACF;aACF;SACF,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,6CAA2B,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,YAAY,EAAE;gBACZ;oBACE,EAAE,EAAE,CAAC,4CAA4C,CAAC;oBAClD,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport {\n BlockHeightMap,\n DictionaryResponse,\n IBlock,\n NodeConfig,\n} from '@subql/node-core';\nimport {\n EthereumBlock,\n EthereumDatasourceKind,\n EthereumHandlerKind,\n SubqlDatasource,\n SubqlRuntimeDatasource,\n} from '@subql/types-ethereum';\nimport EventEmitter2 from 'eventemitter2';\nimport {\n EthereumProjectDs,\n EthereumProjectDsTemplate,\n SubqueryProject,\n} from '../../../configure/SubqueryProject';\nimport { EthereumApi } from '../../../ethereum';\nimport { ethFilterDs } from '../utils';\nimport {\n buildDictionaryV2QueryEntry,\n EthDictionaryV2,\n} from './ethDictionaryV2';\n\nconst DEFAULT_DICTIONARY = 'https://ethereum.node.subquery.network/public';\nconst HTTP_ENDPOINT = 'https://ethereum.rpc.subquery.network/public';\nconst mockDs: EthereumProjectDs[] = [\n {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 19217803,\n mapping: {\n file: './dist/index.js',\n handlers: [\n {\n handler: 'handleTransaction',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'approve(address spender, uint256 rawAmount)',\n },\n },\n {\n handler: 'handleLog',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: [\n 'Transfer(address indexed from, address indexed to, uint256 amount)',\n ],\n },\n },\n ],\n },\n },\n];\n\nconst templateTs: EthereumProjectDsTemplate = {\n name: 'template',\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: ['Transfer(address, address, uint256)'],\n },\n },\n ],\n },\n};\n\n// tx to is null\nconst mockDs2: EthereumProjectDs[] = [\n {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 19217803,\n mapping: {\n file: './dist/index.js',\n handlers: [\n {\n handler: 'handleTransaction',\n kind: EthereumHandlerKind.Call,\n filter: {\n to: null,\n },\n },\n ],\n },\n processor: { file: '' },\n },\n];\n\nconst nodeConfig = new NodeConfig({\n subquery: 'eth-starter',\n subqueryName: 'eth-starter',\n dictionaryTimeout: 10,\n networkEndpoint: [HTTP_ENDPOINT],\n networkDictionary: [DEFAULT_DICTIONARY],\n});\n\nfunction makeBlockHeightMap(mockDs: SubqlDatasource[]): BlockHeightMap<any> {\n const m = new Map<number, any>();\n mockDs.forEach((ds, index, dataSources) => {\n m.set(ds.startBlock || 1, dataSources.slice(0, index + 1));\n });\n return new BlockHeightMap(m);\n}\n\n// enable this once dictionary v2 is online\ndescribe('eth dictionary v2', () => {\n let ethDictionaryV2: EthDictionaryV2;\n\n const dsMap = makeBlockHeightMap(mockDs);\n\n beforeAll(async () => {\n ethDictionaryV2 = await EthDictionaryV2.create(\n DEFAULT_DICTIONARY,\n nodeConfig,\n { network: { chainId: '1' } } as SubqueryProject,\n new EthereumApi(HTTP_ENDPOINT, 1, new EventEmitter2()),\n );\n }, 10000);\n\n beforeEach(() => {\n ethDictionaryV2.updateQueriesMap(dsMap);\n });\n\n it('converts ds to v2 dictionary queries', () => {\n const query = (ethDictionaryV2 as any).queriesMap.get(19217803);\n expect(query.logs.length).toBe(1);\n expect(query.transactions.length).toBe(1);\n });\n\n it('query response match with entries', async () => {\n const ethBlocks = (await ethDictionaryV2.getData(\n 19217803,\n (ethDictionaryV2 as any)._metadata.end,\n 2,\n )) as DictionaryResponse<IBlock<EthereumBlock>>;\n\n expect(ethBlocks.batchBlocks.map((b) => b.block.number)).toStrictEqual([\n 19217803, 19217804,\n ]);\n\n const ethBlock19217803 = ethBlocks.batchBlocks[0].block;\n const ethBlock19217804 = ethBlocks.batchBlocks[1].block;\n\n expect(ethBlock19217803.number).toBe(19217803);\n expect(ethBlock19217804.number).toBe(19217804);\n\n // Sighash of approval tx\n expect(\n ethBlock19217803.transactions.filter(\n (tx) => tx.input.indexOf('0x095ea7b3') === 0,\n ).length,\n ).toBe(4);\n\n expect(ethBlock19217804.logs.length).toBe(233);\n\n // This matches with dictionaryQueryEntries[0].topics\n expect(ethBlock19217804.logs[0].topics).toContain(\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n );\n }, 10000);\n\n // Geth currently throwing errors with this request\n it.skip('is able to get transaction with field to is null', async () => {\n const dsMap = makeBlockHeightMap(mockDs2);\n ethDictionaryV2.updateQueriesMap(dsMap);\n\n const { conditions } = (ethDictionaryV2 as any).getQueryConditions(\n 19217803,\n (ethDictionaryV2 as any)._metadata.end,\n );\n\n expect(conditions).toEqual({ transactions: [{ to: [null] }] });\n\n const ethBlocks = (await ethDictionaryV2.getData(\n 19217803,\n (ethDictionaryV2 as any)._metadata.end,\n 1,\n )) as DictionaryResponse<IBlock<EthereumBlock>>;\n\n const { hash, transactions } = ethBlocks.batchBlocks[0].block;\n\n expect(hash).toBe(\n '0xa9ba70126240a8418739a103527860948a2be32de2eb9a8f590591faa174c08b',\n );\n\n // https://etherscan.io/tx/0x57e8cd9483cb5d308151372b0cf33fdc615999283c80ee3c28e94f074dda61f1\n expect(\n transactions.find(\n (tx) =>\n tx.hash ===\n '0x57e8cd9483cb5d308151372b0cf33fdc615999283c80ee3c28e94f074dda61f1',\n ),\n ).toBeDefined();\n });\n\n it('is able to query with not null topics', async () => {\n /**\n * Dictionary v1 supported filtering logs where a topic was null or not null.\n * V2 doesn't yet support this but we should still be able to make a dictionary query that gets relevant logs.\n * It will just include events that will be filtered out later.\n * */\n\n const ds: SubqlRuntimeDatasource = {\n kind: EthereumDatasourceKind.Runtime,\n assets: new Map(),\n options: {\n abi: 'erc20',\n },\n startBlock: 19476187,\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\n const dsMap = makeBlockHeightMap([ds]);\n ethDictionaryV2.updateQueriesMap(dsMap);\n\n const { conditions } = (ethDictionaryV2 as any).getQueryConditions(\n 19476187,\n (ethDictionaryV2 as any)._metadata.end,\n );\n\n expect(conditions).toEqual({\n logs: [\n {\n address: [],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n topics3: [],\n },\n ],\n });\n\n const ethBlocks = (await ethDictionaryV2.getData(\n 19476187,\n (ethDictionaryV2 as any)._metadata.end,\n 2,\n )) as DictionaryResponse<IBlock<EthereumBlock>>;\n\n const { hash, logs } = ethBlocks.batchBlocks[0].block;\n\n expect(hash).toEqual(\n '0xa798861151ed58ad67d80d1cf61dc30e65d003bc958e99a7969a05a67e69e0b2',\n );\n\n const log = logs.find((l) => l.logIndex === 184);\n expect(log).toBeDefined();\n expect(log!.transactionHash).toEqual(\n '0x5491f3f4b7ca6cc81f992a17e19bc9bafff408518c643c5a254de44b5a7b6d72',\n );\n\n // Uncomment this when not null filter supported\n // expect(logs.filter(l => !l.topics[3]).length).toEqual(6) // There are 6 events with no topic3\n }, 100000);\n});\n\ndescribe('buildDictionaryV2QueryEntry', () => {\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 = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n logs: [\n {\n address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n topics3: [],\n },\n ],\n });\n });\n\n it('Build filter tx filter', () => {\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: 'handleTx',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n },\n },\n ],\n },\n };\n const result = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n transactions: [\n {\n to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n data: ['0x7ef9ea98'],\n },\n ],\n });\n });\n\n it('build query entries for multiple ds', () => {\n const ds: SubqlRuntimeDatasource[] = [\n {\n kind: EthereumDatasourceKind.Runtime,\n startBlock: 3327417,\n options: {\n abi: 'EnsRegistry',\n address: '0x314159265dd8dbb310642f98f50c066173c1259b',\n },\n assets: new Map(),\n mapping: {\n file: './dist/index.js',\n handlers: [\n // one duplicate one\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleTransferOldRegistry',\n filter: {\n topics: ['Transfer(bytes32,address)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleTransferOldRegistry',\n filter: {\n topics: ['Transfer(bytes32,address)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleNewOwnerOldRegistry',\n filter: {\n topics: ['NewOwner(bytes32,bytes32,address)'],\n },\n },\n ],\n },\n },\n {\n kind: EthereumDatasourceKind.Runtime,\n startBlock: 3327417,\n options: {\n abi: 'Resolver',\n },\n assets: new Map(),\n mapping: {\n file: './dist/index.js',\n handlers: [\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleABIChanged',\n filter: {\n topics: ['ABIChanged(bytes32,uint256)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleAddrChanged',\n filter: {\n topics: ['AddrChanged(bytes32,address)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleMulticoinAddrChanged',\n filter: {\n topics: ['AddressChanged(bytes32,uint256,bytes)'],\n },\n },\n {\n kind: EthereumHandlerKind.Event,\n handler: 'handleAuthorisationChanged',\n filter: {\n topics: ['AuthorisationChanged(bytes32,address,address,bool)'],\n },\n },\n ],\n },\n },\n ];\n\n const queryEntry = buildDictionaryV2QueryEntry(ds);\n // Total 7 handlers were given, 1 is duplicate\n expect(queryEntry.logs!.length).toBe(6);\n });\n\n it('should unique QueryEntry for duplicate dataSources', () => {\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: ['Transfer(address, address, uint256)'],\n },\n },\n {\n handler: 'handleLogSame',\n kind: EthereumHandlerKind.Event,\n filter: {\n topics: ['Transfer(address, address, uint256)'],\n },\n },\n {\n handler: 'handleTx',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n from: 'mockAddress',\n },\n },\n {\n handler: 'handleTxSame',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n from: 'mockAddress',\n },\n },\n ],\n },\n };\n const result = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n logs: [\n {\n address: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n },\n ],\n transactions: [\n {\n from: ['mockaddress'],\n to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n data: ['0x7ef9ea98'],\n },\n ],\n });\n });\n\n it('should group a small number of dynamic ds', () => {\n const ds: SubqlRuntimeDatasource[] = [];\n\n for (let i = 0; i < 10; i++) {\n // Bad nodejs types\n const tmp = (global as any).structuredClone(templateTs);\n (tmp.options.address = `0x${i}`), ds.push(tmp);\n }\n\n const result = buildDictionaryV2QueryEntry(ethFilterDs(ds));\n\n expect(result).toEqual({\n logs: [\n {\n address: [\n '0x0',\n '0x1',\n '0x2',\n '0x3',\n '0x4',\n '0x5',\n '0x6',\n '0x7',\n '0x8',\n '0x9',\n ],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n ],\n },\n ],\n });\n });\n\n it('should remove address filter with large number of dynamic ds', () => {\n const ds: SubqlRuntimeDatasource[] = [];\n\n for (let i = 0; i < 200; i++) {\n // Bad nodejs types\n const tmp = (global as any).structuredClone(templateTs);\n (tmp.options.address = `0x${i}`), ds.push(tmp);\n }\n\n const result = buildDictionaryV2QueryEntry(ethFilterDs(ds));\n\n expect(result).toEqual({\n logs: [\n {\n address: [],\n topics0: [\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\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 address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',\n },\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleBlock',\n kind: EthereumHandlerKind.Block,\n filter: {\n modulo: 100,\n },\n },\n {\n handler: 'handleTx',\n kind: EthereumHandlerKind.Call,\n filter: {\n function: 'setminimumStakingAmount(uint256 amount)',\n },\n },\n ],\n },\n };\n const result = buildDictionaryV2QueryEntry([ds]);\n\n expect(result).toEqual({\n transactions: [\n {\n to: ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'],\n data: ['0x7ef9ea98'],\n },\n ],\n });\n });\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/types.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { DictionaryV2QueryEntry } from '@subql/node-core';\n\nexport interface RawEthBlock {\n header: {\n parentHash: string;\n sha3Uncles: string;\n miner: string;\n stateRoot: string;\n transactionRoot: string;\n receiptsRoot: string;\n logsBloom: string;\n difficulty: bigint;\n number: bigint;\n gasLimit: bigint;\n gasUsed: bigint;\n timestamp: bigint;\n extraData: string;\n mixHash: string;\n nonce: string;\n baseFeePerGas: bigint;\n withdrawalsRoot: string;\n blobGasUsed: bigint;\n excessBlobGas: bigint;\n parentBeaconBlockRoot: string;\n hash: string;\n };\n transactions: RawEthTransaction[];\n logs: RawEthLog[];\n}\n\nexport interface RawEthTransaction {\n type: string;\n nonce: bigint;\n to: string;\n gas: bigint;\n gasPrice: bigint;\n maxPriorityFeePerGas: bigint;\n maxFeePerGas: bigint;\n value: bigint;\n v: bigint;\n r: string;\n s: string;\n input: string;\n hash: string;\n from: string;\n func: string;\n gasLimit: bigint;\n}\n\nexport interface RawEthLog {\n address: string;\n topics: string[];\n data: string;\n blockNumber: bigint;\n transactionHash: string;\n transactionIndex: bigint;\n blockHash: string;\n logIndex: bigint;\n removed: boolean;\n}\n\n/**\n * Eth dictionary RPC request filter conditions\n */\nexport interface EthDictionaryV2QueryEntry extends DictionaryV2QueryEntry {\n logs?: EthDictionaryLogConditions[];\n transactions?: EthDictionaryTxConditions[];\n}\n\nexport interface EthDictionaryLogConditions {\n address?: string[];\n topics0?: string[];\n topics1?: string[];\n topics2?: string[];\n}\n\nexport interface EthDictionaryTxConditions {\n to?: string[];\n from?: string[];\n data?: string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/types.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { DictionaryV2QueryEntry } from '@subql/node-core';\n\nexport interface RawEthBlock {\n header: {\n parentHash: string;\n sha3Uncles: string;\n miner: string;\n stateRoot: string;\n transactionRoot: string;\n receiptsRoot: string;\n logsBloom: string;\n difficulty: bigint;\n number: bigint;\n gasLimit: bigint;\n gasUsed: bigint;\n timestamp: bigint;\n extraData: string;\n mixHash: string;\n nonce: string;\n baseFeePerGas: bigint;\n withdrawalsRoot: string;\n blobGasUsed: bigint;\n excessBlobGas: bigint;\n parentBeaconBlockRoot: string;\n hash: string;\n };\n transactions: RawEthTransaction[];\n logs: RawEthLog[];\n}\n\nexport interface RawEthTransaction {\n type: string;\n nonce: bigint;\n to: string;\n gas: bigint;\n gasPrice: bigint;\n maxPriorityFeePerGas: bigint;\n maxFeePerGas: bigint;\n value: bigint;\n v: bigint;\n r: string;\n s: string;\n input: string;\n hash: string;\n from: string;\n func: string;\n gasLimit: bigint;\n}\n\nexport interface RawEthLog {\n address: string;\n topics: string[];\n data: string;\n blockNumber: bigint;\n transactionHash: string;\n transactionIndex: bigint;\n blockHash: string;\n logIndex: bigint;\n removed: boolean;\n}\n\n/**\n * Eth dictionary RPC request filter conditions\n */\nexport interface EthDictionaryV2QueryEntry extends DictionaryV2QueryEntry {\n logs?: EthDictionaryLogConditions[];\n transactions?: EthDictionaryTxConditions[];\n}\n\nexport interface EthDictionaryLogConditions {\n address?: string[];\n topics0?: string[];\n topics1?: string[];\n topics2?: string[];\n}\n\nexport interface EthDictionaryTxConditions {\n to?: (string | null)[];\n from?: string[];\n data?: string[];\n}\n"]}
|
|
@@ -17,9 +17,7 @@ function rawBlockToEthBlock(block, api) {
|
|
|
17
17
|
ethBlock.transactions = (block.transactions ?? []).map((tx) => ({
|
|
18
18
|
...(0, utils_ethereum_1.formatTransaction)(tx, ethBlock),
|
|
19
19
|
logs: ethBlock.logs.filter((l) => l.transactionHash === tx.hash),
|
|
20
|
-
receipt: () => api
|
|
21
|
-
.getTransactionReceipt(tx.hash)
|
|
22
|
-
.then((r) => (0, utils_ethereum_1.formatReceipt)(r, ethBlock)),
|
|
20
|
+
receipt: () => api.getTransactionReceipt(tx.hash).then((r) => (0, utils_ethereum_1.formatReceipt)(r)),
|
|
23
21
|
}));
|
|
24
22
|
return (0, utils_ethereum_1.formatBlockUtil)(ethBlock);
|
|
25
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/indexer/dictionary/v2/utils.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,wDAAqD;AAIrD,qEAM0C;AAG1C,SAAgB,kBAAkB,CAChC,KAAkB,EAClB,GAAgB;IAEhB,IAAI;QACF,gFAAgF;QAChF,MAAM,SAAS,GAAG,GAAG,EAAE,GA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C,IAAI,GAAG,qBAAS,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CACpE,KAAK,CAAC,IAAI,IAAI,EAAE,CACjB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,0BAAS,EAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAErC,QAAQ,CAAC,YAAY,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9D,GAAG,IAAA,kCAAiB,EAAC,EAAE,EAAE,QAAQ,CAAC;YAClC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,EAAE,CAAC,IAAI,CAAC;YAChE,OAAO,EAAE,GAA0C,EAAE,CACnD,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,8BAAa,EAAI,CAAC,CAAC,CAAC;SACtE,CAAC,CAAC,CAAC;QAEJ,OAAO,IAAA,gCAAe,EAAC,QAAQ,CAAC,CAAC;KAClC;IAAC,OAAO,CAAM,EAAE;QACf,MAAM,IAAI,KAAK,CACb,4CAA4C,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,EAAE,CAC/E,CAAC;KACH;AACH,CAAC;AA9BD,gDA8BC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Formatter } from '@ethersproject/providers';\nimport { IBlock } from '@subql/node-core';\nimport { EthereumBlock, EthereumReceipt } from '@subql/types-ethereum';\nimport { EthereumApi } from '../../../ethereum';\nimport {\n formatBlock,\n formatBlockUtil,\n formatLog,\n formatReceipt,\n formatTransaction,\n} from '../../../ethereum/utils.ethereum';\nimport { RawEthBlock } from './types';\n\nexport function rawBlockToEthBlock(\n block: RawEthBlock,\n api: EthereumApi,\n): IBlock<EthereumBlock> {\n try {\n // Use the formatter from the api, it could have custom formats e.g l1Gas fields\n const formatter = api?.api.formatter ?? new Formatter();\n\n const ethBlock = formatBlock({\n ...block.header,\n transactions: [],\n });\n\n ethBlock.logs = Formatter.arrayOf(formatter.filterLog.bind(formatter))(\n block.logs ?? [],\n ).map((l) => formatLog(l, ethBlock));\n\n ethBlock.transactions = (block.transactions ?? []).map((tx) => ({\n ...formatTransaction(tx, ethBlock),\n logs: ethBlock.logs.filter((l) => l.transactionHash === tx.hash),\n receipt: <R extends EthereumReceipt>(): Promise<R> =>\n api.getTransactionReceipt(tx.hash).then((r) => formatReceipt<R>(r)),\n }));\n\n return formatBlockUtil(ethBlock);\n } catch (e: any) {\n throw new Error(\n `Convert raw block to Eth block failed at ${block.header.number},${e.message}`,\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-ds.service.js","sourceRoot":"","sources":["../../src/indexer/dynamic-ds.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,4DAIgC;AAChC,gDAG0B;AAC1B,yDAAiD;AACjD,qDAA+C;AAC/C,kEAGsC;AACtC,iEAA4D;AAGrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,4BAGrC;IAEoB;IADnB,YACmB,kBAAsC,EAC3B,OAAwB;QAEpD,KAAK,CAAC,OAAO,CAAC,CAAC;QAHE,uBAAkB,GAAlB,kBAAkB,CAAoB;IAIzD,CAAC;IAES,KAAK,CAAC,aAAa,CAC3B,MAAwB;QAExB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAC5B,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,UAAU,CAClB,CAAC;QAEF,IAAI;YACF,IAAI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ACH,CAAC;CACF,CAAA;AAnDY,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCADU,yCAAkB;QAClB,iCAAe;GAN3C,gBAAgB,CAmD5B;AAnDY,4CAAgB","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n EthereumRuntimeDataSourceImpl,\n isCustomDs,\n isRuntimeDs,\n} from '@subql/common-ethereum';\nimport {\n DatasourceParams,\n DynamicDsService as BaseDynamicDsService,\n} from '@subql/node-core';\nimport { plainToClass } from 'class-transformer';\nimport { validateSync } from 'class-validator';\nimport {\n EthereumProjectDs,\n SubqueryProject,\n} from '../configure/SubqueryProject';\nimport { DsProcessorService } from './ds-processor.service';\n\n@Injectable()\nexport class DynamicDsService extends BaseDynamicDsService<\n EthereumProjectDs,\n SubqueryProject\n> {\n constructor(\n private readonly dsProcessorService: DsProcessorService,\n @Inject('ISubqueryProject') project: SubqueryProject,\n ) {\n super(project);\n }\n\n protected async getDatasource(\n params: DatasourceParams,\n ): Promise<EthereumProjectDs> {\n const dsObj = this.getTemplate<EthereumProjectDs>(\n params.templateName,\n params.startBlock,\n );\n\n try {\n if (isCustomDs(dsObj)) {\n dsObj.processor.options = {\n ...dsObj.processor.options,\n ...params.args,\n };\n await this.dsProcessorService.validateCustomDs([dsObj]);\n } else if (isRuntimeDs(dsObj)) {\n dsObj.options = {\n ...dsObj.options,\n ...params.args,\n };\n\n const parsedDs = plainToClass(EthereumRuntimeDataSourceImpl, dsObj);\n\n const errors = validateSync(parsedDs, {\n whitelist: true,\n forbidNonWhitelisted: false,\n });\n if (errors.length) {\n throw new Error(\n `Dynamic ds is invalid\\n${errors\n .map((e) => e.toString())\n .join('\\n')}`,\n );\n }\n }\n return dsObj;\n } catch (e: any) {\n throw new Error(`Unable to create dynamic datasource.\\n ${e.message}`);\n }\n }\n}\n"]}
|
|
@@ -25,10 +25,8 @@ let FetchModule = class FetchModule {
|
|
|
25
25
|
};
|
|
26
26
|
FetchModule = __decorate([
|
|
27
27
|
(0, common_1.Module)({
|
|
28
|
+
imports: [node_core_1.CoreModule],
|
|
28
29
|
providers: [
|
|
29
|
-
node_core_1.InMemoryCacheService,
|
|
30
|
-
node_core_1.StoreService,
|
|
31
|
-
node_core_1.StoreCacheService,
|
|
32
30
|
{
|
|
33
31
|
provide: node_core_1.ApiService,
|
|
34
32
|
useFactory: async (project, connectionPoolService, eventEmitter, nodeConfig) => {
|
|
@@ -44,8 +42,6 @@ FetchModule = __decorate([
|
|
|
44
42
|
],
|
|
45
43
|
},
|
|
46
44
|
indexer_manager_1.IndexerManager,
|
|
47
|
-
node_core_1.ConnectionPoolStateManager,
|
|
48
|
-
node_core_1.ConnectionPoolService,
|
|
49
45
|
{
|
|
50
46
|
provide: 'IBlockDispatcher',
|
|
51
47
|
useFactory: (nodeConfig, eventEmitter, projectService, projectUpgradeService, apiService, indexerManager, cacheService, storeService, storeCacheService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState, monitorService) => nodeConfig.workers
|
|
@@ -70,23 +66,15 @@ FetchModule = __decorate([
|
|
|
70
66
|
],
|
|
71
67
|
},
|
|
72
68
|
fetch_service_1.FetchService,
|
|
73
|
-
node_core_1.ConnectionPoolService,
|
|
74
|
-
node_core_1.IndexingBenchmarkService,
|
|
75
|
-
node_core_1.PoiBenchmarkService,
|
|
76
69
|
ethDictionary_service_1.EthDictionaryService,
|
|
77
|
-
node_core_1.SandboxService,
|
|
78
70
|
ds_processor_service_1.DsProcessorService,
|
|
79
71
|
dynamic_ds_service_1.DynamicDsService,
|
|
80
|
-
node_core_1.PoiService,
|
|
81
|
-
node_core_1.PoiSyncService,
|
|
82
72
|
{
|
|
83
73
|
useClass: project_service_1.ProjectService,
|
|
84
74
|
provide: 'IProjectService',
|
|
85
75
|
},
|
|
86
|
-
node_core_1.MonitorService,
|
|
87
76
|
unfinalizedBlocks_service_1.UnfinalizedBlocksService,
|
|
88
77
|
],
|
|
89
|
-
exports: [node_core_1.StoreService, node_core_1.StoreCacheService, node_core_1.MonitorService, node_core_1.PoiService],
|
|
90
78
|
})
|
|
91
79
|
], FetchModule);
|
|
92
80
|
exports.FetchModule = FetchModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,gDAY0B;AAG1B,2EAAsE;AACtE,uDAG2B;AAC3B,8EAA0E;AAC1E,iEAA4D;AAC5D,6DAAwD;AACxD,mDAA+C;AAC/C,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AA0GhE,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,WAAW;IAxGvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAU,CAAC;QACrB,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,KAAK,EACf,OAAwB,EACxB,qBAAmE,EACnE,YAA2B,EAC3B,UAAsB,EACtB,EAAE;oBACF,MAAM,UAAU,GAAG,IAAI,yCAAkB,CACvC,OAAO,EACP,qBAAqB,EACrB,YAAY,EACZ,UAAU,CACX,CAAC;oBACF,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;oBACxB,OAAO,UAAU,CAAC;gBACpB,CAAC;gBACD,MAAM,EAAE;oBACN,kBAAkB;oBAClB,iCAAqB;oBACrB,6BAAa;oBACb,sBAAU;iBACX;aACF;YACD,gCAAc;YACd;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,UAAU,EAAE,CACV,UAAsB,EACtB,YAA2B,EAC3B,cAA8B,EAC9B,qBAA6C,EAC7C,UAA8B,EAC9B,cAA8B,EAC9B,YAAkC,EAClC,YAA0B,EAC1B,iBAAoC,EACpC,cAA8B,EAC9B,OAAwB,EACxB,gBAAkC,EAClC,iBAA2C,EAC3C,mBAAsE,EACtE,cAA+B,EAC/B,EAAE,CACF,UAAU,CAAC,OAAO;oBAChB,CAAC,CAAC,IAAI,8CAA4B,CAC9B,UAAU,EACV,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,CACf;oBACH,CAAC,CAAC,IAAI,wCAAsB,CACxB,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,CACR;gBACP,MAAM,EAAE;oBACN,sBAAU;oBACV,6BAAa;oBACb,iBAAiB;oBACjB,wBAAwB;oBACxB,sBAAU;oBACV,gCAAc;oBACd,gCAAoB;oBACpB,wBAAY;oBACZ,6BAAiB;oBACjB,0BAAc;oBACd,kBAAkB;oBAClB,qCAAgB;oBAChB,oDAAwB;oBACxB,sCAA0B;oBAC1B,0BAAc;iBACf;aACF;YACD,4BAAY;YACZ,4CAAoB;YACpB,yCAAkB;YAClB,qCAAgB;YAChB;gBACE,QAAQ,EAAE,gCAAc;gBACxB,OAAO,EAAE,iBAAiB;aAC3B;YACD,oDAAwB;SACzB;KACF,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n StoreService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n StoreCacheService,\n IProjectUpgradeService,\n PoiSyncService,\n InMemoryCacheService,\n MonitorService,\n CoreModule,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { EthereumApiService } from '../ethereum/api.service.ethereum';\nimport {\n BlockDispatcherService,\n WorkerBlockDispatcherService,\n} from './blockDispatcher';\nimport { EthDictionaryService } from './dictionary/ethDictionary.service';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { FetchService } from './fetch.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Module({\n imports: [CoreModule],\n providers: [\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n nodeConfig,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n IndexerManager,\n {\n provide: 'IBlockDispatcher',\n useFactory: (\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n projectService: ProjectService,\n projectUpgradeService: IProjectUpgradeService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiSyncService: PoiSyncService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>,\n monitorService?: MonitorService,\n ) =>\n nodeConfig.workers\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n projectUpgradeService,\n cacheService,\n storeService,\n storeCacheService,\n poiSyncService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n monitorService,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n projectUpgradeService,\n storeService,\n storeCacheService,\n poiSyncService,\n project,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n ApiService,\n IndexerManager,\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n MonitorService,\n ],\n },\n FetchService,\n EthDictionaryService,\n DsProcessorService,\n DynamicDsService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n})\nexport class FetchModule {}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
2
2
|
import { SchedulerRegistry } from '@nestjs/schedule';
|
|
3
|
-
import { NodeConfig, BaseFetchService, ApiService, Header } from '@subql/node-core';
|
|
3
|
+
import { NodeConfig, BaseFetchService, ApiService, Header, StoreCacheService } from '@subql/node-core';
|
|
4
4
|
import { EthereumBlock, SubqlDatasource } from '@subql/types-ethereum';
|
|
5
5
|
import { SubqueryProject } from '../configure/SubqueryProject';
|
|
6
6
|
import { EthereumApi } from '../ethereum';
|
|
@@ -10,7 +10,7 @@ import { ProjectService } from './project.service';
|
|
|
10
10
|
import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
|
|
11
11
|
export declare class FetchService extends BaseFetchService<SubqlDatasource, IEthereumBlockDispatcher, EthereumBlock> {
|
|
12
12
|
private apiService;
|
|
13
|
-
constructor(apiService: ApiService, nodeConfig: NodeConfig, projectService: ProjectService, project: SubqueryProject, blockDispatcher: IEthereumBlockDispatcher, dictionaryService: EthDictionaryService, unfinalizedBlocksService: UnfinalizedBlocksService, eventEmitter: EventEmitter2, schedulerRegistry: SchedulerRegistry);
|
|
13
|
+
constructor(apiService: ApiService, nodeConfig: NodeConfig, projectService: ProjectService, project: SubqueryProject, blockDispatcher: IEthereumBlockDispatcher, dictionaryService: EthDictionaryService, unfinalizedBlocksService: UnfinalizedBlocksService, eventEmitter: EventEmitter2, schedulerRegistry: SchedulerRegistry, storeCacheService: StoreCacheService);
|
|
14
14
|
get api(): EthereumApi;
|
|
15
15
|
protected getFinalizedHeader(): Promise<Header>;
|
|
16
16
|
protected getBestHeight(): Promise<number>;
|