@sentio/sdk 1.33.2 → 1.34.1-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/context.js +0 -3
- package/lib/aptos/context.js.map +1 -1
- package/lib/core/context.js +0 -6
- package/lib/core/context.js.map +1 -1
- package/lib/core/logger.js.map +1 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +1 -1
- package/lib/gen/chainquery/protos/chainquery.js +108 -211
- package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
- package/lib/gen/google/protobuf/empty.js.map +1 -1
- package/lib/gen/google/protobuf/timestamp.js +5 -9
- package/lib/gen/google/protobuf/timestamp.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +119 -189
- package/lib/gen/processor/protos/processor.js +783 -1118
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/gen/service/price/protos/price.d.ts +4 -4
- package/lib/gen/service/price/protos/price.js +15 -27
- package/lib/gen/service/price/protos/price.js.map +1 -1
- package/lib/release.config.js +2 -2
- package/lib/service.d.ts +8 -8
- package/lib/service.js +47 -160
- package/lib/service.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +7 -5
- package/lib/testing/test-processor-server.js +42 -19
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/token.d.ts +1 -1
- package/lib/utils/token.js.map +1 -1
- package/package.json +1 -1
- package/src/aptos/context.ts +1 -3
- package/src/core/context.ts +1 -6
- package/src/core/logger.ts +1 -1
- package/src/gen/chainquery/protos/chainquery.ts +171 -379
- package/src/gen/google/protobuf/empty.ts +7 -19
- package/src/gen/google/protobuf/timestamp.ts +11 -31
- package/src/gen/processor/protos/processor.ts +1058 -1847
- package/src/gen/service/price/protos/price.ts +38 -103
- package/src/service.ts +59 -210
- package/src/testing/test-processor-server.ts +47 -28
- package/src/utils/token.ts +1 -1
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccountConfig,
|
|
3
|
-
BlockBinding,
|
|
4
3
|
ContractConfig,
|
|
5
4
|
DataBinding,
|
|
6
5
|
HandlerType,
|
|
6
|
+
Data_SolInstruction,
|
|
7
7
|
ProcessBindingResponse,
|
|
8
8
|
ProcessBindingsRequest,
|
|
9
|
-
ProcessBlocksRequest,
|
|
10
9
|
ProcessConfigRequest,
|
|
11
10
|
ProcessConfigResponse,
|
|
12
|
-
ProcessInstructionsRequest,
|
|
13
11
|
ProcessorServiceImplementation,
|
|
14
|
-
ProcessTransactionsRequest,
|
|
15
12
|
StartRequest,
|
|
16
13
|
} from '../gen'
|
|
17
14
|
import { CallContext } from 'nice-grpc-common'
|
|
@@ -26,7 +23,6 @@ import { ProcessorState } from '../state/processor-state'
|
|
|
26
23
|
import { ProcessorServiceImpl } from '../service'
|
|
27
24
|
import { Trace } from '../core/trace'
|
|
28
25
|
import { setProvider } from '../provider'
|
|
29
|
-
import { account } from '../builtin/aptos/0x1'
|
|
30
26
|
|
|
31
27
|
export const TEST_CONTEXT: CallContext = <CallContext>{}
|
|
32
28
|
|
|
@@ -75,13 +71,13 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
75
71
|
return this.service.getConfig(request, context)
|
|
76
72
|
}
|
|
77
73
|
|
|
78
|
-
processBlocks(request: ProcessBlocksRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
processInstructions(request: ProcessInstructionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
83
|
-
|
|
84
|
-
}
|
|
74
|
+
// processBlocks(request: ProcessBlocksRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
75
|
+
// return this.service.processBlocks(request, context)
|
|
76
|
+
// }
|
|
77
|
+
//
|
|
78
|
+
// processInstructions(request: ProcessInstructionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
79
|
+
// return this.service.processInstructions(request, context)
|
|
80
|
+
// }
|
|
85
81
|
|
|
86
82
|
processLogs(request: ProcessBindingsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
87
83
|
return this.service.processLogs(request, context)
|
|
@@ -90,10 +86,10 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
90
86
|
processTraces(request: ProcessBindingsRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
91
87
|
return this.service.processTraces(request, context)
|
|
92
88
|
}
|
|
93
|
-
|
|
94
|
-
processTransactions(request: ProcessTransactionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
95
|
-
|
|
96
|
-
}
|
|
89
|
+
//
|
|
90
|
+
// processTransactions(request: ProcessTransactionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
91
|
+
// return this.service.processTransactions(request, context)
|
|
92
|
+
// }
|
|
97
93
|
|
|
98
94
|
testTrace(trace: Trace, network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
99
95
|
return this.testTraces([trace], network)
|
|
@@ -130,9 +126,9 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
130
126
|
if (config.signature == signature) {
|
|
131
127
|
return {
|
|
132
128
|
data: {
|
|
133
|
-
raw:
|
|
129
|
+
raw: new Uint8Array(),
|
|
130
|
+
ethTrace: { data: toBytes(trace) },
|
|
134
131
|
},
|
|
135
|
-
handlerId: 0,
|
|
136
132
|
handlerIds: [config.handlerId],
|
|
137
133
|
handlerType: HandlerType.ETH_TRACE,
|
|
138
134
|
}
|
|
@@ -192,9 +188,9 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
192
188
|
if (match) {
|
|
193
189
|
return {
|
|
194
190
|
data: {
|
|
195
|
-
raw:
|
|
191
|
+
raw: new Uint8Array(),
|
|
192
|
+
ethLog: { data: toBytes(log) },
|
|
196
193
|
},
|
|
197
|
-
handlerId: 0,
|
|
198
194
|
handlerIds: [config.handlerId],
|
|
199
195
|
handlerType: HandlerType.ETH_LOG,
|
|
200
196
|
}
|
|
@@ -254,10 +250,10 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
254
250
|
if (match) {
|
|
255
251
|
return {
|
|
256
252
|
data: {
|
|
257
|
-
raw:
|
|
253
|
+
raw: new Uint8Array(),
|
|
254
|
+
ethLog: { data: toBytes(log) },
|
|
258
255
|
},
|
|
259
256
|
handlerIds: [config.handlerId],
|
|
260
|
-
handlerId: 0,
|
|
261
257
|
handlerType: HandlerType.ETH_LOG,
|
|
262
258
|
}
|
|
263
259
|
}
|
|
@@ -280,16 +276,20 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
280
276
|
}
|
|
281
277
|
bindings.push(binding)
|
|
282
278
|
}
|
|
283
|
-
return this.
|
|
284
|
-
|
|
279
|
+
return this.processBindings({
|
|
280
|
+
bindings: bindings,
|
|
285
281
|
})
|
|
286
282
|
}
|
|
287
283
|
|
|
288
|
-
buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1):
|
|
289
|
-
const binding:
|
|
290
|
-
|
|
291
|
-
raw:
|
|
284
|
+
buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1): DataBinding {
|
|
285
|
+
const binding: DataBinding = {
|
|
286
|
+
data: {
|
|
287
|
+
raw: new Uint8Array(),
|
|
288
|
+
ethBlock: {
|
|
289
|
+
data: toBytes(block),
|
|
290
|
+
},
|
|
292
291
|
},
|
|
292
|
+
handlerType: HandlerType.ETH_BLOCK,
|
|
293
293
|
handlerIds: [],
|
|
294
294
|
}
|
|
295
295
|
for (const contract of this.contractConfigs) {
|
|
@@ -311,12 +311,31 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
311
311
|
return binding
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
testInstructions(instructions: Data_SolInstruction[]): Promise<ProcessBindingResponse> {
|
|
315
|
+
return this.processBindings({
|
|
316
|
+
bindings: instructions.map((instruction) => {
|
|
317
|
+
return {
|
|
318
|
+
data: {
|
|
319
|
+
raw: new Uint8Array(),
|
|
320
|
+
solInstruction: instruction,
|
|
321
|
+
},
|
|
322
|
+
handlerIds: [],
|
|
323
|
+
handlerType: HandlerType.SOL_INSTRUCTION,
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
|
|
314
329
|
processBindings(
|
|
315
330
|
request: ProcessBindingsRequest,
|
|
316
331
|
context: CallContext = TEST_CONTEXT
|
|
317
332
|
): Promise<ProcessBindingResponse> {
|
|
318
333
|
return this.service.processBindings(request, context)
|
|
319
334
|
}
|
|
335
|
+
|
|
336
|
+
processBindingsStream(request: AsyncIterable<DataBinding>, context: CallContext) {
|
|
337
|
+
return this.service.processBindingsStream(request, context)
|
|
338
|
+
}
|
|
320
339
|
}
|
|
321
340
|
|
|
322
341
|
function toBytes(obj: any): Uint8Array {
|
package/src/utils/token.ts
CHANGED
|
@@ -64,7 +64,7 @@ export async function getER20NormalizedAmount(
|
|
|
64
64
|
return scaleDown(amount, tokenInfo.decimal)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export function scaleDown(amount: BigNumber, decimal: number) {
|
|
67
|
+
export function scaleDown(amount: BigNumber | bigint, decimal: number) {
|
|
68
68
|
const divider = new BigDecimal(10).pow(decimal)
|
|
69
69
|
return toBigDecimal(amount).dividedBy(divider)
|
|
70
70
|
}
|