@sentio/sdk 1.7.14 → 1.7.17
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/{base-processor-template.d.ts → lib/base-processor-template.d.ts} +0 -0
- package/{base-processor-template.js → lib/base-processor-template.js} +0 -0
- package/{base-processor-template.js.map → lib/base-processor-template.js.map} +0 -0
- package/{base-processor.d.ts → lib/base-processor.d.ts} +0 -0
- package/{base-processor.js → lib/base-processor.js} +0 -0
- package/{base-processor.js.map → lib/base-processor.js.map} +0 -0
- package/{bind-options.d.ts → lib/bind-options.d.ts} +0 -0
- package/{bind-options.js → lib/bind-options.js} +0 -0
- package/{bind-options.js.map → lib/bind-options.js.map} +0 -0
- package/{binds.d.ts → lib/binds.d.ts} +0 -0
- package/{binds.js → lib/binds.js} +0 -0
- package/{binds.js.map → lib/binds.js.map} +0 -0
- package/{builtin → lib/builtin}/erc20/index.d.ts +0 -0
- package/{builtin → lib/builtin}/erc20/index.js +0 -0
- package/{builtin → lib/builtin}/erc20/index.js.map +0 -0
- package/{builtin → lib/builtin}/erc20/test-utils.d.ts +0 -0
- package/{builtin → lib/builtin}/erc20/test-utils.js +0 -0
- package/{builtin → lib/builtin}/erc20/test-utils.js.map +0 -0
- package/{builtin → lib/builtin}/internal/Erc20.d.ts +0 -0
- package/{builtin → lib/builtin}/internal/Erc20.js +0 -0
- package/{builtin → lib/builtin}/internal/Erc20.js.map +0 -0
- package/lib/builtin/internal/Weth9.d.ts +221 -0
- package/lib/builtin/internal/Weth9.js +3 -0
- package/lib/builtin/internal/Weth9.js.map +1 -0
- package/{builtin → lib/builtin}/internal/common.d.ts +0 -0
- package/{builtin → lib/builtin}/internal/common.js +0 -0
- package/{builtin → lib/builtin}/internal/common.js.map +0 -0
- package/{builtin → lib/builtin}/internal/erc20_processor.d.ts +0 -0
- package/{builtin → lib/builtin}/internal/erc20_processor.js +0 -0
- package/{builtin → lib/builtin}/internal/erc20_processor.js.map +0 -0
- package/{builtin → lib/builtin}/internal/factories/Erc20__factory.d.ts +0 -0
- package/{builtin → lib/builtin}/internal/factories/Erc20__factory.js +0 -0
- package/{builtin → lib/builtin}/internal/factories/Erc20__factory.js.map +0 -0
- package/lib/builtin/internal/factories/Weth9__factory.d.ts +45 -0
- package/lib/builtin/internal/factories/Weth9__factory.js +297 -0
- package/lib/builtin/internal/factories/Weth9__factory.js.map +1 -0
- package/{builtin → lib/builtin}/internal/factories/index.d.ts +1 -0
- package/{builtin → lib/builtin}/internal/factories/index.js +3 -1
- package/lib/builtin/internal/factories/index.js.map +1 -0
- package/{builtin → lib/builtin}/internal/index.d.ts +2 -0
- package/{builtin → lib/builtin}/internal/index.js +3 -1
- package/lib/builtin/internal/index.js.map +1 -0
- package/lib/builtin/internal/weth9_processor.d.ts +50 -0
- package/lib/builtin/internal/weth9_processor.js +295 -0
- package/lib/builtin/internal/weth9_processor.js.map +1 -0
- package/lib/builtin/weth9/index.d.ts +2 -0
- package/lib/builtin/weth9/index.js +22 -0
- package/lib/builtin/weth9/index.js.map +1 -0
- package/lib/builtin/weth9/test-utils.d.ts +6 -0
- package/lib/builtin/weth9/test-utils.js +57 -0
- package/lib/builtin/weth9/test-utils.js.map +1 -0
- package/{chain-config.d.ts → lib/chain-config.d.ts} +0 -0
- package/{chain-config.js → lib/chain-config.js} +0 -0
- package/{chain-config.js.map → lib/chain-config.js.map} +0 -0
- package/{cli → lib/cli}/build.d.ts +0 -0
- package/{cli → lib/cli}/build.js +14 -0
- package/lib/cli/build.js.map +1 -0
- package/{cli → lib/cli}/cli.d.ts +0 -0
- package/{cli → lib/cli}/cli.js +0 -0
- package/{cli → lib/cli}/cli.js.map +0 -0
- package/{cli → lib/cli}/config.d.ts +0 -0
- package/{cli → lib/cli}/config.js +0 -0
- package/{cli → lib/cli}/config.js.map +0 -0
- package/{cli → lib/cli}/key.d.ts +0 -0
- package/{cli → lib/cli}/key.js +0 -0
- package/{cli → lib/cli}/key.js.map +0 -0
- package/{cli → lib/cli}/solana-code-gen.d.ts +0 -0
- package/{cli → lib/cli}/solana-code-gen.js +0 -0
- package/{cli → lib/cli}/solana-code-gen.js.map +0 -0
- package/{cli → lib/cli}/upload.d.ts +0 -0
- package/{cli → lib/cli}/upload.js +0 -0
- package/{cli → lib/cli}/upload.js.map +0 -0
- package/{cli → lib/cli}/webpack.config.js +0 -0
- package/{context.d.ts → lib/context.d.ts} +0 -0
- package/{context.js → lib/context.js} +0 -0
- package/{context.js.map → lib/context.js.map} +0 -0
- package/{contract-namer.d.ts → lib/contract-namer.d.ts} +0 -0
- package/{contract-namer.js → lib/contract-namer.js} +0 -0
- package/{contract-namer.js.map → lib/contract-namer.js.map} +0 -0
- package/{error.d.ts → lib/error.d.ts} +0 -0
- package/{error.js → lib/error.js} +0 -0
- package/{error.js.map → lib/error.js.map} +0 -0
- package/{gen → lib/gen}/builtin.d.ts +0 -0
- package/{gen → lib/gen}/builtin.js +0 -0
- package/{gen → lib/gen}/builtin.js.map +0 -0
- package/{gen → lib/gen}/google/protobuf/empty.d.ts +0 -0
- package/{gen → lib/gen}/google/protobuf/empty.js +0 -0
- package/{gen → lib/gen}/google/protobuf/empty.js.map +0 -0
- package/{gen → lib/gen}/processor/protos/processor.d.ts +0 -0
- package/{gen → lib/gen}/processor/protos/processor.js +0 -0
- package/{gen → lib/gen}/processor/protos/processor.js.map +0 -0
- package/{generic-processor.d.ts → lib/generic-processor.d.ts} +0 -0
- package/{generic-processor.js → lib/generic-processor.js} +0 -0
- package/{generic-processor.js.map → lib/generic-processor.js.map} +0 -0
- package/{index.d.ts → lib/index.d.ts} +0 -0
- package/{index.js → lib/index.js} +0 -0
- package/{index.js.map → lib/index.js.map} +0 -0
- package/lib/loader.d.ts +5 -0
- package/lib/loader.js +30 -0
- package/lib/loader.js.map +1 -0
- package/{meter.d.ts → lib/meter.d.ts} +0 -0
- package/{meter.js → lib/meter.js} +0 -0
- package/{meter.js.map → lib/meter.js.map} +0 -0
- package/{numberish.d.ts → lib/numberish.d.ts} +0 -0
- package/{numberish.js → lib/numberish.js} +0 -0
- package/{numberish.js.map → lib/numberish.js.map} +0 -0
- package/{numberish.test.d.ts → lib/numberish.test.d.ts} +0 -0
- package/{numberish.test.js → lib/numberish.test.js} +0 -0
- package/{numberish.test.js.map → lib/numberish.test.js.map} +0 -0
- package/{processor-runner.d.ts → lib/processor-runner.d.ts} +0 -0
- package/{processor-runner.js → lib/processor-runner.js} +2 -27
- package/lib/processor-runner.js.map +1 -0
- package/{processor-state.d.ts → lib/processor-state.d.ts} +0 -0
- package/{processor-state.js → lib/processor-state.js} +0 -0
- package/{processor-state.js.map → lib/processor-state.js.map} +0 -0
- package/{promise-or-void.d.ts → lib/promise-or-void.d.ts} +0 -0
- package/{promise-or-void.js → lib/promise-or-void.js} +0 -0
- package/{promise-or-void.js.map → lib/promise-or-void.js.map} +0 -0
- package/{provider.d.ts → lib/provider.d.ts} +0 -0
- package/{provider.js → lib/provider.js} +0 -0
- package/{provider.js.map → lib/provider.js.map} +0 -0
- package/{release.config.js → lib/release.config.js} +0 -0
- package/{service.d.ts → lib/service.d.ts} +2 -1
- package/{service.js → lib/service.js} +6 -3
- package/lib/service.js.map +1 -0
- package/{solana → lib/solana}/builtin/index.d.ts +0 -0
- package/{solana → lib/solana}/builtin/index.js +0 -0
- package/{solana → lib/solana}/builtin/index.js.map +0 -0
- package/{solana → lib/solana}/builtin/spl-token-processor.d.ts +0 -0
- package/{solana → lib/solana}/builtin/spl-token-processor.js +0 -0
- package/{solana → lib/solana}/builtin/spl-token-processor.js.map +0 -0
- package/{solana → lib/solana}/builtin/types.d.ts +0 -0
- package/{solana → lib/solana}/builtin/types.js +0 -0
- package/{solana → lib/solana}/builtin/types.js.map +0 -0
- package/{solana → lib/solana}/builtin/wormhole-processor.d.ts +0 -0
- package/{solana → lib/solana}/builtin/wormhole-processor.js +0 -0
- package/{solana → lib/solana}/builtin/wormhole-processor.js.map +0 -0
- package/{solana-processor.d.ts → lib/solana-processor.d.ts} +0 -0
- package/{solana-processor.js → lib/solana-processor.js} +0 -0
- package/{solana-processor.js.map → lib/solana-processor.js.map} +0 -0
- package/{target-ethers-sentio → lib/target-ethers-sentio}/codegen.d.ts +0 -0
- package/{target-ethers-sentio → lib/target-ethers-sentio}/codegen.js +0 -0
- package/lib/target-ethers-sentio/codegen.js.map +1 -0
- package/{target-ethers-sentio → lib/target-ethers-sentio}/index.d.ts +0 -0
- package/{target-ethers-sentio → lib/target-ethers-sentio}/index.js +0 -0
- package/lib/target-ethers-sentio/index.js.map +1 -0
- package/{test → lib/test}/codegen.test.d.ts +0 -0
- package/{test → lib/test}/codegen.test.js +1 -1
- package/{test → lib/test}/codegen.test.js.map +1 -1
- package/{test → lib/test}/erc20-template.d.ts +0 -0
- package/{test → lib/test}/erc20-template.js +0 -0
- package/{test → lib/test}/erc20-template.js.map +0 -0
- package/{test → lib/test}/erc20-template.test.d.ts +0 -0
- package/{test → lib/test}/erc20-template.test.js +1 -3
- package/lib/test/erc20-template.test.js.map +1 -0
- package/{test → lib/test}/erc20.d.ts +0 -0
- package/{test → lib/test}/erc20.js +0 -0
- package/{test → lib/test}/erc20.js.map +0 -0
- package/{test → lib/test}/erc20.test.d.ts +0 -0
- package/{test → lib/test}/erc20.test.js +1 -3
- package/lib/test/erc20.test.js.map +1 -0
- package/{test → lib/test}/generic-processor.test.d.ts +0 -0
- package/{test → lib/test}/generic-processor.test.js +3 -3
- package/lib/test/generic-processor.test.js.map +1 -0
- package/{test → lib/test}/index.d.ts +0 -0
- package/{test → lib/test}/index.js +0 -0
- package/{test → lib/test}/index.js.map +0 -0
- package/{test → lib/test}/metric-utils.d.ts +0 -0
- package/{test → lib/test}/metric-utils.js +0 -0
- package/{test → lib/test}/metric-utils.js.map +0 -0
- package/{test → lib/test}/mirrorworld.d.ts +0 -0
- package/{test → lib/test}/mirrorworld.js +0 -0
- package/{test → lib/test}/mirrorworld.js.map +0 -0
- package/{test → lib/test}/solana.test.d.ts +0 -0
- package/{test → lib/test}/solana.test.js +3 -3
- package/lib/test/solana.test.js.map +1 -0
- package/{test → lib/test}/test-processor-server.d.ts +1 -1
- package/{test → lib/test}/test-processor-server.js +3 -8
- package/lib/test/test-processor-server.js.map +1 -0
- package/{test → lib/test}/types/game_wallet.d.ts +0 -0
- package/{test → lib/test}/types/game_wallet.js +0 -0
- package/{test → lib/test}/types/game_wallet.js.map +0 -0
- package/{test → lib/test}/types/game_wallet_processor.d.ts +0 -0
- package/{test → lib/test}/types/game_wallet_processor.js +0 -0
- package/{test → lib/test}/types/game_wallet_processor.js.map +0 -0
- package/{test → lib/test}/wormhole-token-bridge.d.ts +0 -0
- package/{test → lib/test}/wormhole-token-bridge.js +0 -0
- package/{test → lib/test}/wormhole-token-bridge.js.map +0 -0
- package/{utils → lib/utils}/chainmap.d.ts +0 -0
- package/{utils → lib/utils}/chainmap.js +0 -0
- package/{utils → lib/utils}/chainmap.js.map +0 -0
- package/{utils → lib/utils}/convert.d.ts +0 -0
- package/{utils → lib/utils}/convert.js +0 -0
- package/{utils → lib/utils}/convert.js.map +0 -0
- package/{utils → lib/utils}/index.d.ts +0 -0
- package/{utils → lib/utils}/index.js +0 -0
- package/{utils → lib/utils}/index.js.map +0 -0
- package/package.json +47 -6
- package/src/abis/erc20.json +198 -0
- package/src/abis/weth9.json +153 -0
- package/src/base-processor-template.ts +92 -0
- package/src/base-processor.ts +128 -0
- package/src/bind-options.ts +41 -0
- package/src/binds.ts +73 -0
- package/src/builtin/erc20/index.ts +6 -0
- package/src/builtin/erc20/test-utils.ts +49 -0
- package/src/builtin/internal/Erc20.ts +356 -0
- package/src/builtin/internal/Weth9.ts +480 -0
- package/src/builtin/internal/common.ts +46 -0
- package/src/builtin/internal/erc20_processor.ts +295 -0
- package/src/builtin/internal/factories/Erc20__factory.ts +216 -0
- package/src/builtin/internal/factories/Weth9__factory.ts +297 -0
- package/src/builtin/internal/factories/index.ts +5 -0
- package/src/builtin/internal/index.ts +8 -0
- package/src/builtin/internal/weth9_processor.ts +403 -0
- package/src/builtin/weth9/index.ts +6 -0
- package/src/builtin/weth9/test-utils.ts +89 -0
- package/src/chain-config.ts +6 -0
- package/src/cli/build.ts +196 -0
- package/src/cli/cli.ts +217 -0
- package/src/cli/config.ts +43 -0
- package/src/cli/key.ts +43 -0
- package/src/cli/solana-code-gen.ts +16 -0
- package/src/cli/upload.ts +86 -0
- package/src/cli/webpack.config.js +42 -0
- package/src/context.ts +93 -0
- package/src/contract-namer.ts +17 -0
- package/src/error.ts +43 -0
- package/src/gen/builtin.ts +22 -0
- package/src/gen/google/protobuf/empty.ts +70 -0
- package/src/gen/processor/protos/processor.ts +3071 -0
- package/src/generic-processor.ts +38 -0
- package/src/index.ts +19 -0
- package/src/loader.ts +24 -0
- package/src/meter.ts +122 -0
- package/src/numberish.test.ts +82 -0
- package/src/numberish.ts +99 -0
- package/src/processor-runner.ts +49 -0
- package/src/processor-state.ts +24 -0
- package/src/promise-or-void.ts +1 -0
- package/src/provider.ts +74 -0
- package/src/service.ts +439 -0
- package/src/solana/builtin/index.ts +2 -0
- package/src/solana/builtin/spl-token-processor.ts +164 -0
- package/src/solana/builtin/types.ts +268 -0
- package/src/solana/builtin/wormhole-processor.ts +178 -0
- package/src/solana-processor.ts +105 -0
- package/src/target-ethers-sentio/codegen.ts +289 -0
- package/src/target-ethers-sentio/index.ts +50 -0
- package/src/target-ethers-sentio/tsconfig.json +9 -0
- package/src/test/abis/evm/anyswapRouter.json +490 -0
- package/src/test/abis/solana/mirrorworld.json +1392 -0
- package/src/test/codegen.test.ts +26 -0
- package/src/test/erc20-template.test.ts +37 -0
- package/src/test/erc20-template.ts +25 -0
- package/src/test/erc20.test.ts +90 -0
- package/src/test/erc20.ts +48 -0
- package/src/test/generic-processor.test.ts +70 -0
- package/src/test/index.ts +1 -0
- package/src/test/metric-utils.ts +49 -0
- package/src/test/mirrorworld.ts +40 -0
- package/src/test/sentio.yaml +4 -0
- package/src/test/solana.test.ts +93 -0
- package/src/test/test-processor-server.ts +205 -0
- package/src/test/types/game_wallet.ts +1392 -0
- package/src/test/types/game_wallet_processor.ts +113 -0
- package/src/test/wormhole-token-bridge.ts +21 -0
- package/src/types/global.d.ts +17 -0
- package/src/utils/chainmap.ts +95 -0
- package/src/utils/convert.ts +6 -0
- package/src/utils/index.ts +2 -0
- package/builtin/internal/factories/index.js.map +0 -1
- package/builtin/internal/index.js.map +0 -1
- package/cli/build.js.map +0 -1
- package/processor-runner.js.map +0 -1
- package/service.js.map +0 -1
- package/target-ethers-sentio/codegen.js.map +0 -1
- package/target-ethers-sentio/index.js.map +0 -1
- package/test/erc20-template.test.js.map +0 -1
- package/test/erc20.test.js.map +0 -1
- package/test/generic-processor.test.js.map +0 -1
- package/test/solana.test.js.map +0 -1
- package/test/test-processor-server.js.map +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.17",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
|
|
7
|
+
"compile": "tsc -p . && cp src/cli/webpack.config.js lib/cli",
|
|
8
|
+
"build": "yarn gen && yarn compile",
|
|
9
|
+
"start_ts": "ts-node --files src/processor-runner.ts ../examples/x2y2/src/processor.ts",
|
|
10
|
+
"start_ts_solana": "ts-node --files src/processor-runner.ts ../examples/mirrorworld/src/processor.ts",
|
|
11
|
+
"start": "ts-node --files src/processor-runner.ts ../examples/x2y2/dist/lib.js",
|
|
12
|
+
"start_js": "node lib/processor.js ../examples/x2y2/dist/lib.js",
|
|
13
|
+
"ts-start": "ts-node --files src/processor-runner.ts ./src/anyswap/src/processor.ts",
|
|
14
|
+
"cli": "yarn build && node lib/cli/cli.js",
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"gen": "yarn compile_target && yarn gen_bultin_evm && yarn gen_test_abi",
|
|
17
|
+
"gen_test_abi": "yarn gen_solana_abi",
|
|
18
|
+
"gen_bultin_evm": "typechain --target lib/target-ethers-sentio --out-dir src/builtin/internal 'src/abis/*.json'",
|
|
19
|
+
"gen_solana_abi": "ts-node src/cli/solana-code-gen.ts src/test types",
|
|
20
|
+
"postbuild": "echo || clear-package-json package.json -o ./lib/package.json && cp release.config.js ./lib"
|
|
21
|
+
},
|
|
5
22
|
"dependencies": {
|
|
6
23
|
"@ethersproject/providers": "~5.7.0",
|
|
7
24
|
"@project-serum/anchor": "^0.25.0",
|
|
@@ -27,11 +44,35 @@
|
|
|
27
44
|
"webpack": "^5.72.1",
|
|
28
45
|
"webpack-cli": "^4.9.2"
|
|
29
46
|
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/chai": "^4.3.1",
|
|
49
|
+
"@types/command-line-args": "^5.2.0",
|
|
50
|
+
"@types/command-line-usage": "^5.0.2",
|
|
51
|
+
"@types/expect": "^24.3.0",
|
|
52
|
+
"@types/fs-extra": "^9.0.13",
|
|
53
|
+
"@types/google-protobuf": "^3.15.6",
|
|
54
|
+
"@types/jest": "^29.0.0",
|
|
55
|
+
"@types/js-yaml": "^4.0.5",
|
|
56
|
+
"@types/mkdirp": "^1.0.2",
|
|
57
|
+
"@types/node": "^18.0.4",
|
|
58
|
+
"chai": "^4.3.6",
|
|
59
|
+
"clean-publish": "^4.0.1",
|
|
60
|
+
"jest": "^28.0.1",
|
|
61
|
+
"semantic-release": "^19.0.5",
|
|
62
|
+
"ts-jest": "^28.0.8",
|
|
63
|
+
"ts-node": "^10.8.0",
|
|
64
|
+
"tsconfig-paths": "^4.0.0",
|
|
65
|
+
"typescript": "^4.8.0"
|
|
66
|
+
},
|
|
30
67
|
"bin": {
|
|
31
|
-
"processor-runner": "./processor-runner.js",
|
|
32
|
-
"sentio": "./cli/cli.js"
|
|
68
|
+
"processor-runner": "./lib/processor-runner.js",
|
|
69
|
+
"sentio": "./lib/cli/cli.js"
|
|
33
70
|
},
|
|
34
|
-
"main": "./index.js",
|
|
35
|
-
"types": "./index.d.
|
|
36
|
-
"module": "./index.js"
|
|
71
|
+
"main": "./lib/index.js",
|
|
72
|
+
"types": "./lib/index.d.ts",
|
|
73
|
+
"module": "./lib/index.js",
|
|
74
|
+
"files": [
|
|
75
|
+
"lib/**/*",
|
|
76
|
+
"src/**/*"
|
|
77
|
+
]
|
|
37
78
|
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"anonymous": false,
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"indexed": true,
|
|
7
|
+
"internalType": "address",
|
|
8
|
+
"name": "owner",
|
|
9
|
+
"type": "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"indexed": true,
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "spender",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"indexed": false,
|
|
19
|
+
"internalType": "uint256",
|
|
20
|
+
"name": "value",
|
|
21
|
+
"type": "uint256"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "Approval",
|
|
25
|
+
"type": "event"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"anonymous": false,
|
|
29
|
+
"inputs": [
|
|
30
|
+
{
|
|
31
|
+
"indexed": true,
|
|
32
|
+
"internalType": "address",
|
|
33
|
+
"name": "from",
|
|
34
|
+
"type": "address"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"indexed": true,
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "to",
|
|
40
|
+
"type": "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"indexed": false,
|
|
44
|
+
"internalType": "uint256",
|
|
45
|
+
"name": "value",
|
|
46
|
+
"type": "uint256"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"name": "Transfer",
|
|
50
|
+
"type": "event"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"inputs": [
|
|
54
|
+
{
|
|
55
|
+
"internalType": "address",
|
|
56
|
+
"name": "owner",
|
|
57
|
+
"type": "address"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"internalType": "address",
|
|
61
|
+
"name": "spender",
|
|
62
|
+
"type": "address"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "allowance",
|
|
66
|
+
"outputs": [
|
|
67
|
+
{
|
|
68
|
+
"internalType": "uint256",
|
|
69
|
+
"name": "",
|
|
70
|
+
"type": "uint256"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"stateMutability": "view",
|
|
74
|
+
"type": "function"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"internalType": "address",
|
|
80
|
+
"name": "spender",
|
|
81
|
+
"type": "address"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "amount",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"name": "approve",
|
|
90
|
+
"outputs": [
|
|
91
|
+
{
|
|
92
|
+
"internalType": "bool",
|
|
93
|
+
"name": "",
|
|
94
|
+
"type": "bool"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "nonpayable",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"internalType": "address",
|
|
104
|
+
"name": "account",
|
|
105
|
+
"type": "address"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "balanceOf",
|
|
109
|
+
"outputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "uint256",
|
|
112
|
+
"name": "",
|
|
113
|
+
"type": "uint256"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"stateMutability": "view",
|
|
117
|
+
"type": "function"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [],
|
|
121
|
+
"name": "decimals",
|
|
122
|
+
"outputs": [
|
|
123
|
+
{
|
|
124
|
+
"internalType": "uint8",
|
|
125
|
+
"name": "",
|
|
126
|
+
"type": "uint8"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"stateMutability": "view",
|
|
130
|
+
"type": "function"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"inputs": [],
|
|
134
|
+
"name": "totalSupply",
|
|
135
|
+
"outputs": [
|
|
136
|
+
{
|
|
137
|
+
"internalType": "uint256",
|
|
138
|
+
"name": "",
|
|
139
|
+
"type": "uint256"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"stateMutability": "view",
|
|
143
|
+
"type": "function"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"inputs": [
|
|
147
|
+
{
|
|
148
|
+
"internalType": "address",
|
|
149
|
+
"name": "to",
|
|
150
|
+
"type": "address"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"internalType": "uint256",
|
|
154
|
+
"name": "amount",
|
|
155
|
+
"type": "uint256"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"name": "transfer",
|
|
159
|
+
"outputs": [
|
|
160
|
+
{
|
|
161
|
+
"internalType": "bool",
|
|
162
|
+
"name": "",
|
|
163
|
+
"type": "bool"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"stateMutability": "nonpayable",
|
|
167
|
+
"type": "function"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"inputs": [
|
|
171
|
+
{
|
|
172
|
+
"internalType": "address",
|
|
173
|
+
"name": "from",
|
|
174
|
+
"type": "address"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"internalType": "address",
|
|
178
|
+
"name": "to",
|
|
179
|
+
"type": "address"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"internalType": "uint256",
|
|
183
|
+
"name": "amount",
|
|
184
|
+
"type": "uint256"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"name": "transferFrom",
|
|
188
|
+
"outputs": [
|
|
189
|
+
{
|
|
190
|
+
"internalType": "bool",
|
|
191
|
+
"name": "",
|
|
192
|
+
"type": "bool"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"stateMutability": "nonpayable",
|
|
196
|
+
"type": "function"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"constant": true,
|
|
4
|
+
"inputs": [],
|
|
5
|
+
"name": "name",
|
|
6
|
+
"outputs": [{ "name": "", "type": "string" }],
|
|
7
|
+
"payable": false,
|
|
8
|
+
"stateMutability": "view",
|
|
9
|
+
"type": "function"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"constant": false,
|
|
13
|
+
"inputs": [
|
|
14
|
+
{ "name": "guy", "type": "address" },
|
|
15
|
+
{ "name": "wad", "type": "uint256" }
|
|
16
|
+
],
|
|
17
|
+
"name": "approve",
|
|
18
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
19
|
+
"payable": false,
|
|
20
|
+
"stateMutability": "nonpayable",
|
|
21
|
+
"type": "function"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"constant": true,
|
|
25
|
+
"inputs": [],
|
|
26
|
+
"name": "totalSupply",
|
|
27
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
28
|
+
"payable": false,
|
|
29
|
+
"stateMutability": "view",
|
|
30
|
+
"type": "function"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"constant": false,
|
|
34
|
+
"inputs": [
|
|
35
|
+
{ "name": "src", "type": "address" },
|
|
36
|
+
{ "name": "dst", "type": "address" },
|
|
37
|
+
{ "name": "wad", "type": "uint256" }
|
|
38
|
+
],
|
|
39
|
+
"name": "transferFrom",
|
|
40
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
41
|
+
"payable": false,
|
|
42
|
+
"stateMutability": "nonpayable",
|
|
43
|
+
"type": "function"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"constant": false,
|
|
47
|
+
"inputs": [{ "name": "wad", "type": "uint256" }],
|
|
48
|
+
"name": "withdraw",
|
|
49
|
+
"outputs": [],
|
|
50
|
+
"payable": false,
|
|
51
|
+
"stateMutability": "nonpayable",
|
|
52
|
+
"type": "function"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"constant": true,
|
|
56
|
+
"inputs": [],
|
|
57
|
+
"name": "decimals",
|
|
58
|
+
"outputs": [{ "name": "", "type": "uint8" }],
|
|
59
|
+
"payable": false,
|
|
60
|
+
"stateMutability": "view",
|
|
61
|
+
"type": "function"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"constant": true,
|
|
65
|
+
"inputs": [{ "name": "", "type": "address" }],
|
|
66
|
+
"name": "balanceOf",
|
|
67
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
68
|
+
"payable": false,
|
|
69
|
+
"stateMutability": "view",
|
|
70
|
+
"type": "function"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"constant": true,
|
|
74
|
+
"inputs": [],
|
|
75
|
+
"name": "symbol",
|
|
76
|
+
"outputs": [{ "name": "", "type": "string" }],
|
|
77
|
+
"payable": false,
|
|
78
|
+
"stateMutability": "view",
|
|
79
|
+
"type": "function"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"constant": false,
|
|
83
|
+
"inputs": [
|
|
84
|
+
{ "name": "dst", "type": "address" },
|
|
85
|
+
{ "name": "wad", "type": "uint256" }
|
|
86
|
+
],
|
|
87
|
+
"name": "transfer",
|
|
88
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
89
|
+
"payable": false,
|
|
90
|
+
"stateMutability": "nonpayable",
|
|
91
|
+
"type": "function"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"constant": false,
|
|
95
|
+
"inputs": [],
|
|
96
|
+
"name": "deposit",
|
|
97
|
+
"outputs": [],
|
|
98
|
+
"payable": true,
|
|
99
|
+
"stateMutability": "payable",
|
|
100
|
+
"type": "function"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"constant": true,
|
|
104
|
+
"inputs": [
|
|
105
|
+
{ "name": "", "type": "address" },
|
|
106
|
+
{ "name": "", "type": "address" }
|
|
107
|
+
],
|
|
108
|
+
"name": "allowance",
|
|
109
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
110
|
+
"payable": false,
|
|
111
|
+
"stateMutability": "view",
|
|
112
|
+
"type": "function"
|
|
113
|
+
},
|
|
114
|
+
{ "payable": true, "stateMutability": "payable", "type": "fallback" },
|
|
115
|
+
{
|
|
116
|
+
"anonymous": false,
|
|
117
|
+
"inputs": [
|
|
118
|
+
{ "indexed": true, "name": "src", "type": "address" },
|
|
119
|
+
{ "indexed": true, "name": "guy", "type": "address" },
|
|
120
|
+
{ "indexed": false, "name": "wad", "type": "uint256" }
|
|
121
|
+
],
|
|
122
|
+
"name": "Approval",
|
|
123
|
+
"type": "event"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"anonymous": false,
|
|
127
|
+
"inputs": [
|
|
128
|
+
{ "indexed": true, "name": "src", "type": "address" },
|
|
129
|
+
{ "indexed": true, "name": "dst", "type": "address" },
|
|
130
|
+
{ "indexed": false, "name": "wad", "type": "uint256" }
|
|
131
|
+
],
|
|
132
|
+
"name": "Transfer",
|
|
133
|
+
"type": "event"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"anonymous": false,
|
|
137
|
+
"inputs": [
|
|
138
|
+
{ "indexed": true, "name": "dst", "type": "address" },
|
|
139
|
+
{ "indexed": false, "name": "wad", "type": "uint256" }
|
|
140
|
+
],
|
|
141
|
+
"name": "Deposit",
|
|
142
|
+
"type": "event"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"anonymous": false,
|
|
146
|
+
"inputs": [
|
|
147
|
+
{ "indexed": true, "name": "src", "type": "address" },
|
|
148
|
+
{ "indexed": false, "name": "wad", "type": "uint256" }
|
|
149
|
+
],
|
|
150
|
+
"name": "Withdrawal",
|
|
151
|
+
"type": "event"
|
|
152
|
+
}
|
|
153
|
+
]
|
|
@@ -0,0 +1,92 @@
|
|
|
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, getOptionsSignature } from './bind-options'
|
|
7
|
+
import { TemplateInstance } from './gen/processor/protos/processor'
|
|
8
|
+
import Long from 'long'
|
|
9
|
+
import { getNetwork } from '@ethersproject/providers'
|
|
10
|
+
import { PromiseOrVoid } from './promise-or-void'
|
|
11
|
+
|
|
12
|
+
export abstract class BaseProcessorTemplate<
|
|
13
|
+
TContract extends BaseContract,
|
|
14
|
+
TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>
|
|
15
|
+
> {
|
|
16
|
+
id: number
|
|
17
|
+
binds = new Set<string>()
|
|
18
|
+
blockHandlers: ((block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid)[] = []
|
|
19
|
+
eventHandlers: {
|
|
20
|
+
handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid
|
|
21
|
+
filter: EventFilter | EventFilter[]
|
|
22
|
+
}[] = []
|
|
23
|
+
|
|
24
|
+
constructor() {
|
|
25
|
+
this.id = global.PROCESSOR_STATE.templates.length
|
|
26
|
+
global.PROCESSOR_STATE.templates.push(this)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public bind(options: BindOptions) {
|
|
30
|
+
const sig = getOptionsSignature(options)
|
|
31
|
+
if (this.binds.has(sig)) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
this.binds.add(sig)
|
|
35
|
+
|
|
36
|
+
const processor = this.bindInternal(options)
|
|
37
|
+
|
|
38
|
+
for (const eh of this.eventHandlers) {
|
|
39
|
+
processor.onEvent(eh.handler, eh.filter)
|
|
40
|
+
}
|
|
41
|
+
for (const bh of this.blockHandlers) {
|
|
42
|
+
processor.onBlock(bh)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const instance: TemplateInstance = {
|
|
46
|
+
templateId: this.id,
|
|
47
|
+
contract: {
|
|
48
|
+
address: options.address,
|
|
49
|
+
name: options.name || '',
|
|
50
|
+
chainId: options.network ? getNetwork(options.network).chainId.toString() : '1',
|
|
51
|
+
abi: '',
|
|
52
|
+
},
|
|
53
|
+
startBlock: Long.ZERO,
|
|
54
|
+
endBlock: Long.ZERO,
|
|
55
|
+
}
|
|
56
|
+
if (options.startBlock) {
|
|
57
|
+
if (typeof options.startBlock === 'number') {
|
|
58
|
+
instance.startBlock = Long.fromNumber(options.startBlock)
|
|
59
|
+
} else {
|
|
60
|
+
instance.startBlock = options.startBlock
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (options.endBlock) {
|
|
64
|
+
if (typeof options.endBlock === 'number') {
|
|
65
|
+
instance.endBlock = Long.fromNumber(options.endBlock)
|
|
66
|
+
} else {
|
|
67
|
+
instance.endBlock = options.endBlock
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
global.PROCESSOR_STATE.templatesInstances.push(instance)
|
|
71
|
+
|
|
72
|
+
return processor
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public onEvent(
|
|
76
|
+
handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
77
|
+
filter: EventFilter | EventFilter[]
|
|
78
|
+
) {
|
|
79
|
+
this.eventHandlers.push({
|
|
80
|
+
handler: handler,
|
|
81
|
+
filter: filter,
|
|
82
|
+
})
|
|
83
|
+
return this
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
87
|
+
this.blockHandlers.push(handler)
|
|
88
|
+
return this
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>
|
|
92
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Event } from '@ethersproject/contracts'
|
|
2
|
+
import { BytesLike } from '@ethersproject/bytes'
|
|
3
|
+
import { Block, Log, getNetwork } from '@ethersproject/providers'
|
|
4
|
+
import { BaseContract, EventFilter } from '@ethersproject/contracts'
|
|
5
|
+
import Long from 'long'
|
|
6
|
+
|
|
7
|
+
import { BoundContractView, Context, ContractView } from './context'
|
|
8
|
+
import { O11yResult } from './gen/processor/protos/processor'
|
|
9
|
+
import { BindInternalOptions, BindOptions } from './bind-options'
|
|
10
|
+
import { PromiseOrVoid } from './promise-or-void'
|
|
11
|
+
|
|
12
|
+
export class EventsHandler {
|
|
13
|
+
filters: EventFilter[]
|
|
14
|
+
handler: (event: Log) => Promise<O11yResult>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export abstract class BaseProcessor<
|
|
18
|
+
TContract extends BaseContract,
|
|
19
|
+
TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>
|
|
20
|
+
> {
|
|
21
|
+
blockHandlers: ((block: Block) => Promise<O11yResult>)[] = []
|
|
22
|
+
eventHandlers: EventsHandler[] = []
|
|
23
|
+
|
|
24
|
+
name: string
|
|
25
|
+
config: BindInternalOptions
|
|
26
|
+
|
|
27
|
+
constructor(config: BindOptions) {
|
|
28
|
+
this.config = {
|
|
29
|
+
address: config.address,
|
|
30
|
+
name: config.name || '',
|
|
31
|
+
network: config.network ? config.network : 1,
|
|
32
|
+
startBlock: new Long(0),
|
|
33
|
+
}
|
|
34
|
+
if (config.startBlock) {
|
|
35
|
+
if (typeof config.startBlock === 'number') {
|
|
36
|
+
this.config.startBlock = Long.fromNumber(config.startBlock)
|
|
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.fromNumber(config.endBlock)
|
|
44
|
+
} else {
|
|
45
|
+
this.config.endBlock = config.endBlock
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
protected abstract CreateBoundContractView(): TBoundContractView
|
|
51
|
+
|
|
52
|
+
public getChainId(): number {
|
|
53
|
+
return getNetwork(this.config.network).chainId
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public onEvent(
|
|
57
|
+
handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
58
|
+
filter: EventFilter | EventFilter[]
|
|
59
|
+
) {
|
|
60
|
+
const chainId = this.getChainId()
|
|
61
|
+
|
|
62
|
+
let _filters: EventFilter[] = []
|
|
63
|
+
|
|
64
|
+
if (Array.isArray(filter)) {
|
|
65
|
+
_filters = filter
|
|
66
|
+
} else {
|
|
67
|
+
_filters.push(filter)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const contractView = this.CreateBoundContractView()
|
|
71
|
+
this.eventHandlers.push({
|
|
72
|
+
filters: _filters,
|
|
73
|
+
handler: async function (log) {
|
|
74
|
+
const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, log)
|
|
75
|
+
// let event: Event = <Event>deepCopy(log);
|
|
76
|
+
const event: Event = <Event>log
|
|
77
|
+
const parsed = contractView.rawContract.interface.parseLog(log)
|
|
78
|
+
if (parsed) {
|
|
79
|
+
event.args = parsed.args
|
|
80
|
+
event.decode = (data: BytesLike, topics?: Array<any>) => {
|
|
81
|
+
return contractView.rawContract.interface.decodeEventLog(parsed.eventFragment, data, topics)
|
|
82
|
+
}
|
|
83
|
+
event.event = parsed.name
|
|
84
|
+
event.eventSignature = parsed.signature
|
|
85
|
+
|
|
86
|
+
// TODO fix this bug
|
|
87
|
+
await handler(event, ctx)
|
|
88
|
+
return {
|
|
89
|
+
gauges: ctx.gauges,
|
|
90
|
+
counters: ctx.counters,
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
gauges: [],
|
|
95
|
+
counters: [],
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
})
|
|
99
|
+
return this
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
103
|
+
const chainId = this.getChainId()
|
|
104
|
+
const contractView = this.CreateBoundContractView()
|
|
105
|
+
|
|
106
|
+
this.blockHandlers.push(async function (block: Block) {
|
|
107
|
+
const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, block, undefined)
|
|
108
|
+
await handler(block, ctx)
|
|
109
|
+
return {
|
|
110
|
+
gauges: ctx.gauges,
|
|
111
|
+
counters: ctx.counters,
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
return this
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
118
|
+
const _filters: EventFilter[] = []
|
|
119
|
+
const tmpContract = this.CreateBoundContractView()
|
|
120
|
+
|
|
121
|
+
for (const key in tmpContract.filters) {
|
|
122
|
+
_filters.push(tmpContract.filters[key]())
|
|
123
|
+
}
|
|
124
|
+
return this.onEvent(function (log, ctx) {
|
|
125
|
+
return handler(log, ctx)
|
|
126
|
+
}, _filters)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Networkish } from '@ethersproject/networks'
|
|
2
|
+
import Long from 'long'
|
|
3
|
+
import { getNetwork } from '@ethersproject/providers'
|
|
4
|
+
|
|
5
|
+
export class BindOptions {
|
|
6
|
+
address: string
|
|
7
|
+
network?: Networkish = 1
|
|
8
|
+
name?: string
|
|
9
|
+
startBlock?: Long | number
|
|
10
|
+
endBlock?: Long | number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getOptionsSignature(opts: BindOptions): string {
|
|
14
|
+
const sig = [opts.address]
|
|
15
|
+
if (opts.network) {
|
|
16
|
+
sig.push(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
|
+
|
|
30
|
+
export class BindInternalOptions {
|
|
31
|
+
address: string
|
|
32
|
+
network: Networkish
|
|
33
|
+
name: string
|
|
34
|
+
startBlock: Long
|
|
35
|
+
endBlock?: Long
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class SolanaBindOptions extends BindOptions {
|
|
39
|
+
declare network?: string
|
|
40
|
+
processInnerInstruction?: boolean
|
|
41
|
+
}
|