@sentio/sdk 1.13.0 → 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/lib/test/index.d.ts +1 -0
- package/lib/test/index.js +5 -1
- package/lib/test/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/run-create.ts +3 -0
- package/src/test/index.ts +1 -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
|
@@ -73,6 +73,8 @@ function runCreate(argv) {
|
|
|
73
73
|
}
|
|
74
74
|
packageJson.version = cliVersion;
|
|
75
75
|
packageJson.name = projectName;
|
|
76
|
+
// Don't add directly to avoid deps issue
|
|
77
|
+
packageJson.scripts.postinstall = 'sentio gen';
|
|
76
78
|
fs_extra_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
77
79
|
}
|
|
78
80
|
console.log(chalk_1.default.green("successfully create project '" + projectName + "'"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-create.js","sourceRoot":"","sources":["../../../src/cli/commands/run-create.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA+C;AAC/C,4EAAiD;AACjD,gDAAuB;AACvB,wDAAyB;AACzB,kDAAyB;AACzB,oCAAwC;AAExC,SAAgB,SAAS,CAAC,IAAc;IACtC,MAAM,iBAAiB,GAAG;QACxB;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,2BAA2B;SACzC;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,GAAG;YACV,aAAa,EAAE,IAAI;YACnB,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,cAAc;SAC5B;KACF,CAAA;IAED,MAAM,OAAO,GAAG,IAAA,2BAAe,EAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5D,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjC,MAAM,KAAK,GAAG,IAAA,4BAAgB,EAAC;YAC7B;gBACE,MAAM,EAAE,2BAA2B;gBACnC,O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AAA;YACb,CAAC;YACD,SAAS,EAAE,KAAK;SACjB,CAAC,CAAA;QACF,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,MAAM,cAAc,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;YAC7D,kBAAE,CAAC,aAAa,CAAC,cAAc,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;YAElF,MAAM,eAAe,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;YAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAA;YAExE,IAAI,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAA;YAChC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBAC/B,UAAU,GAAG,GAAG,GAAG,UAAU,CAAA;aAC9B;YAED,WAAW,CAAC,OAAO,GAAG,UAAU,CAAA;YAChC,WAAW,CAAC,IAAI,GAAG,WAAW,CAAA;YAE9B,yCAAyC;YACzC,WAAW,CAAC,OAAO,CAAC,WAAW,GAAG,YAAY,CAAA;YAE9C,kBAAE,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;SACxE;QACD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,+BAA+B,GAAG,WAAW,GAAG,GAAG,CAAC,CAAC,CAAA;KAC9E;AACH,CAAC;AA9ED,8BA8EC","sourcesContent":["import commandLineArgs from 'command-line-args'\nimport commandLineUsage from 'command-line-usage'\nimport path from 'path'\nimport fs from 'fs-extra'\nimport chalk from 'chalk'\nimport { getCliVersion } from '../utils'\n\nexport function runCreate(argv: string[]) {\n const optionDefinitions = [\n {\n name: 'help',\n alias: 'h',\n type: Boolean,\n description: 'Display this usage guide.',\n },\n {\n name: 'name',\n alias: 'n',\n defaultOption: true,\n type: String,\n description: 'Project name',\n },\n ]\n\n const options = commandLineArgs(optionDefinitions, { argv })\n if (options.help || !options.name) {\n const usage = commandLineUsage([\n {\n header: 'Create a template project',\n content: 'sentio create $NAME',\n },\n {\n header: 'Options',\n optionList: optionDefinitions,\n },\n ])\n console.log(usage)\n } else {\n const templateFolder = path.resolve(__dirname, '../../../template')\n const projectName = options.name || 'default'\n\n const dstFolder = path.resolve(projectName)\n if (fs.existsSync(dstFolder)) {\n console.error(chalk.red(\"can't create project '\" + projectName + \"', directory already existed\"))\n process.exit(1)\n }\n\n fs.copySync(templateFolder, dstFolder, {\n filter: (src, _) => {\n // TODO read from .gitignore to be more reliable\n if (\n src.endsWith('types') ||\n src.endsWith('dist') ||\n src.endsWith('node_modules') ||\n src.endsWith('.lock') ||\n src.endsWith('dist')\n ) {\n return false\n }\n return true\n },\n overwrite: false,\n })\n if (options.name) {\n const sentioYamlPath = path.resolve(dstFolder, 'sentio.yaml')\n fs.writeFileSync(sentioYamlPath, 'project: ' + projectName + '\\n', { flag: 'w+' })\n\n const packageJsonPath = path.resolve(dstFolder, 'package.json')\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))\n\n let cliVersion = getCliVersion()\n if (!cliVersion.startsWith('^')) {\n cliVersion = '^' + cliVersion\n }\n\n packageJson.version = cliVersion\n packageJson.name = projectName\n\n // Don't add directly to avoid deps issue\n packageJson.scripts.postinstall = 'sentio gen'\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n }\n console.log(chalk.green(\"successfully create project '\" + projectName + \"'\"))\n }\n}\n"]}
|
package/lib/test/index.d.ts
CHANGED
package/lib/test/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadTestProvidersFromEnv = exports.TestProcessorServer = void 0;
|
|
3
|
+
exports.firstGaugeValue = exports.firstCounterValue = exports.MetricValueToNumber = exports.loadTestProvidersFromEnv = exports.TestProcessorServer = void 0;
|
|
4
4
|
var test_processor_server_1 = require("./test-processor-server");
|
|
5
5
|
Object.defineProperty(exports, "TestProcessorServer", { enumerable: true, get: function () { return test_processor_server_1.TestProcessorServer; } });
|
|
6
6
|
var test_provider_1 = require("./test-provider");
|
|
7
7
|
Object.defineProperty(exports, "loadTestProvidersFromEnv", { enumerable: true, get: function () { return test_provider_1.loadTestProvidersFromEnv; } });
|
|
8
|
+
var metric_utils_1 = require("./metric-utils");
|
|
9
|
+
Object.defineProperty(exports, "MetricValueToNumber", { enumerable: true, get: function () { return metric_utils_1.MetricValueToNumber; } });
|
|
10
|
+
Object.defineProperty(exports, "firstCounterValue", { enumerable: true, get: function () { return metric_utils_1.firstCounterValue; } });
|
|
11
|
+
Object.defineProperty(exports, "firstGaugeValue", { enumerable: true, get: function () { return metric_utils_1.firstGaugeValue; } });
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
package/lib/test/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,4HAAA,mBAAmB,OAAA;AAC5B,iDAA0D;AAAjD,yHAAA,wBAAwB,OAAA","sourcesContent":["export { TestProcessorServer } from './test-processor-server'\nexport { loadTestProvidersFromEnv } from './test-provider'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,4HAAA,mBAAmB,OAAA;AAC5B,iDAA0D;AAAjD,yHAAA,wBAAwB,OAAA;AACjC,+CAAwF;AAA/E,mHAAA,mBAAmB,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,+GAAA,eAAe,OAAA","sourcesContent":["export { TestProcessorServer } from './test-processor-server'\nexport { loadTestProvidersFromEnv } from './test-provider'\nexport { MetricValueToNumber, firstCounterValue, firstGaugeValue } from './metric-utils'\n"]}
|
package/package.json
CHANGED
|
@@ -76,6 +76,9 @@ export function runCreate(argv: string[]) {
|
|
|
76
76
|
packageJson.version = cliVersion
|
|
77
77
|
packageJson.name = projectName
|
|
78
78
|
|
|
79
|
+
// Don't add directly to avoid deps issue
|
|
80
|
+
packageJson.scripts.postinstall = 'sentio gen'
|
|
81
|
+
|
|
79
82
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
80
83
|
}
|
|
81
84
|
console.log(chalk.green("successfully create project '" + projectName + "'"))
|
package/src/test/index.ts
CHANGED
package/template/package.json
CHANGED
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
"test": "jest",
|
|
7
7
|
"gen": "sentio gen",
|
|
8
8
|
"build": "sentio build",
|
|
9
|
-
"upload": "sentio upload"
|
|
10
|
-
"postinstall": "sentio gen"
|
|
9
|
+
"upload": "sentio upload"
|
|
11
10
|
},
|
|
12
11
|
"dependencies": {
|
|
13
|
-
"@sentio/sdk": "^1.0.0"
|
|
12
|
+
"@sentio/sdk": "^1.0.0-development"
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
16
15
|
"@types/jest": "^29.0.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TestProcessorServer } from '@sentio/sdk/lib/test'
|
|
2
2
|
import { mockTransferLog } from '@sentio/sdk/lib/builtin/erc20/test-utils'
|
|
3
|
-
import { BigNumber } from 'ethers'
|
|
4
3
|
import { firstCounterValue } from '@sentio/sdk/lib/test/metric-utils'
|
|
4
|
+
import { BigNumber } from 'ethers'
|
|
5
5
|
|
|
6
6
|
describe('Test Processor', () => {
|
|
7
7
|
const service = new TestProcessorServer(() => require('./processor'))
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Counter, Gauge } from '@sentio/sdk'
|
|
2
|
+
import { toBigDecimal } from '@sentio/sdk/lib/utils'
|
|
3
|
+
import { ERC20Processor } from '@sentio/sdk/lib/builtin/erc20'
|
|
4
|
+
import { X2y2Processor } from './types/x2y2'
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
6
|
+
const rewardPerBlock = new Gauge('reward_per_block', {
|
|
7
|
+
description: 'rewards for each block grouped by phase',
|
|
8
|
+
unit: 'x2y2',
|
|
9
|
+
})
|
|
10
|
+
const token = new Counter('token')
|
|
11
|
+
|
|
12
|
+
X2y2Processor.bind({ address: '0xB329e39Ebefd16f40d38f07643652cE17Ca5Bac1' }).onBlock(async (_, ctx) => {
|
|
13
|
+
const phase = (await ctx.contract.currentPhase()).toString()
|
|
14
|
+
const reward = toBigDecimal(await ctx.contract.rewardPerBlockForStaking()).div(10 ** 18)
|
|
15
|
+
rewardPerBlock.record(ctx, reward, { phase })
|
|
16
|
+
})
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
const filter = ERC20Processor.filters.Transfer(
|
|
13
19
|
'0x0000000000000000000000000000000000000000',
|
|
14
20
|
'0xb329e39ebefd16f40d38f07643652ce17ca5bac1'
|
|
15
21
|
)
|
|
16
22
|
|
|
17
23
|
ERC20Processor.bind({ address: '0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9' }).onEventTransfer(
|
|
18
|
-
|
|
24
|
+
async (event, ctx) => {
|
|
25
|
+
const val = toBigDecimal(event.args.value).div(10 ** 18)
|
|
26
|
+
token.add(ctx, val)
|
|
27
|
+
},
|
|
19
28
|
filter // filter is an optional parameter
|
|
20
29
|
)
|
|
21
|
-
|
|
22
|
-
async function handleTransfer(event: TransferEvent, ctx: ERC20Context) {
|
|
23
|
-
const val = Number(event.args.value.toBigInt() / 10n ** 18n)
|
|
24
|
-
ctx.meter.Counter('token').add(val)
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BoundContractView, Context, ContractView } from './context';
|
|
2
|
-
import { Block } from '@ethersproject/abstract-provider';
|
|
3
|
-
import { BaseContract, EventFilter } from 'ethers';
|
|
4
|
-
import { Event } from '@ethersproject/contracts';
|
|
5
|
-
import { BaseProcessor } from './base-processor';
|
|
6
|
-
import { BindOptions } from './bind-options';
|
|
7
|
-
import { PromiseOrVoid } from './promise-or-void';
|
|
8
|
-
import { Trace } from './trace';
|
|
9
|
-
export declare abstract class BaseProcessorTemplate<TContract extends BaseContract, TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>> {
|
|
10
|
-
id: number;
|
|
11
|
-
binds: Set<string>;
|
|
12
|
-
blockHandlers: ((block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid)[];
|
|
13
|
-
traceHandlers: {
|
|
14
|
-
signature: string;
|
|
15
|
-
handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid;
|
|
16
|
-
}[];
|
|
17
|
-
eventHandlers: {
|
|
18
|
-
handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid;
|
|
19
|
-
filter: EventFilter | EventFilter[];
|
|
20
|
-
}[];
|
|
21
|
-
constructor();
|
|
22
|
-
bind(options: BindOptions): BaseProcessor<TContract, TBoundContractView> | undefined;
|
|
23
|
-
onEvent(handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid, filter: EventFilter | EventFilter[]): this;
|
|
24
|
-
onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
25
|
-
onTrace(signature: string, handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
26
|
-
protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>;
|
|
27
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BaseProcessorTemplate = void 0;
|
|
7
|
-
const bind_options_1 = require("./bind-options");
|
|
8
|
-
const long_1 = __importDefault(require("long"));
|
|
9
|
-
const providers_1 = require("@ethersproject/providers");
|
|
10
|
-
class BaseProcessorTemplate {
|
|
11
|
-
id;
|
|
12
|
-
binds = new Set();
|
|
13
|
-
blockHandlers = [];
|
|
14
|
-
traceHandlers = [];
|
|
15
|
-
eventHandlers = [];
|
|
16
|
-
constructor() {
|
|
17
|
-
this.id = global.PROCESSOR_STATE.templates.length;
|
|
18
|
-
global.PROCESSOR_STATE.templates.push(this);
|
|
19
|
-
}
|
|
20
|
-
bind(options) {
|
|
21
|
-
const sig = (0, bind_options_1.getOptionsSignature)(options);
|
|
22
|
-
if (this.binds.has(sig)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
this.binds.add(sig);
|
|
26
|
-
const processor = this.bindInternal(options);
|
|
27
|
-
for (const eh of this.eventHandlers) {
|
|
28
|
-
processor.onEvent(eh.handler, eh.filter);
|
|
29
|
-
}
|
|
30
|
-
for (const bh of this.blockHandlers) {
|
|
31
|
-
processor.onBlock(bh);
|
|
32
|
-
}
|
|
33
|
-
const instance = {
|
|
34
|
-
templateId: this.id,
|
|
35
|
-
contract: {
|
|
36
|
-
address: options.address,
|
|
37
|
-
name: options.name || '',
|
|
38
|
-
chainId: options.network ? (0, providers_1.getNetwork)(options.network).chainId.toString() : '1',
|
|
39
|
-
abi: '',
|
|
40
|
-
},
|
|
41
|
-
startBlock: long_1.default.ZERO,
|
|
42
|
-
endBlock: long_1.default.ZERO,
|
|
43
|
-
};
|
|
44
|
-
if (options.startBlock) {
|
|
45
|
-
if (typeof options.startBlock === 'number') {
|
|
46
|
-
instance.startBlock = long_1.default.fromNumber(options.startBlock);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
instance.startBlock = options.startBlock;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (options.endBlock) {
|
|
53
|
-
if (typeof options.endBlock === 'number') {
|
|
54
|
-
instance.endBlock = long_1.default.fromNumber(options.endBlock);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
instance.endBlock = options.endBlock;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
global.PROCESSOR_STATE.templatesInstances.push(instance);
|
|
61
|
-
return processor;
|
|
62
|
-
}
|
|
63
|
-
onEvent(handler, filter) {
|
|
64
|
-
this.eventHandlers.push({
|
|
65
|
-
handler: handler,
|
|
66
|
-
filter: filter,
|
|
67
|
-
});
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
onBlock(handler) {
|
|
71
|
-
this.blockHandlers.push(handler);
|
|
72
|
-
return this;
|
|
73
|
-
}
|
|
74
|
-
onTrace(signature, handler) {
|
|
75
|
-
this.traceHandlers.push({ signature, handler });
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.BaseProcessorTemplate = BaseProcessorTemplate;
|
|
80
|
-
//# sourceMappingURL=base-processor-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-processor-template.js","sourceRoot":"","sources":["../src/base-processor-template.ts"],"names":[],"mappings":";;;;;;AAKA,iDAAiE;AAEjE,gDAAuB;AACvB,wDAAqD;AAIrD,MAAsB,qBAAqB;IAIzC,EAAE,CAAQ;IACV,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IACzB,aAAa,GAAqF,EAAE,CAAA;IACpG,aAAa,GAGP,EAAE,CAAA;IACR,aAAa,GAGP,EAAE,CAAA;IAER;QACE,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAA;QACjD,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC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UAAU,CAAA;aACzC;SACF;QACD,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACxC,QAAQ,CAAC,QAAQ,GAAG,cAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;aACtD;iBAAM;gBACL,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;aACrC;SACF;QACD,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAExD,OAAO,SAAS,CAAA;IAClB,CAAC;IAEM,OAAO,CACZ,OAAqF,EACrF,MAAmC;QAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACtB,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,OAAO,CAAC,OAAqF;QAClG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,OAAO,CACZ,SAAiB,EACjB,OAAqF;QAErF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;CAGF;AA5FD,sDA4FC","sourcesContent":["import { BoundContractView, Context, ContractView } from './context'\nimport { Block } from '@ethersproject/abstract-provider'\nimport { BaseContract, EventFilter } from 'ethers'\nimport { Event } from '@ethersproject/contracts'\nimport { BaseProcessor } from './base-processor'\nimport { BindOptions, getOptionsSignature } from './bind-options'\nimport { TemplateInstance } from './gen/processor/protos/processor'\nimport Long from 'long'\nimport { getNetwork } from '@ethersproject/providers'\nimport { PromiseOrVoid } from './promise-or-void'\nimport { Trace } from './trace'\n\nexport abstract class BaseProcessorTemplate<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n id: number\n binds = new Set<string>()\n blockHandlers: ((block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid)[] = []\n traceHandlers: {\n signature: string\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n }[] = []\n eventHandlers: {\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n filter: EventFilter | EventFilter[]\n }[] = []\n\n constructor() {\n this.id = global.PROCESSOR_STATE.templates.length\n global.PROCESSOR_STATE.templates.push(this)\n }\n\n public bind(options: BindOptions) {\n const sig = getOptionsSignature(options)\n if (this.binds.has(sig)) {\n return\n }\n this.binds.add(sig)\n\n const processor = this.bindInternal(options)\n\n for (const eh of this.eventHandlers) {\n processor.onEvent(eh.handler, eh.filter)\n }\n for (const bh of this.blockHandlers) {\n processor.onBlock(bh)\n }\n\n const instance: TemplateInstance = {\n templateId: this.id,\n contract: {\n address: options.address,\n name: options.name || '',\n chainId: options.network ? getNetwork(options.network).chainId.toString() : '1',\n abi: '',\n },\n startBlock: Long.ZERO,\n endBlock: Long.ZERO,\n }\n if (options.startBlock) {\n if (typeof options.startBlock === 'number') {\n instance.startBlock = Long.fromNumber(options.startBlock)\n } else {\n instance.startBlock = options.startBlock\n }\n }\n if (options.endBlock) {\n if (typeof options.endBlock === 'number') {\n instance.endBlock = Long.fromNumber(options.endBlock)\n } else {\n instance.endBlock = options.endBlock\n }\n }\n global.PROCESSOR_STATE.templatesInstances.push(instance)\n\n return processor\n }\n\n public onEvent(\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: EventFilter | EventFilter[]\n ) {\n this.eventHandlers.push({\n handler: handler,\n filter: filter,\n })\n return this\n }\n\n public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n this.blockHandlers.push(handler)\n return this\n }\n\n public onTrace(\n signature: string,\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n this.traceHandlers.push({ signature, handler })\n return this\n }\n\n protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Event } from '@ethersproject/contracts';
|
|
2
|
-
import { Block, Log } from '@ethersproject/providers';
|
|
3
|
-
import { BaseContract, EventFilter } from '@ethersproject/contracts';
|
|
4
|
-
import { BoundContractView, Context, ContractView } from './context';
|
|
5
|
-
import { ProcessResult } from './gen/processor/protos/processor';
|
|
6
|
-
import { BindInternalOptions, BindOptions } from './bind-options';
|
|
7
|
-
import { PromiseOrVoid } from './promise-or-void';
|
|
8
|
-
import { Trace } from './trace';
|
|
9
|
-
export declare class EventsHandler {
|
|
10
|
-
filters: EventFilter[];
|
|
11
|
-
handler: (event: Log) => Promise<ProcessResult>;
|
|
12
|
-
}
|
|
13
|
-
export declare class TraceHandler {
|
|
14
|
-
signature: string;
|
|
15
|
-
handler: (trace: Trace) => Promise<ProcessResult>;
|
|
16
|
-
}
|
|
17
|
-
export declare abstract class BaseProcessor<TContract extends BaseContract, TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>> {
|
|
18
|
-
blockHandlers: ((block: Block) => Promise<ProcessResult>)[];
|
|
19
|
-
eventHandlers: EventsHandler[];
|
|
20
|
-
traceHandlers: TraceHandler[];
|
|
21
|
-
name: string;
|
|
22
|
-
config: BindInternalOptions;
|
|
23
|
-
constructor(config: BindOptions);
|
|
24
|
-
protected abstract CreateBoundContractView(): TBoundContractView;
|
|
25
|
-
getChainId(): number;
|
|
26
|
-
onEvent(handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid, filter: EventFilter | EventFilter[]): this;
|
|
27
|
-
onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
28
|
-
onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
29
|
-
protected onTrace(signature: string, handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
30
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BaseProcessor = exports.TraceHandler = exports.EventsHandler = void 0;
|
|
7
|
-
const providers_1 = require("@ethersproject/providers");
|
|
8
|
-
const long_1 = __importDefault(require("long"));
|
|
9
|
-
const context_1 = require("./context");
|
|
10
|
-
class EventsHandler {
|
|
11
|
-
filters;
|
|
12
|
-
handler;
|
|
13
|
-
}
|
|
14
|
-
exports.EventsHandler = EventsHandler;
|
|
15
|
-
class TraceHandler {
|
|
16
|
-
signature;
|
|
17
|
-
handler;
|
|
18
|
-
}
|
|
19
|
-
exports.TraceHandler = TraceHandler;
|
|
20
|
-
class BaseProcessor {
|
|
21
|
-
blockHandlers = [];
|
|
22
|
-
eventHandlers = [];
|
|
23
|
-
traceHandlers = [];
|
|
24
|
-
name;
|
|
25
|
-
config;
|
|
26
|
-
constructor(config) {
|
|
27
|
-
this.config = {
|
|
28
|
-
address: config.address,
|
|
29
|
-
name: config.name || '',
|
|
30
|
-
network: config.network ? config.network : 1,
|
|
31
|
-
startBlock: new long_1.default(0),
|
|
32
|
-
};
|
|
33
|
-
if (config.startBlock) {
|
|
34
|
-
if (typeof config.startBlock === 'number') {
|
|
35
|
-
this.config.startBlock = long_1.default.fromNumber(config.startBlock);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
this.config.startBlock = config.startBlock;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (config.endBlock) {
|
|
42
|
-
if (typeof config.endBlock === 'number') {
|
|
43
|
-
this.config.endBlock = long_1.default.fromNumber(config.endBlock);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.config.endBlock = config.endBlock;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
getChainId() {
|
|
51
|
-
return (0, providers_1.getNetwork)(this.config.network).chainId;
|
|
52
|
-
}
|
|
53
|
-
onEvent(handler, filter) {
|
|
54
|
-
const chainId = this.getChainId();
|
|
55
|
-
let _filters = [];
|
|
56
|
-
if (Array.isArray(filter)) {
|
|
57
|
-
_filters = filter;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
_filters.push(filter);
|
|
61
|
-
}
|
|
62
|
-
const contractView = this.CreateBoundContractView();
|
|
63
|
-
this.eventHandlers.push({
|
|
64
|
-
filters: _filters,
|
|
65
|
-
handler: async function (log) {
|
|
66
|
-
const ctx = new context_1.Context(contractView, chainId, undefined, log);
|
|
67
|
-
// let event: Event = <Event>deepCopy(log);
|
|
68
|
-
const event = log;
|
|
69
|
-
const parsed = contractView.rawContract.interface.parseLog(log);
|
|
70
|
-
if (parsed) {
|
|
71
|
-
event.args = parsed.args;
|
|
72
|
-
event.decode = (data, topics) => {
|
|
73
|
-
return contractView.rawContract.interface.decodeEventLog(parsed.eventFragment, data, topics);
|
|
74
|
-
};
|
|
75
|
-
event.event = parsed.name;
|
|
76
|
-
event.eventSignature = parsed.signature;
|
|
77
|
-
// TODO fix this bug
|
|
78
|
-
await handler(event, ctx);
|
|
79
|
-
return {
|
|
80
|
-
gauges: ctx.gauges,
|
|
81
|
-
counters: ctx.counters,
|
|
82
|
-
logs: [],
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
gauges: [],
|
|
87
|
-
counters: [],
|
|
88
|
-
logs: [],
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
return this;
|
|
93
|
-
}
|
|
94
|
-
onBlock(handler) {
|
|
95
|
-
const chainId = this.getChainId();
|
|
96
|
-
const contractView = this.CreateBoundContractView();
|
|
97
|
-
this.blockHandlers.push(async function (block) {
|
|
98
|
-
const ctx = new context_1.Context(contractView, chainId, block, undefined);
|
|
99
|
-
await handler(block, ctx);
|
|
100
|
-
return {
|
|
101
|
-
gauges: ctx.gauges,
|
|
102
|
-
counters: ctx.counters,
|
|
103
|
-
logs: [],
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
onAllEvents(handler) {
|
|
109
|
-
const _filters = [];
|
|
110
|
-
const tmpContract = this.CreateBoundContractView();
|
|
111
|
-
for (const key in tmpContract.filters) {
|
|
112
|
-
_filters.push(tmpContract.filters[key]());
|
|
113
|
-
}
|
|
114
|
-
return this.onEvent(function (log, ctx) {
|
|
115
|
-
return handler(log, ctx);
|
|
116
|
-
}, _filters);
|
|
117
|
-
}
|
|
118
|
-
onTrace(signature, handler) {
|
|
119
|
-
const chainId = this.getChainId();
|
|
120
|
-
const contractView = this.CreateBoundContractView();
|
|
121
|
-
this.traceHandlers.push({
|
|
122
|
-
signature,
|
|
123
|
-
handler: async function (trace) {
|
|
124
|
-
const contractInterface = contractView.rawContract.interface;
|
|
125
|
-
const fragment = contractInterface.getFunction(signature);
|
|
126
|
-
if (!trace.action.input) {
|
|
127
|
-
return {
|
|
128
|
-
gauges: [],
|
|
129
|
-
counters: [],
|
|
130
|
-
logs: [],
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
const traceData = '0x' + trace.action.input.slice(10);
|
|
134
|
-
trace.args = contractInterface._abiCoder.decode(fragment.inputs, traceData);
|
|
135
|
-
const ctx = new context_1.Context(contractView, chainId, undefined, undefined, trace);
|
|
136
|
-
await handler(trace, ctx);
|
|
137
|
-
return {
|
|
138
|
-
gauges: ctx.gauges,
|
|
139
|
-
counters: ctx.counters,
|
|
140
|
-
logs: [],
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.BaseProcessor = BaseProcessor;
|
|
148
|
-
//# sourceMappingURL=base-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../src/base-processor.ts"],"names":[],"mappings":";;;;;;AAEA,wDAAiE;AAEjE,gDAAuB;AAEvB,uCAAoE;AAMpE,MAAa,aAAa;IACxB,OAAO,CAAe;IACtB,OAAO,CAAwC;CAChD;AAHD,sCAGC;AAED,MAAa,YAAY;IACvB,SAAS,CAAQ;IACjB,OAAO,CAA0C;CAClD;AAHD,oCAGC;AAED,MAAsB,aAAa;IAIjC,aAAa,GAAiD,EAAE,CAAA;IAChE,aAAa,GAAoB,EAAE,CAAA;IACnC,aAAa,GAAmB,EAAE,CAAA;IAElC,IAAI,CAAQ;IACZ,MAAM,CAAqB;IAE3B,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5C,UAAU,EAAE,IAAI,cAAI,CAAC,CAAC,CAAC;SACxB,CAAA;QACD,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE;gBACzC,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,cAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;aAC5D;iBAAM;gBACL,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;aAC3C;SACF;QACD,IAAI,MAAM,CAAC,QAAQ,EAAE;YACnB,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,cAAI,CAAC,UAAU,CA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;iBACT,CAAA;YACH,CAAC;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AArJD,sCAqJC","sourcesContent":["import { Event } from '@ethersproject/contracts'\nimport { BytesLike } from '@ethersproject/bytes'\nimport { Block, Log, getNetwork } from '@ethersproject/providers'\nimport { BaseContract, EventFilter } from '@ethersproject/contracts'\nimport Long from 'long'\n\nimport { BoundContractView, Context, ContractView } from './context'\nimport { ProcessResult } from './gen/processor/protos/processor'\nimport { BindInternalOptions, BindOptions } from './bind-options'\nimport { PromiseOrVoid } from './promise-or-void'\nimport { Trace } from './trace'\n\nexport class EventsHandler {\n filters: EventFilter[]\n handler: (event: Log) => Promise<ProcessResult>\n}\n\nexport class TraceHandler {\n signature: string\n handler: (trace: Trace) => Promise<ProcessResult>\n}\n\nexport abstract class BaseProcessor<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []\n eventHandlers: EventsHandler[] = []\n traceHandlers: TraceHandler[] = []\n\n name: string\n config: BindInternalOptions\n\n constructor(config: BindOptions) {\n this.config = {\n address: config.address,\n name: config.name || '',\n network: config.network ? config.network : 1,\n startBlock: new Long(0),\n }\n if (config.startBlock) {\n if (typeof config.startBlock === 'number') {\n this.config.startBlock = Long.fromNumber(config.startBlock)\n } else {\n this.config.startBlock = config.startBlock\n }\n }\n if (config.endBlock) {\n if (typeof config.endBlock === 'number') {\n this.config.endBlock = Long.fromNumber(config.endBlock)\n } else {\n this.config.endBlock = config.endBlock\n }\n }\n }\n\n protected abstract CreateBoundContractView(): TBoundContractView\n\n public getChainId(): number {\n return getNetwork(this.config.network).chainId\n }\n\n public onEvent(\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: EventFilter | EventFilter[]\n ) {\n const chainId = this.getChainId()\n\n let _filters: EventFilter[] = []\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n const contractView = this.CreateBoundContractView()\n this.eventHandlers.push({\n filters: _filters,\n handler: async function (log) {\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, log)\n // let event: Event = <Event>deepCopy(log);\n const event: Event = <Event>log\n const parsed = contractView.rawContract.interface.parseLog(log)\n if (parsed) {\n event.args = parsed.args\n event.decode = (data: BytesLike, topics?: Array<any>) => {\n return contractView.rawContract.interface.decodeEventLog(parsed.eventFragment, data, topics)\n }\n event.event = parsed.name\n event.eventSignature = parsed.signature\n\n // TODO fix this bug\n await handler(event, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n }\n return {\n gauges: [],\n counters: [],\n logs: [],\n }\n },\n })\n return this\n }\n\n public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n const chainId = this.getChainId()\n const contractView = this.CreateBoundContractView()\n\n this.blockHandlers.push(async function (block: Block) {\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, block, undefined)\n await handler(block, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n })\n return this\n }\n\n public onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n const _filters: EventFilter[] = []\n const tmpContract = this.CreateBoundContractView()\n\n for (const key in tmpContract.filters) {\n _filters.push(tmpContract.filters[key]())\n }\n return this.onEvent(function (log, ctx) {\n return handler(log, ctx)\n }, _filters)\n }\n\n protected onTrace(\n signature: string,\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n const chainId = this.getChainId()\n const contractView = this.CreateBoundContractView()\n\n this.traceHandlers.push({\n signature,\n handler: async function (trace: Trace) {\n const contractInterface = contractView.rawContract.interface\n const fragment = contractInterface.getFunction(signature)\n if (!trace.action.input) {\n return {\n gauges: [],\n counters: [],\n logs: [],\n }\n }\n const traceData = '0x' + trace.action.input.slice(10)\n trace.args = contractInterface._abiCoder.decode(fragment.inputs, traceData)\n\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, undefined, trace)\n await handler(trace, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n },\n })\n return this\n }\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Networkish } from '@ethersproject/networks';
|
|
2
|
-
import Long from 'long';
|
|
3
|
-
export declare class BindOptions {
|
|
4
|
-
address: string;
|
|
5
|
-
network?: Networkish;
|
|
6
|
-
name?: string;
|
|
7
|
-
startBlock?: Long | number;
|
|
8
|
-
endBlock?: Long | number;
|
|
9
|
-
}
|
|
10
|
-
export declare function getOptionsSignature(opts: BindOptions): string;
|
|
11
|
-
export declare class BindInternalOptions {
|
|
12
|
-
address: string;
|
|
13
|
-
network: Networkish;
|
|
14
|
-
name: string;
|
|
15
|
-
startBlock: Long;
|
|
16
|
-
endBlock?: Long;
|
|
17
|
-
}
|
|
18
|
-
export declare class SolanaBindOptions extends BindOptions {
|
|
19
|
-
network?: string;
|
|
20
|
-
processInnerInstruction?: boolean;
|
|
21
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaBindOptions = exports.BindInternalOptions = exports.getOptionsSignature = exports.BindOptions = void 0;
|
|
4
|
-
const providers_1 = require("@ethersproject/providers");
|
|
5
|
-
class BindOptions {
|
|
6
|
-
address;
|
|
7
|
-
network = 1;
|
|
8
|
-
name;
|
|
9
|
-
startBlock;
|
|
10
|
-
endBlock;
|
|
11
|
-
}
|
|
12
|
-
exports.BindOptions = BindOptions;
|
|
13
|
-
function getOptionsSignature(opts) {
|
|
14
|
-
const sig = [opts.address];
|
|
15
|
-
if (opts.network) {
|
|
16
|
-
sig.push((0, providers_1.getNetwork)(opts.network).chainId.toString());
|
|
17
|
-
}
|
|
18
|
-
if (opts.name) {
|
|
19
|
-
sig.push(opts.name);
|
|
20
|
-
}
|
|
21
|
-
if (opts.startBlock) {
|
|
22
|
-
sig.push(opts.startBlock.toString());
|
|
23
|
-
}
|
|
24
|
-
if (opts.endBlock) {
|
|
25
|
-
sig.push(opts.endBlock.toString());
|
|
26
|
-
}
|
|
27
|
-
return sig.join('_');
|
|
28
|
-
}
|
|
29
|
-
exports.getOptionsSignature = getOptionsSignature;
|
|
30
|
-
class BindInternalOptions {
|
|
31
|
-
address;
|
|
32
|
-
network;
|
|
33
|
-
name;
|
|
34
|
-
startBlock;
|
|
35
|
-
endBlock;
|
|
36
|
-
}
|
|
37
|
-
exports.BindInternalOptions = BindInternalOptions;
|
|
38
|
-
class SolanaBindOptions extends BindOptions {
|
|
39
|
-
processInnerInstruction;
|
|
40
|
-
}
|
|
41
|
-
exports.SolanaBindOptions = SolanaBindOptions;
|
|
42
|
-
//# sourceMappingURL=bind-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bind-options.js","sourceRoot":"","sources":["../src/bind-options.ts"],"names":[],"mappings":";;;AAEA,wDAAqD;AAErD,MAAa,WAAW;IACtB,OAAO,CAAQ;IACf,OAAO,GAAgB,CAAC,CAAA;IACxB,IAAI,CAAS;IACb,UAAU,CAAgB;IAC1B,QAAQ,CAAgB;CACzB;AAND,kCAMC;AAED,SAAgB,mBAAmB,CAAC,IAAiB;IACnD,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1B,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,GAAG,CAAC,IAAI,CAAC,IAAA,sBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;KACtD;IACD,IAAI,IAAI,CAAC,IAAI,EAAE;QACb,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACpB;IACD,IAAI,IAAI,CAAC,UAAU,EAAE;QACnB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAA;KACrC;IACD,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;KACnC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACtB,CAAC;AAfD,kDAeC;AAED,MAAa,mBAAmB;IAC9B,OAAO,CAAQ;IACf,OAAO,CAAY;IACnB,IAAI,CAAQ;IACZ,UAAU,CAAM;IAChB,QAAQ,CAAO;CAChB;AAND,kDAMC;AAED,MAAa,iBAAkB,SAAQ,WAAW;IAEhD,uBAAuB,CAAU;CAClC;AAHD,8CAGC","sourcesContent":["import { Networkish } from '@ethersproject/networks'\nimport Long from 'long'\nimport { getNetwork } from '@ethersproject/providers'\n\nexport class BindOptions {\n address: string\n network?: Networkish = 1\n name?: string\n startBlock?: Long | number\n endBlock?: Long | number\n}\n\nexport function getOptionsSignature(opts: BindOptions): string {\n const sig = [opts.address]\n if (opts.network) {\n sig.push(getNetwork(opts.network).chainId.toString())\n }\n if (opts.name) {\n sig.push(opts.name)\n }\n if (opts.startBlock) {\n sig.push(opts.startBlock.toString())\n }\n if (opts.endBlock) {\n sig.push(opts.endBlock.toString())\n }\n return sig.join('_')\n}\n\nexport class BindInternalOptions {\n address: string\n network: Networkish\n name: string\n startBlock: Long\n endBlock?: Long\n}\n\nexport class SolanaBindOptions extends BindOptions {\n declare network?: string\n processInnerInstruction?: boolean\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BindOptions } from './bind-options';
|
|
2
|
-
import { BaseProcessor } from './base-processor';
|
|
3
|
-
import { Networkish } from '@ethersproject/networks';
|
|
4
|
-
import { ContractView } from './context';
|
|
5
|
-
import { BaseContract } from 'ethers';
|
|
6
|
-
export declare function getContractName(abiName: string, contractName: string | undefined, address: string, network?: Networkish): string;
|
|
7
|
-
export declare function getProcessor(abiName: string, opts: BindOptions): BaseProcessor<any, any> | undefined;
|
|
8
|
-
export declare function addProcessor(abiName: string, opts: BindOptions, processor: BaseProcessor<any, any>): void;
|
|
9
|
-
export declare function getContractByABI(abiName: string, address: string, network: Networkish): ContractView<BaseContract> | undefined;
|
|
10
|
-
export declare function addContractByABI(abiName: string, address: string, network: Networkish, contract: ContractView<BaseContract>): Map<string, ContractView<BaseContract>>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addContractByABI = exports.getContractByABI = exports.addProcessor = exports.getProcessor = exports.getContractName = void 0;
|
|
4
|
-
const bind_options_1 = require("./bind-options");
|
|
5
|
-
const providers_1 = require("@ethersproject/providers");
|
|
6
|
-
const contract_namer_1 = require("./contract-namer");
|
|
7
|
-
function getKey(abiName, address, network) {
|
|
8
|
-
const chainId = (0, providers_1.getNetwork)(network).chainId.toString();
|
|
9
|
-
return [abiName, address.toLowerCase(), chainId].join('_');
|
|
10
|
-
}
|
|
11
|
-
// TODO move to processor state
|
|
12
|
-
const addressToName = new Map();
|
|
13
|
-
const namerMap = new Map();
|
|
14
|
-
// Get contract name by ABI, and other options
|
|
15
|
-
// If there is contract using same ABI and different (address, network) pair
|
|
16
|
-
// It will be renamed as ABI, ABI_1, ABI_2
|
|
17
|
-
// Otherwise just use same contract name
|
|
18
|
-
function getContractName(abiName, contractName, address, network = 1) {
|
|
19
|
-
const key = getKey(abiName, address, network);
|
|
20
|
-
let name = addressToName.get(key);
|
|
21
|
-
if (name) {
|
|
22
|
-
return name;
|
|
23
|
-
}
|
|
24
|
-
if (contractName) {
|
|
25
|
-
addressToName.set(key, contractName);
|
|
26
|
-
return contractName;
|
|
27
|
-
}
|
|
28
|
-
let namer = namerMap.get(abiName);
|
|
29
|
-
if (!namer) {
|
|
30
|
-
namer = new contract_namer_1.ContractNamer(abiName);
|
|
31
|
-
namerMap.set(abiName, namer);
|
|
32
|
-
}
|
|
33
|
-
name = namer.nextName();
|
|
34
|
-
addressToName.set(key, name);
|
|
35
|
-
return name;
|
|
36
|
-
}
|
|
37
|
-
exports.getContractName = getContractName;
|
|
38
|
-
function getProcessor(abiName, opts) {
|
|
39
|
-
const sig = abiName + '_' + (0, bind_options_1.getOptionsSignature)(opts);
|
|
40
|
-
return global.PROCESSOR_STATE.processorMap.get(sig);
|
|
41
|
-
}
|
|
42
|
-
exports.getProcessor = getProcessor;
|
|
43
|
-
function addProcessor(abiName, opts, processor) {
|
|
44
|
-
const sig = abiName + '_' + (0, bind_options_1.getOptionsSignature)(opts);
|
|
45
|
-
global.PROCESSOR_STATE.processors.push(processor);
|
|
46
|
-
global.PROCESSOR_STATE.processorMap.set(sig, processor);
|
|
47
|
-
}
|
|
48
|
-
exports.addProcessor = addProcessor;
|
|
49
|
-
function getContractByABI(abiName, address, network) {
|
|
50
|
-
const key = getKey(abiName, address, network);
|
|
51
|
-
return global.PROCESSOR_STATE.contracts.get(key);
|
|
52
|
-
}
|
|
53
|
-
exports.getContractByABI = getContractByABI;
|
|
54
|
-
function addContractByABI(abiName, address, network, contract) {
|
|
55
|
-
const key = getKey(abiName, address, network);
|
|
56
|
-
return global.PROCESSOR_STATE.contracts.set(key, contract);
|
|
57
|
-
}
|
|
58
|
-
exports.addContractByABI = addContractByABI;
|
|
59
|
-
//# sourceMappingURL=binds.js.map
|