@sentio/sdk 2.0.0-rc.9 → 2.0.0
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 +384 -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/run.d.ts +1 -0
- package/lib/aptos/codegen/run.js +12 -0
- package/lib/aptos/codegen/run.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/aptos/codegen/typegen.test.d.ts +1 -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 +29 -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/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/big-decimal.d.ts +2 -0
- package/lib/core/big-decimal.js +8 -0
- package/lib/core/big-decimal.js.map +1 -1
- package/lib/{utils → core}/chain.d.ts +0 -0
- package/lib/{utils → core}/chain.js +0 -0
- package/lib/core/chain.js.map +1 -0
- package/lib/core/index.d.ts +2 -4
- package/lib/core/index.js +2 -4
- package/lib/core/index.js.map +1 -1
- package/lib/core/numberish.d.ts +0 -2
- package/lib/core/numberish.js +0 -9
- package/lib/core/numberish.js.map +1 -1
- package/lib/core/sui-plugin.js +1 -1
- package/lib/core/sui-plugin.js.map +1 -1
- package/lib/core/sui-processor.d.ts +1 -1
- package/lib/core/sui-processor.js +1 -1
- package/lib/core/sui-processor.js.map +1 -1
- package/lib/eth/account-processor.d.ts +4 -4
- package/lib/eth/account-processor.js +4 -4
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +6 -5
- package/lib/eth/base-processor-template.js +1 -1
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +6 -5
- package/lib/eth/base-processor.js +3 -2
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/{core → eth}/bind-options.d.ts +0 -0
- package/lib/{core → eth}/bind-options.js +0 -0
- package/lib/eth/bind-options.js.map +1 -0
- package/lib/eth/binds.d.ts +2 -2
- package/lib/eth/binds.js +1 -1
- package/lib/eth/binds.js.map +1 -1
- package/lib/{builtin → eth/builtin}/eacaggregatorproxy/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/eacaggregatorproxy/index.js +0 -0
- package/lib/eth/builtin/eacaggregatorproxy/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/eacaggregatorproxy/test-utils.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/eacaggregatorproxy/test-utils.js +0 -0
- package/lib/eth/builtin/eacaggregatorproxy/test-utils.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc1155/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc1155/index.js +0 -0
- package/lib/eth/builtin/erc1155/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc1155/test-utils.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc1155/test-utils.js +0 -0
- package/lib/eth/builtin/erc1155/test-utils.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc20/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc20/index.js +0 -0
- package/lib/eth/builtin/erc20/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc20/test-utils.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc20/test-utils.js +0 -0
- package/lib/eth/builtin/erc20/test-utils.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc20bytes/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc20bytes/index.js +0 -0
- package/lib/eth/builtin/erc20bytes/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc20bytes/test-utils.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc20bytes/test-utils.js +0 -0
- package/lib/eth/builtin/erc20bytes/test-utils.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc721/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc721/index.js +0 -0
- package/lib/eth/builtin/erc721/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/erc721/test-utils.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/erc721/test-utils.js +0 -0
- package/lib/eth/builtin/erc721/test-utils.js.map +1 -0
- package/lib/{builtin → eth/builtin}/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/index.js +0 -0
- package/lib/eth/builtin/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/EACAggregatorProxy.d.ts +5 -5
- package/lib/{builtin → eth/builtin}/internal/EACAggregatorProxy.js +0 -0
- package/lib/eth/builtin/internal/EACAggregatorProxy.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC1155.d.ts +5 -5
- package/lib/{builtin → eth/builtin}/internal/ERC1155.js +0 -0
- package/lib/eth/builtin/internal/ERC1155.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC20.d.ts +4 -4
- package/lib/{builtin → eth/builtin}/internal/ERC20.js +0 -0
- package/lib/eth/builtin/internal/ERC20.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC20Bytes.d.ts +3 -3
- package/lib/{builtin → eth/builtin}/internal/ERC20Bytes.js +0 -0
- package/lib/eth/builtin/internal/ERC20Bytes.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/ERC721.d.ts +4 -4
- package/lib/{builtin → eth/builtin}/internal/ERC721.js +0 -0
- package/lib/eth/builtin/internal/ERC721.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/WETH9.d.ts +5 -5
- package/lib/{builtin → eth/builtin}/internal/WETH9.js +0 -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 +0 -0
- package/lib/eth/builtin/internal/common.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/eacaggregatorproxy_processor.d.ts +5 -5
- package/lib/{builtin → eth/builtin}/internal/eacaggregatorproxy_processor.js +92 -182
- package/lib/eth/builtin/internal/eacaggregatorproxy_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc1155_processor.d.ts +5 -5
- package/lib/{builtin → eth/builtin}/internal/erc1155_processor.js +27 -52
- package/lib/eth/builtin/internal/erc1155_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc20_processor.d.ts +4 -4
- package/lib/{builtin → eth/builtin}/internal/erc20_processor.js +42 -82
- 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 +32 -62
- package/lib/eth/builtin/internal/erc20bytes_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/erc721_processor.d.ts +4 -4
- package/lib/{builtin → eth/builtin}/internal/erc721_processor.js +47 -92
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/lib/eth/builtin/internal/factories/WETH9__factory.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/factories/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/internal/factories/index.js +0 -0
- package/lib/eth/builtin/internal/factories/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/internal/index.js +0 -0
- package/lib/eth/builtin/internal/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/internal/weth9_processor.d.ts +5 -5
- package/lib/{builtin → eth/builtin}/internal/weth9_processor.js +32 -62
- package/lib/eth/builtin/internal/weth9_processor.js.map +1 -0
- package/lib/{builtin → eth/builtin}/weth9/index.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/weth9/index.js +0 -0
- package/lib/eth/builtin/weth9/index.js.map +1 -0
- package/lib/{builtin → eth/builtin}/weth9/test-utils.d.ts +0 -0
- package/lib/{builtin → eth/builtin}/weth9/test-utils.js +0 -0
- 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.cts → 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/event-handler.d.cts → 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/file.d.cts → eth/codegen/file.d.ts} +0 -0
- package/lib/{target-ethers-sentio/file.cjs → eth/codegen/file.js} +28 -35
- package/lib/eth/codegen/file.js.map +1 -0
- package/lib/{target-ethers-sentio/functions-handler.d.cts → eth/codegen/functions-handler.d.ts} +0 -0
- package/lib/{target-ethers-sentio/functions-handler.cjs → eth/codegen/functions-handler.js} +13 -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/eth/codegen/run.d.ts +2 -0
- package/lib/eth/codegen/run.js +12 -0
- package/lib/eth/codegen/run.js.map +1 -0
- package/lib/{target-ethers-sentio/types.d.cts → eth/codegen/types.d.ts} +0 -0
- package/lib/{target-ethers-sentio/types.cjs → eth/codegen/types.js} +4 -10
- package/lib/eth/codegen/types.js.map +1 -0
- package/lib/{target-ethers-sentio/view-function.d.cts → 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 -4
- package/lib/{core → eth}/context.js +7 -8
- 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.d.ts +13 -0
- package/lib/{error.js → eth/eth.js} +20 -14
- package/lib/eth/eth.js.map +1 -0
- package/lib/eth/generic-processor.d.ts +2 -2
- package/lib/eth/generic-processor.js +2 -2
- package/lib/eth/generic-processor.js.map +1 -1
- package/lib/eth/generic-processor.test.js.map +1 -1
- package/lib/eth/index.d.ts +5 -1
- package/lib/eth/index.js +5 -1
- package/lib/eth/index.js.map +1 -1
- package/lib/eth/provider.js +3 -2
- package/lib/eth/provider.js.map +1 -1
- package/lib/index.d.ts +1 -3
- package/lib/index.js +1 -5
- 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/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/codegen/run.d.ts +2 -0
- package/lib/solana/codegen/run.js +12 -0
- package/lib/solana/codegen/run.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/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/test-processor-server.js +1 -1
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/testing/test-provider.js +1 -1
- package/lib/testing/test-provider.js.map +1 -1
- package/lib/tsup.config.ts +3 -0
- package/lib/utils/conversion.d.ts +0 -5
- package/lib/utils/conversion.js +21 -20
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/dex-price.js +2 -2
- package/lib/utils/dex-price.js.map +1 -1
- package/lib/utils/index.d.ts +4 -4
- package/lib/utils/index.js +4 -4
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/token.d.ts +0 -1
- package/lib/utils/token.js +17 -28
- package/lib/utils/token.js.map +1 -1
- package/package.json +42 -20
- 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/aptos/builtin/index.ts +5 -0
- package/src/aptos/codegen/codegen.ts +461 -0
- package/src/aptos/codegen/index.ts +1 -0
- package/src/aptos/codegen/run.ts +13 -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 +37 -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/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/big-decimal.ts +11 -0
- package/src/{utils → core}/chain.ts +0 -0
- package/src/core/index.ts +2 -5
- package/src/core/numberish.ts +0 -11
- package/src/core/sui-plugin.ts +1 -1
- 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.ts +7 -7
- package/src/eth/base-processor-template.ts +5 -4
- package/src/eth/base-processor.ts +10 -20
- package/src/{core → eth}/bind-options.ts +0 -0
- package/src/eth/binds.ts +2 -2
- package/src/{builtin → eth/builtin}/eacaggregatorproxy/index.ts +0 -0
- package/src/{builtin → eth/builtin}/eacaggregatorproxy/test-utils.ts +0 -0
- package/src/{builtin → eth/builtin}/erc1155/index.ts +0 -0
- package/src/{builtin → eth/builtin}/erc1155/test-utils.ts +0 -0
- package/src/{builtin → eth/builtin}/erc20/index.ts +0 -0
- package/src/{builtin → eth/builtin}/erc20/test-utils.ts +0 -0
- package/src/{builtin → eth/builtin}/erc20bytes/index.ts +0 -0
- package/src/{builtin → eth/builtin}/erc20bytes/test-utils.ts +0 -0
- package/src/{builtin → eth/builtin}/erc721/index.ts +0 -0
- package/src/{builtin → eth/builtin}/erc721/test-utils.ts +0 -0
- package/src/{builtin → eth/builtin}/index.ts +0 -0
- package/src/{builtin → eth/builtin}/internal/EACAggregatorProxy.ts +5 -9
- package/src/{builtin → eth/builtin}/internal/ERC1155.ts +5 -9
- package/src/{builtin → eth/builtin}/internal/ERC20.ts +4 -7
- package/src/{builtin → eth/builtin}/internal/ERC20Bytes.ts +3 -5
- package/src/{builtin → eth/builtin}/internal/ERC721.ts +4 -7
- package/src/{builtin → eth/builtin}/internal/WETH9.ts +5 -9
- package/src/eth/builtin/internal/common.ts +22 -0
- package/src/{builtin → eth/builtin}/internal/eacaggregatorproxy_processor.ts +92 -164
- package/src/{builtin → eth/builtin}/internal/erc1155_processor.ts +27 -51
- package/src/{builtin → eth/builtin}/internal/erc20_processor.ts +42 -74
- package/src/{builtin → eth/builtin}/internal/erc20bytes_processor.ts +32 -56
- package/src/{builtin → eth/builtin}/internal/erc721_processor.ts +47 -83
- 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/{builtin → eth/builtin}/internal/factories/index.ts +0 -0
- package/src/{builtin → eth/builtin}/internal/index.ts +0 -0
- package/src/{builtin → eth/builtin}/internal/weth9_processor.ts +32 -56
- package/src/{builtin → eth/builtin}/weth9/index.ts +0 -0
- package/src/{builtin → eth/builtin}/weth9/test-utils.ts +0 -0
- package/src/eth/codegen/codegen.ts +62 -0
- package/src/{target-ethers-sentio/index.cts → eth/codegen/ethers-sentio.ts} +2 -2
- package/src/{target-ethers-sentio/event-handler.cts → eth/codegen/event-handler.ts} +2 -2
- package/src/{target-ethers-sentio/file.cts → eth/codegen/file.ts} +7 -7
- package/src/{target-ethers-sentio/functions-handler.cts → eth/codegen/functions-handler.ts} +4 -4
- package/src/eth/codegen/index.ts +1 -0
- package/src/eth/codegen/run.ts +12 -0
- package/src/eth/codegen/tsconfig.json +8 -0
- package/src/{target-ethers-sentio/types.cts → eth/codegen/types.ts} +1 -1
- package/src/{target-ethers-sentio/view-function.cts → eth/codegen/view-function.ts} +7 -12
- package/src/{core → eth}/context.ts +8 -9
- package/src/eth/error.ts +4 -0
- package/src/eth/eth.ts +56 -0
- package/src/eth/generic-processor.ts +3 -3
- package/src/eth/index.ts +6 -2
- package/src/eth/provider.ts +4 -3
- package/src/index.ts +1 -6
- 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/run.ts +12 -0
- package/src/solana/codegen/tsconfig.json +8 -0
- package/src/solana/index.ts +4 -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/test-processor-server.ts +1 -1
- package/src/testing/test-provider.ts +1 -1
- package/src/tsup.config.ts +3 -0
- package/src/utils/conversion.ts +21 -25
- package/src/utils/dex-price.ts +2 -3
- package/src/utils/index.ts +4 -4
- package/src/utils/token.ts +19 -30
- package/lib/builtin/eacaggregatorproxy/index.js.map +0 -1
- package/lib/builtin/eacaggregatorproxy/test-utils.js.map +0 -1
- package/lib/builtin/erc1155/index.js.map +0 -1
- package/lib/builtin/erc1155/test-utils.js.map +0 -1
- package/lib/builtin/erc20/index.js.map +0 -1
- package/lib/builtin/erc20/test-utils.js.map +0 -1
- package/lib/builtin/erc20bytes/index.js.map +0 -1
- package/lib/builtin/erc20bytes/test-utils.js.map +0 -1
- package/lib/builtin/erc721/index.js.map +0 -1
- package/lib/builtin/erc721/test-utils.js.map +0 -1
- package/lib/builtin/index.js.map +0 -1
- package/lib/builtin/internal/EACAggregatorProxy.js.map +0 -1
- package/lib/builtin/internal/ERC1155.js.map +0 -1
- package/lib/builtin/internal/ERC20.js.map +0 -1
- package/lib/builtin/internal/ERC20Bytes.js.map +0 -1
- package/lib/builtin/internal/ERC721.js.map +0 -1
- 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.js.map +0 -1
- package/lib/builtin/internal/index.js.map +0 -1
- package/lib/builtin/internal/weth9_processor.js.map +0 -1
- 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.map +0 -1
- package/lib/core/context.js.map +0 -1
- package/lib/error.d.ts +0 -7
- package/lib/error.js.map +0 -1
- package/lib/target-ethers-sentio/event-handler.cjs +0 -52
- package/lib/target-ethers-sentio/event-handler.cjs.map +0 -1
- package/lib/target-ethers-sentio/file.cjs.map +0 -1
- package/lib/target-ethers-sentio/functions-handler.cjs.map +0 -1
- package/lib/target-ethers-sentio/index.cjs +0 -61
- package/lib/target-ethers-sentio/index.cjs.map +0 -1
- package/lib/target-ethers-sentio/types.cjs.map +0 -1
- package/lib/target-ethers-sentio/view-function.cjs +0 -74
- package/lib/target-ethers-sentio/view-function.cjs.map +0 -1
- package/lib/utils/chain.js.map +0 -1
- package/src/builtin/internal/common.ts +0 -46
- package/src/error.ts +0 -45
- package/src/target-ethers-sentio/.eslintrc.json +0 -14
- package/src/target-ethers-sentio/tsconfig.json +0 -9
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { RecordMetaData } from '@sentio/protos'
|
|
2
|
+
import { type Labels, BaseContext, normalizeLabels } from '@sentio/sdk'
|
|
3
|
+
import { Transaction_UserTransaction } from './move-types.js'
|
|
4
|
+
import { AptosNetwork, getChainId } from './network.js'
|
|
5
|
+
|
|
6
|
+
export class AptosContext extends BaseContext {
|
|
7
|
+
address: string
|
|
8
|
+
network: AptosNetwork
|
|
9
|
+
moduleName: string
|
|
10
|
+
version: bigint
|
|
11
|
+
transaction: Transaction_UserTransaction
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
moduleName: string,
|
|
15
|
+
network: AptosNetwork,
|
|
16
|
+
address: string,
|
|
17
|
+
version: bigint,
|
|
18
|
+
transaction?: Transaction_UserTransaction
|
|
19
|
+
) {
|
|
20
|
+
super()
|
|
21
|
+
this.address = address
|
|
22
|
+
this.network = network
|
|
23
|
+
this.moduleName = moduleName
|
|
24
|
+
this.version = version
|
|
25
|
+
if (transaction) {
|
|
26
|
+
this.transaction = transaction
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getMetaData(name: string, labels: Labels): RecordMetaData {
|
|
31
|
+
return {
|
|
32
|
+
address: this.address,
|
|
33
|
+
contractName: this.moduleName,
|
|
34
|
+
blockNumber: this.version,
|
|
35
|
+
transactionIndex: 0,
|
|
36
|
+
transactionHash: this.transaction?.hash || '', // TODO
|
|
37
|
+
logIndex: 0,
|
|
38
|
+
chainId: getChainId(this.network),
|
|
39
|
+
name: name,
|
|
40
|
+
labels: normalizeLabels(labels),
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class AptosResourceContext extends BaseContext {
|
|
46
|
+
address: string
|
|
47
|
+
network: AptosNetwork
|
|
48
|
+
version: bigint
|
|
49
|
+
timestampInMicros: number
|
|
50
|
+
|
|
51
|
+
constructor(network: AptosNetwork, address: string, version: bigint, timestampInMicros: number) {
|
|
52
|
+
super()
|
|
53
|
+
this.address = address
|
|
54
|
+
this.network = network
|
|
55
|
+
this.version = version
|
|
56
|
+
this.timestampInMicros = timestampInMicros
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getMetaData(name: string, labels: Labels): RecordMetaData {
|
|
60
|
+
return {
|
|
61
|
+
address: this.address,
|
|
62
|
+
contractName: 'resources',
|
|
63
|
+
blockNumber: this.version,
|
|
64
|
+
transactionIndex: 0,
|
|
65
|
+
transactionHash: '',
|
|
66
|
+
logIndex: 0,
|
|
67
|
+
chainId: getChainId(this.network),
|
|
68
|
+
name: name,
|
|
69
|
+
labels: normalizeLabels(labels),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './move-types.js'
|
|
2
|
+
export type { EventInstance, TypedEventInstance, TypedEntryFunctionPayload, TypedMoveResource } from './models.js'
|
|
3
|
+
export { defaultMoveCoder, MoveCoder } from './move-coder.js'
|
|
4
|
+
export type { FunctionNameAndCallFilter, EventFilter, CallFilter, ArgumentsFilter } from './aptos-processor.js'
|
|
5
|
+
export { AptosBaseProcessor, AptosAccountProcessor } from './aptos-processor.js'
|
|
6
|
+
export { AptosContext, AptosResourceContext } from './context.js'
|
|
7
|
+
export { AptosBindOptions, AptosNetwork } from './network.js'
|
|
8
|
+
export * from './api.js'
|
|
9
|
+
|
|
10
|
+
export { AptosPlugin } from './aptos-plugin.js'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Event, MoveResource, TransactionPayload_EntryFunctionPayload } from './move-types.js'
|
|
2
|
+
|
|
3
|
+
export type EventInstance = Event & {
|
|
4
|
+
version: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type TypedEventInstance<T> = EventInstance & {
|
|
8
|
+
/**
|
|
9
|
+
* decoded data using ABI, undefined if there is decoding error, usually because the ABI/data mismatch
|
|
10
|
+
*/
|
|
11
|
+
data_decoded: T
|
|
12
|
+
|
|
13
|
+
type_arguments: string[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Don't use intermediate type to make IDE happier
|
|
17
|
+
export type TypedEntryFunctionPayload<T extends Array<any>> = TransactionPayload_EntryFunctionPayload & {
|
|
18
|
+
/**
|
|
19
|
+
* decoded argument data using ABI, undefined if there is decoding error, usually because the ABI/data mismatch
|
|
20
|
+
*/
|
|
21
|
+
arguments_decoded: T
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type TypedMoveResource<T> = MoveResource & {
|
|
25
|
+
data_decoded: T
|
|
26
|
+
type_arguments: string[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface StructWithTag {
|
|
30
|
+
type: string
|
|
31
|
+
data: any
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface StructWithType<T> extends StructWithTag {
|
|
35
|
+
data_decoded: T
|
|
36
|
+
type_arguments: string[]
|
|
37
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Event,
|
|
3
|
+
MoveFunction,
|
|
4
|
+
MoveModule,
|
|
5
|
+
MoveResource,
|
|
6
|
+
MoveStruct,
|
|
7
|
+
TransactionPayload_EntryFunctionPayload,
|
|
8
|
+
} from './move-types.js'
|
|
9
|
+
|
|
10
|
+
import { getMeaningfulFunctionParams, moduleQname, SPLITTER, VECTOR_STR } from './utils.js'
|
|
11
|
+
import { parseMoveType, TypeDescriptor } from './types.js'
|
|
12
|
+
import {
|
|
13
|
+
TypedEventInstance,
|
|
14
|
+
TypedMoveResource,
|
|
15
|
+
StructWithTag,
|
|
16
|
+
StructWithType,
|
|
17
|
+
TypedEntryFunctionPayload,
|
|
18
|
+
} from './models.js'
|
|
19
|
+
|
|
20
|
+
export class MoveCoder {
|
|
21
|
+
private moduleMapping = new Map<string, MoveModule>()
|
|
22
|
+
private typeMapping = new Map<string, MoveStruct>()
|
|
23
|
+
private funcMapping = new Map<string, MoveFunction>()
|
|
24
|
+
|
|
25
|
+
contains(account: string, name: string) {
|
|
26
|
+
return this.moduleMapping.has(account + '::' + name)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
load(module: MoveModule) {
|
|
30
|
+
if (this.contains(module.address, module.name)) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
this.moduleMapping.set(moduleQname(module), module)
|
|
34
|
+
|
|
35
|
+
for (const struct of module.structs) {
|
|
36
|
+
// TODO move to util
|
|
37
|
+
const key = [module.address, module.name, struct.name].join(SPLITTER)
|
|
38
|
+
this.typeMapping.set(key, struct)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const func of module.exposed_functions) {
|
|
42
|
+
if (!func.is_entry) {
|
|
43
|
+
continue
|
|
44
|
+
}
|
|
45
|
+
const key = [module.address, module.name, func.name].join(SPLITTER)
|
|
46
|
+
this.funcMapping.set(key, func)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getMoveStruct(type: string): MoveStruct {
|
|
51
|
+
const struct = this.typeMapping.get(type)
|
|
52
|
+
if (!struct) {
|
|
53
|
+
throw new Error('Failed to load type' + type)
|
|
54
|
+
}
|
|
55
|
+
return struct
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getMoveFunction(type: string): MoveFunction {
|
|
59
|
+
const func = this.funcMapping.get(type)
|
|
60
|
+
if (!func) {
|
|
61
|
+
throw new Error('Failed to load function' + type)
|
|
62
|
+
}
|
|
63
|
+
return func
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
decode(data: any, type: TypeDescriptor): any {
|
|
67
|
+
// process simple type
|
|
68
|
+
if (type.qname.startsWith('&')) {
|
|
69
|
+
return data
|
|
70
|
+
}
|
|
71
|
+
switch (type.qname) {
|
|
72
|
+
case 'signer': // TODO check this
|
|
73
|
+
case 'address':
|
|
74
|
+
case '0x1::string::String':
|
|
75
|
+
case 'bool':
|
|
76
|
+
case 'u8':
|
|
77
|
+
case 'u16':
|
|
78
|
+
case 'u32':
|
|
79
|
+
return data
|
|
80
|
+
case 'u64':
|
|
81
|
+
case 'u128':
|
|
82
|
+
return BigInt(data)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// process vector
|
|
86
|
+
if (type.qname === VECTOR_STR) {
|
|
87
|
+
// vector<u8> as hex string
|
|
88
|
+
if (type.typeArgs[0].qname === 'u8') {
|
|
89
|
+
return data
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const res = []
|
|
93
|
+
for (const entry of data) {
|
|
94
|
+
res.push(this.decode(entry, type.typeArgs[0]))
|
|
95
|
+
}
|
|
96
|
+
return res
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Process complex type
|
|
100
|
+
const struct = this.getMoveStruct(type.qname)
|
|
101
|
+
|
|
102
|
+
const typeCtx = new Map<string, TypeDescriptor>()
|
|
103
|
+
for (const [idx, typeArg] of type.typeArgs.entries()) {
|
|
104
|
+
typeCtx.set('T' + idx, typeArg)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const typedData: any = {}
|
|
108
|
+
|
|
109
|
+
for (const field of struct.fields) {
|
|
110
|
+
let filedType = parseMoveType(field.type)
|
|
111
|
+
filedType = filedType.applyTypeArgs(typeCtx)
|
|
112
|
+
const value = this.decode(data[field.name], filedType)
|
|
113
|
+
typedData[field.name] = value
|
|
114
|
+
}
|
|
115
|
+
return typedData
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
decodeEvent<T>(event: Event): TypedEventInstance<T> | undefined {
|
|
119
|
+
return this.decodedInternal<T>(event) as TypedEventInstance<T>
|
|
120
|
+
}
|
|
121
|
+
filterAndDecodeEvents<T>(typeQname: string, resources: Event[]): TypedEventInstance<T>[] {
|
|
122
|
+
return this.filterAndDecodeInternal(typeQname, resources) as TypedEventInstance<T>[]
|
|
123
|
+
}
|
|
124
|
+
decodeResource<T>(res: MoveResource): TypedMoveResource<T> | undefined {
|
|
125
|
+
return this.decodedInternal<T>(res)
|
|
126
|
+
}
|
|
127
|
+
filterAndDecodeResources<T>(typeQname: string, resources: MoveResource[]): TypedMoveResource<T>[] {
|
|
128
|
+
return this.filterAndDecodeInternal(typeQname, resources)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private filterAndDecodeInternal<T>(typeQname: string, structs: StructWithTag[]): StructWithType<T>[] {
|
|
132
|
+
if (!structs) {
|
|
133
|
+
return []
|
|
134
|
+
}
|
|
135
|
+
const results: StructWithType<T>[] = []
|
|
136
|
+
for (const resource of structs) {
|
|
137
|
+
if (resource.type.split('<')[0] !== typeQname) {
|
|
138
|
+
continue
|
|
139
|
+
}
|
|
140
|
+
const result = this.decodedInternal(resource)
|
|
141
|
+
if (result) {
|
|
142
|
+
results.push(result as StructWithType<T>)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return results
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private decodedInternal<T>(typeStruct: StructWithTag): StructWithType<T> | undefined {
|
|
149
|
+
const registry = MOVE_CODER
|
|
150
|
+
// this.loadTypes(registry)
|
|
151
|
+
// TODO check if module is not loaded
|
|
152
|
+
|
|
153
|
+
const typeDescriptor = parseMoveType(typeStruct.type)
|
|
154
|
+
const typeArguments = typeDescriptor.typeArgs.map((t) => t.getSignature())
|
|
155
|
+
|
|
156
|
+
let dataTyped = undefined
|
|
157
|
+
try {
|
|
158
|
+
dataTyped = registry.decode(typeStruct.data, typeDescriptor)
|
|
159
|
+
} catch (e) {
|
|
160
|
+
console.error('Decoding error for ', JSON.stringify(typeStruct), e)
|
|
161
|
+
return undefined
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
...typeStruct,
|
|
165
|
+
data_decoded: dataTyped,
|
|
166
|
+
type_arguments: typeArguments,
|
|
167
|
+
} as StructWithType<T>
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
decodeFunctionPayload(payload: TransactionPayload_EntryFunctionPayload): TransactionPayload_EntryFunctionPayload {
|
|
171
|
+
const registry = MOVE_CODER
|
|
172
|
+
// this.loadTypes(registry)
|
|
173
|
+
const argumentsTyped: any[] = []
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
const func = registry.getMoveFunction(payload.function)
|
|
177
|
+
const params = getMeaningfulFunctionParams(func)
|
|
178
|
+
for (const [idx, arg] of payload.arguments.entries()) {
|
|
179
|
+
// TODO consider apply payload.type_arguments, but this might be hard since we don't code gen for them
|
|
180
|
+
const argType = parseMoveType(params[idx])
|
|
181
|
+
argumentsTyped.push(registry.decode(arg, argType))
|
|
182
|
+
}
|
|
183
|
+
} catch (e) {
|
|
184
|
+
console.error('Decoding error for ', JSON.stringify(payload), e)
|
|
185
|
+
return payload
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
...payload,
|
|
190
|
+
arguments_decoded: argumentsTyped,
|
|
191
|
+
} as TypedEntryFunctionPayload<any>
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const MOVE_CODER = new MoveCoder()
|
|
196
|
+
|
|
197
|
+
export function defaultMoveCoder(): MoveCoder {
|
|
198
|
+
return MOVE_CODER
|
|
199
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Types } from 'aptos-sdk'
|
|
2
|
+
|
|
3
|
+
export type Address = Types.Address
|
|
4
|
+
export type Event = Types.Event
|
|
5
|
+
export type MoveFunction = Types.MoveFunction
|
|
6
|
+
export type MoveModule = Types.MoveModule
|
|
7
|
+
export type MoveResource = Types.MoveResource
|
|
8
|
+
export type MoveStruct = Types.MoveStruct
|
|
9
|
+
export type MoveModuleBytecode = Types.MoveModuleBytecode
|
|
10
|
+
export type TransactionPayload_EntryFunctionPayload = Types.TransactionPayload_EntryFunctionPayload
|
|
11
|
+
export type Transaction_UserTransaction = Types.Transaction_UserTransaction
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CHAIN_IDS, getChainName } from '../core/chain.js'
|
|
2
|
+
|
|
3
|
+
export enum AptosNetwork {
|
|
4
|
+
MAIN_NET = 1,
|
|
5
|
+
TEST_NET = 2,
|
|
6
|
+
// DEV_NET,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getChainId(network: AptosNetwork): string {
|
|
10
|
+
switch (network) {
|
|
11
|
+
case AptosNetwork.TEST_NET:
|
|
12
|
+
return CHAIN_IDS.APTOS_TESTNET
|
|
13
|
+
}
|
|
14
|
+
return CHAIN_IDS.APTOS_MAINNET
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getAptosChainName(network: AptosNetwork): string {
|
|
18
|
+
switch (network) {
|
|
19
|
+
case AptosNetwork.TEST_NET:
|
|
20
|
+
return getChainName(CHAIN_IDS.APTOS_TESTNET)
|
|
21
|
+
}
|
|
22
|
+
return getChainName(CHAIN_IDS.APTOS_MAINNET)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class AptosBindOptions {
|
|
26
|
+
address: string
|
|
27
|
+
network?: AptosNetwork = AptosNetwork.MAIN_NET
|
|
28
|
+
startVersion?: bigint | number
|
|
29
|
+
}
|