@sentio/sdk 1.36.4-rc.1 → 1.37.0-rc.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/aptos/api.d.ts +1 -1
- package/lib/aptos/api.js +1 -1
- package/lib/aptos/api.js.map +1 -1
- package/lib/aptos/aptos-plugin.d.ts +2 -2
- package/lib/aptos/aptos-plugin.js +14 -19
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/aptos/aptos-processor.d.ts +2 -2
- package/lib/aptos/aptos-processor.js +3 -3
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/context.d.ts +1 -1
- package/lib/aptos/context.js +2 -6
- package/lib/aptos/context.js.map +1 -1
- package/lib/binds.d.ts +1 -1
- package/lib/binds.js +2 -2
- package/lib/binds.js.map +1 -1
- package/lib/builtin/internal/eacaggregatorproxy_processor.js +18 -18
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
- package/lib/builtin/internal/erc1155_processor.js +5 -5
- package/lib/builtin/internal/erc1155_processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.js +8 -8
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.js +6 -6
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/erc721_processor.js +9 -9
- package/lib/builtin/internal/erc721_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.js +6 -6
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/core/account-processor.d.ts +1 -1
- package/lib/core/account-processor.js +2 -2
- package/lib/core/account-processor.js.map +1 -1
- package/lib/core/base-context.d.ts +1 -1
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/base-processor-template.d.ts +2 -2
- package/lib/core/base-processor-template.js +7 -21
- package/lib/core/base-processor-template.js.map +1 -1
- package/lib/core/base-processor.d.ts +1 -1
- package/lib/core/base-processor.js +6 -20
- package/lib/core/base-processor.js.map +1 -1
- package/lib/core/bind-options.d.ts +5 -6
- package/lib/core/bind-options.js.map +1 -1
- package/lib/core/context.d.ts +4 -5
- package/lib/core/context.js +6 -10
- package/lib/core/context.js.map +1 -1
- package/lib/core/eth-plugin.d.ts +2 -2
- package/lib/core/eth-plugin.js +8 -12
- package/lib/core/eth-plugin.js.map +1 -1
- package/lib/core/event-tracker.d.ts +1 -1
- package/lib/core/event-tracker.js +2 -2
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/exporter.d.ts +1 -1
- package/lib/core/exporter.js +2 -2
- package/lib/core/exporter.js.map +1 -1
- package/lib/core/generic-processor.test.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +2 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/logger.d.ts +1 -1
- package/lib/core/logger.js +5 -5
- package/lib/core/logger.js.map +1 -1
- package/lib/core/meter.d.ts +2 -2
- package/lib/core/meter.js +10 -10
- package/lib/core/meter.js.map +1 -1
- package/lib/core/numberish.d.ts +3 -3
- package/lib/core/numberish.js +18 -12
- package/lib/core/numberish.js.map +1 -1
- package/lib/core/numberish.test.js.map +1 -1
- package/lib/core/solana-context.d.ts +2 -3
- package/lib/core/solana-context.js.map +1 -1
- package/lib/core/solana-options.d.ts +2 -3
- package/lib/core/solana-options.js.map +1 -1
- package/lib/core/solana-plugin.d.ts +2 -2
- package/lib/core/solana-plugin.js +6 -6
- package/lib/core/solana-plugin.js.map +1 -1
- package/lib/core/solana-processor.d.ts +7 -8
- package/lib/core/solana-processor.js +5 -15
- package/lib/core/solana-processor.js.map +1 -1
- package/lib/core/sui-plugin.d.ts +2 -2
- package/lib/core/sui-plugin.js +5 -5
- package/lib/core/sui-plugin.js.map +1 -1
- package/lib/core/sui-processor.d.ts +8 -9
- package/lib/core/sui-processor.js +5 -15
- package/lib/core/sui-processor.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +3 -5
- package/lib/index.js.map +1 -1
- package/lib/processor-runner.js +4 -4
- package/lib/processor-runner.js.map +1 -1
- package/lib/service.d.ts +3 -4
- package/lib/service.js +7 -11
- package/lib/service.js.map +1 -1
- package/lib/target-ethers-sentio/file.js +1 -0
- package/lib/target-ethers-sentio/file.js.map +1 -1
- package/lib/target-ethers-sentio/view-function.js +1 -1
- package/lib/testing/metric-utils.d.ts +1 -1
- package/lib/testing/metric-utils.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +3 -3
- package/lib/testing/test-processor-server.js +10 -22
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/conversion.d.ts +1 -1
- package/lib/utils/conversion.js.map +1 -1
- package/lib/utils/dex-price.test.js.map +1 -1
- package/lib/utils/erc20.test.js.map +1 -1
- package/lib/utils/price.d.ts +10 -10
- package/lib/utils/price.js +1 -1
- package/lib/utils/price.js.map +1 -1
- package/package.json +4 -2
- package/src/aptos/api.ts +1 -1
- package/src/aptos/aptos-plugin.ts +10 -11
- package/src/aptos/aptos-processor.ts +2 -2
- package/src/aptos/context.ts +3 -4
- package/src/binds.ts +1 -1
- package/src/builtin/internal/eacaggregatorproxy_processor.ts +19 -18
- package/src/builtin/internal/erc1155_processor.ts +6 -5
- package/src/builtin/internal/erc20_processor.ts +9 -8
- package/src/builtin/internal/erc20bytes_processor.ts +7 -6
- package/src/builtin/internal/erc721_processor.ts +10 -9
- package/src/builtin/internal/weth9_processor.ts +7 -6
- package/src/core/account-processor.ts +1 -1
- package/src/core/base-context.ts +1 -1
- package/src/core/base-processor-template.ts +6 -15
- package/src/core/base-processor.ts +4 -13
- package/src/core/bind-options.ts +5 -6
- package/src/core/context.ts +10 -11
- package/src/core/eth-plugin.ts +3 -4
- package/src/core/event-tracker.ts +2 -2
- package/src/core/exporter.ts +1 -1
- package/src/core/index.ts +1 -1
- package/src/core/logger.ts +1 -1
- package/src/core/meter.ts +2 -2
- package/src/core/numberish.ts +12 -6
- package/src/core/solana-context.ts +2 -3
- package/src/core/solana-options.ts +2 -4
- package/src/core/solana-plugin.ts +3 -3
- package/src/core/solana-processor.ts +10 -17
- package/src/core/sui-plugin.ts +3 -8
- package/src/core/sui-processor.ts +11 -18
- package/src/index.ts +3 -5
- package/src/processor-runner.ts +3 -3
- package/src/service.ts +5 -5
- package/src/target-ethers-sentio/file.ts +1 -0
- package/src/target-ethers-sentio/view-function.ts +1 -1
- package/src/testing/metric-utils.ts +1 -1
- package/src/testing/test-processor-server.ts +6 -16
- package/src/types/global.d.ts +2 -2
- package/src/utils/conversion.ts +1 -1
- package/src/utils/price.ts +1 -1
- package/lib/gen/builtin.d.ts +0 -6
- package/lib/gen/builtin.js +0 -3
- package/lib/gen/builtin.js.map +0 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +0 -400
- package/lib/gen/chainquery/protos/chainquery.js +0 -972
- package/lib/gen/chainquery/protos/chainquery.js.map +0 -1
- package/lib/gen/google/protobuf/empty.d.ts +0 -16
- package/lib/gen/google/protobuf/empty.js +0 -47
- package/lib/gen/google/protobuf/empty.js.map +0 -1
- package/lib/gen/google/protobuf/struct.d.ts +0 -73
- package/lib/gen/google/protobuf/struct.js +0 -371
- package/lib/gen/google/protobuf/struct.js.map +0 -1
- package/lib/gen/google/protobuf/timestamp.d.ts +0 -18
- package/lib/gen/google/protobuf/timestamp.js +0 -71
- package/lib/gen/google/protobuf/timestamp.js.map +0 -1
- package/lib/gen/index.d.ts +0 -2
- package/lib/gen/index.js +0 -19
- package/lib/gen/index.js.map +0 -1
- package/lib/gen/processor/protos/processor.d.ts +0 -826
- package/lib/gen/processor/protos/processor.js +0 -3988
- package/lib/gen/processor/protos/processor.js.map +0 -1
- package/lib/gen/service/price/protos/price.d.ts +0 -85
- package/lib/gen/service/price/protos/price.js +0 -269
- package/lib/gen/service/price/protos/price.js.map +0 -1
- package/lib/plugin.d.ts +0 -15
- package/lib/plugin.js +0 -32
- package/lib/plugin.js.map +0 -1
- package/lib/state/processor-state.d.ts +0 -3
- package/lib/state/processor-state.js +0 -8
- package/lib/state/processor-state.js.map +0 -1
- package/lib/state/state-storage.d.ts +0 -17
- package/lib/state/state-storage.js +0 -60
- package/lib/state/state-storage.js.map +0 -1
- package/lib/state/state-storage.test.d.ts +0 -1
- package/lib/state/state-storage.test.js.map +0 -1
- package/src/gen/builtin.ts +0 -22
- package/src/gen/chainquery/protos/chainquery.ts +0 -1212
- package/src/gen/google/protobuf/empty.ts +0 -58
- package/src/gen/google/protobuf/struct.ts +0 -422
- package/src/gen/google/protobuf/timestamp.ts +0 -85
- package/src/gen/index.ts +0 -3
- package/src/gen/processor/protos/processor.ts +0 -4619
- package/src/gen/service/price/protos/price.ts +0 -329
- package/src/plugin.ts +0 -41
- package/src/state/processor-state.ts +0 -3
- package/src/state/state-storage.ts +0 -65
package/src/core/context.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { RecordMetaData
|
|
1
|
+
import { RecordMetaData } from '@sentio/protos'
|
|
2
2
|
import { BaseContract, EventFilter } from 'ethers'
|
|
3
3
|
import { Block, Log } from '@ethersproject/abstract-provider'
|
|
4
4
|
import { normalizeLabels } from './meter'
|
|
5
|
-
import Long from 'long'
|
|
6
5
|
import { Trace } from './trace'
|
|
7
6
|
import { Labels } from './metadata'
|
|
8
7
|
import { CHAIN_IDS } from '../utils/chain'
|
|
@@ -14,7 +13,7 @@ export abstract class EthContext extends BaseContext {
|
|
|
14
13
|
log?: Log
|
|
15
14
|
block?: Block
|
|
16
15
|
trace?: Trace
|
|
17
|
-
blockNumber:
|
|
16
|
+
blockNumber: bigint | number
|
|
18
17
|
transactionHash?: string
|
|
19
18
|
|
|
20
19
|
protected constructor(chainId: number, address: string, block?: Block, log?: Log, trace?: Trace) {
|
|
@@ -25,12 +24,12 @@ export abstract class EthContext extends BaseContext {
|
|
|
25
24
|
this.trace = trace
|
|
26
25
|
this.address = address
|
|
27
26
|
if (log) {
|
|
28
|
-
this.blockNumber =
|
|
27
|
+
this.blockNumber = log.blockNumber
|
|
29
28
|
this.transactionHash = log.transactionHash
|
|
30
29
|
} else if (block) {
|
|
31
|
-
this.blockNumber =
|
|
30
|
+
this.blockNumber = block.number
|
|
32
31
|
} else if (trace) {
|
|
33
|
-
this.blockNumber =
|
|
32
|
+
this.blockNumber = trace.blockNumber
|
|
34
33
|
this.transactionHash = trace.transactionHash
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -42,7 +41,7 @@ export abstract class EthContext extends BaseContext {
|
|
|
42
41
|
return {
|
|
43
42
|
address: this.address,
|
|
44
43
|
contractName: this.getContractName(),
|
|
45
|
-
blockNumber: this.blockNumber,
|
|
44
|
+
blockNumber: BigInt(this.blockNumber),
|
|
46
45
|
transactionIndex: this.log.transactionIndex,
|
|
47
46
|
transactionHash: this.transactionHash || '',
|
|
48
47
|
logIndex: this.log.logIndex,
|
|
@@ -55,7 +54,7 @@ export abstract class EthContext extends BaseContext {
|
|
|
55
54
|
return {
|
|
56
55
|
address: this.address,
|
|
57
56
|
contractName: this.getContractName(),
|
|
58
|
-
blockNumber: this.blockNumber,
|
|
57
|
+
blockNumber: BigInt(this.blockNumber),
|
|
59
58
|
transactionIndex: -1,
|
|
60
59
|
transactionHash: '',
|
|
61
60
|
logIndex: -1,
|
|
@@ -68,7 +67,7 @@ export abstract class EthContext extends BaseContext {
|
|
|
68
67
|
return {
|
|
69
68
|
address: this.address,
|
|
70
69
|
contractName: this.getContractName(),
|
|
71
|
-
blockNumber: this.blockNumber,
|
|
70
|
+
blockNumber: BigInt(this.blockNumber),
|
|
72
71
|
transactionIndex: this.trace.transactionPosition,
|
|
73
72
|
transactionHash: this.transactionHash || '',
|
|
74
73
|
logIndex: -1,
|
|
@@ -159,9 +158,9 @@ export class BoundContractView<TContract extends BaseContract, TContractView ext
|
|
|
159
158
|
export class SuiContext extends BaseContext {
|
|
160
159
|
address: string
|
|
161
160
|
moduleName: string
|
|
162
|
-
blockNumber:
|
|
161
|
+
blockNumber: bigint
|
|
163
162
|
|
|
164
|
-
constructor(address: string, slot:
|
|
163
|
+
constructor(address: string, slot: bigint) {
|
|
165
164
|
super()
|
|
166
165
|
this.address = address
|
|
167
166
|
this.blockNumber = slot
|
package/src/core/eth-plugin.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin, PluginManager } from '
|
|
1
|
+
import { Plugin, PluginManager } from '@sentio/base'
|
|
2
2
|
import {
|
|
3
3
|
AccountConfig,
|
|
4
4
|
ContractConfig,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
LogHandlerConfig,
|
|
9
9
|
ProcessConfigResponse,
|
|
10
10
|
ProcessResult,
|
|
11
|
-
} from '
|
|
11
|
+
} from '@sentio/protos'
|
|
12
12
|
import { DEFAULT_MAX_BLOCK, errorString, mergeProcessResults, USER_PROCESSOR, Utf8ArrayToStr } from '../service'
|
|
13
13
|
|
|
14
14
|
import { ServerError, Status } from 'nice-grpc'
|
|
@@ -16,7 +16,6 @@ import { Block, Log } from '@ethersproject/abstract-provider'
|
|
|
16
16
|
import { Trace } from '@sentio/sdk'
|
|
17
17
|
import { ProcessorState } from '../binds'
|
|
18
18
|
import { AccountProcessorState } from './account-processor'
|
|
19
|
-
import Long from 'long'
|
|
20
19
|
|
|
21
20
|
export class EthPlugin implements Plugin {
|
|
22
21
|
name: string = 'EthPlugin'
|
|
@@ -118,7 +117,7 @@ export class EthPlugin implements Plugin {
|
|
|
118
117
|
const accountConfig: AccountConfig = {
|
|
119
118
|
address: processor.config.address,
|
|
120
119
|
chainId: processor.getChainId().toString(),
|
|
121
|
-
startBlock: processor.config.startBlock ?
|
|
120
|
+
startBlock: processor.config.startBlock ? BigInt(processor.config.startBlock) : 0n,
|
|
122
121
|
aptosIntervalConfigs: [],
|
|
123
122
|
intervalConfigs: [],
|
|
124
123
|
logConfigs: [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseContext } from './base-context'
|
|
2
|
-
import { EventTrackingResult } from '
|
|
2
|
+
import { EventTrackingResult } from '@sentio/protos'
|
|
3
3
|
import { NamedResultDescriptor } from './metadata'
|
|
4
|
-
import { MapStateStorage } from '
|
|
4
|
+
import { MapStateStorage } from '@sentio/base'
|
|
5
5
|
|
|
6
6
|
export interface Event {
|
|
7
7
|
// The unique identifier of main identity associate with an event
|
package/src/core/exporter.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseContext } from './base-context'
|
|
2
2
|
import { ExportResult } from '@sentio/sdk'
|
|
3
3
|
import { NamedResultDescriptor } from './metadata'
|
|
4
|
-
import { MapStateStorage } from '
|
|
4
|
+
import { MapStateStorage } from '@sentio/base'
|
|
5
5
|
|
|
6
6
|
export type Export = Record<string, any>
|
|
7
7
|
|
package/src/core/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { BigDecimal } from './big-decimal'
|
|
|
2
2
|
export { ContractContext, ContractView, BoundContractView } from './context'
|
|
3
3
|
export { CounterBinding, Meter, GaugeBinding, Counter, Gauge, MetricOptions } from './meter'
|
|
4
4
|
export { EventTracker, AccountEventTracker } from './event-tracker'
|
|
5
|
-
export { type Numberish, toBigInteger, toMetricValue } from './numberish'
|
|
5
|
+
export { type Numberish, toBigInteger, toMetricValue, toBlockTag } from './numberish'
|
|
6
6
|
|
|
7
7
|
export { BindOptions } from './bind-options'
|
|
8
8
|
|
package/src/core/logger.ts
CHANGED
package/src/core/meter.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseContext } from './base-context'
|
|
2
2
|
import { Numberish, toMetricValue } from './numberish'
|
|
3
3
|
import { Labels, NamedResultDescriptor } from './metadata'
|
|
4
|
-
import { AggregationConfig, AggregationType, MetricConfig, MetricType } from '
|
|
5
|
-
import { MapStateStorage } from '
|
|
4
|
+
import { AggregationConfig, AggregationType, MetricConfig, MetricType } from '@sentio/protos'
|
|
5
|
+
import { MapStateStorage } from '@sentio/base'
|
|
6
6
|
|
|
7
7
|
export function normalizeName(name: string): string {
|
|
8
8
|
const regex = new RegExp('![_.a-zA-Z0-9]')
|
package/src/core/numberish.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers'
|
|
2
|
-
import { BigInteger, MetricValue } from '
|
|
2
|
+
import { BigInteger, MetricValue } from '@sentio/protos'
|
|
3
3
|
import { BigDecimal } from '.'
|
|
4
4
|
import { BN } from '@project-serum/anchor'
|
|
5
|
-
import
|
|
5
|
+
import { BlockTag } from '@ethersproject/providers'
|
|
6
6
|
|
|
7
7
|
export type Numberish = number | BigNumber | bigint | BigDecimal
|
|
8
8
|
|
|
9
|
+
export function toBlockTag(a: number | bigint): BlockTag {
|
|
10
|
+
if (typeof a === 'number') {
|
|
11
|
+
return a
|
|
12
|
+
}
|
|
13
|
+
if (a > Number.MAX_SAFE_INTEGER) {
|
|
14
|
+
return '0x' + a.toString(16)
|
|
15
|
+
}
|
|
16
|
+
return Number(a)
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
export function toMetricValue(value: Numberish): MetricValue {
|
|
10
20
|
if (value instanceof BigNumber) {
|
|
11
21
|
return MetricValue.fromPartial({
|
|
@@ -115,7 +125,3 @@ function hexToBigInteger(hex: string, negative: boolean): BigInteger {
|
|
|
115
125
|
data: new Uint8Array(buffer),
|
|
116
126
|
}
|
|
117
127
|
}
|
|
118
|
-
|
|
119
|
-
export function toBigInt(v: Long): bigint {
|
|
120
|
-
return BigInt(v.toString())
|
|
121
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseContext } from './base-context'
|
|
2
|
-
import Long from 'long'
|
|
3
2
|
import { Labels } from './metadata'
|
|
4
3
|
import { RecordMetaData } from '@sentio/sdk'
|
|
5
4
|
import { CHAIN_IDS } from '../utils/chain'
|
|
@@ -9,9 +8,9 @@ export class SolanaContext extends BaseContext {
|
|
|
9
8
|
network: string
|
|
10
9
|
address: string
|
|
11
10
|
programName: string
|
|
12
|
-
blockNumber:
|
|
11
|
+
blockNumber: bigint
|
|
13
12
|
|
|
14
|
-
constructor(programName: string, network: string, address: string, slot:
|
|
13
|
+
constructor(programName: string, network: string, address: string, slot: bigint) {
|
|
15
14
|
super()
|
|
16
15
|
this.network = network || CHAIN_IDS.SOLANA_MAINNET
|
|
17
16
|
this.programName = programName
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import Long from 'long'
|
|
2
|
-
|
|
3
1
|
export class SolanaBindOptions {
|
|
4
2
|
address: string
|
|
5
3
|
network?: string
|
|
6
4
|
name?: string
|
|
7
|
-
startBlock?:
|
|
8
|
-
endBlock?:
|
|
5
|
+
startBlock?: bigint | number
|
|
6
|
+
endBlock?: bigint | number
|
|
9
7
|
processInnerInstruction?: boolean
|
|
10
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin, PluginManager } from '
|
|
1
|
+
import { Plugin, PluginManager } from '@sentio/base'
|
|
2
2
|
import {
|
|
3
3
|
ContractConfig,
|
|
4
4
|
Data_SolInstruction,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
HandlerType,
|
|
7
7
|
ProcessConfigResponse,
|
|
8
8
|
ProcessResult,
|
|
9
|
-
} from '
|
|
10
|
-
import { DEFAULT_MAX_BLOCK,
|
|
9
|
+
} from '@sentio/protos'
|
|
10
|
+
import { DEFAULT_MAX_BLOCK, mergeProcessResults, USER_PROCESSOR } from '../service'
|
|
11
11
|
|
|
12
12
|
import { ServerError, Status } from 'nice-grpc'
|
|
13
13
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ProcessResult } from '
|
|
1
|
+
import { ProcessResult } from '@sentio/protos'
|
|
2
2
|
import { SolanaContext } from './solana-context'
|
|
3
|
-
import Long from 'long'
|
|
4
3
|
import { Instruction } from '@project-serum/anchor'
|
|
5
4
|
import { SolanaBindOptions } from './solana-options'
|
|
6
|
-
import { ListStateStorage } from '
|
|
5
|
+
import { ListStateStorage } from '@sentio/base'
|
|
7
6
|
import { CHAIN_IDS } from '../utils/chain'
|
|
8
7
|
|
|
9
8
|
type IndexConfigure = {
|
|
10
|
-
startSlot:
|
|
11
|
-
endSlot?:
|
|
9
|
+
startSlot: bigint
|
|
10
|
+
endSlot?: bigint
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
export type SolanaInstructionHandler = (instruction: Instruction, ctx: SolanaContext, accounts?: string[]) => void
|
|
@@ -24,7 +23,7 @@ export class SolanaBaseProcessor {
|
|
|
24
23
|
contractName: string
|
|
25
24
|
network: string
|
|
26
25
|
processInnerInstruction: boolean
|
|
27
|
-
config: IndexConfigure = { startSlot:
|
|
26
|
+
config: IndexConfigure = { startSlot: 0n }
|
|
28
27
|
decodeInstruction: (rawInstruction: string) => Instruction | null
|
|
29
28
|
fromParsedInstruction: (instruction: { type: string; info: any }) => Instruction | null
|
|
30
29
|
|
|
@@ -80,7 +79,7 @@ export class SolanaBaseProcessor {
|
|
|
80
79
|
parsedInstruction: Instruction,
|
|
81
80
|
accounts: string[],
|
|
82
81
|
handler: SolanaInstructionHandler,
|
|
83
|
-
slot:
|
|
82
|
+
slot: bigint
|
|
84
83
|
): ProcessResult {
|
|
85
84
|
const ctx = new SolanaContext(this.contractName, this.network, this.address, slot)
|
|
86
85
|
handler(parsedInstruction, ctx, accounts)
|
|
@@ -91,19 +90,13 @@ export class SolanaBaseProcessor {
|
|
|
91
90
|
return this.address !== null
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
public startSlot(startSlot:
|
|
95
|
-
|
|
96
|
-
startSlot = Long.fromNumber(startSlot)
|
|
97
|
-
}
|
|
98
|
-
this.config.startSlot = startSlot
|
|
93
|
+
public startSlot(startSlot: bigint | number) {
|
|
94
|
+
this.config.startSlot = BigInt(startSlot)
|
|
99
95
|
return this
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
public endBlock(endBlock:
|
|
103
|
-
|
|
104
|
-
endBlock = Long.fromNumber(endBlock)
|
|
105
|
-
}
|
|
106
|
-
this.config.endSlot = endBlock
|
|
98
|
+
public endBlock(endBlock: bigint | number) {
|
|
99
|
+
this.config.endSlot = BigInt(endBlock)
|
|
107
100
|
return this
|
|
108
101
|
}
|
|
109
102
|
}
|
package/src/core/sui-plugin.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { Plugin, PluginManager } from '
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
DataBinding,
|
|
5
|
-
HandlerType,
|
|
6
|
-
ProcessConfigResponse,
|
|
7
|
-
ProcessResult,
|
|
8
|
-
} from '../gen/processor/protos/processor'
|
|
1
|
+
import { Plugin, PluginManager } from '@sentio/base'
|
|
2
|
+
import { ContractConfig, DataBinding, HandlerType, ProcessConfigResponse, ProcessResult } from '@sentio/protos'
|
|
3
|
+
|
|
9
4
|
import { DEFAULT_MAX_BLOCK, USER_PROCESSOR } from '../service'
|
|
10
5
|
|
|
11
6
|
import { ServerError, Status } from 'nice-grpc'
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { SuiContext } from './context'
|
|
2
|
-
import { ProcessResult } from '
|
|
3
|
-
import
|
|
4
|
-
import { ListStateStorage } from '../state/state-storage'
|
|
2
|
+
import { ProcessResult } from '@sentio/protos'
|
|
3
|
+
import { ListStateStorage } from '@sentio/base'
|
|
5
4
|
|
|
6
5
|
type IndexConfigure = {
|
|
7
|
-
startSeqNumber:
|
|
8
|
-
endSeqNumber?:
|
|
6
|
+
startSeqNumber: bigint
|
|
7
|
+
endSeqNumber?: bigint
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export class SuiBindOptions {
|
|
12
11
|
address: string
|
|
13
12
|
// network?: Networkish = 1
|
|
14
13
|
// name?: string
|
|
15
|
-
startBlock?:
|
|
14
|
+
startBlock?: bigint | number
|
|
16
15
|
// endBlock?: Long | number
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -23,7 +22,7 @@ export class SuiProcessorState extends ListStateStorage<SuiBaseProcessor> {
|
|
|
23
22
|
export class SuiBaseProcessor {
|
|
24
23
|
public transactionHanlder: (transaction: any, ctx: SuiContext) => void
|
|
25
24
|
address: string
|
|
26
|
-
config: IndexConfigure = { startSeqNumber:
|
|
25
|
+
config: IndexConfigure = { startSeqNumber: 0n }
|
|
27
26
|
|
|
28
27
|
constructor(name: string, options: SuiBindOptions) {
|
|
29
28
|
this.address = options.address
|
|
@@ -38,7 +37,7 @@ export class SuiBaseProcessor {
|
|
|
38
37
|
return this
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
public handleTransaction(txn: any, slot:
|
|
40
|
+
public handleTransaction(txn: any, slot: bigint): ProcessResult | null {
|
|
42
41
|
const ctx = new SuiContext(this.address, slot)
|
|
43
42
|
|
|
44
43
|
if (txn) {
|
|
@@ -47,19 +46,13 @@ export class SuiBaseProcessor {
|
|
|
47
46
|
return ctx.getProcessResult()
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
public startSlot(startSlot:
|
|
51
|
-
|
|
52
|
-
startSlot = Long.fromNumber(startSlot)
|
|
53
|
-
}
|
|
54
|
-
this.config.startSeqNumber = startSlot
|
|
49
|
+
public startSlot(startSlot: bigint | number) {
|
|
50
|
+
this.config.startSeqNumber = BigInt(startSlot)
|
|
55
51
|
return this
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
public endBlock(endBlock:
|
|
59
|
-
|
|
60
|
-
endBlock = Long.fromNumber(endBlock)
|
|
61
|
-
}
|
|
62
|
-
this.config.endSeqNumber = endBlock
|
|
54
|
+
public endBlock(endBlock: bigint | number) {
|
|
55
|
+
this.config.endSeqNumber = BigInt(endBlock)
|
|
63
56
|
return this
|
|
64
57
|
}
|
|
65
58
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
// export { ProcessorServiceImpl } from './service'
|
|
2
1
|
export { getProvider, setProvider, DummyProvider } from './provider'
|
|
3
|
-
export { transformEtherError } from './error'
|
|
4
|
-
// export { ProcessorState } from './state/processor-state'
|
|
5
|
-
export { EthersError } from './error'
|
|
2
|
+
export { transformEtherError, EthersError } from './error'
|
|
6
3
|
|
|
7
4
|
export { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds'
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
// TODO maybe remove this
|
|
7
|
+
export * from '@sentio/protos'
|
|
10
8
|
|
|
11
9
|
export * from './core'
|
|
12
10
|
|
package/src/processor-runner.ts
CHANGED
|
@@ -9,14 +9,14 @@ import { createServer } from 'nice-grpc'
|
|
|
9
9
|
import { createLogger, transports, format } from 'winston'
|
|
10
10
|
import { CompressionAlgorithms } from '@grpc/grpc-js/build/src/compression-algorithms'
|
|
11
11
|
|
|
12
|
-
import { ProcessorDefinition } from '
|
|
12
|
+
import { ProcessorDefinition } from '@sentio/protos'
|
|
13
13
|
import { ProcessorServiceImpl } from './service'
|
|
14
14
|
import { setProvider } from './provider'
|
|
15
|
-
import {
|
|
15
|
+
import { State } from '@sentio/base'
|
|
16
16
|
import { load } from './loader'
|
|
17
17
|
import { Endpoints } from './endpoints'
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
State.reset()
|
|
20
20
|
global.ENDPOINTS = new Endpoints()
|
|
21
21
|
|
|
22
22
|
const optionDefinitions = [
|
package/src/service.ts
CHANGED
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
ProcessorServiceImplementation,
|
|
11
11
|
ProcessResult,
|
|
12
12
|
StartRequest,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@sentio/protos'
|
|
14
|
+
|
|
15
|
+
import { Empty } from '@sentio/protos/lib/google/protobuf/empty'
|
|
14
16
|
|
|
15
|
-
import { Empty } from './gen/google/protobuf/empty'
|
|
16
|
-
import Long from 'long'
|
|
17
17
|
import { MetricState } from './core/meter'
|
|
18
18
|
import { ExporterState } from './core/exporter'
|
|
19
19
|
import { EventTrackerState } from './core/event-tracker'
|
|
@@ -22,12 +22,12 @@ import { ProcessorTemplateProcessorState, TemplateInstanceState } from './core/b
|
|
|
22
22
|
// (Long.prototype as any).toBigInt = function() {
|
|
23
23
|
// return BigInt(this.toString())
|
|
24
24
|
// };
|
|
25
|
-
import { PluginManager } from '
|
|
25
|
+
import { PluginManager } from '@sentio/base'
|
|
26
26
|
;(BigInt.prototype as any).toJSON = function () {
|
|
27
27
|
return this.toString()
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export const DEFAULT_MAX_BLOCK =
|
|
30
|
+
export const DEFAULT_MAX_BLOCK = 0n
|
|
31
31
|
|
|
32
32
|
export const USER_PROCESSOR = 'user_processor'
|
|
33
33
|
|
|
@@ -61,7 +61,7 @@ export function generateBoundViewFunction(fn: FunctionDeclaration, includeArgTyp
|
|
|
61
61
|
try {
|
|
62
62
|
if (!overrides && this.context) {
|
|
63
63
|
overrides = {
|
|
64
|
-
blockTag: this.context.blockNumber
|
|
64
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if (overrides) {
|
|
@@ -10,16 +10,15 @@ import {
|
|
|
10
10
|
ProcessConfigResponse,
|
|
11
11
|
ProcessorServiceImplementation,
|
|
12
12
|
StartRequest,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@sentio/protos'
|
|
14
14
|
import { CallContext } from 'nice-grpc-common'
|
|
15
|
-
import { Empty } from '
|
|
15
|
+
import { Empty } from '@sentio/protos/lib/google/protobuf/empty'
|
|
16
16
|
import { ChainConfig } from '../chain-config'
|
|
17
17
|
import { CHAIN_MAP } from '../utils/chain'
|
|
18
18
|
import { Block, Log } from '@ethersproject/abstract-provider'
|
|
19
|
-
import Long from 'long'
|
|
20
19
|
import { getNetwork, Networkish } from '@ethersproject/providers'
|
|
21
20
|
import { Endpoints } from '../endpoints'
|
|
22
|
-
import {
|
|
21
|
+
import { State } from '@sentio/base'
|
|
23
22
|
import { ProcessorServiceImpl } from '../service'
|
|
24
23
|
import { Trace } from '../core/trace'
|
|
25
24
|
import { setProvider } from '../provider'
|
|
@@ -27,7 +26,7 @@ import { setProvider } from '../provider'
|
|
|
27
26
|
export const TEST_CONTEXT: CallContext = <CallContext>{}
|
|
28
27
|
|
|
29
28
|
export function cleanTest() {
|
|
30
|
-
|
|
29
|
+
State.reset()
|
|
31
30
|
if (!global.ENDPOINTS) {
|
|
32
31
|
global.ENDPOINTS = new Endpoints()
|
|
33
32
|
}
|
|
@@ -282,11 +281,11 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
282
281
|
if (contract.contract?.chainId !== getNetwork(network).chainId.toString()) {
|
|
283
282
|
continue
|
|
284
283
|
}
|
|
285
|
-
const longBlockNumber =
|
|
284
|
+
const longBlockNumber = block.number
|
|
286
285
|
if (longBlockNumber < contract.startBlock) {
|
|
287
286
|
continue
|
|
288
287
|
}
|
|
289
|
-
if (contract.endBlock !==
|
|
288
|
+
if (contract.endBlock !== 0n && longBlockNumber >= contract.endBlock) {
|
|
290
289
|
continue
|
|
291
290
|
}
|
|
292
291
|
|
|
@@ -323,12 +322,3 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
323
322
|
return this.service.processBindingsStream(request, context)
|
|
324
323
|
}
|
|
325
324
|
}
|
|
326
|
-
|
|
327
|
-
function toBytes(obj: any): Uint8Array {
|
|
328
|
-
const logJsonStr = JSON.stringify(obj)
|
|
329
|
-
const raw = new Uint8Array(logJsonStr.length)
|
|
330
|
-
for (let i = 0; i < logJsonStr.length; i++) {
|
|
331
|
-
raw[i] = logJsonStr.charCodeAt(i)
|
|
332
|
-
}
|
|
333
|
-
return raw
|
|
334
|
-
}
|
package/src/types/global.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
// import { State } from '../../../base/src/state'
|
|
2
2
|
import { Endpoints } from "../endpoints";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
-
var PROCESSOR_STATE:
|
|
5
|
+
// var PROCESSOR_STATE: State
|
|
6
6
|
var ENDPOINTS: Endpoints
|
|
7
7
|
}
|
|
8
8
|
|
package/src/utils/conversion.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers'
|
|
2
2
|
import { BigDecimal } from '../core/big-decimal'
|
|
3
3
|
import { Numberish } from '../core'
|
|
4
|
-
import { MetricValue } from '
|
|
4
|
+
import { MetricValue } from '@sentio/protos'
|
|
5
5
|
|
|
6
6
|
export function toBigDecimal(n: BigNumber | bigint) {
|
|
7
7
|
return new BigDecimal(n.toString())
|
package/src/utils/price.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PriceServiceClient, PriceServiceDefinition } from '
|
|
1
|
+
import { PriceServiceClient, PriceServiceDefinition } from '@sentio/protos/lib/service/price/protos/price'
|
|
2
2
|
import { createChannel, createClientFactory } from 'nice-grpc'
|
|
3
3
|
import { retryMiddleware, RetryOptions } from 'nice-grpc-client-middleware-retry'
|
|
4
4
|
|
package/lib/gen/builtin.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import Long from 'long';
|
|
2
|
-
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
3
|
-
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
4
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
5
|
-
} : Partial<T>;
|
|
6
|
-
export {};
|
package/lib/gen/builtin.js
DELETED
package/lib/gen/builtin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../src/gen/builtin.ts"],"names":[],"mappings":"","sourcesContent":["import Long from 'long'\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | boolean\n | undefined;\n\nexport type DeepPartial<T> = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n"]}
|