@sentio/sdk 1.13.1 → 1.13.2
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/cli/commands/run-create.js +2 -0
- package/lib/cli/commands/run-create.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/run-create.ts +3 -0
- package/template/package.json +2 -3
- package/template/src/processor.test.ts +1 -1
- package/template/src/processor.ts +20 -16
- package/template/node_modules/@sentio/sdk/lib/base-processor-template.d.ts +0 -27
- package/template/node_modules/@sentio/sdk/lib/base-processor-template.js +0 -80
- package/template/node_modules/@sentio/sdk/lib/base-processor-template.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/base-processor.d.ts +0 -30
- package/template/node_modules/@sentio/sdk/lib/base-processor.js +0 -148
- package/template/node_modules/@sentio/sdk/lib/base-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/bind-options.d.ts +0 -21
- package/template/node_modules/@sentio/sdk/lib/bind-options.js +0 -42
- package/template/node_modules/@sentio/sdk/lib/bind-options.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/binds.d.ts +0 -10
- package/template/node_modules/@sentio/sdk/lib/binds.js +0 -59
- package/template/node_modules/@sentio/sdk/lib/binds.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.d.ts +0 -5
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js +0 -46
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.d.ts +0 -4
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js +0 -35
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.d.ts +0 -307
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.d.ts +0 -166
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.d.ts +0 -221
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.d.ts +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.d.ts +0 -184
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js +0 -453
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.d.ts +0 -110
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js +0 -325
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -48
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js +0 -254
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.d.ts +0 -42
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js +0 -404
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.d.ts +0 -45
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js +0 -297
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.d.ts +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js +0 -13
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.d.ts +0 -7
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js +0 -34
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.d.ts +0 -126
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js +0 -361
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js +0 -57
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/chain-config.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/chain-config.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/chain-config.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/build.d.ts +0 -4
- package/template/node_modules/@sentio/sdk/lib/cli/build.js +0 -178
- package/template/node_modules/@sentio/sdk/lib/cli/build.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/cli.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/cli.js +0 -163
- package/template/node_modules/@sentio/sdk/lib/cli/cli.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js +0 -43
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js +0 -77
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/config.d.ts +0 -16
- package/template/node_modules/@sentio/sdk/lib/cli/config.js +0 -36
- package/template/node_modules/@sentio/sdk/lib/cli/config.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/key.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/key.js +0 -44
- package/template/node_modules/@sentio/sdk/lib/cli/key.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js +0 -19
- package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/upload.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/upload.js +0 -85
- package/template/node_modules/@sentio/sdk/lib/cli/upload.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/webpack.config.js +0 -42
- package/template/node_modules/@sentio/sdk/lib/context.d.ts +0 -49
- package/template/node_modules/@sentio/sdk/lib/context.js +0 -93
- package/template/node_modules/@sentio/sdk/lib/context.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/contract-namer.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/contract-namer.js +0 -20
- package/template/node_modules/@sentio/sdk/lib/contract-namer.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/error.d.ts +0 -7
- package/template/node_modules/@sentio/sdk/lib/error.js +0 -43
- package/template/node_modules/@sentio/sdk/lib/error.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/gen/builtin.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/gen/builtin.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/gen/builtin.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.d.ts +0 -16
- package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js +0 -47
- package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.d.ts +0 -666
- package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js +0 -2837
- package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/generic-processor.d.ts +0 -10
- package/template/node_modules/@sentio/sdk/lib/generic-processor.js +0 -32
- package/template/node_modules/@sentio/sdk/lib/generic-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/index.d.ts +0 -18
- package/template/node_modules/@sentio/sdk/lib/index.js +0 -63
- package/template/node_modules/@sentio/sdk/lib/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/loader.d.ts +0 -5
- package/template/node_modules/@sentio/sdk/lib/loader.js +0 -30
- package/template/node_modules/@sentio/sdk/lib/loader.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/meter.d.ts +0 -26
- package/template/node_modules/@sentio/sdk/lib/meter.js +0 -131
- package/template/node_modules/@sentio/sdk/lib/meter.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/meter.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/meter.test.js +0 -16
- package/template/node_modules/@sentio/sdk/lib/meter.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/numberish.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/numberish.js +0 -96
- package/template/node_modules/@sentio/sdk/lib/numberish.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/numberish.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/numberish.test.js +0 -70
- package/template/node_modules/@sentio/sdk/lib/numberish.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/processor-runner.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/processor-runner.js +0 -40
- package/template/node_modules/@sentio/sdk/lib/processor-runner.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/processor-state.d.ts +0 -16
- package/template/node_modules/@sentio/sdk/lib/processor-state.js +0 -20
- package/template/node_modules/@sentio/sdk/lib/processor-state.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/promise-or-void.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/promise-or-void.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/promise-or-void.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/provider.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/provider.js +0 -66
- package/template/node_modules/@sentio/sdk/lib/provider.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/release.config.js +0 -31
- package/template/node_modules/@sentio/sdk/lib/service.d.ts +0 -25
- package/template/node_modules/@sentio/sdk/lib/service.js +0 -406
- package/template/node_modules/@sentio/sdk/lib/service.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js +0 -19
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.d.ts +0 -26
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js +0 -138
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.d.ts +0 -330
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js +0 -203
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.d.ts +0 -18
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js +0 -192
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana-processor.d.ts +0 -34
- package/template/node_modules/@sentio/sdk/lib/solana-processor.js +0 -95
- package/template/node_modules/@sentio/sdk/lib/solana-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.d.ts +0 -4
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js +0 -292
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.d.ts +0 -3
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js +0 -61
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js +0 -51
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/codegen.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js +0 -49
- package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js +0 -23
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js +0 -37
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.js +0 -44
- package/template/node_modules/@sentio/sdk/lib/test/erc20.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js +0 -96
- package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js +0 -59
- package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/test/index.js +0 -8
- package/template/node_modules/@sentio/sdk/lib/test/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/metric-utils.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js +0 -50
- package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js +0 -42
- package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/solana.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/solana.test.js +0 -90
- package/template/node_modules/@sentio/sdk/lib/test/solana.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.d.ts +0 -34
- package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js +0 -205
- package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/test-provider.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/test-provider.js +0 -25
- package/template/node_modules/@sentio/sdk/lib/test/test-provider.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.d.ts +0 -45
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js +0 -1396
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.d.ts +0 -107
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js +0 -105
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/trace.d.ts +0 -35
- package/template/node_modules/@sentio/sdk/lib/trace.js +0 -43
- package/template/node_modules/@sentio/sdk/lib/trace.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/chainmap.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js +0 -98
- package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/convert.d.ts +0 -5
- package/template/node_modules/@sentio/sdk/lib/utils/convert.js +0 -27
- package/template/node_modules/@sentio/sdk/lib/utils/convert.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.d.ts +0 -14
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.js +0 -62
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js +0 -23
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/index.d.ts +0 -3
- package/template/node_modules/@sentio/sdk/lib/utils/index.js +0 -14
- package/template/node_modules/@sentio/sdk/lib/utils/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/package.json +0 -78
- package/template/node_modules/@sentio/sdk/src/abis/ERC20.json +0 -174
- package/template/node_modules/@sentio/sdk/src/abis/ERC20Bytes.json +0 -236
- package/template/node_modules/@sentio/sdk/src/abis/WETH9.json +0 -153
- package/template/node_modules/@sentio/sdk/src/base-processor-template.ts +0 -105
- package/template/node_modules/@sentio/sdk/src/base-processor.ts +0 -172
- package/template/node_modules/@sentio/sdk/src/bind-options.ts +0 -41
- package/template/node_modules/@sentio/sdk/src/binds.ts +0 -73
- package/template/node_modules/@sentio/sdk/src/builtin/erc20/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/erc20/test-utils.ts +0 -71
- package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/test-utils.ts +0 -53
- package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20.ts +0 -679
- package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20Bytes.ts +0 -384
- package/template/node_modules/@sentio/sdk/src/builtin/internal/WETH9.ts +0 -480
- package/template/node_modules/@sentio/sdk/src/builtin/internal/common.ts +0 -46
- package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20_processor.ts +0 -762
- package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20bytes_processor.ts +0 -531
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20Bytes__factory.ts +0 -257
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20__factory.ts +0 -404
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/WETH9__factory.ts +0 -297
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/internal/index.ts +0 -10
- package/template/node_modules/@sentio/sdk/src/builtin/internal/weth9_processor.ts +0 -589
- package/template/node_modules/@sentio/sdk/src/builtin/weth9/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/weth9/test-utils.ts +0 -89
- package/template/node_modules/@sentio/sdk/src/chain-config.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/cli/build.ts +0 -196
- package/template/node_modules/@sentio/sdk/src/cli/cli.ts +0 -160
- package/template/node_modules/@sentio/sdk/src/cli/commands/run-create.ts +0 -36
- package/template/node_modules/@sentio/sdk/src/cli/commands/run-login.ts +0 -70
- package/template/node_modules/@sentio/sdk/src/cli/config.ts +0 -45
- package/template/node_modules/@sentio/sdk/src/cli/key.ts +0 -43
- package/template/node_modules/@sentio/sdk/src/cli/solana-code-gen.ts +0 -16
- package/template/node_modules/@sentio/sdk/src/cli/upload.ts +0 -88
- package/template/node_modules/@sentio/sdk/src/cli/webpack.config.js +0 -42
- package/template/node_modules/@sentio/sdk/src/context.ts +0 -103
- package/template/node_modules/@sentio/sdk/src/contract-namer.ts +0 -17
- package/template/node_modules/@sentio/sdk/src/error.ts +0 -45
- package/template/node_modules/@sentio/sdk/src/gen/builtin.ts +0 -22
- package/template/node_modules/@sentio/sdk/src/gen/google/protobuf/empty.ts +0 -70
- package/template/node_modules/@sentio/sdk/src/gen/processor/protos/processor.ts +0 -3626
- package/template/node_modules/@sentio/sdk/src/generic-processor.ts +0 -35
- package/template/node_modules/@sentio/sdk/src/index.ts +0 -21
- package/template/node_modules/@sentio/sdk/src/loader.ts +0 -24
- package/template/node_modules/@sentio/sdk/src/meter.test.ts +0 -16
- package/template/node_modules/@sentio/sdk/src/meter.ts +0 -140
- package/template/node_modules/@sentio/sdk/src/numberish.test.ts +0 -82
- package/template/node_modules/@sentio/sdk/src/numberish.ts +0 -100
- package/template/node_modules/@sentio/sdk/src/processor-runner.ts +0 -46
- package/template/node_modules/@sentio/sdk/src/processor-state.ts +0 -24
- package/template/node_modules/@sentio/sdk/src/promise-or-void.ts +0 -1
- package/template/node_modules/@sentio/sdk/src/provider.ts +0 -74
- package/template/node_modules/@sentio/sdk/src/service.ts +0 -491
- package/template/node_modules/@sentio/sdk/src/solana/builtin/index.ts +0 -2
- package/template/node_modules/@sentio/sdk/src/solana/builtin/spl-token-processor.ts +0 -164
- package/template/node_modules/@sentio/sdk/src/solana/builtin/types.ts +0 -268
- package/template/node_modules/@sentio/sdk/src/solana/builtin/wormhole-processor.ts +0 -178
- package/template/node_modules/@sentio/sdk/src/solana-processor.ts +0 -106
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/codegen.ts +0 -315
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/functions.ts +0 -68
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/index.ts +0 -50
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/tsconfig.json +0 -9
- package/template/node_modules/@sentio/sdk/src/test/abis/evm/CommitmentPool.json +0 -1034
- package/template/node_modules/@sentio/sdk/src/test/abis/evm/anyswapRouter.json +0 -490
- package/template/node_modules/@sentio/sdk/src/test/abis/solana/mirrorworld.json +0 -1392
- package/template/node_modules/@sentio/sdk/src/test/codegen.test.ts +0 -29
- package/template/node_modules/@sentio/sdk/src/test/erc20-template.test.ts +0 -37
- package/template/node_modules/@sentio/sdk/src/test/erc20-template.ts +0 -25
- package/template/node_modules/@sentio/sdk/src/test/erc20.test.ts +0 -117
- package/template/node_modules/@sentio/sdk/src/test/erc20.ts +0 -50
- package/template/node_modules/@sentio/sdk/src/test/generic-processor.test.ts +0 -70
- package/template/node_modules/@sentio/sdk/src/test/index.ts +0 -2
- package/template/node_modules/@sentio/sdk/src/test/metric-utils.ts +0 -49
- package/template/node_modules/@sentio/sdk/src/test/mirrorworld.ts +0 -40
- package/template/node_modules/@sentio/sdk/src/test/sentio.yaml +0 -4
- package/template/node_modules/@sentio/sdk/src/test/solana.test.ts +0 -93
- package/template/node_modules/@sentio/sdk/src/test/test-processor-server.ts +0 -258
- package/template/node_modules/@sentio/sdk/src/test/test-provider.ts +0 -25
- package/template/node_modules/@sentio/sdk/src/test/types/game_wallet.ts +0 -1392
- package/template/node_modules/@sentio/sdk/src/test/types/game_wallet_processor.ts +0 -113
- package/template/node_modules/@sentio/sdk/src/test/wormhole-token-bridge.ts +0 -21
- package/template/node_modules/@sentio/sdk/src/trace.ts +0 -86
- package/template/node_modules/@sentio/sdk/src/types/global.d.ts +0 -17
- package/template/node_modules/@sentio/sdk/src/utils/chainmap.ts +0 -95
- package/template/node_modules/@sentio/sdk/src/utils/convert.ts +0 -26
- package/template/node_modules/@sentio/sdk/src/utils/erc20.test.ts +0 -26
- package/template/node_modules/@sentio/sdk/src/utils/erc20.ts +0 -66
- package/template/node_modules/@sentio/sdk/src/utils/index.ts +0 -3
- package/template/node_modules/base-x/LICENSE.md +0 -22
- package/template/node_modules/base-x/README.md +0 -73
- package/template/node_modules/base-x/package.json +0 -46
- package/template/node_modules/base-x/src/index.d.ts +0 -9
- package/template/node_modules/base-x/src/index.js +0 -121
- package/template/node_modules/bs58/CHANGELOG.md +0 -65
- package/template/node_modules/bs58/LICENSE +0 -21
- package/template/node_modules/bs58/README.md +0 -91
- package/template/node_modules/bs58/index.d.ts +0 -5
- package/template/node_modules/bs58/index.js +0 -4
- package/template/node_modules/bs58/package.json +0 -39
- package/template/src/types/internal/X2y2.ts +0 -684
- package/template/src/types/internal/common.ts +0 -46
- package/template/src/types/internal/factories/X2y2__factory.ts +0 -436
- package/template/src/types/internal/factories/index.ts +0 -4
- package/template/src/types/internal/index.ts +0 -6
- package/template/src/types/internal/x2y2_processor.ts +0 -1004
- package/template/src/types/x2y2/index.ts +0 -6
- package/template/src/types/x2y2/test-utils.ts +0 -89
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from '@ethersproject/contracts'
|
|
2
|
-
import { BoundContractView, ContractView } from './context'
|
|
3
|
-
import { BindOptions } from './bind-options'
|
|
4
|
-
import { BaseProcessor } from './base-processor'
|
|
5
|
-
import { getProvider } from './provider'
|
|
6
|
-
import { addProcessor, getContractName } from './binds'
|
|
7
|
-
|
|
8
|
-
export class GenericProcessor extends BaseProcessor<
|
|
9
|
-
BaseContract,
|
|
10
|
-
BoundContractView<BaseContract, ContractView<BaseContract>>
|
|
11
|
-
> {
|
|
12
|
-
eventABI: string[]
|
|
13
|
-
constructor(eventABI: string[], options: BindOptions) {
|
|
14
|
-
super(options)
|
|
15
|
-
this.eventABI = eventABI
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
protected CreateBoundContractView(): BoundContractView<BaseContract, ContractView<BaseContract>> {
|
|
19
|
-
const contract = new BaseContract(this.config.address, this.eventABI, getProvider(this.config.network))
|
|
20
|
-
return new BoundContractView(new ContractView<BaseContract>(contract))
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public static bind(eventABI: string[] | string, options: BindOptions): GenericProcessor {
|
|
24
|
-
const AbiName = 'Generic'
|
|
25
|
-
if (!Array.isArray(eventABI)) {
|
|
26
|
-
eventABI = [eventABI]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const finalOptions = Object.assign({}, options)
|
|
30
|
-
finalOptions.name = getContractName(AbiName, options.name, options.address, options.network)
|
|
31
|
-
const processor = new GenericProcessor(eventABI, finalOptions)
|
|
32
|
-
addProcessor(AbiName, options, processor)
|
|
33
|
-
return processor
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export { BaseProcessor } from './base-processor'
|
|
2
|
-
export { GenericProcessor } from './generic-processor'
|
|
3
|
-
export { BaseProcessorTemplate } from './base-processor-template'
|
|
4
|
-
export { Context, ContractView, BoundContractView, SolanaContext } from './context'
|
|
5
|
-
export { ProcessorServiceImpl } from './service'
|
|
6
|
-
export { Counter, Meter, Gauge } from './meter'
|
|
7
|
-
export { getProvider, setProvider, DummyProvider } from './provider'
|
|
8
|
-
export { SolanaBaseProcessor } from './solana-processor'
|
|
9
|
-
export { ContractNamer } from './contract-namer'
|
|
10
|
-
export { BindOptions, SolanaBindOptions } from './bind-options'
|
|
11
|
-
export { transformEtherError } from './error'
|
|
12
|
-
export { ProcessorState } from './processor-state'
|
|
13
|
-
export { BigNumber as BigDecimal } from 'bignumber.js'
|
|
14
|
-
export { EthersError } from './error'
|
|
15
|
-
export type { TypedCallTrace } from './trace'
|
|
16
|
-
|
|
17
|
-
export { getProcessor, addProcessor, getContractByABI, addContractByABI, getContractName } from './binds'
|
|
18
|
-
|
|
19
|
-
export * from './gen/processor/protos/processor'
|
|
20
|
-
|
|
21
|
-
export { SPLTokenProcessor } from './solana/builtin'
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function load(name: string): { module: any; name: string; path: string } | undefined {
|
|
2
|
-
const req = eval('require')
|
|
3
|
-
|
|
4
|
-
try {
|
|
5
|
-
let path: string
|
|
6
|
-
try {
|
|
7
|
-
path = req.resolve(name, { paths: [process.cwd()] })
|
|
8
|
-
} catch {
|
|
9
|
-
path = req.resolve(name)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const module = { module: req(path), name, path }
|
|
13
|
-
console.log('Load successfully: ', name)
|
|
14
|
-
return module
|
|
15
|
-
} catch (err) {
|
|
16
|
-
if (err instanceof Error && err.message.startsWith(`Cannot find module '${name}'`)) {
|
|
17
|
-
// this error is expected
|
|
18
|
-
console.log("Couldn't load (expected): ", name)
|
|
19
|
-
return undefined
|
|
20
|
-
} else {
|
|
21
|
-
throw err
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai'
|
|
2
|
-
import { normalizeName } from './meter'
|
|
3
|
-
|
|
4
|
-
describe('meter tests', () => {
|
|
5
|
-
test('test normalization ', async () => {
|
|
6
|
-
expect(normalizeName('abc') === 'abc')
|
|
7
|
-
expect(normalizeName('a-b-c') === 'a-b-c')
|
|
8
|
-
expect(normalizeName('_a-B-1.') === '_a-B-1.')
|
|
9
|
-
|
|
10
|
-
expect(normalizeName('a/b\\c\n') === 'abc')
|
|
11
|
-
expect(normalizeName('abc abc') === 'abc_abc')
|
|
12
|
-
expect(normalizeName('*&~') === '___')
|
|
13
|
-
|
|
14
|
-
expect(normalizeName('x'.repeat(200)).length === 100)
|
|
15
|
-
})
|
|
16
|
-
})
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { RecordMetaData } from './gen/processor/protos/processor'
|
|
2
|
-
import { BaseContext, Context, SolanaContext } from './context'
|
|
3
|
-
import { toMetricValue, Numberish } from './numberish'
|
|
4
|
-
import Long from 'long'
|
|
5
|
-
|
|
6
|
-
export function normalizeName(name: string) {
|
|
7
|
-
const regex = new RegExp('![_.a-zA-Z0-9]')
|
|
8
|
-
return name.slice(0, 100).replace(regex, '_')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function GetRecordMetaData(ctx: BaseContext, name: string, labels: Labels): RecordMetaData {
|
|
12
|
-
name = normalizeName(name)
|
|
13
|
-
|
|
14
|
-
if (ctx instanceof Context) {
|
|
15
|
-
if (ctx.log) {
|
|
16
|
-
return {
|
|
17
|
-
contractAddress: ctx.contract.rawContract.address,
|
|
18
|
-
blockNumber: Long.fromNumber(ctx.log.blockNumber, true), // TODO need number type to be long
|
|
19
|
-
transactionIndex: ctx.log.transactionIndex,
|
|
20
|
-
logIndex: ctx.log.logIndex,
|
|
21
|
-
chainId: ctx.chainId.toString(),
|
|
22
|
-
name: name,
|
|
23
|
-
labels: labels,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (ctx.block) {
|
|
27
|
-
return {
|
|
28
|
-
contractAddress: ctx.contract.rawContract.address,
|
|
29
|
-
blockNumber: Long.fromNumber(ctx.block.number, true),
|
|
30
|
-
transactionIndex: -1,
|
|
31
|
-
logIndex: -1,
|
|
32
|
-
chainId: ctx.chainId.toString(),
|
|
33
|
-
name: name,
|
|
34
|
-
labels: labels,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (ctx.trace) {
|
|
38
|
-
return {
|
|
39
|
-
contractAddress: ctx.contract.rawContract.address,
|
|
40
|
-
blockNumber: Long.fromNumber(ctx.trace.blockNumber, true),
|
|
41
|
-
transactionIndex: ctx.trace.transactionPosition, // TODO make sure if this is the right value to set
|
|
42
|
-
logIndex: -1,
|
|
43
|
-
chainId: ctx.chainId.toString(),
|
|
44
|
-
name: name,
|
|
45
|
-
labels: labels,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
} else if (ctx instanceof SolanaContext) {
|
|
49
|
-
return {
|
|
50
|
-
contractAddress: ctx.address,
|
|
51
|
-
blockNumber: Long.ZERO, // TODO need number type to be long
|
|
52
|
-
transactionIndex: 0,
|
|
53
|
-
logIndex: 0,
|
|
54
|
-
chainId: 'SOL_mainnet', // TODO set in context
|
|
55
|
-
name: name,
|
|
56
|
-
labels: labels,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
throw new Error("This can't happen")
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type Labels = { [key: string]: string }
|
|
63
|
-
|
|
64
|
-
export class Counter {
|
|
65
|
-
private readonly ctx: BaseContext
|
|
66
|
-
private readonly name: string
|
|
67
|
-
|
|
68
|
-
constructor(name: string, ctx: BaseContext) {
|
|
69
|
-
this.name = name
|
|
70
|
-
this.ctx = ctx
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
add(value: Numberish, labels: Labels = {}) {
|
|
74
|
-
this.record(value, labels, true)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
sub(value: Numberish, labels: Labels = {}) {
|
|
78
|
-
this.record(value, labels, false)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private record(value: Numberish, labels: Labels, add: boolean) {
|
|
82
|
-
this.ctx.counters.push({
|
|
83
|
-
metadata: GetRecordMetaData(this.ctx, this.name, labels),
|
|
84
|
-
metricValue: toMetricValue(value),
|
|
85
|
-
add: add,
|
|
86
|
-
runtimeInfo: undefined,
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export class Gauge {
|
|
92
|
-
private readonly name: string
|
|
93
|
-
private readonly ctx: BaseContext
|
|
94
|
-
|
|
95
|
-
constructor(name: string, ctx: BaseContext) {
|
|
96
|
-
this.name = name
|
|
97
|
-
this.ctx = ctx
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
record(value: Numberish, labels: Labels = {}) {
|
|
101
|
-
this.ctx.gauges.push({
|
|
102
|
-
metadata: GetRecordMetaData(this.ctx, this.name, labels),
|
|
103
|
-
metricValue: toMetricValue(value),
|
|
104
|
-
runtimeInfo: undefined,
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export class Meter {
|
|
110
|
-
private readonly ctx: BaseContext
|
|
111
|
-
|
|
112
|
-
// TODO is map necessary since we are sending request remotely?
|
|
113
|
-
// counterMap = new Map<string, Counter>()
|
|
114
|
-
// gaugeMap = new Map<string, Gauge>()
|
|
115
|
-
|
|
116
|
-
constructor(ctx: BaseContext) {
|
|
117
|
-
this.ctx = ctx
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
Counter(name: string): Counter {
|
|
121
|
-
// let counter = this.counterMap.get(name)
|
|
122
|
-
|
|
123
|
-
// if (!counter) {
|
|
124
|
-
// counter = new Counter(name, this.ctx)
|
|
125
|
-
// }
|
|
126
|
-
// return counter
|
|
127
|
-
|
|
128
|
-
return new Counter(name, this.ctx)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
Gauge(name: string): Gauge {
|
|
132
|
-
// let gauge = this.gaugeMap.get(name)
|
|
133
|
-
//
|
|
134
|
-
// if (!gauge) {
|
|
135
|
-
// gauge = new Gauge(name, this.ctx)
|
|
136
|
-
// }
|
|
137
|
-
// return gauge
|
|
138
|
-
return new Gauge(name, this.ctx)
|
|
139
|
-
}
|
|
140
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai'
|
|
2
|
-
import { toBigInteger, toMetricValue } from './numberish'
|
|
3
|
-
import { webcrypto } from 'crypto'
|
|
4
|
-
import { BigNumber } from 'ethers'
|
|
5
|
-
import { performance } from 'perf_hooks'
|
|
6
|
-
import { BigInteger } from './gen/processor/protos/processor'
|
|
7
|
-
import { BigDecimal } from './index'
|
|
8
|
-
|
|
9
|
-
// TODO add test for type conversion
|
|
10
|
-
describe('Numberish tests', () => {
|
|
11
|
-
const values: bigint[] = [0n, -0n, 3815372408723498172304781320847103784n, 2132n, -18708707n, 123n << 100n]
|
|
12
|
-
|
|
13
|
-
test('big integer conversion correctness ', async () => {
|
|
14
|
-
for (const v of values) {
|
|
15
|
-
const b = toBigInteger(v)
|
|
16
|
-
const hex1 = BigIntegerToHex(b)
|
|
17
|
-
const hex2 = v.toString(16)
|
|
18
|
-
expect(hex1).equals(hex2)
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
test('random big integer conversion correctness ', async () => {
|
|
23
|
-
for (let i = 0; i < 1000; i++) {
|
|
24
|
-
const random = webcrypto.getRandomValues(new Uint8Array(256))
|
|
25
|
-
const v = BigNumber.from(random).toBigInt()
|
|
26
|
-
const b = toBigInteger(v)
|
|
27
|
-
|
|
28
|
-
expect(BigNumber.from(b.data).eq(v)).to.equals(true)
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
test.skip('random big integer performance', async () => {
|
|
33
|
-
jest.setTimeout(100000)
|
|
34
|
-
jest.retryTimes(3)
|
|
35
|
-
|
|
36
|
-
let timer1 = 0
|
|
37
|
-
let timer2 = 0
|
|
38
|
-
for (let i = 0; i < 1000; i++) {
|
|
39
|
-
// Use higher value for local debugging
|
|
40
|
-
const random = webcrypto.getRandomValues(new Uint8Array(256))
|
|
41
|
-
const v = BigNumber.from(random).toBigInt()
|
|
42
|
-
|
|
43
|
-
let start = performance.now()
|
|
44
|
-
toBigInteger(v)
|
|
45
|
-
timer1 += performance.now() - start
|
|
46
|
-
|
|
47
|
-
start = performance.now()
|
|
48
|
-
v.toString(16)
|
|
49
|
-
timer2 += performance.now() - start
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
console.log(timer1, timer2)
|
|
53
|
-
expect(timer1).to.lessThan(timer2 * 3)
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
test('metric values', async () => {
|
|
57
|
-
const longDec = '12.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002'
|
|
58
|
-
expect(toMetricValue(new BigDecimal(longDec)).bigDecimal == longDec)
|
|
59
|
-
|
|
60
|
-
const complexDec = '-7.350918e-428'
|
|
61
|
-
expect(toMetricValue(new BigDecimal(complexDec)).bigDecimal == complexDec)
|
|
62
|
-
|
|
63
|
-
expect(BigIntegerToBigInt(toMetricValue(new BigDecimal('100000')).bigInteger!) === 100000n)
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// Performance very bad
|
|
68
|
-
function BigIntegerToHex(b: BigInteger): string {
|
|
69
|
-
let res = BigNumber.from(b.data).toBigInt().toString(16)
|
|
70
|
-
if (b.negative) {
|
|
71
|
-
res = '-' + res
|
|
72
|
-
}
|
|
73
|
-
return res
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function BigIntegerToBigInt(b: BigInteger): bigint {
|
|
77
|
-
let res = BigNumber.from(b.data).toBigInt()
|
|
78
|
-
if (b.negative) {
|
|
79
|
-
res = -res
|
|
80
|
-
}
|
|
81
|
-
return res
|
|
82
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from 'ethers'
|
|
2
|
-
import { BigInteger, MetricValue } from './gen/processor/protos/processor'
|
|
3
|
-
import { BigDecimal } from '.'
|
|
4
|
-
import { BN } from '@project-serum/anchor'
|
|
5
|
-
|
|
6
|
-
export type Numberish = number | BigNumber | bigint | BigDecimal
|
|
7
|
-
|
|
8
|
-
export function toMetricValue(value: Numberish): MetricValue {
|
|
9
|
-
if (value instanceof BigNumber) {
|
|
10
|
-
return MetricValue.fromPartial({
|
|
11
|
-
bigInteger: toBigInteger(value.toBigInt()),
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
if (value instanceof BigDecimal) {
|
|
15
|
-
// Carefully consider the use case here
|
|
16
|
-
if (value.isInteger()) {
|
|
17
|
-
return MetricValue.fromPartial({
|
|
18
|
-
bigInteger: bigDecimalToBigInteger(value),
|
|
19
|
-
})
|
|
20
|
-
} else {
|
|
21
|
-
return MetricValue.fromPartial({
|
|
22
|
-
bigDecimal: value.toString(), // e.g. -7.350918e-428
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (BN.isBN(value)) {
|
|
27
|
-
return MetricValue.fromPartial({
|
|
28
|
-
bigInteger: bnToBigInteger(value),
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
if (typeof value === 'bigint' || Number.isInteger(value)) {
|
|
32
|
-
return MetricValue.fromPartial({
|
|
33
|
-
bigInteger: toBigInteger(value),
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return MetricValue.fromPartial({
|
|
38
|
-
doubleValue: Number(value),
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function bigDecimalToBigInteger(a: BigDecimal): BigInteger {
|
|
43
|
-
const negative = a.isNegative()
|
|
44
|
-
if (negative) {
|
|
45
|
-
a = a.abs()
|
|
46
|
-
}
|
|
47
|
-
return hexToBigInteger(a.toString(16), negative)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function bnToBigInteger(a: BN): BigInteger {
|
|
51
|
-
const negative = a.isNeg()
|
|
52
|
-
if (negative) {
|
|
53
|
-
a = a.abs()
|
|
54
|
-
}
|
|
55
|
-
return hexToBigInteger(a.toString(16), negative)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function intToBigInteger(a: bigint | number): BigInteger {
|
|
59
|
-
const negative = a < 0
|
|
60
|
-
if (negative) {
|
|
61
|
-
a = -a
|
|
62
|
-
}
|
|
63
|
-
return hexToBigInteger(a.toString(16), negative)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function toBigInteger(a: Numberish): BigInteger {
|
|
67
|
-
if (a instanceof BigDecimal) {
|
|
68
|
-
return bigDecimalToBigInteger(a)
|
|
69
|
-
}
|
|
70
|
-
if (a instanceof BN) {
|
|
71
|
-
return bnToBigInteger(a)
|
|
72
|
-
}
|
|
73
|
-
if (a instanceof BigNumber) {
|
|
74
|
-
return intToBigInteger(a.toBigInt())
|
|
75
|
-
}
|
|
76
|
-
return intToBigInteger(a)
|
|
77
|
-
|
|
78
|
-
// Following code is actually very slow
|
|
79
|
-
// while (a > 0) {
|
|
80
|
-
// const d = a & 0xffn
|
|
81
|
-
// a >>= 8n
|
|
82
|
-
// value.push(Number(d))
|
|
83
|
-
// }
|
|
84
|
-
//
|
|
85
|
-
// return {
|
|
86
|
-
// negative, value: new Uint8Array(value.reverse()),
|
|
87
|
-
// }
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function hexToBigInteger(hex: string, negative: boolean): BigInteger {
|
|
91
|
-
if (hex.length % 2 === 1) {
|
|
92
|
-
hex = '0' + hex
|
|
93
|
-
}
|
|
94
|
-
const buffer = Buffer.from(hex, 'hex')
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
negative: negative,
|
|
98
|
-
data: new Uint8Array(buffer),
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import commandLineArgs from 'command-line-args'
|
|
4
|
-
import { createServer } from 'nice-grpc'
|
|
5
|
-
import { ProcessorDefinition } from './gen/processor/protos/processor'
|
|
6
|
-
import { ProcessorServiceImpl } from './service'
|
|
7
|
-
import { setProvider } from './provider'
|
|
8
|
-
|
|
9
|
-
import path from 'path'
|
|
10
|
-
import fs from 'fs-extra'
|
|
11
|
-
import { ProcessorState } from './processor-state'
|
|
12
|
-
import { load } from './loader'
|
|
13
|
-
|
|
14
|
-
global.sentio_sdk = require('.')
|
|
15
|
-
global.PROCESSOR_STATE = new ProcessorState()
|
|
16
|
-
|
|
17
|
-
const optionDefinitions = [
|
|
18
|
-
{ name: 'target', type: String, defaultOption: true },
|
|
19
|
-
{ name: 'port', alias: 'p', type: String, defaultValue: '4000' },
|
|
20
|
-
{ name: 'concurrency', type: Number, defaultValue: 4 },
|
|
21
|
-
{ name: 'use-chainserver', type: Boolean, defaultValue: false },
|
|
22
|
-
{
|
|
23
|
-
name: 'chains-config',
|
|
24
|
-
alias: 'c',
|
|
25
|
-
type: String,
|
|
26
|
-
defaultValue: 'chains-config.json',
|
|
27
|
-
},
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
const options = commandLineArgs(optionDefinitions, { partial: true })
|
|
31
|
-
|
|
32
|
-
console.log('loading', options.target)
|
|
33
|
-
|
|
34
|
-
const fullPath = path.resolve(options['chains-config'])
|
|
35
|
-
const chainsConfig = fs.readJsonSync(fullPath)
|
|
36
|
-
|
|
37
|
-
setProvider(chainsConfig, options.concurrency, options['use-chainserver'])
|
|
38
|
-
|
|
39
|
-
console.log('Start Server', options)
|
|
40
|
-
|
|
41
|
-
const server = createServer()
|
|
42
|
-
|
|
43
|
-
const service = new ProcessorServiceImpl(() => load(options.target), server.shutdown)
|
|
44
|
-
server.add(ProcessorDefinition, service)
|
|
45
|
-
|
|
46
|
-
server.listen('0.0.0.0:' + options.port)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseProcessor } from './base-processor'
|
|
2
|
-
import { BaseContract } from 'ethers'
|
|
3
|
-
import { BoundContractView, ContractView } from './context'
|
|
4
|
-
import { BaseProcessorTemplate } from './base-processor-template'
|
|
5
|
-
import { TemplateInstance } from './gen/processor/protos/processor'
|
|
6
|
-
import { Provider } from '@ethersproject/providers'
|
|
7
|
-
import { SolanaBaseProcessor } from './solana-processor'
|
|
8
|
-
|
|
9
|
-
export class ProcessorState {
|
|
10
|
-
// from abiName_address_chainId => contract wrapper
|
|
11
|
-
contracts = new Map<string, ContractView<BaseContract>>()
|
|
12
|
-
// all evm processors
|
|
13
|
-
processors: BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>[] = []
|
|
14
|
-
// from abiName_options to contracts
|
|
15
|
-
processorMap = new Map<string, BaseProcessor<any, any>>()
|
|
16
|
-
// evm providers
|
|
17
|
-
providers = new Map<number, Provider>()
|
|
18
|
-
// evm processor templates
|
|
19
|
-
templates: BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>[] = []
|
|
20
|
-
// evm processor template instances spec
|
|
21
|
-
templatesInstances: TemplateInstance[] = []
|
|
22
|
-
|
|
23
|
-
solanaProcessors: SolanaBaseProcessor[] = []
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type PromiseOrVoid = void | Promise<any>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { getNetwork, Provider, StaticJsonRpcProvider } from '@ethersproject/providers'
|
|
2
|
-
import { Networkish } from '@ethersproject/networks'
|
|
3
|
-
import PQueue from 'p-queue'
|
|
4
|
-
import { ConnectionInfo } from '@ethersproject/web'
|
|
5
|
-
import { ChainConfig } from './chain-config'
|
|
6
|
-
|
|
7
|
-
export const DummyProvider = new StaticJsonRpcProvider(undefined, 1)
|
|
8
|
-
|
|
9
|
-
export function getProvider(networkish?: Networkish): Provider {
|
|
10
|
-
if (!networkish) {
|
|
11
|
-
networkish = 1
|
|
12
|
-
}
|
|
13
|
-
const network = getNetwork(networkish)
|
|
14
|
-
|
|
15
|
-
if (!global.PROCESSOR_STATE.providers) {
|
|
16
|
-
throw Error('Provider not set')
|
|
17
|
-
}
|
|
18
|
-
const value = global.PROCESSOR_STATE.providers.get(network.chainId)
|
|
19
|
-
if (value === undefined) {
|
|
20
|
-
throw Error(
|
|
21
|
-
'Provider not found for chain ' +
|
|
22
|
-
network.chainId +
|
|
23
|
-
', configured chains: ' +
|
|
24
|
-
[...global.PROCESSOR_STATE.providers.keys()].join(' ')
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
return value
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function setProvider(config: Record<string, ChainConfig>, concurrency = 4, useChainServer = false) {
|
|
31
|
-
global.PROCESSOR_STATE.providers = new Map<number, Provider>()
|
|
32
|
-
|
|
33
|
-
for (const chainIdStr in config) {
|
|
34
|
-
if (isNaN(Number.parseInt(chainIdStr))) {
|
|
35
|
-
continue
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const chainConfig = config[chainIdStr]
|
|
39
|
-
const chainId = Number(chainIdStr)
|
|
40
|
-
|
|
41
|
-
// let providers: StaticJsonRpcProvider[] = []
|
|
42
|
-
// for (const http of chainConfig.Https) {
|
|
43
|
-
// providers.push(new StaticJsonRpcProvider(http, chainId))
|
|
44
|
-
// }
|
|
45
|
-
// random shuffle
|
|
46
|
-
// providers = providers.sort(() => Math.random() - 0.5)
|
|
47
|
-
|
|
48
|
-
// const provider = new FallbackProvider(providers)
|
|
49
|
-
|
|
50
|
-
let rpcAddress = ''
|
|
51
|
-
if (useChainServer && chainConfig.ChainServer) {
|
|
52
|
-
rpcAddress = chainConfig.ChainServer
|
|
53
|
-
} else {
|
|
54
|
-
const idx = Math.floor(Math.random() * chainConfig.Https.length)
|
|
55
|
-
rpcAddress = chainConfig.Https[idx]
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const provider = new QueuedStaticJsonRpcProvider(rpcAddress, chainId, concurrency)
|
|
59
|
-
global.PROCESSOR_STATE.providers.set(chainId, provider)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
class QueuedStaticJsonRpcProvider extends StaticJsonRpcProvider {
|
|
64
|
-
executor: PQueue
|
|
65
|
-
|
|
66
|
-
constructor(url: ConnectionInfo | string, network: Networkish, concurrency: number) {
|
|
67
|
-
super(url, network)
|
|
68
|
-
this.executor = new PQueue({ concurrency: concurrency })
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
send(method: string, params: Array<any>): Promise<any> {
|
|
72
|
-
return this.executor.add(() => super.send(method, params))
|
|
73
|
-
}
|
|
74
|
-
}
|