@sentio/sdk 2.0.0-rc.2 → 2.0.0-rc.20
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/lib/aptos/api.d.ts +5 -0
- package/lib/aptos/api.js +21 -0
- package/lib/aptos/api.js.map +1 -0
- package/lib/aptos/aptos-plugin.d.ts +14 -0
- package/lib/aptos/aptos-plugin.js +146 -0
- package/lib/aptos/aptos-plugin.js.map +1 -0
- package/lib/aptos/aptos-processor.d.ts +72 -0
- package/lib/aptos/aptos-processor.js +201 -0
- package/lib/aptos/aptos-processor.js.map +1 -0
- package/lib/aptos/builtin/0x1.d.ts +1914 -0
- package/lib/aptos/builtin/0x1.js +2727 -0
- package/lib/aptos/builtin/0x1.js.map +1 -0
- package/lib/aptos/builtin/0x3.d.ts +491 -0
- package/lib/aptos/builtin/0x3.js +496 -0
- package/lib/aptos/builtin/0x3.js.map +1 -0
- package/lib/aptos/builtin/index.d.ts +2 -0
- package/lib/aptos/builtin/index.js +6 -0
- package/lib/aptos/builtin/index.js.map +1 -0
- package/lib/aptos/codegen/codegen.d.ts +21 -0
- package/lib/aptos/codegen/codegen.js +380 -0
- package/lib/aptos/codegen/codegen.js.map +1 -0
- package/lib/aptos/codegen/index.d.ts +1 -0
- package/lib/aptos/codegen/index.js +2 -0
- package/lib/aptos/codegen/index.js.map +1 -0
- package/lib/aptos/codegen/typegen.d.ts +18 -0
- package/lib/aptos/codegen/typegen.js +145 -0
- package/lib/aptos/codegen/typegen.js.map +1 -0
- package/lib/{core/generic-processor.test.d.ts → aptos/codegen/typegen.test.d.ts} +0 -0
- package/lib/aptos/codegen/typegen.test.js.map +1 -0
- package/lib/aptos/context.d.ts +21 -0
- package/lib/aptos/context.js +59 -0
- package/lib/aptos/context.js.map +1 -0
- package/lib/aptos/index.d.ts +9 -0
- package/lib/aptos/index.js +8 -0
- package/lib/aptos/index.js.map +1 -0
- package/lib/aptos/models.d.ts +27 -0
- package/lib/aptos/models.js +2 -0
- package/lib/aptos/models.js.map +1 -0
- package/lib/aptos/move-coder.d.ts +22 -0
- package/lib/aptos/move-coder.js +162 -0
- package/lib/aptos/move-coder.js.map +1 -0
- package/lib/aptos/move-types.d.ts +10 -0
- package/lib/aptos/move-types.js +2 -0
- package/lib/aptos/move-types.js.map +1 -0
- package/lib/aptos/network.d.ts +11 -0
- package/lib/aptos/network.js +27 -0
- package/lib/aptos/network.js.map +1 -0
- package/lib/aptos/run-codegen.d.ts +1 -0
- package/lib/aptos/run-codegen.js +12 -0
- package/lib/aptos/run-codegen.js.map +1 -0
- package/lib/aptos/tests/aptos.test.d.ts +1 -0
- package/lib/aptos/tests/aptos.test.js.map +1 -0
- package/lib/aptos/tests/souffl3.d.ts +1 -0
- package/lib/aptos/tests/souffl3.js +44 -0
- package/lib/aptos/tests/souffl3.js.map +1 -0
- package/lib/aptos/tests/types/index.d.ts +3 -0
- package/lib/aptos/tests/types/index.js +7 -0
- package/lib/aptos/tests/types/index.js.map +1 -0
- package/lib/aptos/tests/types/reserved.d.ts +345 -0
- package/lib/aptos/tests/types/reserved.js +301 -0
- package/lib/aptos/tests/types/reserved.js.map +1 -0
- package/lib/aptos/tests/types/soffl3.d.ts +812 -0
- package/lib/aptos/tests/types/soffl3.js +548 -0
- package/lib/aptos/tests/types/soffl3.js.map +1 -0
- package/lib/aptos/tests/types/souffle.d.ts +340 -0
- package/lib/aptos/tests/types/souffle.js +295 -0
- package/lib/aptos/tests/types/souffle.js.map +1 -0
- package/lib/aptos/types.d.ts +9 -0
- package/lib/aptos/types.js +130 -0
- package/lib/aptos/types.js.map +1 -0
- package/lib/aptos/types.test.d.ts +1 -0
- package/lib/aptos/types.test.js.map +1 -0
- package/lib/aptos/utils.d.ts +7 -0
- package/lib/aptos/utils.js +20 -0
- package/lib/aptos/utils.js.map +1 -0
- package/lib/core/base-context.d.ts +4 -4
- package/lib/core/base-context.js +7 -11
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/big-decimal.d.ts +2 -0
- package/lib/core/big-decimal.js +11 -7
- package/lib/core/big-decimal.js.map +1 -1
- package/lib/{utils → core}/chain.d.ts +0 -0
- package/lib/{utils → core}/chain.js +7 -12
- package/lib/core/chain.js.map +1 -0
- package/lib/core/core-plugin.js +9 -13
- package/lib/core/core-plugin.js.map +1 -1
- package/lib/core/event-tracker.d.ts +2 -2
- package/lib/core/event-tracker.js +6 -13
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/exporter.d.ts +2 -2
- package/lib/core/exporter.js +4 -9
- package/lib/core/exporter.js.map +1 -1
- package/lib/core/index.d.ts +10 -9
- package/lib/core/index.js +10 -32
- package/lib/core/index.js.map +1 -1
- package/lib/core/logger.d.ts +2 -2
- package/lib/core/logger.js +7 -11
- package/lib/core/logger.js.map +1 -1
- package/lib/core/metadata.d.ts +4 -0
- package/lib/core/metadata.js +21 -7
- package/lib/core/metadata.js.map +1 -1
- package/lib/core/meter.d.ts +3 -7
- package/lib/core/meter.js +22 -57
- package/lib/core/meter.js.map +1 -1
- package/lib/core/meter.test.js.map +1 -1
- package/lib/core/numberish.d.ts +1 -3
- package/lib/core/numberish.js +11 -26
- package/lib/core/numberish.js.map +1 -1
- package/lib/core/numberish.test.js.map +1 -1
- package/lib/core/sui-plugin.js +12 -16
- package/lib/core/sui-plugin.js.map +1 -1
- package/lib/core/sui-processor.d.ts +1 -1
- package/lib/core/sui-processor.js +6 -12
- package/lib/core/sui-processor.js.map +1 -1
- package/lib/eth/account-processor-state.d.ts +1 -1
- package/lib/eth/account-processor-state.js +2 -6
- package/lib/eth/account-processor-state.js.map +1 -1
- package/lib/eth/account-processor.d.ts +7 -7
- package/lib/eth/account-processor.js +23 -27
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +9 -8
- package/lib/eth/base-processor-template.js +8 -14
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +8 -7
- package/lib/eth/base-processor.js +21 -27
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/{core → eth}/bind-options.d.ts +0 -0
- package/lib/eth/bind-options.js +40 -0
- package/lib/eth/bind-options.js.map +1 -0
- package/lib/eth/binds.d.ts +3 -3
- package/lib/eth/binds.js +11 -19
- package/lib/eth/binds.js.map +1 -1
- package/lib/eth/builtin/eacaggregatorproxy/index.d.ts +3 -0
- package/lib/eth/builtin/eacaggregatorproxy/index.js +7 -0
- package/lib/eth/builtin/eacaggregatorproxy/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/eacaggregatorproxy/test-utils.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/eacaggregatorproxy/test-utils.js +9 -16
- package/lib/eth/builtin/eacaggregatorproxy/test-utils.js.map +1 -0
- package/lib/eth/builtin/erc1155/index.d.ts +3 -0
- package/lib/eth/builtin/erc1155/index.js +7 -0
- package/lib/eth/builtin/erc1155/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc1155/test-utils.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/erc1155/test-utils.js +9 -16
- package/lib/eth/builtin/erc1155/test-utils.js.map +1 -0
- package/lib/eth/builtin/erc20/index.d.ts +3 -0
- package/lib/eth/builtin/erc20/index.js +7 -0
- package/lib/eth/builtin/erc20/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc20/test-utils.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/erc20/test-utils.js +7 -13
- package/lib/eth/builtin/erc20/test-utils.js.map +1 -0
- package/lib/eth/builtin/erc20bytes/index.d.ts +3 -0
- package/lib/eth/builtin/erc20bytes/index.js +7 -0
- package/lib/eth/builtin/erc20bytes/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc20bytes/test-utils.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/erc20bytes/test-utils.js +5 -10
- package/lib/eth/builtin/erc20bytes/test-utils.js.map +1 -0
- package/lib/eth/builtin/erc721/index.d.ts +3 -0
- package/lib/eth/builtin/erc721/index.js +7 -0
- package/lib/eth/builtin/erc721/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc721/test-utils.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/erc721/test-utils.js +7 -13
- package/lib/eth/builtin/erc721/test-utils.js.map +1 -0
- package/lib/eth/builtin/index.d.ts +8 -0
- package/lib/eth/builtin/index.js +9 -0
- package/lib/eth/builtin/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/EACAggregatorProxy.d.ts +6 -6
- package/lib/eth/builtin/internal/EACAggregatorProxy.js +2 -0
- package/lib/eth/builtin/internal/EACAggregatorProxy.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC1155.d.ts +6 -6
- package/lib/eth/builtin/internal/ERC1155.js +2 -0
- package/lib/eth/builtin/internal/ERC1155.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC20.d.ts +5 -5
- package/lib/eth/builtin/internal/ERC20.js +2 -0
- package/lib/eth/builtin/internal/ERC20.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC20Bytes.d.ts +4 -4
- package/lib/eth/builtin/internal/ERC20Bytes.js +2 -0
- package/lib/eth/builtin/internal/ERC20Bytes.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC721.d.ts +5 -5
- package/lib/eth/builtin/internal/ERC721.js +2 -0
- package/lib/eth/builtin/internal/ERC721.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/WETH9.d.ts +6 -6
- package/lib/eth/builtin/internal/WETH9.js +2 -0
- package/lib/eth/builtin/internal/WETH9.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/common.d.ts +4 -2
- package/lib/{builtin → eth/builtin}/internal/common.js +1 -2
- package/lib/eth/builtin/internal/common.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/eacaggregatorproxy_processor.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/eacaggregatorproxy_processor.js +123 -221
- package/lib/eth/builtin/internal/eacaggregatorproxy_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc1155_processor.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/erc1155_processor.js +45 -78
- package/lib/eth/builtin/internal/erc1155_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc20_processor.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/erc20_processor.js +63 -111
- package/lib/eth/builtin/internal/erc20_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc20bytes_processor.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/erc20bytes_processor.js +51 -89
- package/lib/eth/builtin/internal/erc20bytes_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc721_processor.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/erc721_processor.js +69 -122
- package/lib/eth/builtin/internal/erc721_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/EACAggregatorProxy__factory.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/internal/factories/EACAggregatorProxy__factory.js +4 -8
- package/lib/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/ERC1155__factory.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/internal/factories/ERC1155__factory.js +4 -8
- package/lib/eth/builtin/internal/factories/ERC1155__factory.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/ERC20Bytes__factory.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/internal/factories/ERC20Bytes__factory.js +4 -8
- package/lib/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/ERC20__factory.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/internal/factories/ERC20__factory.js +4 -8
- package/lib/eth/builtin/internal/factories/ERC20__factory.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/ERC721__factory.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/internal/factories/ERC721__factory.js +4 -8
- package/lib/eth/builtin/internal/factories/ERC721__factory.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/WETH9__factory.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/internal/factories/WETH9__factory.js +4 -8
- package/lib/eth/builtin/internal/factories/WETH9__factory.js.map +1 -0
- package/lib/eth/builtin/internal/factories/index.d.ts +6 -0
- package/lib/eth/builtin/internal/factories/index.js +10 -0
- package/lib/eth/builtin/internal/factories/index.js.map +1 -0
- package/lib/eth/builtin/internal/index.d.ts +13 -0
- package/lib/eth/builtin/internal/index.js +8 -0
- package/lib/eth/builtin/internal/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/weth9_processor.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/weth9_processor.js +51 -89
- package/lib/eth/builtin/internal/weth9_processor.js.map +1 -0
- package/lib/eth/builtin/weth9/index.d.ts +3 -0
- package/lib/eth/builtin/weth9/index.js +7 -0
- package/lib/eth/builtin/weth9/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/weth9/test-utils.d.ts +1 -1
- package/lib/{builtin → eth/builtin}/weth9/test-utils.js +9 -16
- package/lib/eth/builtin/weth9/test-utils.js.map +1 -0
- package/lib/eth/codegen/codegen.d.ts +1 -0
- package/lib/eth/codegen/codegen.js +53 -0
- package/lib/eth/codegen/codegen.js.map +1 -0
- package/lib/{target-ethers-sentio/index.d.ts → eth/codegen/ethers-sentio.d.ts} +1 -1
- package/lib/eth/codegen/ethers-sentio.js +57 -0
- package/lib/eth/codegen/ethers-sentio.js.map +1 -0
- package/lib/{target-ethers-sentio → eth/codegen}/event-handler.d.ts +0 -0
- package/lib/eth/codegen/event-handler.js +46 -0
- package/lib/eth/codegen/event-handler.js.map +1 -0
- package/lib/{target-ethers-sentio → eth/codegen}/file.d.ts +0 -0
- package/lib/{target-ethers-sentio → eth/codegen}/file.js +33 -39
- package/lib/eth/codegen/file.js.map +1 -0
- package/lib/{target-ethers-sentio → eth/codegen}/functions-handler.d.ts +0 -0
- package/lib/{target-ethers-sentio → eth/codegen}/functions-handler.js +12 -18
- package/lib/eth/codegen/functions-handler.js.map +1 -0
- package/lib/eth/codegen/index.d.ts +1 -0
- package/lib/eth/codegen/index.js +2 -0
- package/lib/eth/codegen/index.js.map +1 -0
- package/lib/{target-ethers-sentio → eth/codegen}/types.d.ts +0 -0
- package/lib/{target-ethers-sentio → eth/codegen}/types.js +3 -9
- package/lib/eth/codegen/types.js.map +1 -0
- package/lib/{target-ethers-sentio → eth/codegen}/view-function.d.ts +0 -0
- package/lib/eth/codegen/view-function.js +62 -0
- package/lib/eth/codegen/view-function.js.map +1 -0
- package/lib/{core → eth}/context.d.ts +5 -5
- package/lib/{core → eth}/context.js +14 -23
- package/lib/eth/context.js.map +1 -0
- package/lib/eth/error.d.ts +1 -0
- package/lib/eth/error.js +3 -0
- package/lib/eth/error.js.map +1 -0
- package/lib/eth/eth-plugin.js +30 -34
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/eth.d.ts +13 -0
- package/lib/eth/eth.js +44 -0
- package/lib/eth/eth.js.map +1 -0
- package/lib/eth/generic-processor.d.ts +3 -3
- package/lib/eth/generic-processor.js +9 -13
- package/lib/eth/generic-processor.js.map +1 -1
- package/lib/eth/generic-processor.test.d.ts +1 -0
- package/lib/eth/generic-processor.test.js.map +1 -0
- package/lib/eth/index.d.ts +11 -6
- package/lib/eth/index.js +10 -14
- package/lib/eth/index.js.map +1 -1
- package/lib/eth/provider.js +13 -17
- package/lib/eth/provider.js.map +1 -1
- package/lib/eth/run-codegen.d.ts +2 -0
- package/lib/eth/run-codegen.js +12 -0
- package/lib/eth/run-codegen.js.map +1 -0
- package/lib/eth/trace.js +1 -2
- package/lib/eth/trace.js.map +1 -1
- package/lib/index.d.ts +2 -5
- package/lib/index.js +3 -18
- package/lib/index.js.map +1 -1
- package/lib/jest.config.d.ts +9 -0
- package/lib/jest.config.js +9 -0
- package/lib/jest.config.js.map +1 -0
- package/lib/promise-or-void.js +1 -2
- package/lib/solana/builtin/index.d.ts +1 -0
- package/lib/solana/builtin/index.js +2 -0
- package/lib/solana/builtin/index.js.map +1 -0
- package/lib/solana/builtin/spl-token-processor.d.ts +39 -0
- package/lib/solana/builtin/spl-token-processor.js +254 -0
- package/lib/solana/builtin/spl-token-processor.js.map +1 -0
- package/lib/solana/builtin/types.d.ts +427 -0
- package/lib/solana/builtin/types.js +200 -0
- package/lib/solana/builtin/types.js.map +1 -0
- package/lib/solana/codegen/codegen.d.ts +1 -0
- package/lib/solana/codegen/codegen.js +122 -0
- package/lib/solana/codegen/codegen.js.map +1 -0
- package/lib/solana/codegen/index.d.ts +1 -0
- package/lib/solana/codegen/index.js +2 -0
- package/lib/solana/codegen/index.js.map +1 -0
- package/lib/solana/index.d.ts +4 -0
- package/lib/solana/index.js +5 -0
- package/lib/solana/index.js.map +1 -0
- package/lib/solana/run-codegen.d.ts +2 -0
- package/lib/solana/run-codegen.js +12 -0
- package/lib/solana/run-codegen.js.map +1 -0
- package/lib/solana/solana-context.d.ts +9 -0
- package/lib/solana/solana-context.js +28 -0
- package/lib/solana/solana-context.js.map +1 -0
- package/lib/solana/solana-options.d.ts +10 -0
- package/lib/solana/solana-options.js +10 -0
- package/lib/solana/solana-options.js.map +1 -0
- package/lib/solana/solana-plugin.d.ts +9 -0
- package/lib/solana/solana-plugin.js +87 -0
- package/lib/solana/solana-plugin.js.map +1 -0
- package/lib/solana/solana-processor.d.ts +43 -0
- package/lib/solana/solana-processor.js +72 -0
- package/lib/solana/solana-processor.js.map +1 -0
- package/lib/solana/tests/solana.test.d.ts +1 -0
- package/lib/solana/tests/solana.test.js.map +1 -0
- package/lib/solana/tests/types/basic_1.d.ts +26 -0
- package/lib/solana/tests/types/basic_1.js +63 -0
- package/lib/solana/tests/types/basic_1.js.map +1 -0
- package/lib/solana/tests/types/basic_1_processor.d.ts +21 -0
- package/lib/solana/tests/types/basic_1_processor.js +35 -0
- package/lib/solana/tests/types/basic_1_processor.js.map +1 -0
- package/lib/solana/tests/types/token_bridge.d.ts +29 -0
- package/lib/solana/tests/types/token_bridge.js +938 -0
- package/lib/solana/tests/types/token_bridge.js.map +1 -0
- package/lib/solana/tests/types/token_bridge_processor.d.ts +212 -0
- package/lib/solana/tests/types/token_bridge_processor.js +134 -0
- package/lib/solana/tests/types/token_bridge_processor.js.map +1 -0
- package/lib/solana/tests/wormhole-token-bridge.d.ts +15 -0
- package/lib/solana/tests/wormhole-token-bridge.js +79 -0
- package/lib/solana/tests/wormhole-token-bridge.js.map +1 -0
- package/lib/testing/index.d.ts +3 -2
- package/lib/testing/index.js +3 -10
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/metric-utils.d.ts +1 -1
- package/lib/testing/metric-utils.js +7 -13
- package/lib/testing/metric-utils.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +3 -4
- package/lib/testing/test-processor-server.js +24 -29
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/testing/test-provider.js +5 -9
- package/lib/testing/test-provider.js.map +1 -1
- package/lib/tsup.config.ts +31 -0
- package/lib/utils/conversion.d.ts +0 -5
- package/lib/utils/conversion.js +22 -27
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/dex-price.js +14 -19
- package/lib/utils/dex-price.js.map +1 -1
- package/lib/utils/dex-price.test.js.map +1 -1
- package/lib/utils/erc20.test.js.map +1 -1
- package/lib/utils/index.d.ts +3 -4
- package/lib/utils/index.js +3 -8
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/price.d.ts +11 -11
- package/lib/utils/price.js +10 -16
- package/lib/utils/price.js.map +1 -1
- package/lib/utils/token.d.ts +1 -2
- package/lib/utils/token.js +23 -40
- package/lib/utils/token.js.map +1 -1
- package/package.json +51 -23
- package/src/aptos/abis/0x1.json +9205 -0
- package/src/aptos/abis/0x3.json +1515 -0
- package/src/aptos/api.ts +23 -0
- package/src/aptos/aptos-plugin.ts +183 -0
- package/src/aptos/aptos-processor.ts +331 -0
- package/src/aptos/builtin/0x1.ts +4685 -0
- package/src/aptos/builtin/0x3.ts +1010 -0
- package/src/{builtin/weth9 → aptos/builtin}/index.ts +2 -3
- package/src/aptos/codegen/codegen.ts +457 -0
- package/src/aptos/codegen/index.ts +1 -0
- package/src/aptos/codegen/tsconfig.json +8 -0
- package/src/aptos/codegen/typegen.ts +165 -0
- package/src/aptos/context.ts +72 -0
- package/src/aptos/index.ts +10 -0
- package/src/aptos/models.ts +35 -0
- package/src/aptos/move-coder.ts +199 -0
- package/src/aptos/move-types.ts +11 -0
- package/src/aptos/network.ts +29 -0
- package/src/aptos/run-codegen.ts +13 -0
- package/src/aptos/tests/abis/reserved.json +402 -0
- package/src/aptos/tests/abis/soffl3.json +1411 -0
- package/src/aptos/tests/abis/souffle.json +389 -0
- package/src/aptos/tests/souffl3.ts +57 -0
- package/src/aptos/tests/types/index.ts +6 -0
- package/src/aptos/tests/types/reserved.ts +781 -0
- package/src/aptos/tests/types/soffl3.ts +1567 -0
- package/src/aptos/tests/types/souffle.ts +780 -0
- package/src/aptos/types.ts +149 -0
- package/src/aptos/utils.ts +26 -0
- package/src/core/base-context.ts +4 -4
- package/src/core/big-decimal.ts +11 -0
- package/src/{utils → core}/chain.ts +0 -0
- package/src/core/core-plugin.ts +3 -3
- package/src/core/event-tracker.ts +2 -2
- package/src/core/exporter.ts +3 -3
- package/src/core/index.ts +10 -10
- package/src/core/logger.ts +2 -2
- package/src/core/metadata.ts +23 -2
- package/src/core/meter.ts +3 -26
- package/src/core/numberish.ts +1 -12
- package/src/core/sui-plugin.ts +2 -2
- package/src/core/sui-processor.ts +1 -1
- package/src/{abis → eth/abis}/EACAggregatorProxy.json +0 -0
- package/src/{abis → eth/abis}/ERC1155.json +0 -0
- package/src/{abis → eth/abis}/ERC20.json +0 -0
- package/src/{abis → eth/abis}/ERC20Bytes.json +0 -0
- package/src/{abis → eth/abis}/ERC721.json +0 -0
- package/src/{abis → eth/abis}/WETH9.json +0 -0
- package/src/eth/account-processor-state.ts +1 -1
- package/src/eth/account-processor.ts +11 -11
- package/src/eth/base-processor-template.ts +8 -7
- package/src/eth/base-processor.ts +12 -22
- package/src/{core → eth}/bind-options.ts +0 -0
- package/src/eth/binds.ts +3 -3
- package/src/eth/builtin/eacaggregatorproxy/index.ts +7 -0
- package/src/{builtin → eth/builtin}/eacaggregatorproxy/test-utils.ts +1 -1
- package/src/eth/builtin/erc1155/index.ts +7 -0
- package/src/{builtin → eth/builtin}/erc1155/test-utils.ts +1 -1
- package/src/eth/builtin/erc20/index.ts +7 -0
- package/src/{builtin → eth/builtin}/erc20/test-utils.ts +1 -1
- package/src/eth/builtin/erc20bytes/index.ts +7 -0
- package/src/{builtin → eth/builtin}/erc20bytes/test-utils.ts +1 -1
- package/src/eth/builtin/erc721/index.ts +7 -0
- package/src/{builtin → eth/builtin}/erc721/test-utils.ts +1 -1
- package/src/eth/builtin/index.ts +8 -0
- package/src/{builtin → eth/builtin}/internal/EACAggregatorProxy.ts +6 -10
- package/src/{builtin → eth/builtin}/internal/ERC1155.ts +6 -10
- package/src/{builtin → eth/builtin}/internal/ERC20.ts +5 -8
- package/src/{builtin → eth/builtin}/internal/ERC20Bytes.ts +4 -6
- package/src/{builtin → eth/builtin}/internal/ERC721.ts +5 -8
- package/src/{builtin → eth/builtin}/internal/WETH9.ts +6 -10
- package/src/eth/builtin/internal/common.ts +22 -0
- package/src/{builtin → eth/builtin}/internal/eacaggregatorproxy_processor.ts +93 -165
- package/src/{builtin → eth/builtin}/internal/erc1155_processor.ts +28 -52
- package/src/{builtin → eth/builtin}/internal/erc20_processor.ts +43 -75
- package/src/{builtin → eth/builtin}/internal/erc20bytes_processor.ts +33 -57
- package/src/{builtin → eth/builtin}/internal/erc721_processor.ts +48 -84
- package/src/{builtin → eth/builtin}/internal/factories/EACAggregatorProxy__factory.ts +1 -1
- package/src/{builtin → eth/builtin}/internal/factories/ERC1155__factory.ts +1 -1
- package/src/{builtin → eth/builtin}/internal/factories/ERC20Bytes__factory.ts +1 -1
- package/src/{builtin → eth/builtin}/internal/factories/ERC20__factory.ts +1 -1
- package/src/{builtin → eth/builtin}/internal/factories/ERC721__factory.ts +1 -1
- package/src/{builtin → eth/builtin}/internal/factories/WETH9__factory.ts +1 -1
- package/src/eth/builtin/internal/factories/index.ts +9 -0
- package/src/eth/builtin/internal/index.ts +16 -0
- package/src/{builtin → eth/builtin}/internal/weth9_processor.ts +33 -57
- package/src/eth/builtin/weth9/index.ts +7 -0
- package/src/{builtin → eth/builtin}/weth9/test-utils.ts +1 -1
- package/src/eth/codegen/codegen.ts +62 -0
- package/src/{target-ethers-sentio/index.ts → eth/codegen/ethers-sentio.ts} +5 -2
- package/src/{target-ethers-sentio → eth/codegen}/event-handler.ts +2 -2
- package/src/{target-ethers-sentio → eth/codegen}/file.ts +13 -12
- package/src/{target-ethers-sentio → eth/codegen}/functions-handler.ts +4 -5
- package/src/eth/codegen/index.ts +1 -0
- package/src/eth/codegen/tsconfig.json +8 -0
- package/src/{target-ethers-sentio → eth/codegen}/types.ts +1 -1
- package/src/{target-ethers-sentio → eth/codegen}/view-function.ts +7 -12
- package/src/{core → eth}/context.ts +5 -6
- package/src/eth/error.ts +4 -0
- package/src/eth/eth-plugin.ts +3 -3
- package/src/eth/eth.ts +56 -0
- package/src/eth/generic-processor.ts +5 -5
- package/src/eth/index.ts +12 -6
- package/src/eth/provider.ts +4 -3
- package/src/eth/run-codegen.ts +12 -0
- package/src/index.ts +2 -9
- package/src/jest.config.ts +8 -0
- package/src/solana/builtin/index.ts +1 -0
- package/src/solana/builtin/spl-token-processor.ts +298 -0
- package/src/solana/builtin/types.ts +279 -0
- package/src/solana/codegen/codegen.ts +140 -0
- package/src/solana/codegen/index.ts +1 -0
- package/src/solana/codegen/tsconfig.json +8 -0
- package/src/solana/index.ts +4 -0
- package/src/solana/run-codegen.ts +13 -0
- package/src/solana/solana-context.ts +30 -0
- package/src/solana/solana-options.ts +11 -0
- package/src/solana/solana-plugin.ts +103 -0
- package/src/solana/solana-processor.ts +102 -0
- package/src/solana/tests/abis/basic_1.json +62 -0
- package/src/solana/tests/abis/token_bridge.json +937 -0
- package/src/solana/tests/types/basic_1.ts +62 -0
- package/src/solana/tests/types/basic_1_processor.ts +42 -0
- package/src/solana/tests/types/token_bridge.ts +937 -0
- package/src/solana/tests/types/token_bridge_processor.ts +150 -0
- package/src/solana/tests/wormhole-token-bridge.ts +96 -0
- package/src/testing/index.ts +3 -3
- package/src/testing/metric-utils.ts +2 -2
- package/src/testing/test-processor-server.ts +5 -5
- package/src/testing/test-provider.ts +1 -1
- package/src/tsup.config.ts +31 -0
- package/src/utils/conversion.ts +21 -25
- package/src/utils/dex-price.ts +4 -5
- package/src/utils/index.ts +3 -4
- package/src/utils/price.ts +1 -1
- package/src/utils/token.ts +20 -31
- package/lib/builtin/eacaggregatorproxy/index.d.ts +0 -2
- package/lib/builtin/eacaggregatorproxy/index.js +0 -9
- package/lib/builtin/eacaggregatorproxy/index.js.map +0 -1
- package/lib/builtin/eacaggregatorproxy/test-utils.js.map +0 -1
- package/lib/builtin/erc1155/index.d.ts +0 -2
- package/lib/builtin/erc1155/index.js +0 -9
- package/lib/builtin/erc1155/index.js.map +0 -1
- package/lib/builtin/erc1155/test-utils.js.map +0 -1
- package/lib/builtin/erc20/index.d.ts +0 -2
- package/lib/builtin/erc20/index.js +0 -9
- package/lib/builtin/erc20/index.js.map +0 -1
- package/lib/builtin/erc20/test-utils.js.map +0 -1
- package/lib/builtin/erc20bytes/index.d.ts +0 -2
- package/lib/builtin/erc20bytes/index.js +0 -9
- package/lib/builtin/erc20bytes/index.js.map +0 -1
- package/lib/builtin/erc20bytes/test-utils.js.map +0 -1
- package/lib/builtin/erc721/index.d.ts +0 -2
- package/lib/builtin/erc721/index.js +0 -9
- package/lib/builtin/erc721/index.js.map +0 -1
- package/lib/builtin/erc721/test-utils.js.map +0 -1
- package/lib/builtin/index.d.ts +0 -4
- package/lib/builtin/index.js +0 -9
- package/lib/builtin/index.js.map +0 -1
- package/lib/builtin/internal/EACAggregatorProxy.js +0 -3
- package/lib/builtin/internal/EACAggregatorProxy.js.map +0 -1
- package/lib/builtin/internal/ERC1155.js +0 -3
- package/lib/builtin/internal/ERC1155.js.map +0 -1
- package/lib/builtin/internal/ERC20.js +0 -3
- package/lib/builtin/internal/ERC20.js.map +0 -1
- package/lib/builtin/internal/ERC20Bytes.js +0 -3
- package/lib/builtin/internal/ERC20Bytes.js.map +0 -1
- package/lib/builtin/internal/ERC721.js +0 -3
- package/lib/builtin/internal/ERC721.js.map +0 -1
- package/lib/builtin/internal/WETH9.js +0 -3
- package/lib/builtin/internal/WETH9.js.map +0 -1
- package/lib/builtin/internal/common.js.map +0 -1
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +0 -1
- package/lib/builtin/internal/erc1155_processor.js.map +0 -1
- package/lib/builtin/internal/erc20_processor.js.map +0 -1
- package/lib/builtin/internal/erc20bytes_processor.js.map +0 -1
- package/lib/builtin/internal/erc721_processor.js.map +0 -1
- package/lib/builtin/internal/factories/EACAggregatorProxy__factory.js.map +0 -1
- package/lib/builtin/internal/factories/ERC1155__factory.js.map +0 -1
- package/lib/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
- package/lib/builtin/internal/factories/ERC20__factory.js.map +0 -1
- package/lib/builtin/internal/factories/ERC721__factory.js.map +0 -1
- package/lib/builtin/internal/factories/WETH9__factory.js.map +0 -1
- package/lib/builtin/internal/factories/index.d.ts +0 -6
- package/lib/builtin/internal/factories/index.js +0 -19
- package/lib/builtin/internal/factories/index.js.map +0 -1
- package/lib/builtin/internal/index.d.ts +0 -13
- package/lib/builtin/internal/index.js +0 -18
- package/lib/builtin/internal/index.js.map +0 -1
- package/lib/builtin/internal/weth9_processor.js.map +0 -1
- package/lib/builtin/weth9/index.d.ts +0 -2
- package/lib/builtin/weth9/index.js +0 -9
- package/lib/builtin/weth9/index.js.map +0 -1
- package/lib/builtin/weth9/test-utils.js.map +0 -1
- package/lib/core/bind-options.js +0 -47
- package/lib/core/bind-options.js.map +0 -1
- package/lib/core/context.js.map +0 -1
- package/lib/core/generic-processor.test.js.map +0 -1
- package/lib/error.d.ts +0 -7
- package/lib/error.js +0 -43
- package/lib/error.js.map +0 -1
- package/lib/target-ethers-sentio/event-handler.js +0 -52
- package/lib/target-ethers-sentio/event-handler.js.map +0 -1
- package/lib/target-ethers-sentio/file.js.map +0 -1
- package/lib/target-ethers-sentio/functions-handler.js.map +0 -1
- package/lib/target-ethers-sentio/index.js +0 -58
- package/lib/target-ethers-sentio/index.js.map +0 -1
- package/lib/target-ethers-sentio/types.js.map +0 -1
- package/lib/target-ethers-sentio/view-function.js +0 -74
- package/lib/target-ethers-sentio/view-function.js.map +0 -1
- package/lib/utils/chain.js.map +0 -1
- package/lib/webpack.config.js +0 -50
- package/src/builtin/eacaggregatorproxy/index.ts +0 -6
- package/src/builtin/erc1155/index.ts +0 -6
- package/src/builtin/erc20/index.ts +0 -6
- package/src/builtin/erc20bytes/index.ts +0 -6
- package/src/builtin/erc721/index.ts +0 -6
- package/src/builtin/index.ts +0 -4
- package/src/builtin/internal/common.ts +0 -46
- package/src/builtin/internal/factories/index.ts +0 -9
- package/src/builtin/internal/index.ts +0 -16
- package/src/error.ts +0 -45
- package/src/target-ethers-sentio/.eslintrc.json +0 -14
- package/src/target-ethers-sentio/tsconfig.json +0 -9
- package/src/webpack.config.js +0 -50
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
export { EACAggregatorProxy__factory } from "./EACAggregatorProxy__factory.js";
|
|
5
|
+
export { ERC1155__factory } from "./ERC1155__factory.js";
|
|
6
|
+
export { ERC20__factory } from "./ERC20__factory.js";
|
|
7
|
+
export { ERC20Bytes__factory } from "./ERC20Bytes__factory.js";
|
|
8
|
+
export { ERC721__factory } from "./ERC721__factory.js";
|
|
9
|
+
export { WETH9__factory } from "./WETH9__factory.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
export type { EACAggregatorProxy } from "./EACAggregatorProxy.js";
|
|
5
|
+
export type { ERC1155 } from "./ERC1155.js";
|
|
6
|
+
export type { ERC20 } from "./ERC20.js";
|
|
7
|
+
export type { ERC20Bytes } from "./ERC20Bytes.js";
|
|
8
|
+
export type { ERC721 } from "./ERC721.js";
|
|
9
|
+
export type { WETH9 } from "./WETH9.js";
|
|
10
|
+
export * as factories from "./factories/index.js";
|
|
11
|
+
export { EACAggregatorProxy__factory } from "./factories/EACAggregatorProxy__factory.js";
|
|
12
|
+
export { ERC1155__factory } from "./factories/ERC1155__factory.js";
|
|
13
|
+
export { ERC20__factory } from "./factories/ERC20__factory.js";
|
|
14
|
+
export { ERC20Bytes__factory } from "./factories/ERC20Bytes__factory.js";
|
|
15
|
+
export { ERC721__factory } from "./factories/ERC721__factory.js";
|
|
16
|
+
export { WETH9__factory } from "./factories/WETH9__factory.js";
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
DummyProvider,
|
|
21
21
|
TypedCallTrace,
|
|
22
22
|
toBlockTag,
|
|
23
|
-
} from "@sentio/sdk";
|
|
23
|
+
} from "@sentio/sdk/eth";
|
|
24
24
|
import { EthFetchConfig } from "@sentio/protos";
|
|
25
25
|
|
|
26
|
-
import { WETH9, WETH9__factory } from "./index";
|
|
26
|
+
import { WETH9, WETH9__factory } from "./index.js";
|
|
27
27
|
import {
|
|
28
28
|
ApprovalEvent,
|
|
29
29
|
ApprovalEventFilter,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
DepositEventFilter,
|
|
34
34
|
WithdrawalEvent,
|
|
35
35
|
WithdrawalEventFilter,
|
|
36
|
-
} from "./WETH9";
|
|
36
|
+
} from "./WETH9.js";
|
|
37
37
|
|
|
38
38
|
export interface NameCallObject {}
|
|
39
39
|
|
|
@@ -182,68 +182,48 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
182
182
|
WETH9ContractView
|
|
183
183
|
> {
|
|
184
184
|
async name(overrides?: Overrides): Promise<string> {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
return await this.view.name(overrides || {});
|
|
192
|
-
} catch (e) {
|
|
193
|
-
throw transformEtherError(e, this.context);
|
|
185
|
+
if (!overrides && this.context) {
|
|
186
|
+
overrides = {
|
|
187
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
188
|
+
};
|
|
194
189
|
}
|
|
190
|
+
return await this.view.name(overrides || {});
|
|
195
191
|
}
|
|
196
192
|
|
|
197
193
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return await this.view.totalSupply(overrides || {});
|
|
205
|
-
} catch (e) {
|
|
206
|
-
throw transformEtherError(e, this.context);
|
|
194
|
+
if (!overrides && this.context) {
|
|
195
|
+
overrides = {
|
|
196
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
197
|
+
};
|
|
207
198
|
}
|
|
199
|
+
return await this.view.totalSupply(overrides || {});
|
|
208
200
|
}
|
|
209
201
|
|
|
210
202
|
async decimals(overrides?: Overrides): Promise<bigint> {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
return await this.view.decimals(overrides || {});
|
|
218
|
-
} catch (e) {
|
|
219
|
-
throw transformEtherError(e, this.context);
|
|
203
|
+
if (!overrides && this.context) {
|
|
204
|
+
overrides = {
|
|
205
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
206
|
+
};
|
|
220
207
|
}
|
|
208
|
+
return await this.view.decimals(overrides || {});
|
|
221
209
|
}
|
|
222
210
|
|
|
223
211
|
async balanceOf(arg0: string, overrides?: Overrides): Promise<bigint> {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return await this.view.balanceOf(arg0, overrides || {});
|
|
231
|
-
} catch (e) {
|
|
232
|
-
throw transformEtherError(e, this.context);
|
|
212
|
+
if (!overrides && this.context) {
|
|
213
|
+
overrides = {
|
|
214
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
215
|
+
};
|
|
233
216
|
}
|
|
217
|
+
return await this.view.balanceOf(arg0, overrides || {});
|
|
234
218
|
}
|
|
235
219
|
|
|
236
220
|
async symbol(overrides?: Overrides): Promise<string> {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
return await this.view.symbol(overrides || {});
|
|
244
|
-
} catch (e) {
|
|
245
|
-
throw transformEtherError(e, this.context);
|
|
221
|
+
if (!overrides && this.context) {
|
|
222
|
+
overrides = {
|
|
223
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
224
|
+
};
|
|
246
225
|
}
|
|
226
|
+
return await this.view.symbol(overrides || {});
|
|
247
227
|
}
|
|
248
228
|
|
|
249
229
|
async allowance(
|
|
@@ -251,16 +231,12 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
251
231
|
arg1: string,
|
|
252
232
|
overrides?: Overrides
|
|
253
233
|
): Promise<bigint> {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
return await this.view.allowance(arg0, arg1, overrides || {});
|
|
261
|
-
} catch (e) {
|
|
262
|
-
throw transformEtherError(e, this.context);
|
|
234
|
+
if (!overrides && this.context) {
|
|
235
|
+
overrides = {
|
|
236
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
237
|
+
};
|
|
263
238
|
}
|
|
239
|
+
return await this.view.allowance(arg0, arg1, overrides || {});
|
|
264
240
|
}
|
|
265
241
|
}
|
|
266
242
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { loadFileDescriptions, processOutput, skipEmptyAbis } from 'typechain/dist/typechain/io.js'
|
|
2
|
+
import * as fs from 'fs'
|
|
3
|
+
import { Config, DEFAULT_FLAGS, Services } from 'typechain'
|
|
4
|
+
import EthersSentio from './ethers-sentio.js'
|
|
5
|
+
import * as prettier from 'prettier'
|
|
6
|
+
import path from 'path'
|
|
7
|
+
import mkdirp from 'mkdirp'
|
|
8
|
+
|
|
9
|
+
export async function codegen(abisDir: string, outDir: string) {
|
|
10
|
+
if (!fs.existsSync(abisDir)) {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
console.log('Generated', await codegenInternal(abisDir, outDir), 'files')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function codegenInternal(abisDir: string, outDir: string): Promise<number> {
|
|
17
|
+
let allFiles = fs.readdirSync(abisDir)
|
|
18
|
+
if (allFiles.length === 0) {
|
|
19
|
+
return 0
|
|
20
|
+
}
|
|
21
|
+
allFiles = allFiles.map((f) => path.resolve(abisDir, f))
|
|
22
|
+
|
|
23
|
+
allFiles = skipEmptyAbis(allFiles)
|
|
24
|
+
if (allFiles.length === 0) {
|
|
25
|
+
return 0
|
|
26
|
+
}
|
|
27
|
+
const outInternal = path.resolve(outDir, 'internal')
|
|
28
|
+
if (!fs.existsSync(outInternal)) {
|
|
29
|
+
fs.mkdirSync(outInternal, { recursive: true })
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// skip empty paths
|
|
33
|
+
const config: Config = {
|
|
34
|
+
cwd: process.cwd(),
|
|
35
|
+
flags: DEFAULT_FLAGS,
|
|
36
|
+
inputDir: abisDir,
|
|
37
|
+
target: '',
|
|
38
|
+
outDir: outInternal,
|
|
39
|
+
allFiles: allFiles,
|
|
40
|
+
filesToProcess: allFiles,
|
|
41
|
+
}
|
|
42
|
+
const services: Services = {
|
|
43
|
+
fs,
|
|
44
|
+
prettier,
|
|
45
|
+
mkdirp: mkdirp.sync,
|
|
46
|
+
}
|
|
47
|
+
let filesGenerated = 0
|
|
48
|
+
|
|
49
|
+
const target = new EthersSentio(config)
|
|
50
|
+
|
|
51
|
+
const fileDescriptions = loadFileDescriptions(services, config.filesToProcess)
|
|
52
|
+
|
|
53
|
+
filesGenerated += processOutput(services, config, await target.beforeRun())
|
|
54
|
+
|
|
55
|
+
for (const fd of fileDescriptions) {
|
|
56
|
+
filesGenerated += processOutput(services, config, await target.transformFile(fd))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
filesGenerated += processOutput(services, config, target.afterRun())
|
|
60
|
+
|
|
61
|
+
return filesGenerated
|
|
62
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Ethers from '@sentio/ethers-v6'
|
|
2
2
|
import { Config, extractAbi, extractDocumentation, FileDescription, parse, shortenFullJsonFilePath } from 'typechain'
|
|
3
3
|
import { dirname, join, relative } from 'path'
|
|
4
|
-
import { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file'
|
|
4
|
+
import { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file.js'
|
|
5
5
|
|
|
6
|
-
export default class EthersSentio extends Ethers {
|
|
6
|
+
export default class EthersSentio extends Ethers.default {
|
|
7
7
|
constructor(config: Config) {
|
|
8
8
|
if (!config.outDir) {
|
|
9
9
|
throw new Error('Out put path not specificed')
|
|
@@ -54,6 +54,9 @@ export default class EthersSentio extends Ethers {
|
|
|
54
54
|
if (file.path.endsWith('__factory.ts')) {
|
|
55
55
|
file.contents = '// @ts-nocheck\n' + file.contents
|
|
56
56
|
}
|
|
57
|
+
if (file.path.endsWith('factories/index.ts')) {
|
|
58
|
+
file.contents = file.contents.replaceAll("__factory'", "__factory.js'")
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
return files
|
|
59
62
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventDeclaration, Contract, getFullSignatureAsSymbolForEvent } from 'typechain'
|
|
2
|
-
import { getFullSignatureForEventPatched } from './types'
|
|
3
|
-
import { generateEventInputs } from '@sentio/ethers-v6/dist/codegen/events'
|
|
2
|
+
import { getFullSignatureForEventPatched } from './types.js'
|
|
3
|
+
import { generateEventInputs } from '@sentio/ethers-v6/dist/codegen/events.js'
|
|
4
4
|
|
|
5
5
|
export function generateEventHandler(event: EventDeclaration, contractName: string, includeArgTypes: boolean): string {
|
|
6
6
|
const eventName = includeArgTypes ? getFullSignatureAsSymbolForEvent(event) : event.name
|
|
@@ -3,18 +3,19 @@ import {
|
|
|
3
3
|
createImportsForUsedIdentifiers,
|
|
4
4
|
EventDeclaration,
|
|
5
5
|
getFullSignatureAsSymbolForEvent,
|
|
6
|
+
getFullSignatureForEvent,
|
|
6
7
|
} from 'typechain'
|
|
7
8
|
|
|
8
|
-
import { reservedKeywords } from '@sentio/ethers-v6/dist/codegen/reserved-keywords'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { generateBoundViewFunctions, generateViewFunctions } from './view-function'
|
|
9
|
+
import { reservedKeywords } from '@sentio/ethers-v6/dist/codegen/reserved-keywords.js'
|
|
10
|
+
import { codegenCallTraceTypes, generateCallHandlers } from './functions-handler.js'
|
|
11
|
+
import { generateEventFilters, generateEventHandlers } from './event-handler.js'
|
|
12
|
+
import { generateBoundViewFunctions, generateViewFunctions } from './view-function.js'
|
|
13
13
|
|
|
14
14
|
export function codeGenIndex(contract: Contract): string {
|
|
15
15
|
return `
|
|
16
|
-
export * from '../internal/${contract.name.toLowerCase()}_processor'
|
|
17
|
-
export * from '../internal/${contract.name}'
|
|
16
|
+
export * from '../internal/${contract.name.toLowerCase()}_processor.js'
|
|
17
|
+
export * from '../internal/${contract.name}.js'
|
|
18
|
+
export * from './test-utils.js'
|
|
18
19
|
`
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -145,7 +146,7 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
|
145
146
|
{
|
|
146
147
|
ethers: ['BigNumberish', 'Overrides', 'BytesLike'],
|
|
147
148
|
'ethers/providers': ['Networkish'],
|
|
148
|
-
'@sentio/sdk': [
|
|
149
|
+
'@sentio/sdk/eth': [
|
|
149
150
|
'addContractByABI',
|
|
150
151
|
'getContractByABI',
|
|
151
152
|
'addProcessor',
|
|
@@ -164,9 +165,9 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
|
164
165
|
'toBlockTag',
|
|
165
166
|
],
|
|
166
167
|
'@sentio/protos': ['EthFetchConfig'],
|
|
167
|
-
'./common': ['PromiseOrValue'],
|
|
168
|
-
'./index': [`${contract.name}`, `${contract.name}__factory`],
|
|
169
|
-
[`./${contract.name}`]: eventsImports.concat(uniqueStructImports),
|
|
168
|
+
'./common.js': ['PromiseOrValue'],
|
|
169
|
+
'./index.js': [`${contract.name}`, `${contract.name}__factory`],
|
|
170
|
+
[`./${contract.name}.js`]: eventsImports.concat(uniqueStructImports),
|
|
170
171
|
},
|
|
171
172
|
source
|
|
172
173
|
)
|
|
@@ -200,7 +201,7 @@ export function codeGenTestUtilsFile(contract: Contract): string {
|
|
|
200
201
|
const imports = createImportsForUsedIdentifiers(
|
|
201
202
|
{
|
|
202
203
|
'ethers/providers': ['LogParams'],
|
|
203
|
-
'.': [
|
|
204
|
+
'./index.js': [
|
|
204
205
|
`get${contract.name}Contract`,
|
|
205
206
|
...Object.values(contract.events).flatMap((events) => {
|
|
206
207
|
if (events.length === 1) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateOutputComplexTypeAsArray,
|
|
3
3
|
generateOutputComplexTypesAsObject,
|
|
4
|
-
} from '@sentio/ethers-v6/dist/codegen/types'
|
|
5
|
-
import
|
|
4
|
+
} from '@sentio/ethers-v6/dist/codegen/types.js'
|
|
5
|
+
import sha3 from 'js-sha3'
|
|
6
6
|
import { FunctionDeclaration, getSignatureForFn } from 'typechain'
|
|
7
|
-
|
|
8
|
-
import { getFullSignatureAsSymbolForFunction } from './types'
|
|
7
|
+
import { getFullSignatureAsSymbolForFunction } from './types.js'
|
|
9
8
|
|
|
10
9
|
export function generateCallHandlers(fns: FunctionDeclaration[], contractName: string): string {
|
|
11
10
|
if (fns.length === 1) {
|
|
@@ -42,7 +41,7 @@ function generateCallHandler(fn: FunctionDeclaration, contractName: string, over
|
|
|
42
41
|
// utils.toUtf8Bytes(signature))
|
|
43
42
|
|
|
44
43
|
const test = new TextEncoder().encode(signature)
|
|
45
|
-
const sighash =
|
|
44
|
+
const sighash = '0x' + sha3.keccak_256(test).substring(0, 8)
|
|
46
45
|
|
|
47
46
|
return `
|
|
48
47
|
onCall${capitalizeFirstChar(overloadedName ?? fn.name)}(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './codegen.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventDeclaration, FunctionDeclaration } from 'typechain'
|
|
2
|
-
import { EvmType } from 'typechain/dist/parser/parseEvmType'
|
|
2
|
+
import { EvmType } from 'typechain/dist/parser/parseEvmType.js'
|
|
3
3
|
|
|
4
4
|
export function getFullSignatureAsSymbolForFunction(fn: FunctionDeclaration): string {
|
|
5
5
|
return `${fn.name}_${fn.inputs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// https://github.com/dethcrypto/TypeChain/blob/015abb28bd22826611051f27e0ec96a00f9a0b61/packages/target-ethers-v5/src/codegen/functions.ts#L54
|
|
2
2
|
import { FunctionDeclaration } from 'typechain'
|
|
3
|
-
import { generateInputTypes, generateOutputTypes } from '@sentio/ethers-v6/dist/codegen/types'
|
|
4
|
-
import { getFullSignatureAsSymbolForFunction, getFullSignatureForFunction } from './types'
|
|
3
|
+
import { generateInputTypes, generateOutputTypes } from '@sentio/ethers-v6/dist/codegen/types.js'
|
|
4
|
+
import { getFullSignatureAsSymbolForFunction, getFullSignatureForFunction } from './types.js'
|
|
5
5
|
|
|
6
6
|
function generateReturnTypes(fn: FunctionDeclaration) {
|
|
7
7
|
// sounds like returnResultObject should be true but we need to set false to make it work
|
|
@@ -60,19 +60,14 @@ export function generateBoundViewFunction(fn: FunctionDeclaration, includeArgTyp
|
|
|
60
60
|
async ${declName ?? fn.name}(${generateInputTypes(fn.inputs, {
|
|
61
61
|
useStructs: true,
|
|
62
62
|
})}overrides?: Overrides): ${generateReturnTypes(fn)} {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
blockTag: toBlockTag(this.context.blockNumber),
|
|
67
|
-
}
|
|
63
|
+
if (!overrides && this.context) {
|
|
64
|
+
overrides = {
|
|
65
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
68
66
|
}
|
|
69
|
-
|
|
67
|
+
}
|
|
68
|
+
return await this.view.${declName}(${
|
|
70
69
|
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
|
71
70
|
} overrides || {})
|
|
72
|
-
|
|
73
|
-
} catch (e) {
|
|
74
|
-
throw transformEtherError(e, this.context)
|
|
75
|
-
}
|
|
76
71
|
}
|
|
77
72
|
`
|
|
78
73
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { BaseContract, Transaction, TransactionReceipt, Block
|
|
1
|
+
import { BaseContract, Transaction, TransactionReceipt, Block } from 'ethers'
|
|
2
2
|
import { LogParams } from 'ethers/providers'
|
|
3
3
|
|
|
4
4
|
import { RecordMetaData } from '@sentio/protos'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { BaseContext } from './base-context'
|
|
5
|
+
import { Trace } from './trace.js'
|
|
6
|
+
import { Labels, normalizeLabels } from '../core/metadata.js'
|
|
7
|
+
import { CHAIN_IDS } from '../core/chain.js'
|
|
8
|
+
import { BaseContext } from '../core/base-context.js'
|
|
10
9
|
|
|
11
10
|
export abstract class EthContext extends BaseContext {
|
|
12
11
|
chainId: number
|
package/src/eth/error.ts
ADDED
package/src/eth/eth-plugin.ts
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
} from '@sentio/protos'
|
|
16
16
|
|
|
17
17
|
import { ServerError, Status } from 'nice-grpc'
|
|
18
|
-
import { ProcessorState } from './binds'
|
|
19
|
-
import { AccountProcessorState } from './account-processor-state'
|
|
20
|
-
import { ProcessorTemplateProcessorState, TemplateInstanceState } from './base-processor-template'
|
|
18
|
+
import { ProcessorState } from './binds.js'
|
|
19
|
+
import { AccountProcessorState } from './account-processor-state.js'
|
|
20
|
+
import { ProcessorTemplateProcessorState, TemplateInstanceState } from './base-processor-template.js'
|
|
21
21
|
|
|
22
22
|
export class EthPlugin extends Plugin {
|
|
23
23
|
name: string = 'EthPlugin'
|
package/src/eth/eth.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BlockTag, LogParams } from 'ethers/providers'
|
|
2
|
+
import { CallExceptionError, Result } from 'ethers'
|
|
3
|
+
import { ContractContext } from './context.js'
|
|
4
|
+
|
|
5
|
+
export interface EthLog<TArgsArray extends Array<any> = any, TArgsObject = any> extends LogParams {
|
|
6
|
+
args: TArgsArray & TArgsObject & Result
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function toBlockTag(a: number | bigint): BlockTag {
|
|
10
|
+
if (typeof a === 'number') {
|
|
11
|
+
return a
|
|
12
|
+
}
|
|
13
|
+
if (a > Number.MAX_SAFE_INTEGER) {
|
|
14
|
+
return '0x' + a.toString(16)
|
|
15
|
+
}
|
|
16
|
+
return Number(a)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class SimpleEthersError extends Error {
|
|
20
|
+
e: Error
|
|
21
|
+
|
|
22
|
+
constructor(message: string, e: Error) {
|
|
23
|
+
super(message)
|
|
24
|
+
this.stack = e.stack
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
toString() {
|
|
28
|
+
return this.message + '\n' + this.stack?.toString()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function transformEtherError(e: Error, ctx: ContractContext<any, any> | undefined): Error {
|
|
33
|
+
if (e instanceof SimpleEthersError) {
|
|
34
|
+
return e
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let msg = ''
|
|
38
|
+
const err = e as CallExceptionError
|
|
39
|
+
if (err.code === 'CALL_EXCEPTION') {
|
|
40
|
+
if (err.data === '0x') {
|
|
41
|
+
if (ctx) {
|
|
42
|
+
msg =
|
|
43
|
+
"jsonrpc eth_call return '0x' (likely contract not existed) at chain " +
|
|
44
|
+
ctx.chainId +
|
|
45
|
+
': ' +
|
|
46
|
+
JSON.stringify(e)
|
|
47
|
+
} else {
|
|
48
|
+
msg = "jsonrpc eth_call return '0x' (likely contract not existed): " + JSON.stringify(err)
|
|
49
|
+
}
|
|
50
|
+
return new SimpleEthersError(msg, err)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
msg = 'ethers call error\n' + JSON.stringify(e) + '\n' + e.stack?.toString()
|
|
55
|
+
return new Error(msg)
|
|
56
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseContract } from 'ethers'
|
|
2
|
-
import { BoundContractView, ContractView } from '
|
|
3
|
-
import { BindOptions } from '
|
|
4
|
-
import { BaseProcessor } from './base-processor'
|
|
5
|
-
import { getProvider } from './provider'
|
|
6
|
-
import { addProcessor } from './binds'
|
|
2
|
+
import { BoundContractView, ContractView } from './context.js'
|
|
3
|
+
import { BindOptions } from './bind-options.js'
|
|
4
|
+
import { BaseProcessor } from './base-processor.js'
|
|
5
|
+
import { getProvider } from './provider.js'
|
|
6
|
+
import { addProcessor } from './binds.js'
|
|
7
7
|
|
|
8
8
|
export class GenericProcessor extends BaseProcessor<
|
|
9
9
|
BaseContract,
|
package/src/eth/index.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
export { BaseProcessor } from './base-processor'
|
|
2
|
-
export { GenericProcessor } from './generic-processor'
|
|
3
|
-
export { BaseProcessorTemplate } from './base-processor-template'
|
|
4
|
-
export { getProvider, DummyProvider } from './provider'
|
|
5
|
-
export type { TypedCallTrace, Trace } from './trace'
|
|
6
|
-
export
|
|
1
|
+
export { BaseProcessor } from './base-processor.js'
|
|
2
|
+
export { GenericProcessor } from './generic-processor.js'
|
|
3
|
+
export { BaseProcessorTemplate } from './base-processor-template.js'
|
|
4
|
+
export { getProvider, DummyProvider } from './provider.js'
|
|
5
|
+
export type { TypedCallTrace, Trace } from './trace.js'
|
|
6
|
+
export * from './eth.js'
|
|
7
|
+
export * from './error.js'
|
|
8
|
+
export { BindOptions, AccountBindOptions } from './bind-options.js'
|
|
9
|
+
export { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds.js'
|
|
10
|
+
export { ContractContext, ContractView, BoundContractView } from './context.js'
|
|
11
|
+
|
|
12
|
+
export { EthPlugin } from './eth-plugin.js'
|
package/src/eth/provider.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function getProvider(networkish?: Networkish): Provider {
|
|
|
31
31
|
[...Endpoints.INSTANCE.chainServer.keys()].join(' ')
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
|
-
provider = new QueuedStaticJsonRpcProvider(address, network, Endpoints.INSTANCE.concurrency)
|
|
34
|
+
provider = new QueuedStaticJsonRpcProvider(address, Network.from(network), Endpoints.INSTANCE.concurrency)
|
|
35
35
|
providers.set(network.chainId.toString(), provider)
|
|
36
36
|
return provider
|
|
37
37
|
}
|
|
@@ -71,8 +71,9 @@ export function getProvider(networkish?: Networkish): Provider {
|
|
|
71
71
|
class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
|
|
72
72
|
executor: PQueue
|
|
73
73
|
|
|
74
|
-
constructor(url: string, network:
|
|
75
|
-
|
|
74
|
+
constructor(url: string, network: Network, concurrency: number) {
|
|
75
|
+
// TODO re-enable match when possible
|
|
76
|
+
super(url, network, { staticNetwork: network, batchMaxCount: 1 })
|
|
76
77
|
this.executor = new PQueue({ concurrency: concurrency })
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { codegen } from './codegen/index.js'
|
|
4
|
+
|
|
5
|
+
if (process.argv.length > 3) {
|
|
6
|
+
const abisDir = process.argv[2]
|
|
7
|
+
const targetDir = process.argv[3]
|
|
8
|
+
await codegen(abisDir, targetDir)
|
|
9
|
+
} else {
|
|
10
|
+
console.error('Not enough argument')
|
|
11
|
+
process.exit(1)
|
|
12
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
export { transformEtherError, EthersError } from './error'
|
|
2
|
-
|
|
3
|
-
export { getProcessor, addProcessor, getContractByABI, addContractByABI } from './eth/binds'
|
|
4
|
-
|
|
5
|
-
// TODO maybe remove this
|
|
6
1
|
export * from '@sentio/protos'
|
|
7
2
|
|
|
8
|
-
export * from './core'
|
|
9
|
-
export * from './eth'
|
|
3
|
+
export * from './core/index.js'
|
|
10
4
|
|
|
11
|
-
export * from './
|
|
12
|
-
// export * from './api'
|
|
5
|
+
export * from './core/chain.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spl-token-processor.js'
|