@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,149 @@
|
|
|
1
|
+
import { SPLITTER, VECTOR_STR } from './utils.js'
|
|
2
|
+
|
|
3
|
+
export class TypeDescriptor {
|
|
4
|
+
// type: string
|
|
5
|
+
|
|
6
|
+
// qualified name without type parameters
|
|
7
|
+
qname: string
|
|
8
|
+
// account?: string
|
|
9
|
+
// module?: string
|
|
10
|
+
|
|
11
|
+
typeArgs: TypeDescriptor[]
|
|
12
|
+
|
|
13
|
+
constructor(symbol: string, typeParams?: TypeDescriptor[]) {
|
|
14
|
+
this.qname = symbol
|
|
15
|
+
this.typeArgs = typeParams || []
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getSignature(): string {
|
|
19
|
+
if (this.typeArgs.length > 0) {
|
|
20
|
+
return this.qname + '<' + this.typeArgs.map((t) => t.getSignature()).join(', ') + '>'
|
|
21
|
+
}
|
|
22
|
+
return this.qname
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Replace T0, T1 with more concrete type
|
|
26
|
+
applyTypeArgs(ctx: Map<string, TypeDescriptor>): TypeDescriptor {
|
|
27
|
+
const replace = ctx.get(this.qname)
|
|
28
|
+
if (replace) {
|
|
29
|
+
return replace
|
|
30
|
+
}
|
|
31
|
+
if (ctx.size === 0 || this.typeArgs.length === 0) {
|
|
32
|
+
return this
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const typeArgs: TypeDescriptor[] = []
|
|
36
|
+
for (const arg of this.typeArgs) {
|
|
37
|
+
const replace = ctx.get(arg.qname)
|
|
38
|
+
if (replace) {
|
|
39
|
+
typeArgs.push(replace)
|
|
40
|
+
} else {
|
|
41
|
+
typeArgs.push(arg.applyTypeArgs(ctx))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return new TypeDescriptor(this.qname, typeArgs)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// all depended types including itself, not include system type
|
|
48
|
+
dependedTypes(): string[] {
|
|
49
|
+
if (this.qname.startsWith('&')) {
|
|
50
|
+
return []
|
|
51
|
+
}
|
|
52
|
+
switch (this.qname) {
|
|
53
|
+
case 'signer':
|
|
54
|
+
case 'address':
|
|
55
|
+
case '0x1::string::String':
|
|
56
|
+
case 'bool':
|
|
57
|
+
case 'u8':
|
|
58
|
+
case 'u16':
|
|
59
|
+
case 'u32':
|
|
60
|
+
case 'u64':
|
|
61
|
+
case 'u128':
|
|
62
|
+
return []
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Type parameters are not depended
|
|
66
|
+
if (this.qname.indexOf(SPLITTER) == -1) {
|
|
67
|
+
if (this.qname.startsWith('T')) {
|
|
68
|
+
return []
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const types = new Set<string>()
|
|
73
|
+
for (const param of this.typeArgs) {
|
|
74
|
+
param.dependedTypes().forEach((t) => types.add(t))
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (this.qname !== VECTOR_STR) {
|
|
78
|
+
types.add(this.qname)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return Array.from(types)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function parseMoveType(type: string): TypeDescriptor {
|
|
86
|
+
// type = type.replace('&', '')
|
|
87
|
+
|
|
88
|
+
type = type.replaceAll('&mut ', '&')
|
|
89
|
+
type = type.replaceAll('mut ', '')
|
|
90
|
+
|
|
91
|
+
// TODO replace ' ' is not exactly safe, need to double check this
|
|
92
|
+
type = type.replaceAll(' ', '')
|
|
93
|
+
|
|
94
|
+
const stack: TypeDescriptor[] = [new TypeDescriptor('')]
|
|
95
|
+
let buffer = []
|
|
96
|
+
|
|
97
|
+
// xxx:asdf<g1<a,<c,d>>, b, g2<a,b>, e>
|
|
98
|
+
for (let i = 0; i < type.length; i++) {
|
|
99
|
+
const ch = type[i]
|
|
100
|
+
if (ch === '<') {
|
|
101
|
+
// const symbol = type.slice(symbolStart, i)
|
|
102
|
+
// symbolStart =
|
|
103
|
+
const symbol = buffer.join('')
|
|
104
|
+
buffer = []
|
|
105
|
+
stack[stack.length - 1].qname = symbol
|
|
106
|
+
stack.push(new TypeDescriptor(''))
|
|
107
|
+
continue
|
|
108
|
+
}
|
|
109
|
+
if (ch === '>') {
|
|
110
|
+
const typeParam = stack.pop()
|
|
111
|
+
if (!typeParam) {
|
|
112
|
+
throw Error('Uxpectecd stack size')
|
|
113
|
+
}
|
|
114
|
+
if (buffer.length > 0) {
|
|
115
|
+
typeParam.qname = buffer.join('')
|
|
116
|
+
buffer = []
|
|
117
|
+
}
|
|
118
|
+
stack[stack.length - 1].typeArgs.push(typeParam)
|
|
119
|
+
continue
|
|
120
|
+
}
|
|
121
|
+
if (ch === ',') {
|
|
122
|
+
const typeParam = stack.pop()
|
|
123
|
+
if (!typeParam) {
|
|
124
|
+
throw Error('Uxpectecd stack size')
|
|
125
|
+
}
|
|
126
|
+
if (buffer.length > 0) {
|
|
127
|
+
typeParam.qname = buffer.join('')
|
|
128
|
+
buffer = []
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
stack[stack.length - 1].typeArgs.push(typeParam)
|
|
132
|
+
// continue parse next param
|
|
133
|
+
stack.push(new TypeDescriptor(''))
|
|
134
|
+
continue
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
buffer.push(ch)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (buffer.length > 0) {
|
|
141
|
+
stack[stack.length - 1].qname = buffer.join('')
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const res = stack.pop()
|
|
145
|
+
if (!res || stack.length > 0) {
|
|
146
|
+
throw Error('Uxpectecd stack size')
|
|
147
|
+
}
|
|
148
|
+
return res
|
|
149
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MoveFunction, MoveModule } from './move-types.js'
|
|
2
|
+
|
|
3
|
+
export const SPLITTER = '::'
|
|
4
|
+
|
|
5
|
+
export const VECTOR_STR = 'vector'
|
|
6
|
+
|
|
7
|
+
export function isFrameworkAccount(account: string) {
|
|
8
|
+
return account === '0x1' || account === '0x2' || account === '0x3'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function moduleQname(module: MoveModule): string {
|
|
12
|
+
return module.address.toLowerCase() + SPLITTER + module.name
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function moduleQnameForType(type: string): [string, string] {
|
|
16
|
+
const parts = type.split(SPLITTER).slice(0, 2)
|
|
17
|
+
return [parts[0], parts[1]]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getMeaningfulFunctionParams(func: MoveFunction): string[] {
|
|
21
|
+
let params = func.params
|
|
22
|
+
if (func.params[0] === '&signer') {
|
|
23
|
+
params = params.slice(1)
|
|
24
|
+
}
|
|
25
|
+
return params
|
|
26
|
+
}
|
package/src/core/base-context.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ProcessResult, RecordMetaData } from '@sentio/protos'
|
|
2
|
-
import { Logger } from './logger'
|
|
3
|
-
import { Labels } from './metadata'
|
|
4
|
-
import { Meter } from './meter'
|
|
5
|
-
import { BoundedEventTracker } from './event-tracker'
|
|
2
|
+
import { Logger } from './logger.js'
|
|
3
|
+
import { Labels } from './metadata.js'
|
|
4
|
+
import { Meter } from './meter.js'
|
|
5
|
+
import { BoundedEventTracker } from './event-tracker.js'
|
|
6
6
|
|
|
7
7
|
export abstract class BaseContext {
|
|
8
8
|
meter: Meter
|
package/src/core/big-decimal.ts
CHANGED
|
@@ -5,8 +5,19 @@ export { BigDecimal } from '@sentio/bigdecimal'
|
|
|
5
5
|
declare global {
|
|
6
6
|
interface BigInt {
|
|
7
7
|
asBigDecimal(): BigDecimal
|
|
8
|
+
scaleDown(decimal: number | bigint): BigDecimal
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
BigInt.prototype.asBigDecimal = function () {
|
|
11
12
|
return new BigDecimal(this.toString())
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
BigInt.prototype.scaleDown = function (decimal: number | bigint) {
|
|
16
|
+
// @ts-ignore this is fine
|
|
17
|
+
return scaleDown(this, decimal)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function scaleDown(amount: bigint, decimal: number | bigint): BigDecimal {
|
|
21
|
+
const divider = new BigDecimal(10).pow(Number(decimal))
|
|
22
|
+
return amount.asBigDecimal().dividedBy(divider)
|
|
23
|
+
}
|
|
File without changes
|
package/src/core/core-plugin.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Plugin, PluginManager } from '@sentio/runtime'
|
|
2
2
|
import { ProcessConfigResponse } from '@sentio/protos'
|
|
3
3
|
|
|
4
|
-
import { MetricState } from './meter'
|
|
5
|
-
import { EventTrackerState } from './event-tracker'
|
|
6
|
-
import { ExporterState } from './exporter'
|
|
4
|
+
import { MetricState } from './meter.js'
|
|
5
|
+
import { EventTrackerState } from './event-tracker.js'
|
|
6
|
+
import { ExporterState } from './exporter.js'
|
|
7
7
|
|
|
8
8
|
export class CorePlugin extends Plugin {
|
|
9
9
|
name: string = 'CorePlugin'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseContext } from './base-context'
|
|
1
|
+
import { BaseContext } from './base-context.js'
|
|
2
2
|
import { EventTrackingResult } from '@sentio/protos'
|
|
3
|
-
import { NamedResultDescriptor } from './metadata'
|
|
3
|
+
import { NamedResultDescriptor } from './metadata.js'
|
|
4
4
|
import { MapStateStorage } from '@sentio/runtime'
|
|
5
5
|
|
|
6
6
|
export interface Event {
|
package/src/core/exporter.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseContext } from './base-context'
|
|
2
|
-
import { ExportResult } from '@sentio/
|
|
3
|
-
import { NamedResultDescriptor } from './metadata'
|
|
1
|
+
import { BaseContext } from './base-context.js'
|
|
2
|
+
import { ExportResult } from '@sentio/protos'
|
|
3
|
+
import { NamedResultDescriptor } from './metadata.js'
|
|
4
4
|
import { MapStateStorage } from '@sentio/runtime'
|
|
5
5
|
|
|
6
6
|
export type Export = Record<string, any>
|
package/src/core/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { BigDecimal } from './big-decimal'
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { BigDecimal, scaleDown } from './big-decimal.js'
|
|
2
|
+
export { BaseContext } from './base-context.js'
|
|
3
|
+
export { type Labels, normalizeLabels } from './metadata.js'
|
|
4
|
+
export { CounterBinding, Meter, GaugeBinding, Counter, Gauge, MetricOptions } from './meter.js'
|
|
5
|
+
export { EventTracker, AccountEventTracker } from './event-tracker.js'
|
|
6
|
+
export { Exporter } from './exporter.js'
|
|
7
|
+
export { type Numberish, toBigInteger, toMetricValue } from './numberish.js'
|
|
6
8
|
|
|
7
|
-
export {
|
|
9
|
+
export { SuiBaseProcessor, SuiBindOptions } from './sui-processor.js'
|
|
8
10
|
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export { SuiPlugin } from './sui-plugin'
|
|
12
|
-
export { CorePlugin } from './core-plugin'
|
|
11
|
+
export { SuiPlugin } from './sui-plugin.js'
|
|
12
|
+
export { CorePlugin } from './core-plugin.js'
|
package/src/core/logger.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseContext } from './base-context'
|
|
1
|
+
import { BaseContext } from './base-context.js'
|
|
2
2
|
import { LogLevel } from '@sentio/protos'
|
|
3
|
-
import { NamedResultDescriptor } from './metadata'
|
|
3
|
+
import { NamedResultDescriptor } from './metadata.js'
|
|
4
4
|
|
|
5
5
|
export type Attributes = Record<string, any>
|
|
6
6
|
|
package/src/core/metadata.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import { normalizeName } from './meter'
|
|
2
|
-
|
|
3
1
|
export type Labels = { [key: string]: string }
|
|
4
2
|
|
|
3
|
+
export function normalizeName(name: string): string {
|
|
4
|
+
return name.slice(0, 100).replace(/[^_\-a-zA-Z0-9]/g, '_')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function normalizeKey(name: string): string {
|
|
8
|
+
if (name === 'labels') {
|
|
9
|
+
return 'labels_'
|
|
10
|
+
}
|
|
11
|
+
return normalizeName(name)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function normalizeValue(name: string): string {
|
|
15
|
+
return name.slice(0, 100)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function normalizeLabels(labels: Labels): Labels {
|
|
19
|
+
const normLabels: Labels = {}
|
|
20
|
+
for (const key in labels) {
|
|
21
|
+
normLabels[normalizeKey(key)] = normalizeValue(labels[key])
|
|
22
|
+
}
|
|
23
|
+
return normLabels
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
export class NamedResultDescriptor {
|
|
6
27
|
name: string
|
|
7
28
|
|
package/src/core/meter.ts
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import { BaseContext } from './base-context'
|
|
2
|
-
import { Numberish, toMetricValue } from './numberish'
|
|
3
|
-
import { Labels, NamedResultDescriptor } from './metadata'
|
|
1
|
+
import { BaseContext } from './base-context.js'
|
|
2
|
+
import { Numberish, toMetricValue } from './numberish.js'
|
|
3
|
+
import { Labels, NamedResultDescriptor, normalizeKey } from './metadata.js'
|
|
4
4
|
import { AggregationConfig, AggregationType, MetricConfig, MetricType } from '@sentio/protos'
|
|
5
5
|
import { MapStateStorage } from '@sentio/runtime'
|
|
6
6
|
|
|
7
|
-
export function normalizeName(name: string): string {
|
|
8
|
-
return name.slice(0, 100).replace(/[^_\-a-zA-Z0-9]/g, '_')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function normalizeKey(name: string): string {
|
|
12
|
-
if (name === 'labels') {
|
|
13
|
-
return 'labels_'
|
|
14
|
-
}
|
|
15
|
-
return normalizeName(name)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function normalizeValue(name: string): string {
|
|
19
|
-
return name.slice(0, 100)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function normalizeLabels(labels: Labels): Labels {
|
|
23
|
-
const normLabels: Labels = {}
|
|
24
|
-
for (const key in labels) {
|
|
25
|
-
normLabels[normalizeKey(key)] = normalizeValue(labels[key])
|
|
26
|
-
}
|
|
27
|
-
return normLabels
|
|
28
|
-
}
|
|
29
|
-
|
|
30
7
|
export class MetricOptions {
|
|
31
8
|
unit?: string
|
|
32
9
|
description?: string
|
package/src/core/numberish.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import { BigInteger, MetricValue } from '@sentio/protos'
|
|
2
|
-
import { BigDecimal } from '.'
|
|
3
|
-
import { BlockTag } from 'ethers/providers'
|
|
2
|
+
import { BigDecimal } from './big-decimal.js'
|
|
4
3
|
|
|
5
4
|
export type Numberish = number | bigint | BigDecimal | string
|
|
6
5
|
|
|
7
|
-
export function toBlockTag(a: number | bigint): BlockTag {
|
|
8
|
-
if (typeof a === 'number') {
|
|
9
|
-
return a
|
|
10
|
-
}
|
|
11
|
-
if (a > Number.MAX_SAFE_INTEGER) {
|
|
12
|
-
return '0x' + a.toString(16)
|
|
13
|
-
}
|
|
14
|
-
return Number(a)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
6
|
export function toMetricValue(value: Numberish): MetricValue {
|
|
18
7
|
if (typeof value === 'number') {
|
|
19
8
|
if (Number.isNaN(value)) {
|
package/src/core/sui-plugin.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { ContractConfig, DataBinding, HandlerType, ProcessConfigResponse, Proces
|
|
|
3
3
|
|
|
4
4
|
import { ServerError, Status } from 'nice-grpc'
|
|
5
5
|
|
|
6
|
-
import { CHAIN_IDS } from '
|
|
7
|
-
import { SuiProcessorState } from './sui-processor'
|
|
6
|
+
import { CHAIN_IDS } from './chain.js'
|
|
7
|
+
import { SuiProcessorState } from './sui-processor.js'
|
|
8
8
|
|
|
9
9
|
export class SuiPlugin extends Plugin {
|
|
10
10
|
name: string = 'SuiPlugin'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListStateStorage } from '@sentio/runtime'
|
|
2
|
-
import { AccountProcessor } from './account-processor'
|
|
2
|
+
import { AccountProcessor } from './account-processor.js'
|
|
3
3
|
|
|
4
4
|
export class AccountProcessorState extends ListStateStorage<AccountProcessor> {
|
|
5
5
|
static INSTANCE = new AccountProcessorState()
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ERC20__factory, ERC721__factory } from '
|
|
2
|
-
import { AddressType,
|
|
3
|
-
import { AccountBindOptions } from '
|
|
1
|
+
import { ERC20__factory, ERC721__factory } from './builtin/internal/index.js'
|
|
2
|
+
import { AddressType, EthFetchConfig, ProcessResult } from '@sentio/protos'
|
|
3
|
+
import { AccountBindOptions } from './bind-options.js'
|
|
4
4
|
|
|
5
5
|
import { Network, LogParams } from 'ethers/providers'
|
|
6
6
|
|
|
7
|
-
import { TransferEvent as ERC20TransferEvent } from '
|
|
8
|
-
import { TransferEvent as ERC721TransferEvent } from '
|
|
7
|
+
import { TransferEvent as ERC20TransferEvent } from './builtin/internal/ERC20.js'
|
|
8
|
+
import { TransferEvent as ERC721TransferEvent } from './builtin/internal/ERC721.js'
|
|
9
9
|
|
|
10
|
-
import { ERC20Processor } from '
|
|
11
|
-
import { ERC721Processor } from '
|
|
10
|
+
import { ERC20Processor } from './builtin/internal/erc20_processor.js'
|
|
11
|
+
import { ERC721Processor } from './builtin/internal/erc721_processor.js'
|
|
12
12
|
|
|
13
|
-
import { AccountContext } from '
|
|
14
|
-
import { PromiseOrVoid } from '../promise-or-void'
|
|
15
|
-
import { AddressOrTypeEventFilter, EventsHandler } from './base-processor'
|
|
13
|
+
import { AccountContext } from './context.js'
|
|
14
|
+
import { PromiseOrVoid } from '../promise-or-void.js'
|
|
15
|
+
import { AddressOrTypeEventFilter, EventsHandler } from './base-processor.js'
|
|
16
16
|
import { Transaction, Block, TransactionReceipt, LogDescription } from 'ethers'
|
|
17
|
-
import { AccountProcessorState } from './account-processor-state'
|
|
17
|
+
import { AccountProcessorState } from './account-processor-state.js'
|
|
18
18
|
|
|
19
19
|
const ERC20_INTERFACE = ERC20__factory.createInterface()
|
|
20
20
|
const ERC721_INTERFACE = ERC721__factory.createInterface()
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { BoundContractView, ContractContext, ContractView } from '
|
|
1
|
+
import { BoundContractView, ContractContext, ContractView } from './context.js'
|
|
2
2
|
import { BaseContract, ContractEvent, Block, LogDescription } from 'ethers'
|
|
3
|
-
import { AddressOrTypeEventFilter, BaseProcessor } from './base-processor'
|
|
4
|
-
import { BindOptions, getOptionsSignature } from '
|
|
3
|
+
import { AddressOrTypeEventFilter, BaseProcessor } from './base-processor.js'
|
|
4
|
+
import { BindOptions, getOptionsSignature } from './bind-options.js'
|
|
5
5
|
import { EthFetchConfig, HandleInterval, TemplateInstance } from '@sentio/protos'
|
|
6
|
-
import { PromiseOrVoid } from '../promise-or-void'
|
|
7
|
-
import { Trace } from './trace'
|
|
6
|
+
import { PromiseOrVoid } from '../promise-or-void.js'
|
|
7
|
+
import { Trace } from './trace.js'
|
|
8
8
|
import { ListStateStorage } from '@sentio/runtime'
|
|
9
9
|
import { EventFilter, LogParams, Network } from 'ethers/providers'
|
|
10
10
|
import { DeferredTopicFilter } from 'ethers/contract'
|
|
11
|
+
import { EthLog } from './eth.js'
|
|
11
12
|
|
|
12
13
|
export class ProcessorTemplateProcessorState extends ListStateStorage<
|
|
13
14
|
BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>
|
|
@@ -36,7 +37,7 @@ export abstract class BaseProcessorTemplate<
|
|
|
36
37
|
fetchConfig?: EthFetchConfig
|
|
37
38
|
}[] = []
|
|
38
39
|
eventHandlers: {
|
|
39
|
-
handler: (event:
|
|
40
|
+
handler: (event: EthLog, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
40
41
|
filter: DeferredTopicFilter | DeferredTopicFilter[]
|
|
41
42
|
fetchConfig?: EthFetchConfig
|
|
42
43
|
}[] = []
|
|
@@ -87,7 +88,7 @@ export abstract class BaseProcessorTemplate<
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
public onEvent(
|
|
90
|
-
handler: (event:
|
|
91
|
+
handler: (event: EthLog, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
91
92
|
filter: DeferredTopicFilter | DeferredTopicFilter[],
|
|
92
93
|
fetchConfig?: EthFetchConfig
|
|
93
94
|
) {
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
ContractEvent,
|
|
4
|
-
Log,
|
|
5
|
-
TransactionReceipt,
|
|
6
|
-
BytesLike,
|
|
7
|
-
BaseContract,
|
|
8
|
-
Transaction,
|
|
9
|
-
DeferredTopicFilter,
|
|
10
|
-
LogDescription,
|
|
11
|
-
EventFragment,
|
|
12
|
-
} from 'ethers'
|
|
13
|
-
import { EventFilter, LogParams, Network } from 'ethers/providers'
|
|
1
|
+
import { Block, TransactionReceipt, BaseContract, Transaction, DeferredTopicFilter } from 'ethers'
|
|
2
|
+
import { LogParams, Network } from 'ethers/providers'
|
|
14
3
|
|
|
15
|
-
import { BoundContractView, ContractContext, ContractView } from '
|
|
4
|
+
import { BoundContractView, ContractContext, ContractView } from './context.js'
|
|
16
5
|
import {
|
|
17
6
|
AddressType,
|
|
18
7
|
Data_EthBlock,
|
|
@@ -22,10 +11,11 @@ import {
|
|
|
22
11
|
HandleInterval,
|
|
23
12
|
ProcessResult,
|
|
24
13
|
} from '@sentio/protos'
|
|
25
|
-
import { BindInternalOptions, BindOptions } from '
|
|
26
|
-
import { PromiseOrVoid } from '../promise-or-void'
|
|
27
|
-
import { Trace } from './trace'
|
|
14
|
+
import { BindInternalOptions, BindOptions } from './bind-options.js'
|
|
15
|
+
import { PromiseOrVoid } from '../promise-or-void.js'
|
|
16
|
+
import { Trace } from './trace.js'
|
|
28
17
|
import { ServerError, Status } from 'nice-grpc'
|
|
18
|
+
import { EthLog } from './eth.js'
|
|
29
19
|
|
|
30
20
|
export interface AddressOrTypeEventFilter extends DeferredTopicFilter {
|
|
31
21
|
addressType?: AddressType
|
|
@@ -88,7 +78,7 @@ export abstract class BaseProcessor<
|
|
|
88
78
|
}
|
|
89
79
|
|
|
90
80
|
public onEvent(
|
|
91
|
-
handler: (event:
|
|
81
|
+
handler: (event: EthLog, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
92
82
|
filter: DeferredTopicFilter | DeferredTopicFilter[],
|
|
93
83
|
fetchConfig?: EthFetchConfig
|
|
94
84
|
) {
|
|
@@ -128,8 +118,10 @@ export abstract class BaseProcessor<
|
|
|
128
118
|
const logParam = log as any as { topics: Array<string>; data: string }
|
|
129
119
|
|
|
130
120
|
const parsed = contractView.rawContract.interface.parseLog(logParam)
|
|
121
|
+
|
|
131
122
|
if (parsed) {
|
|
132
|
-
|
|
123
|
+
const event: EthLog = { ...log, args: parsed.args }
|
|
124
|
+
await handler(event, ctx)
|
|
133
125
|
return ctx.getProcessResult()
|
|
134
126
|
}
|
|
135
127
|
return ProcessResult.fromPartial({})
|
|
@@ -197,9 +189,7 @@ export abstract class BaseProcessor<
|
|
|
197
189
|
return this
|
|
198
190
|
}
|
|
199
191
|
|
|
200
|
-
public onAllEvents(
|
|
201
|
-
handler: (event: LogDescription, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
202
|
-
) {
|
|
192
|
+
public onAllEvents(handler: (event: EthLog, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
203
193
|
const _filters: DeferredTopicFilter[] = []
|
|
204
194
|
const tmpContract = this.CreateBoundContractView()
|
|
205
195
|
|
|
File without changes
|
package/src/eth/binds.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BindOptions, getOptionsSignature } from '
|
|
2
|
-
import { ContractView } from '
|
|
3
|
-
import { BaseProcessor } from './base-processor'
|
|
1
|
+
import { BindOptions, getOptionsSignature } from './bind-options.js'
|
|
2
|
+
import { ContractView } from './context.js'
|
|
3
|
+
import { BaseProcessor } from './base-processor.js'
|
|
4
4
|
import { Networkish, Network } from 'ethers/providers'
|
|
5
5
|
|
|
6
6
|
import { BaseContract } from 'ethers'
|