@sentio/sdk 1.17.2 → 1.18.1
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/binds.d.ts +2 -3
- package/lib/binds.js +1 -1
- package/lib/binds.js.map +1 -1
- package/lib/builtin/eacaggregatorproxy/test-utils.js +4 -4
- package/lib/builtin/eacaggregatorproxy/test-utils.js.map +1 -1
- package/lib/builtin/erc20/test-utils.js +3 -3
- package/lib/builtin/erc20/test-utils.js.map +1 -1
- package/lib/builtin/erc20bytes/test-utils.js +2 -2
- package/lib/builtin/erc20bytes/test-utils.js.map +1 -1
- package/lib/builtin/index.d.ts +5 -0
- package/lib/builtin/index.js +32 -0
- package/lib/builtin/index.js.map +1 -0
- package/lib/{solana/builtin → builtin/solana}/index.d.ts +0 -0
- package/lib/{solana/builtin → builtin/solana}/index.js +0 -0
- package/lib/{solana/builtin → builtin/solana}/index.js.map +1 -1
- package/lib/{solana/builtin → builtin/solana}/spl-token-processor.d.ts +1 -3
- package/lib/{solana/builtin → builtin/solana}/spl-token-processor.js +2 -2
- package/lib/builtin/solana/spl-token-processor.js.map +1 -0
- package/lib/{solana/builtin → builtin/solana}/types.d.ts +27 -27
- package/lib/{solana/builtin → builtin/solana}/types.js +0 -0
- package/lib/{solana/builtin → builtin/solana}/types.js.map +1 -1
- package/lib/{solana/builtin → builtin/solana}/wormhole-processor.d.ts +1 -3
- package/lib/{solana/builtin → builtin/solana}/wormhole-processor.js +2 -2
- package/lib/builtin/solana/wormhole-processor.js.map +1 -0
- package/lib/builtin/weth9/test-utils.js +4 -4
- package/lib/builtin/weth9/test-utils.js.map +1 -1
- package/lib/cli/webpack.config.js +1 -1
- package/lib/{aptos-processor.d.ts → core/aptos-processor.d.ts} +3 -2
- package/lib/{aptos-processor.js → core/aptos-processor.js} +4 -2
- package/lib/core/aptos-processor.js.map +1 -0
- package/lib/{base-processor-template.d.ts → core/base-processor-template.d.ts} +1 -1
- package/lib/{base-processor-template.js → core/base-processor-template.js} +0 -0
- package/lib/core/base-processor-template.js.map +1 -0
- package/lib/{base-processor.d.ts → core/base-processor.d.ts} +2 -2
- package/lib/{base-processor.js → core/base-processor.js} +0 -0
- package/lib/core/base-processor.js.map +1 -0
- package/lib/{bind-options.d.ts → core/bind-options.d.ts} +0 -0
- package/lib/{bind-options.js → core/bind-options.js} +0 -0
- package/lib/core/bind-options.js.map +1 -0
- package/lib/{context.d.ts → core/context.d.ts} +7 -4
- package/lib/{context.js → core/context.js} +12 -6
- package/lib/core/context.js.map +1 -0
- package/lib/{generic-processor.d.ts → core/generic-processor.d.ts} +0 -0
- package/lib/{generic-processor.js → core/generic-processor.js} +2 -2
- package/lib/core/generic-processor.js.map +1 -0
- package/lib/{test → core}/generic-processor.test.d.ts +0 -0
- package/lib/{test → core}/generic-processor.test.js +4 -5
- package/lib/core/generic-processor.test.js.map +1 -0
- package/lib/core/index.d.ts +12 -0
- package/lib/core/index.js +38 -0
- package/lib/core/index.js.map +1 -0
- package/lib/{meter.d.ts → core/meter.d.ts} +1 -1
- package/lib/{meter.js → core/meter.js} +11 -14
- package/lib/core/meter.js.map +1 -0
- package/lib/{meter.test.d.ts → core/meter.test.d.ts} +0 -0
- package/lib/{meter.test.js → core/meter.test.js} +0 -0
- package/lib/core/meter.test.js.map +1 -0
- package/lib/{numberish.d.ts → core/numberish.d.ts} +1 -1
- package/lib/{numberish.js → core/numberish.js} +1 -1
- package/lib/core/numberish.js.map +1 -0
- package/lib/{numberish.test.d.ts → core/numberish.test.d.ts} +0 -0
- package/lib/{numberish.test.js → core/numberish.test.js} +4 -4
- package/lib/core/numberish.test.js.map +1 -0
- package/lib/{solana-processor.d.ts → core/solana-processor.d.ts} +2 -2
- package/lib/{solana-processor.js → core/solana-processor.js} +2 -2
- package/lib/core/solana-processor.js.map +1 -0
- package/lib/{sui-processor.d.ts → core/sui-processor.d.ts} +2 -2
- package/lib/{sui-processor.js → core/sui-processor.js} +2 -2
- package/lib/core/sui-processor.js.map +1 -0
- package/lib/{trace.d.ts → core/trace.d.ts} +0 -0
- package/lib/{trace.js → core/trace.js} +0 -0
- package/lib/core/trace.js.map +1 -0
- package/lib/error.d.ts +1 -1
- package/lib/error.js.map +1 -1
- package/lib/index.d.ts +1 -12
- package/lib/index.js +2 -34
- package/lib/index.js.map +1 -1
- package/lib/processor-state.d.ts +1 -6
- package/lib/processor-state.js.map +1 -1
- package/lib/service.js +21 -54
- package/lib/service.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +2 -1
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/{test → testing}/index.d.ts +0 -1
- package/lib/{test → testing}/index.js +2 -3
- package/lib/testing/index.js.map +1 -0
- package/lib/{test → testing}/metric-utils.d.ts +1 -1
- package/lib/{test → testing}/metric-utils.js +0 -0
- package/lib/testing/metric-utils.js.map +1 -0
- package/lib/{test → testing}/test-processor-server.d.ts +1 -1
- package/lib/{test → testing}/test-processor-server.js +2 -2
- package/lib/testing/test-processor-server.js.map +1 -0
- package/lib/{test → testing}/test-provider.d.ts +0 -0
- package/lib/{test → testing}/test-provider.js +5 -3
- package/lib/testing/test-provider.js.map +1 -0
- package/lib/{test → tests}/aptos.test.d.ts +0 -0
- package/lib/{test → tests}/aptos.test.js +10 -3
- package/lib/tests/aptos.test.js.map +1 -0
- package/lib/{test → tests}/codegen.test.d.ts +0 -0
- package/lib/{test → tests}/codegen.test.js +0 -0
- package/lib/tests/codegen.test.js.map +1 -0
- package/lib/{test → tests}/erc20-template.test.d.ts +0 -0
- package/lib/{test → tests}/erc20-template.test.js +2 -2
- package/lib/tests/erc20-template.test.js.map +1 -0
- package/lib/{test → tests}/erc20.d.ts +0 -0
- package/lib/{test → tests}/erc20.js +0 -0
- package/lib/tests/erc20.js.map +1 -0
- package/lib/{test → tests}/erc20.test.d.ts +0 -0
- package/lib/{test → tests}/erc20.test.js +6 -7
- package/lib/tests/erc20.test.js.map +1 -0
- package/lib/{test → tests}/error-capture.test.d.ts +0 -0
- package/lib/{test → tests}/error-capture.test.js +4 -4
- package/lib/tests/error-capture.test.js.map +1 -0
- package/lib/{test → tests}/solana.test.d.ts +0 -0
- package/lib/{test → tests}/solana.test.js +6 -7
- package/lib/tests/solana.test.js.map +1 -0
- package/lib/{test → tests}/souffl3.d.ts +0 -0
- package/lib/{test → tests}/souffl3.js +2 -2
- package/lib/tests/souffl3.js.map +1 -0
- package/lib/{test → tests}/sui.test.d.ts +0 -0
- package/lib/{test → tests}/sui.test.js +10 -4
- package/lib/tests/sui.test.js.map +1 -0
- package/lib/{test → tests}/types/basic_1.d.ts +0 -0
- package/lib/{test → tests}/types/basic_1.js +0 -0
- package/lib/tests/types/basic_1.js.map +1 -0
- package/lib/{test → tests}/types/basic_1_processor.d.ts +0 -0
- package/lib/{test → tests}/types/basic_1_processor.js +0 -0
- package/lib/tests/types/basic_1_processor.js.map +1 -0
- package/lib/{test → tests}/wormhole-token-bridge.d.ts +0 -0
- package/lib/{test → tests}/wormhole-token-bridge.js +3 -4
- package/lib/tests/wormhole-token-bridge.js.map +1 -0
- package/lib/utils/chain.d.ts +7 -0
- package/lib/utils/{chainmap.js → chain.js} +12 -5
- package/lib/utils/chain.js.map +1 -0
- package/lib/utils/{convert.d.ts → conversion.d.ts} +1 -1
- package/lib/utils/{convert.js → conversion.js} +1 -1
- package/lib/utils/conversion.js.map +1 -0
- package/lib/utils/dex-price.d.ts +5 -5
- package/lib/utils/dex-price.js +2 -2
- package/lib/utils/dex-price.js.map +1 -1
- package/lib/utils/dex-price.test.js +2 -2
- package/lib/utils/dex-price.test.js.map +1 -1
- package/lib/utils/erc20.test.js +6 -5
- package/lib/utils/erc20.test.js.map +1 -1
- package/lib/utils/index.d.ts +4 -5
- package/lib/utils/index.js +28 -16
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/{erc20.d.ts → token.d.ts} +1 -1
- package/lib/utils/{erc20.js → token.js} +4 -10
- package/lib/utils/token.js.map +1 -0
- package/package.json +5 -3
- package/src/binds.ts +2 -3
- package/src/builtin/eacaggregatorproxy/test-utils.ts +4 -4
- package/src/builtin/erc20/test-utils.ts +3 -3
- package/src/builtin/erc20bytes/test-utils.ts +2 -2
- package/src/builtin/index.ts +5 -0
- package/src/{solana/builtin → builtin/solana}/index.ts +0 -0
- package/src/{solana/builtin → builtin/solana}/spl-token-processor.ts +1 -3
- package/src/{solana/builtin → builtin/solana}/types.ts +0 -0
- package/src/{solana/builtin → builtin/solana}/wormhole-processor.ts +1 -3
- package/src/builtin/weth9/test-utils.ts +4 -4
- package/src/cli/webpack.config.js +1 -1
- package/src/{aptos-processor.ts → core/aptos-processor.ts} +5 -3
- package/src/{base-processor-template.ts → core/base-processor-template.ts} +2 -2
- package/src/{base-processor.ts → core/base-processor.ts} +2 -2
- package/src/{bind-options.ts → core/bind-options.ts} +0 -0
- package/src/{context.ts → core/context.ts} +13 -7
- package/src/{test → core}/generic-processor.test.ts +2 -3
- package/src/{generic-processor.ts → core/generic-processor.ts} +2 -2
- package/src/core/index.ts +15 -0
- package/src/{meter.test.ts → core/meter.test.ts} +0 -0
- package/src/{meter.ts → core/meter.ts} +11 -11
- package/src/{numberish.test.ts → core/numberish.test.ts} +2 -2
- package/src/{numberish.ts → core/numberish.ts} +1 -1
- package/src/{solana-processor.ts → core/solana-processor.ts} +3 -3
- package/src/{sui-processor.ts → core/sui-processor.ts} +3 -3
- package/src/{trace.ts → core/trace.ts} +0 -0
- package/src/error.ts +1 -1
- package/src/index.ts +1 -13
- package/src/processor-state.ts +9 -6
- package/src/service.ts +32 -54
- package/src/target-ethers-sentio/codegen.ts +3 -1
- package/src/{test → testing}/index.ts +2 -1
- package/src/{test → testing}/metric-utils.ts +1 -1
- package/src/{test → testing}/test-processor-server.ts +2 -2
- package/src/{test → testing}/test-provider.ts +4 -2
- package/src/{test → tests}/abis/evm/CommitmentPool.json +0 -0
- package/src/{test → tests}/abis/evm/Seaport.json +0 -0
- package/src/{test → tests}/abis/evm/anyswapRouter.json +0 -0
- package/src/{test → tests}/abis/solana/basic_1.json +0 -0
- package/src/{test → tests}/aptos.test.ts +6 -2
- package/src/{test → tests}/codegen.test.ts +0 -0
- package/src/{test → tests}/erc20-template.test.ts +1 -1
- package/src/{test → tests}/erc20.test.ts +2 -3
- package/src/{test → tests}/erc20.ts +0 -0
- package/src/{test → tests}/error-capture.test.ts +4 -4
- package/src/{test → tests}/solana.test.ts +3 -4
- package/src/{test → tests}/souffl3.ts +1 -2
- package/src/{test → tests}/sui.test.ts +6 -3
- package/src/{test → tests}/types/basic_1.ts +0 -0
- package/src/{test → tests}/types/basic_1_processor.ts +0 -0
- package/src/{test → tests}/wormhole-token-bridge.ts +1 -2
- package/src/utils/{chainmap.ts → chain.ts} +13 -3
- package/src/utils/{convert.ts → conversion.ts} +1 -1
- package/src/utils/dex-price.test.ts +2 -1
- package/src/utils/dex-price.ts +6 -6
- package/src/utils/erc20.test.ts +6 -3
- package/src/utils/index.ts +4 -5
- package/src/utils/{erc20.ts → token.ts} +2 -2
- package/template/src/processor.test.ts +1 -2
- package/template/src/processor.ts +5 -5
- package/lib/aptos-processor.js.map +0 -1
- package/lib/base-processor-template.js.map +0 -1
- package/lib/base-processor.js.map +0 -1
- package/lib/bind-options.js.map +0 -1
- package/lib/context.js.map +0 -1
- package/lib/generic-processor.js.map +0 -1
- package/lib/meter.js.map +0 -1
- package/lib/meter.test.js.map +0 -1
- package/lib/numberish.js.map +0 -1
- package/lib/numberish.test.js.map +0 -1
- package/lib/solana/builtin/spl-token-processor.js.map +0 -1
- package/lib/solana/builtin/wormhole-processor.js.map +0 -1
- package/lib/solana-processor.js.map +0 -1
- package/lib/sui-processor.js.map +0 -1
- package/lib/test/aptos.test.js.map +0 -1
- package/lib/test/codegen.test.js.map +0 -1
- package/lib/test/erc20-template.test.js.map +0 -1
- package/lib/test/erc20.js.map +0 -1
- package/lib/test/erc20.test.js.map +0 -1
- package/lib/test/error-capture.test.js.map +0 -1
- package/lib/test/generic-processor.test.js.map +0 -1
- package/lib/test/index.js.map +0 -1
- package/lib/test/metric-utils.js.map +0 -1
- package/lib/test/solana.test.js.map +0 -1
- package/lib/test/souffl3.js.map +0 -1
- package/lib/test/sui.test.js.map +0 -1
- package/lib/test/test-processor-server.js.map +0 -1
- package/lib/test/test-provider.js.map +0 -1
- package/lib/test/types/basic_1.js.map +0 -1
- package/lib/test/types/basic_1_processor.js.map +0 -1
- package/lib/test/wormhole-token-bridge.js.map +0 -1
- package/lib/trace.js.map +0 -1
- package/lib/utils/chainmap.d.ts +0 -2
- package/lib/utils/chainmap.js.map +0 -1
- package/lib/utils/convert.js.map +0 -1
- package/lib/utils/erc20.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
|
|
7
7
|
"compile": "tsc -p . && cp src/cli/webpack.config.js lib/cli && cp src/utils/*.csv lib/utils",
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"gen": "yarn compile_target && yarn gen_bultin_evm && yarn gen_test_abi",
|
|
16
16
|
"gen_test_abi": "yarn gen_solana_abi",
|
|
17
17
|
"gen_bultin_evm": "typechain --target lib/target-ethers-sentio --out-dir src/builtin/internal 'src/abis/*.json'",
|
|
18
|
-
"gen_solana_abi": "ts-node src/cli/solana-code-gen.ts src/
|
|
19
|
-
"postbuild": "echo || clear-package-json package.json -o ./lib/package.json && cp release.config.js ./lib"
|
|
18
|
+
"gen_solana_abi": "ts-node src/cli/solana-code-gen.ts src/tests types",
|
|
19
|
+
"postbuild": "echo || clear-package-json package.json -o ./lib/package.json && cp release.config.js ./lib",
|
|
20
|
+
"docs": "typedoc --options typedoc.json"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@ethersproject/providers": "~5.7.0",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"ts-jest": "^29.0.0",
|
|
64
65
|
"ts-node": "^10.8.0",
|
|
65
66
|
"tsconfig-paths": "^4.0.0",
|
|
67
|
+
"typedoc": "^0.23.15",
|
|
66
68
|
"typescript": "^4.8.0"
|
|
67
69
|
},
|
|
68
70
|
"bin": {
|
package/src/binds.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BindOptions, getOptionsSignature } from './bind-options'
|
|
2
|
-
import { BaseProcessor } from './
|
|
1
|
+
import { BindOptions, getOptionsSignature } from './core/bind-options'
|
|
2
|
+
import { BaseProcessor, ContractView } from './core'
|
|
3
3
|
import { Networkish } from '@ethersproject/networks'
|
|
4
4
|
import { getNetwork } from '@ethersproject/providers'
|
|
5
|
-
import { ContractView } from './context'
|
|
6
5
|
import { BaseContract } from 'ethers'
|
|
7
6
|
import { ContractNamer } from './contract-namer'
|
|
8
7
|
|
|
@@ -27,7 +27,7 @@ export function mockAnswerUpdatedLog(
|
|
|
27
27
|
const contract = getEACAggregatorProxyContract(contractAddress);
|
|
28
28
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
29
29
|
contract.rawContract.interface.getEvent("AnswerUpdated"),
|
|
30
|
-
|
|
30
|
+
[event.current, event.roundId, event.updatedAt]
|
|
31
31
|
);
|
|
32
32
|
return {
|
|
33
33
|
...mockField,
|
|
@@ -44,7 +44,7 @@ export function mockNewRoundLog(
|
|
|
44
44
|
const contract = getEACAggregatorProxyContract(contractAddress);
|
|
45
45
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
46
46
|
contract.rawContract.interface.getEvent("NewRound"),
|
|
47
|
-
|
|
47
|
+
[event.roundId, event.startedBy, event.startedAt]
|
|
48
48
|
);
|
|
49
49
|
return {
|
|
50
50
|
...mockField,
|
|
@@ -61,7 +61,7 @@ export function mockOwnershipTransferRequestedLog(
|
|
|
61
61
|
const contract = getEACAggregatorProxyContract(contractAddress);
|
|
62
62
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
63
63
|
contract.rawContract.interface.getEvent("OwnershipTransferRequested"),
|
|
64
|
-
|
|
64
|
+
[event.from, event.to]
|
|
65
65
|
);
|
|
66
66
|
return {
|
|
67
67
|
...mockField,
|
|
@@ -78,7 +78,7 @@ export function mockOwnershipTransferredLog(
|
|
|
78
78
|
const contract = getEACAggregatorProxyContract(contractAddress);
|
|
79
79
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
80
80
|
contract.rawContract.interface.getEvent("OwnershipTransferred"),
|
|
81
|
-
|
|
81
|
+
[event.from, event.to]
|
|
82
82
|
);
|
|
83
83
|
return {
|
|
84
84
|
...mockField,
|
|
@@ -26,7 +26,7 @@ export function mockApprovalLog(
|
|
|
26
26
|
const contract = getERC20Contract(contractAddress);
|
|
27
27
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
28
28
|
contract.rawContract.interface.getEvent("Approval"),
|
|
29
|
-
|
|
29
|
+
[event.owner, event.spender, event.value]
|
|
30
30
|
);
|
|
31
31
|
return {
|
|
32
32
|
...mockField,
|
|
@@ -43,7 +43,7 @@ export function mockOwnershipTransferredLog(
|
|
|
43
43
|
const contract = getERC20Contract(contractAddress);
|
|
44
44
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
45
45
|
contract.rawContract.interface.getEvent("OwnershipTransferred"),
|
|
46
|
-
|
|
46
|
+
[event.previousOwner, event.newOwner]
|
|
47
47
|
);
|
|
48
48
|
return {
|
|
49
49
|
...mockField,
|
|
@@ -60,7 +60,7 @@ export function mockTransferLog(
|
|
|
60
60
|
const contract = getERC20Contract(contractAddress);
|
|
61
61
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
62
62
|
contract.rawContract.interface.getEvent("Transfer"),
|
|
63
|
-
|
|
63
|
+
[event.from, event.to, event.value]
|
|
64
64
|
);
|
|
65
65
|
return {
|
|
66
66
|
...mockField,
|
|
@@ -25,7 +25,7 @@ export function mockApprovalLog(
|
|
|
25
25
|
const contract = getERC20BytesContract(contractAddress);
|
|
26
26
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
27
27
|
contract.rawContract.interface.getEvent("Approval"),
|
|
28
|
-
|
|
28
|
+
[event.owner, event.spender, event.value]
|
|
29
29
|
);
|
|
30
30
|
return {
|
|
31
31
|
...mockField,
|
|
@@ -42,7 +42,7 @@ export function mockTransferLog(
|
|
|
42
42
|
const contract = getERC20BytesContract(contractAddress);
|
|
43
43
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
44
44
|
contract.rawContract.interface.getEvent("Transfer"),
|
|
45
|
-
|
|
45
|
+
[event.from, event.to, event.value]
|
|
46
46
|
);
|
|
47
47
|
return {
|
|
48
48
|
...mockField,
|
|
File without changes
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { SolanaBaseProcessor } from '
|
|
2
|
-
import { SolanaContext } from '../../context'
|
|
1
|
+
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from '@sentio/sdk'
|
|
3
2
|
import { Instruction } from '@project-serum/anchor'
|
|
4
3
|
import { AmountToUiAmount, Approve, ApproveChecked, Burn, BurnChecked, CloseAccount, CreateNativeMint, DefaultAccountStateExtension, FreezeAccount, GetAccountDataSize, InitializeAccount, InitializeAccount2, InitializeAccount3, InitializeImmutableOwner, InitializeMint, InitializeMintCloseAuthority, InitializeMultisig, MemoTransferExtension, MintTo, MintToChecked, Reallocate, Revoke, SyncNative, ThawAccount, Transfer, TransferChecked, TransferFeeExtension, UiAmountToAmount } from './types';
|
|
5
|
-
import { SolanaBindOptions } from '../../bind-options';
|
|
6
4
|
|
|
7
5
|
export class SPLTokenProcessor extends SolanaBaseProcessor {
|
|
8
6
|
static bind(options: SolanaBindOptions): SPLTokenProcessor {
|
|
File without changes
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { SolanaBaseProcessor } from '
|
|
2
|
-
import { SolanaContext } from '../../context'
|
|
3
|
-
import { SolanaBindOptions } from '../../bind-options'
|
|
1
|
+
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from '@sentio/sdk'
|
|
4
2
|
import { Instruction } from '@project-serum/anchor'
|
|
5
3
|
import * as borsh from '@project-serum/borsh'
|
|
6
4
|
import bs58 from 'bs58'
|
|
@@ -27,7 +27,7 @@ export function mockApprovalLog(
|
|
|
27
27
|
const contract = getWETH9Contract(contractAddress);
|
|
28
28
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
29
29
|
contract.rawContract.interface.getEvent("Approval"),
|
|
30
|
-
|
|
30
|
+
[event.src, event.guy, event.wad]
|
|
31
31
|
);
|
|
32
32
|
return {
|
|
33
33
|
...mockField,
|
|
@@ -44,7 +44,7 @@ export function mockTransferLog(
|
|
|
44
44
|
const contract = getWETH9Contract(contractAddress);
|
|
45
45
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
46
46
|
contract.rawContract.interface.getEvent("Transfer"),
|
|
47
|
-
|
|
47
|
+
[event.src, event.dst, event.wad]
|
|
48
48
|
);
|
|
49
49
|
return {
|
|
50
50
|
...mockField,
|
|
@@ -61,7 +61,7 @@ export function mockDepositLog(
|
|
|
61
61
|
const contract = getWETH9Contract(contractAddress);
|
|
62
62
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
63
63
|
contract.rawContract.interface.getEvent("Deposit"),
|
|
64
|
-
|
|
64
|
+
[event.dst, event.wad]
|
|
65
65
|
);
|
|
66
66
|
return {
|
|
67
67
|
...mockField,
|
|
@@ -78,7 +78,7 @@ export function mockWithdrawalLog(
|
|
|
78
78
|
const contract = getWETH9Contract(contractAddress);
|
|
79
79
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
80
80
|
contract.rawContract.interface.getEvent("Withdrawal"),
|
|
81
|
-
|
|
81
|
+
[event.src, event.wad]
|
|
82
82
|
);
|
|
83
83
|
return {
|
|
84
84
|
...mockField,
|
|
@@ -36,7 +36,7 @@ module.exports = {
|
|
|
36
36
|
if (/^@(ethersproject|solana|project-serum).*$/.test(request)) {
|
|
37
37
|
return callback(null, 'commonjs ' + request)
|
|
38
38
|
}
|
|
39
|
-
if (request.startsWith("@sentio
|
|
39
|
+
if (request.startsWith("@sentio")) {
|
|
40
40
|
return callback(null, 'commonjs2 ' + request)
|
|
41
41
|
}
|
|
42
42
|
callback()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AptosBindOptions } from './bind-options'
|
|
2
2
|
import { AptosContext } from './context'
|
|
3
|
-
import { ProcessResult } from '
|
|
3
|
+
import { ProcessResult } from '..'
|
|
4
4
|
import Long from 'long'
|
|
5
5
|
|
|
6
6
|
type IndexConfigure = {
|
|
@@ -11,6 +11,7 @@ type IndexConfigure = {
|
|
|
11
11
|
export class AptosBaseProcessor {
|
|
12
12
|
public transactionHanlder: (transaction: any, ctx: AptosContext) => void
|
|
13
13
|
address: string
|
|
14
|
+
name: string
|
|
14
15
|
config: IndexConfigure = { startSeqNumber: new Long(0) }
|
|
15
16
|
|
|
16
17
|
constructor(options: AptosBindOptions) {
|
|
@@ -22,6 +23,7 @@ export class AptosBaseProcessor {
|
|
|
22
23
|
|
|
23
24
|
bind(options: AptosBindOptions) {
|
|
24
25
|
this.address = options.address
|
|
26
|
+
this.name = options.name || this.address
|
|
25
27
|
if (options.startBlock) {
|
|
26
28
|
this.startSlot(options.startBlock)
|
|
27
29
|
}
|
|
@@ -40,8 +42,8 @@ export class AptosBaseProcessor {
|
|
|
40
42
|
return this
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
public handleTransaction(txn: any): ProcessResult | null {
|
|
44
|
-
const ctx = new AptosContext(this.address)
|
|
45
|
+
public handleTransaction(txn: any, slot: Long): ProcessResult | null {
|
|
46
|
+
const ctx = new AptosContext(this.address, slot)
|
|
45
47
|
|
|
46
48
|
if (txn) {
|
|
47
49
|
this.transactionHanlder(txn, ctx)
|
|
@@ -4,10 +4,10 @@ import { BaseContract, EventFilter } from 'ethers'
|
|
|
4
4
|
import { Event } from '@ethersproject/contracts'
|
|
5
5
|
import { BaseProcessor } from './base-processor'
|
|
6
6
|
import { BindOptions, getOptionsSignature } from './bind-options'
|
|
7
|
-
import { TemplateInstance } from '
|
|
7
|
+
import { TemplateInstance } from '../gen/processor/protos/processor'
|
|
8
8
|
import Long from 'long'
|
|
9
9
|
import { getNetwork } from '@ethersproject/providers'
|
|
10
|
-
import { PromiseOrVoid } from '
|
|
10
|
+
import { PromiseOrVoid } from '../promise-or-void'
|
|
11
11
|
import { Trace } from './trace'
|
|
12
12
|
|
|
13
13
|
export abstract class BaseProcessorTemplate<
|
|
@@ -5,9 +5,9 @@ import { BaseContract, EventFilter } from '@ethersproject/contracts'
|
|
|
5
5
|
import Long from 'long'
|
|
6
6
|
|
|
7
7
|
import { BoundContractView, Context, ContractView } from './context'
|
|
8
|
-
import { ProcessResult } from '
|
|
8
|
+
import { ProcessResult } from '../gen/processor/protos/processor'
|
|
9
9
|
import { BindInternalOptions, BindOptions } from './bind-options'
|
|
10
|
-
import { PromiseOrVoid } from '
|
|
10
|
+
import { PromiseOrVoid } from '../promise-or-void'
|
|
11
11
|
import { Trace } from './trace'
|
|
12
12
|
|
|
13
13
|
export class EventsHandler {
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CounterResult, GaugeResult, LogResult } from '
|
|
1
|
+
import { CounterResult, GaugeResult, LogResult } from '../gen/processor/protos/processor'
|
|
2
2
|
import { BaseContract, EventFilter } from 'ethers'
|
|
3
3
|
import { Block, Log } from '@ethersproject/abstract-provider'
|
|
4
4
|
import { Meter } from './meter'
|
|
@@ -31,13 +31,13 @@ export class EthContext extends BaseContext {
|
|
|
31
31
|
this.block = block
|
|
32
32
|
this.trace = trace
|
|
33
33
|
if (log) {
|
|
34
|
-
this.blockNumber = Long.fromNumber(log.blockNumber)
|
|
34
|
+
this.blockNumber = Long.fromNumber(log.blockNumber, true)
|
|
35
35
|
this.transactionHash = log.transactionHash
|
|
36
36
|
} else if (block) {
|
|
37
|
-
this.blockNumber = Long.fromNumber(block.number)
|
|
37
|
+
this.blockNumber = Long.fromNumber(block.number, true)
|
|
38
38
|
}
|
|
39
39
|
if (trace) {
|
|
40
|
-
this.blockNumber = Long.fromNumber(trace.blockNumber)
|
|
40
|
+
this.blockNumber = Long.fromNumber(trace.blockNumber, true)
|
|
41
41
|
this.transactionHash = trace.transactionHash
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -100,27 +100,33 @@ export class BoundContractView<TContract extends BaseContract, TContractView ext
|
|
|
100
100
|
|
|
101
101
|
export class SolanaContext extends BaseContext {
|
|
102
102
|
address: string
|
|
103
|
+
blockNumber: Long
|
|
103
104
|
|
|
104
|
-
constructor(address: string) {
|
|
105
|
+
constructor(address: string, slot: Long) {
|
|
105
106
|
super()
|
|
106
107
|
this.address = address
|
|
108
|
+
this.blockNumber = slot
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
export class SuiContext extends BaseContext {
|
|
111
113
|
address: string
|
|
114
|
+
blockNumber: Long
|
|
112
115
|
|
|
113
|
-
constructor(address: string) {
|
|
116
|
+
constructor(address: string, slot: Long) {
|
|
114
117
|
super()
|
|
115
118
|
this.address = address
|
|
119
|
+
this.blockNumber = slot
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
export class AptosContext extends BaseContext {
|
|
120
124
|
address: string
|
|
125
|
+
blockNumber: Long
|
|
121
126
|
|
|
122
|
-
constructor(address: string) {
|
|
127
|
+
constructor(address: string, slot: Long) {
|
|
123
128
|
super()
|
|
124
129
|
this.address = address
|
|
130
|
+
this.blockNumber = slot
|
|
125
131
|
}
|
|
126
132
|
}
|
|
@@ -4,9 +4,8 @@ import { expect } from 'chai'
|
|
|
4
4
|
|
|
5
5
|
import { HandlerType } from '..'
|
|
6
6
|
|
|
7
|
-
import { GenericProcessor } from '
|
|
8
|
-
import { TestProcessorServer } from '
|
|
9
|
-
import { firstCounterValue } from './metric-utils'
|
|
7
|
+
import { GenericProcessor } from './generic-processor'
|
|
8
|
+
import { TestProcessorServer, firstCounterValue } from '../testing'
|
|
10
9
|
|
|
11
10
|
describe('Test Generic Processor', () => {
|
|
12
11
|
const service = new TestProcessorServer(() => {
|
|
@@ -2,8 +2,8 @@ import { BaseContract } from '@ethersproject/contracts'
|
|
|
2
2
|
import { BoundContractView, ContractView } from './context'
|
|
3
3
|
import { BindOptions } from './bind-options'
|
|
4
4
|
import { BaseProcessor } from './base-processor'
|
|
5
|
-
import { getProvider } from '
|
|
6
|
-
import { addProcessor, getContractName } from '
|
|
5
|
+
import { getProvider } from '../provider'
|
|
6
|
+
import { addProcessor, getContractName } from '../binds'
|
|
7
7
|
|
|
8
8
|
export class GenericProcessor extends BaseProcessor<
|
|
9
9
|
BaseContract,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { BigNumber as BigDecimal } from 'bignumber.js'
|
|
2
|
+
export { Context, ContractView, BoundContractView, SolanaContext } from './context'
|
|
3
|
+
export { CounterBinding, Meter, GaugeBinding, Counter, Gauge, MetricDescriptorOption } from './meter'
|
|
4
|
+
export { type Numberish, toBigInteger, toMetricValue } from './numberish'
|
|
5
|
+
|
|
6
|
+
export { BindOptions, SolanaBindOptions, SuiBindOptions, AptosBindOptions } from './bind-options'
|
|
7
|
+
|
|
8
|
+
export { BaseProcessor } from './base-processor'
|
|
9
|
+
export { GenericProcessor } from './generic-processor'
|
|
10
|
+
export { BaseProcessorTemplate } from './base-processor-template'
|
|
11
|
+
export { SolanaBaseProcessor } from './solana-processor'
|
|
12
|
+
export { SuiBaseProcessor } from './sui-processor'
|
|
13
|
+
export { AptosBaseProcessor } from './aptos-processor'
|
|
14
|
+
|
|
15
|
+
export type { TypedCallTrace, Trace } from './trace'
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MetricDescriptor, RecordMetaData } from '
|
|
1
|
+
import { MetricDescriptor, RecordMetaData } from '../gen/processor/protos/processor'
|
|
2
2
|
import { AptosContext, BaseContext, Context, SolanaContext, SuiContext } from './context'
|
|
3
3
|
import { toMetricValue, Numberish } from './numberish'
|
|
4
|
-
import
|
|
4
|
+
import { APTOS_TESTNET_ID, SOL_MAINMET_ID, SUI_DEVNET_ID } from '../utils/chain'
|
|
5
5
|
|
|
6
6
|
export function normalizeName(name: string): string {
|
|
7
7
|
const regex = new RegExp('![_.a-zA-Z0-9]')
|
|
@@ -40,7 +40,7 @@ function GetRecordMetaData(ctx: BaseContext, metric: Metric, labels: Labels): Re
|
|
|
40
40
|
if (ctx.log) {
|
|
41
41
|
return {
|
|
42
42
|
contractAddress: ctx.contract.rawContract.address,
|
|
43
|
-
blockNumber:
|
|
43
|
+
blockNumber: ctx.blockNumber,
|
|
44
44
|
transactionIndex: ctx.log.transactionIndex,
|
|
45
45
|
transactionHash: ctx.transactionHash || '',
|
|
46
46
|
logIndex: ctx.log.logIndex,
|
|
@@ -52,7 +52,7 @@ function GetRecordMetaData(ctx: BaseContext, metric: Metric, labels: Labels): Re
|
|
|
52
52
|
if (ctx.block) {
|
|
53
53
|
return {
|
|
54
54
|
contractAddress: ctx.contract.rawContract.address,
|
|
55
|
-
blockNumber:
|
|
55
|
+
blockNumber: ctx.blockNumber,
|
|
56
56
|
transactionIndex: -1,
|
|
57
57
|
transactionHash: '',
|
|
58
58
|
logIndex: -1,
|
|
@@ -64,7 +64,7 @@ function GetRecordMetaData(ctx: BaseContext, metric: Metric, labels: Labels): Re
|
|
|
64
64
|
if (ctx.trace) {
|
|
65
65
|
return {
|
|
66
66
|
contractAddress: ctx.contract.rawContract.address,
|
|
67
|
-
blockNumber:
|
|
67
|
+
blockNumber: ctx.blockNumber,
|
|
68
68
|
transactionIndex: ctx.trace.transactionPosition,
|
|
69
69
|
transactionHash: ctx.transactionHash || '',
|
|
70
70
|
logIndex: -1,
|
|
@@ -76,33 +76,33 @@ function GetRecordMetaData(ctx: BaseContext, metric: Metric, labels: Labels): Re
|
|
|
76
76
|
} else if (ctx instanceof SolanaContext) {
|
|
77
77
|
return {
|
|
78
78
|
contractAddress: ctx.address,
|
|
79
|
-
blockNumber:
|
|
79
|
+
blockNumber: ctx.blockNumber,
|
|
80
80
|
transactionIndex: 0,
|
|
81
81
|
transactionHash: '', // TODO add
|
|
82
82
|
logIndex: 0,
|
|
83
|
-
chainId:
|
|
83
|
+
chainId: SOL_MAINMET_ID, // TODO set in context
|
|
84
84
|
descriptor: descriptor,
|
|
85
85
|
labels: normalizeLabels(labels),
|
|
86
86
|
}
|
|
87
87
|
} else if (ctx instanceof SuiContext) {
|
|
88
88
|
return {
|
|
89
89
|
contractAddress: ctx.address,
|
|
90
|
-
blockNumber:
|
|
90
|
+
blockNumber: ctx.blockNumber,
|
|
91
91
|
transactionIndex: 0,
|
|
92
92
|
transactionHash: '', // TODO
|
|
93
93
|
logIndex: 0,
|
|
94
|
-
chainId:
|
|
94
|
+
chainId: SUI_DEVNET_ID, // TODO set in context
|
|
95
95
|
descriptor: descriptor,
|
|
96
96
|
labels: normalizeLabels(labels),
|
|
97
97
|
}
|
|
98
98
|
} else if (ctx instanceof AptosContext) {
|
|
99
99
|
return {
|
|
100
100
|
contractAddress: ctx.address,
|
|
101
|
-
blockNumber:
|
|
101
|
+
blockNumber: ctx.blockNumber,
|
|
102
102
|
transactionIndex: 0,
|
|
103
103
|
transactionHash: '', // TODO
|
|
104
104
|
logIndex: 0,
|
|
105
|
-
chainId:
|
|
105
|
+
chainId: APTOS_TESTNET_ID, // TODO set in context
|
|
106
106
|
descriptor: descriptor,
|
|
107
107
|
labels: normalizeLabels(labels),
|
|
108
108
|
}
|
|
@@ -3,8 +3,8 @@ import { toBigInteger, toMetricValue } from './numberish'
|
|
|
3
3
|
import { webcrypto } from 'crypto'
|
|
4
4
|
import { BigNumber } from 'ethers'
|
|
5
5
|
import { performance } from 'perf_hooks'
|
|
6
|
-
import { BigInteger } from '
|
|
7
|
-
import { BigDecimal } from '
|
|
6
|
+
import { BigInteger } from '../gen/processor/protos/processor'
|
|
7
|
+
import { BigDecimal } from '.'
|
|
8
8
|
|
|
9
9
|
// TODO add test for type conversion
|
|
10
10
|
describe('Numberish tests', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProcessResult } from '
|
|
1
|
+
import { ProcessResult } from '../gen/processor/protos/processor'
|
|
2
2
|
import { SolanaContext } from './context'
|
|
3
3
|
import Long from 'long'
|
|
4
4
|
import { Instruction } from '@project-serum/anchor'
|
|
@@ -54,8 +54,8 @@ export class SolanaBaseProcessor {
|
|
|
54
54
|
return this
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
public handleInstruction(ins: string | { type: string; info: any }): ProcessResult | null {
|
|
58
|
-
const ctx = new SolanaContext(this.address)
|
|
57
|
+
public handleInstruction(ins: string | { type: string; info: any }, slot: Long): ProcessResult | null {
|
|
58
|
+
const ctx = new SolanaContext(this.address, slot)
|
|
59
59
|
let parsedInstruction: Instruction | null = null
|
|
60
60
|
|
|
61
61
|
if (ins) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuiBindOptions } from './bind-options'
|
|
2
2
|
import { SuiContext } from './context'
|
|
3
|
-
import { ProcessResult } from '
|
|
3
|
+
import { ProcessResult } from '..'
|
|
4
4
|
import Long from 'long'
|
|
5
5
|
|
|
6
6
|
type IndexConfigure = {
|
|
@@ -40,8 +40,8 @@ export class SuiBaseProcessor {
|
|
|
40
40
|
return this
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
public handleTransaction(txn: any): ProcessResult | null {
|
|
44
|
-
const ctx = new SuiContext(this.address)
|
|
43
|
+
public handleTransaction(txn: any, slot: Long): ProcessResult | null {
|
|
44
|
+
const ctx = new SuiContext(this.address, slot)
|
|
45
45
|
|
|
46
46
|
if (txn) {
|
|
47
47
|
this.transactionHanlder(txn, ctx)
|
|
File without changes
|
package/src/error.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
export { BaseProcessor } from './base-processor'
|
|
2
|
-
export { GenericProcessor } from './generic-processor'
|
|
3
|
-
export { BaseProcessorTemplate } from './base-processor-template'
|
|
4
|
-
export { Context, ContractView, BoundContractView, SolanaContext } from './context'
|
|
5
1
|
export { ProcessorServiceImpl } from './service'
|
|
6
|
-
export { CounterBinding, Meter, GaugeBinding, Counter, Gauge, MetricDescriptorOption } from './meter'
|
|
7
2
|
export { getProvider, setProvider, DummyProvider } from './provider'
|
|
8
|
-
export { SolanaBaseProcessor } from './solana-processor'
|
|
9
|
-
export { SuiBaseProcessor } from './sui-processor'
|
|
10
|
-
export { AptosBaseProcessor } from './aptos-processor'
|
|
11
3
|
export { ContractNamer } from './contract-namer'
|
|
12
|
-
export { BindOptions, SolanaBindOptions, SuiBindOptions, AptosBindOptions } from './bind-options'
|
|
13
4
|
export { transformEtherError } from './error'
|
|
14
5
|
export { ProcessorState } from './processor-state'
|
|
15
|
-
export { BigNumber as BigDecimal } from 'bignumber.js'
|
|
16
6
|
export { EthersError } from './error'
|
|
17
|
-
export type { TypedCallTrace } from './trace'
|
|
18
7
|
|
|
19
8
|
export { getProcessor, addProcessor, getContractByABI, addContractByABI, getContractName } from './binds'
|
|
20
9
|
|
|
21
10
|
export * from './gen/processor/protos/processor'
|
|
22
|
-
|
|
23
|
-
export { SPLTokenProcessor } from './solana/builtin'
|
|
11
|
+
export * from './core'
|
package/src/processor-state.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BaseProcessor,
|
|
3
|
+
BoundContractView,
|
|
4
|
+
ContractView,
|
|
5
|
+
BaseProcessorTemplate,
|
|
6
|
+
SolanaBaseProcessor,
|
|
7
|
+
SuiBaseProcessor,
|
|
8
|
+
AptosBaseProcessor,
|
|
9
|
+
} from './core'
|
|
2
10
|
import { BaseContract } from 'ethers'
|
|
3
|
-
import { BoundContractView, ContractView } from './context'
|
|
4
|
-
import { BaseProcessorTemplate } from './base-processor-template'
|
|
5
11
|
import { TemplateInstance } from './gen/processor/protos/processor'
|
|
6
12
|
import { Provider } from '@ethersproject/providers'
|
|
7
|
-
import { SolanaBaseProcessor } from './solana-processor'
|
|
8
|
-
import { SuiBaseProcessor } from './sui-processor'
|
|
9
|
-
import { AptosBaseProcessor } from './aptos-processor'
|
|
10
13
|
|
|
11
14
|
export class ProcessorState {
|
|
12
15
|
// from abiName_address_chainId => contract wrapper
|