@sentio/sdk 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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} +2 -2
- package/lib/{aptos-processor.js → core/aptos-processor.js} +2 -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} +8 -12
- 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 +10 -45
- 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 +8 -2
- 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 +8 -3
- 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/{chainmap.d.ts → chain.d.ts} +0 -0
- package/lib/utils/{chainmap.js → chain.js} +1 -1
- 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 +5 -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} +3 -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} +8 -8
- 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 +22 -45
- 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 +4 -1
- 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 +4 -2
- 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} +0 -0
- 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 +2 -2
- 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.js.map +0 -1
- package/lib/utils/convert.js.map +0 -1
- package/lib/utils/erc20.js.map +0 -1
|
@@ -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,4 +1,4 @@
|
|
|
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
4
|
import Long from 'long'
|
|
@@ -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,7 +76,7 @@ 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,
|
|
@@ -87,7 +87,7 @@ function GetRecordMetaData(ctx: BaseContext, metric: Metric, labels: Labels): Re
|
|
|
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,
|
|
@@ -98,11 +98,11 @@ function GetRecordMetaData(ctx: BaseContext, metric: Metric, labels: Labels): Re
|
|
|
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', // 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
|
package/src/service.ts
CHANGED
|
@@ -24,12 +24,14 @@ import {
|
|
|
24
24
|
StartRequest,
|
|
25
25
|
TemplateInstance,
|
|
26
26
|
TraceBinding,
|
|
27
|
+
CounterResult,
|
|
28
|
+
GaugeResult,
|
|
27
29
|
} from './gen/processor/protos/processor'
|
|
28
30
|
|
|
29
31
|
import { Empty } from './gen/google/protobuf/empty'
|
|
30
32
|
import Long from 'long'
|
|
31
33
|
import { TextDecoder } from 'util'
|
|
32
|
-
import { Trace } from './
|
|
34
|
+
import { Trace } from './core'
|
|
33
35
|
|
|
34
36
|
const DEFAULT_MAX_BLOCK = Long.ZERO
|
|
35
37
|
|
|
@@ -336,20 +338,13 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
336
338
|
processorPromises.push(
|
|
337
339
|
new Promise((resolve, _) => {
|
|
338
340
|
for (const processor of global.PROCESSOR_STATE.suiProcessors) {
|
|
339
|
-
const res = processor.handleTransaction(
|
|
341
|
+
const res = processor.handleTransaction(
|
|
342
|
+
JSON.parse(new TextDecoder().decode(txn.raw)),
|
|
343
|
+
txn.slot ?? Long.fromNumber(0)
|
|
344
|
+
)
|
|
340
345
|
if (res) {
|
|
341
|
-
res.gauges.forEach((g) =>
|
|
342
|
-
|
|
343
|
-
g.metadata.blockNumber = txn.slot
|
|
344
|
-
}
|
|
345
|
-
result.gauges.push(g)
|
|
346
|
-
})
|
|
347
|
-
res.counters.forEach((c) => {
|
|
348
|
-
if (c.metadata && txn.slot) {
|
|
349
|
-
c.metadata.blockNumber = txn.slot
|
|
350
|
-
}
|
|
351
|
-
result.counters.push(c)
|
|
352
|
-
})
|
|
346
|
+
res.gauges.forEach((g) => result.gauges.push(g))
|
|
347
|
+
res.counters.forEach((c) => result.counters.push(c))
|
|
353
348
|
}
|
|
354
349
|
}
|
|
355
350
|
resolve()
|
|
@@ -366,20 +361,13 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
366
361
|
new Promise((resolve, _) => {
|
|
367
362
|
for (const processor of global.PROCESSOR_STATE.aptosProcessors) {
|
|
368
363
|
if (processor.address === txn.programAccountId!) {
|
|
369
|
-
const res = processor.handleTransaction(
|
|
364
|
+
const res = processor.handleTransaction(
|
|
365
|
+
JSON.parse(new TextDecoder().decode(txn.raw)),
|
|
366
|
+
txn.slot ?? Long.fromNumber(0)
|
|
367
|
+
)
|
|
370
368
|
if (res) {
|
|
371
|
-
res.gauges.forEach((g) =>
|
|
372
|
-
|
|
373
|
-
g.metadata.blockNumber = txn.slot
|
|
374
|
-
}
|
|
375
|
-
result.gauges.push(g)
|
|
376
|
-
})
|
|
377
|
-
res.counters.forEach((c) => {
|
|
378
|
-
if (c.metadata && txn.slot) {
|
|
379
|
-
c.metadata.blockNumber = txn.slot
|
|
380
|
-
}
|
|
381
|
-
result.counters.push(c)
|
|
382
|
-
})
|
|
369
|
+
res.gauges.forEach((g) => result.gauges.push(g))
|
|
370
|
+
res.counters.forEach((c) => result.counters.push(c))
|
|
383
371
|
}
|
|
384
372
|
}
|
|
385
373
|
}
|
|
@@ -424,29 +412,18 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
424
412
|
if (processor.address === instruction.programAccountId) {
|
|
425
413
|
let res: ProcessResult | null
|
|
426
414
|
if (instruction.parsed) {
|
|
427
|
-
res = processor.handleInstruction(
|
|
415
|
+
res = processor.handleInstruction(
|
|
416
|
+
JSON.parse(new TextDecoder().decode(instruction.parsed)),
|
|
417
|
+
instruction.slot
|
|
418
|
+
)
|
|
428
419
|
} else if (instruction.instructionData) {
|
|
429
|
-
res = processor.handleInstruction(instruction.instructionData)
|
|
420
|
+
res = processor.handleInstruction(instruction.instructionData, instruction.slot)
|
|
430
421
|
} else {
|
|
431
422
|
continue
|
|
432
423
|
}
|
|
433
424
|
if (res) {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (g.metadata) {
|
|
437
|
-
g.metadata.blockNumber = instruction.slot
|
|
438
|
-
}
|
|
439
|
-
result.gauges.push(g)
|
|
440
|
-
})
|
|
441
|
-
res.counters.forEach((c) => {
|
|
442
|
-
if (c.metadata) {
|
|
443
|
-
c.metadata.blockNumber = instruction.slot
|
|
444
|
-
}
|
|
445
|
-
result.counters.push(c)
|
|
446
|
-
})
|
|
447
|
-
} catch (e) {
|
|
448
|
-
console.error('error processing instruction ' + errorString(e))
|
|
449
|
-
}
|
|
425
|
+
res.gauges.forEach((g) => result.gauges.push(g))
|
|
426
|
+
res.counters.forEach((c) => result.counters.push(c))
|
|
450
427
|
} else {
|
|
451
428
|
console.warn(
|
|
452
429
|
`Failed to decode the instruction: ${instruction.instructionData} with slot: ${instruction.slot}`
|
|
@@ -327,12 +327,14 @@ function generateMockEventLogFunction(event: EventDeclaration, contractName: str
|
|
|
327
327
|
eventNameWithSignature = getFullSignatureForEvent(event)
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
const eventArgs = event.inputs.map((input, i) => `event.${input.name ?? `arg${i.toString()}`}`)
|
|
331
|
+
|
|
330
332
|
return `
|
|
331
333
|
export function mock${eventName}Log(contractAddress: string, event: ${eventName}EventObject): Log {
|
|
332
334
|
const contract = get${contractName}Contract(contractAddress)
|
|
333
335
|
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
|
334
336
|
contract.rawContract.interface.getEvent('${eventNameWithSignature}'),
|
|
335
|
-
|
|
337
|
+
[${eventArgs.join(', ')}]
|
|
336
338
|
)
|
|
337
339
|
return {
|
|
338
340
|
...mockField,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { TestProcessorServer } from './test-processor-server'
|
|
2
|
-
export { loadTestProvidersFromEnv } from './test-provider'
|
|
3
2
|
export { MetricValueToNumber, firstCounterValue, firstGaugeValue } from './metric-utils'
|
|
3
|
+
|
|
4
|
+
// export { loadTestProvidersFromEnv } from './test-provider' // TODO make the interface more standard and then export
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepPartial } from '../gen/builtin'
|
|
2
2
|
import { BigDecimal, MetricValue, ProcessResult } from '@sentio/sdk'
|
|
3
|
-
import { Numberish } from '../
|
|
3
|
+
import { Numberish } from '../core'
|
|
4
4
|
import { BigNumber } from 'ethers'
|
|
5
5
|
|
|
6
6
|
export function MetricValueToNumber(v: DeepPartial<MetricValue> | undefined): Numberish | undefined {
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
import { CallContext } from 'nice-grpc-common'
|
|
25
25
|
import { Empty } from '../gen/google/protobuf/empty'
|
|
26
26
|
import { ChainConfig } from '../chain-config'
|
|
27
|
-
import { CHAIN_MAP } from '../utils/
|
|
27
|
+
import { CHAIN_MAP } from '../utils/chain'
|
|
28
28
|
import { Block, Log } from '@ethersproject/abstract-provider'
|
|
29
29
|
import Long from 'long'
|
|
30
30
|
import { getNetwork, Networkish } from '@ethersproject/providers'
|
|
31
|
-
import { Trace } from '
|
|
31
|
+
import { Trace } from '@sentio/sdk'
|
|
32
32
|
|
|
33
33
|
const TEST_CONTEXT: CallContext = <CallContext>{}
|
|
34
34
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ChainConfig } from '../chain-config'
|
|
2
|
+
import { CHAIN_MAP } from '../utils/chain'
|
|
2
3
|
import { setProvider } from '@sentio/sdk'
|
|
3
|
-
import { CHAIN_MAP } from '../utils/chainmap'
|
|
4
4
|
|
|
5
5
|
export function loadTestProvidersFromEnv(requiredChainIds: string[] | string): boolean {
|
|
6
6
|
const dummyConfig: Record<string, ChainConfig> = {}
|
|
7
|
+
const found: string[] = []
|
|
7
8
|
|
|
8
9
|
if (!Array.isArray(requiredChainIds)) {
|
|
9
10
|
requiredChainIds = [requiredChainIds]
|
|
@@ -15,6 +16,7 @@ export function loadTestProvidersFromEnv(requiredChainIds: string[] | string): b
|
|
|
15
16
|
if (!http) {
|
|
16
17
|
continue
|
|
17
18
|
}
|
|
19
|
+
found.push(k)
|
|
18
20
|
dummyConfig[k] = {
|
|
19
21
|
ChainID: k,
|
|
20
22
|
Https: [http],
|
|
@@ -23,7 +25,7 @@ export function loadTestProvidersFromEnv(requiredChainIds: string[] | string): b
|
|
|
23
25
|
|
|
24
26
|
setProvider(dummyConfig)
|
|
25
27
|
for (const id of requiredChainIds) {
|
|
26
|
-
if (!
|
|
28
|
+
if (!found.includes(id)) {
|
|
27
29
|
return false
|
|
28
30
|
}
|
|
29
31
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { expect } from 'chai'
|
|
2
|
+
import Long from 'long'
|
|
2
3
|
import { TextEncoder } from 'util'
|
|
3
4
|
import { ProcessTransactionsRequest } from '..'
|
|
4
5
|
|
|
5
|
-
import { TestProcessorServer } from '
|
|
6
|
+
import { TestProcessorServer } from '../testing'
|
|
6
7
|
|
|
7
8
|
describe('Test Aptos Example', () => {
|
|
8
9
|
const service = new TestProcessorServer(() => {
|
|
@@ -25,12 +26,14 @@ describe('Test Aptos Example', () => {
|
|
|
25
26
|
{
|
|
26
27
|
raw: new TextEncoder().encode(JSON.stringify(testData)),
|
|
27
28
|
programAccountId: '4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807',
|
|
29
|
+
slot: Long.fromNumber(12345),
|
|
28
30
|
},
|
|
29
31
|
],
|
|
30
32
|
}
|
|
31
33
|
const res = await service.processTransactions(request)
|
|
32
34
|
expect(res.result?.counters).length(1)
|
|
33
35
|
expect(res.result?.gauges).length(0)
|
|
36
|
+
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(12345)
|
|
34
37
|
})
|
|
35
38
|
})
|
|
36
39
|
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ import { expect } from 'chai'
|
|
|
2
2
|
|
|
3
3
|
import { StartRequest } from '..'
|
|
4
4
|
import Long from 'long'
|
|
5
|
-
import { TestProcessorServer } from '
|
|
5
|
+
import { TestProcessorServer } from '../testing'
|
|
6
6
|
import { ERC20Processor, ERC20ProcessorTemplate } from '../builtin/internal/erc20_processor'
|
|
7
7
|
|
|
8
8
|
describe('Test Template', () => {
|
|
@@ -4,11 +4,10 @@ import { expect } from 'chai'
|
|
|
4
4
|
|
|
5
5
|
import { HandlerType } from '..'
|
|
6
6
|
|
|
7
|
-
import { TestProcessorServer } from '
|
|
8
|
-
import { firstCounterValue, firstGaugeValue } from './metric-utils'
|
|
7
|
+
import { TestProcessorServer, firstCounterValue, firstGaugeValue } from '../testing'
|
|
9
8
|
import { BigNumber } from 'ethers'
|
|
10
9
|
import { mockTransferLog } from '../builtin/erc20/test-utils'
|
|
11
|
-
import { Trace } from '
|
|
10
|
+
import { Trace } from '@sentio/sdk'
|
|
12
11
|
|
|
13
12
|
describe('Test Basic Examples', () => {
|
|
14
13
|
const service = new TestProcessorServer(() => require('./erc20'))
|
|
File without changes
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { assert } from 'chai'
|
|
2
2
|
|
|
3
|
-
import { TestProcessorServer } from '
|
|
3
|
+
import { TestProcessorServer } from '../testing'
|
|
4
4
|
import { BigNumber } from 'ethers'
|
|
5
5
|
import { mockApprovalLog, mockOwnershipTransferredLog, mockTransferLog } from '../builtin/erc20/test-utils'
|
|
6
6
|
import { ERC20Processor } from '../builtin/internal/erc20_processor'
|
|
7
|
-
import {
|
|
7
|
+
import { conversion } from '../utils'
|
|
8
8
|
import { BigDecimal } from '@sentio/sdk'
|
|
9
9
|
|
|
10
10
|
describe('Test Error Capture', () => {
|
|
11
11
|
const service = new TestProcessorServer(() => {
|
|
12
12
|
ERC20Processor.bind({ address: '0x80009ff8154bd5653c6dda2fa5f5053e5a5c1a91' })
|
|
13
13
|
.onEventApproval((evt, ctx) => {
|
|
14
|
-
const v = new BigDecimal(1).div(toBigDecimal(evt.args.value))
|
|
14
|
+
const v = new BigDecimal(1).div(conversion.toBigDecimal(evt.args.value))
|
|
15
15
|
ctx.meter.Gauge('xx').record(v)
|
|
16
16
|
})
|
|
17
17
|
.onEventTransfer((evt, ctx) => {
|
|
18
|
-
const v = new BigDecimal(0).div(toBigDecimal(evt.args.value))
|
|
18
|
+
const v = new BigDecimal(0).div(conversion.toBigDecimal(evt.args.value))
|
|
19
19
|
ctx.meter.Gauge('xx').record(v)
|
|
20
20
|
})
|
|
21
21
|
.onEventOwnershipTransferred((evt, ctx) => {
|
|
@@ -6,8 +6,7 @@ import { HandlerType, ProcessInstructionsRequest } from '..'
|
|
|
6
6
|
|
|
7
7
|
import Long from 'long'
|
|
8
8
|
import { TextEncoder } from 'util'
|
|
9
|
-
import { TestProcessorServer } from '
|
|
10
|
-
import { firstCounterValue } from './metric-utils'
|
|
9
|
+
import { TestProcessorServer, firstCounterValue } from '../testing'
|
|
11
10
|
|
|
12
11
|
describe('Test Solana Example', () => {
|
|
13
12
|
const service = new TestProcessorServer(() => {
|
|
@@ -28,7 +27,7 @@ describe('Test Solana Example', () => {
|
|
|
28
27
|
instructions: [
|
|
29
28
|
{
|
|
30
29
|
instructionData: '33G5T8yXAQWdH8FX7fTy1mBJ6e4dUKfQWbViSrT7qJjpS8UAA3ftEQx9sNzrkaJm56xtENhDsWf',
|
|
31
|
-
slot: Long.fromNumber(
|
|
30
|
+
slot: Long.fromNumber(12345),
|
|
32
31
|
programAccountId: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
|
|
33
32
|
},
|
|
34
33
|
{
|
|
@@ -41,7 +40,7 @@ describe('Test Solana Example', () => {
|
|
|
41
40
|
const res = await service.processInstructions(request)
|
|
42
41
|
expect(res.result?.counters).length(2)
|
|
43
42
|
expect(res.result?.gauges).length(0)
|
|
44
|
-
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(
|
|
43
|
+
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(12345)
|
|
45
44
|
expect(firstCounterValue(res.result, 'total_transfer_amount')).equal(1000000n)
|
|
46
45
|
expect(res.result?.counters[0].runtimeInfo?.from).equals(HandlerType.INSTRUCTION)
|
|
47
46
|
})
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AptosBindOptions } from '
|
|
2
|
-
import { AptosBaseProcessor } from '../aptos-processor'
|
|
1
|
+
import { AptosBindOptions, AptosBaseProcessor } from '@sentio/sdk'
|
|
3
2
|
|
|
4
3
|
class Souffl3 extends AptosBaseProcessor {
|
|
5
4
|
static bind(options: AptosBindOptions): Souffl3 {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { expect } from 'chai'
|
|
2
|
+
import Long from 'long'
|
|
2
3
|
import { TextEncoder } from 'util'
|
|
3
4
|
import { ProcessTransactionsRequest, SuiBaseProcessor, SuiBindOptions } from '..'
|
|
4
5
|
|
|
5
|
-
import { TestProcessorServer } from '
|
|
6
|
+
import { TestProcessorServer } from '../testing'
|
|
6
7
|
|
|
7
8
|
describe('Test Sui Example', () => {
|
|
8
9
|
const service = new TestProcessorServer(() => {
|
|
@@ -52,7 +53,7 @@ describe('Test Sui Example', () => {
|
|
|
52
53
|
chainId: 'SUI_devnet',
|
|
53
54
|
transactions: [
|
|
54
55
|
{
|
|
55
|
-
|
|
56
|
+
slot: Long.fromNumber(12345),
|
|
56
57
|
raw: new TextEncoder().encode(JSON.stringify(testData)),
|
|
57
58
|
programAccountId: '0xb8252513f0b9efaa3e260842c4b84d8ff933522d',
|
|
58
59
|
},
|
|
@@ -61,6 +62,7 @@ describe('Test Sui Example', () => {
|
|
|
61
62
|
const res = await service.processTransactions(request)
|
|
62
63
|
expect(res.result?.counters).length(1)
|
|
63
64
|
expect(res.result?.gauges).length(0)
|
|
65
|
+
expect(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(12345)
|
|
64
66
|
})
|
|
65
67
|
})
|
|
66
68
|
|
|
File without changes
|
|
File without changes
|