@sentio/sdk 1.33.1 → 1.34.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/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/core/meter.d.ts +2 -8
- package/lib/core/meter.js +15 -18
- package/lib/core/meter.js.map +1 -1
- package/lib/core/numberish.js +10 -2
- package/lib/core/numberish.js.map +1 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +25 -2
- package/lib/gen/chainquery/protos/chainquery.js +49 -9
- package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +11 -171
- package/lib/gen/processor/protos/processor.js +61 -429
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/service.d.ts +3 -7
- package/lib/service.js +31 -152
- package/lib/service.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +3 -5
- package/lib/testing/test-processor-server.js +28 -15
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/chain.js +1 -0
- package/lib/utils/chain.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/core/meter.ts +16 -18
- package/src/core/numberish.ts +11 -2
- package/src/gen/chainquery/protos/chainquery.ts +60 -11
- package/src/gen/processor/protos/processor.ts +60 -571
- package/src/service.ts +39 -202
- package/src/testing/test-processor-server.ts +33 -23
- package/src/utils/chain.ts +1 -0
package/src/service.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
AccountConfig,
|
|
7
7
|
AptosCallHandlerConfig,
|
|
8
8
|
AptosEventHandlerConfig,
|
|
9
|
-
BlockBinding,
|
|
10
9
|
ContractConfig,
|
|
11
10
|
DataBinding,
|
|
12
11
|
EventTrackingConfig,
|
|
@@ -18,13 +17,10 @@ import {
|
|
|
18
17
|
MetricConfig,
|
|
19
18
|
ProcessBindingResponse,
|
|
20
19
|
ProcessBindingsRequest,
|
|
21
|
-
ProcessBlocksRequest,
|
|
22
20
|
ProcessConfigRequest,
|
|
23
21
|
ProcessConfigResponse,
|
|
24
|
-
ProcessInstructionsRequest,
|
|
25
22
|
ProcessorServiceImplementation,
|
|
26
23
|
ProcessResult,
|
|
27
|
-
ProcessTransactionsRequest,
|
|
28
24
|
StartRequest,
|
|
29
25
|
TemplateInstance,
|
|
30
26
|
} from './gen'
|
|
@@ -46,7 +42,6 @@ import { AccountProcessorState } from './core/account-processor'
|
|
|
46
42
|
import { SuiProcessorState } from './core/sui-processor'
|
|
47
43
|
import { SolanaProcessorState } from './core/solana-processor'
|
|
48
44
|
import { ProcessorState } from './binds'
|
|
49
|
-
|
|
50
45
|
;(BigInt.prototype as any).toJSON = function () {
|
|
51
46
|
return this.toString()
|
|
52
47
|
}
|
|
@@ -118,7 +113,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
118
113
|
// part 0, prepare metrics and event tracking configs
|
|
119
114
|
for (const metric of MetricState.INSTANCE.getValues()) {
|
|
120
115
|
this.metricConfigs.push({
|
|
121
|
-
...metric.
|
|
116
|
+
...metric.config,
|
|
122
117
|
})
|
|
123
118
|
}
|
|
124
119
|
|
|
@@ -155,7 +150,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
155
150
|
address: processor.config.address,
|
|
156
151
|
abi: '',
|
|
157
152
|
},
|
|
158
|
-
blockConfigs: [],
|
|
159
153
|
intervalConfigs: [],
|
|
160
154
|
logConfigs: [],
|
|
161
155
|
traceConfigs: [],
|
|
@@ -285,7 +279,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
285
279
|
address: solanaProcessor.address,
|
|
286
280
|
abi: '',
|
|
287
281
|
},
|
|
288
|
-
blockConfigs: [],
|
|
289
282
|
logConfigs: [],
|
|
290
283
|
traceConfigs: [],
|
|
291
284
|
intervalConfigs: [],
|
|
@@ -312,7 +305,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
312
305
|
address: suiProcessor.address,
|
|
313
306
|
abi: '',
|
|
314
307
|
},
|
|
315
|
-
blockConfigs: [],
|
|
316
308
|
logConfigs: [],
|
|
317
309
|
intervalConfigs: [],
|
|
318
310
|
traceConfigs: [],
|
|
@@ -335,7 +327,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
335
327
|
address: aptosProcessor.config.address,
|
|
336
328
|
abi: '',
|
|
337
329
|
},
|
|
338
|
-
blockConfigs: [],
|
|
339
330
|
intervalConfigs: [],
|
|
340
331
|
logConfigs: [],
|
|
341
332
|
traceConfigs: [],
|
|
@@ -473,10 +464,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
473
464
|
}
|
|
474
465
|
|
|
475
466
|
async processBinding(request: DataBinding, options?: CallContext): Promise<ProcessResult> {
|
|
476
|
-
if (request.handlerIds.length == 0) {
|
|
477
|
-
request.handlerIds = [request.handlerId]
|
|
478
|
-
}
|
|
479
|
-
|
|
480
467
|
const processBindingInternal = (request: DataBinding) => {
|
|
481
468
|
switch (request.handlerType) {
|
|
482
469
|
case HandlerType.APT_CALL:
|
|
@@ -490,10 +477,10 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
490
477
|
case HandlerType.ETH_TRACE:
|
|
491
478
|
return this.processTrace(request)
|
|
492
479
|
case HandlerType.ETH_BLOCK:
|
|
493
|
-
return this.
|
|
494
|
-
case HandlerType.
|
|
495
|
-
return this.
|
|
496
|
-
// TODO migrate
|
|
480
|
+
return this.processBlock(request)
|
|
481
|
+
case HandlerType.SOL_INSTRUCTION:
|
|
482
|
+
return this.procecessSolInstruSolctions(request)
|
|
483
|
+
// TODO migrate SUI cases
|
|
497
484
|
// case HandlerType.INSTRUCTION:
|
|
498
485
|
// return this.processInstruction(request)
|
|
499
486
|
default:
|
|
@@ -538,9 +525,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
538
525
|
if (!l.data) {
|
|
539
526
|
throw new ServerError(Status.INVALID_ARGUMENT, "Log can't be null")
|
|
540
527
|
}
|
|
541
|
-
if (l.handlerIds.length == 0) {
|
|
542
|
-
l.handlerIds = [l.handlerId]
|
|
543
|
-
}
|
|
544
528
|
|
|
545
529
|
const promises: Promise<ProcessResult>[] = []
|
|
546
530
|
const jsonString = Utf8ArrayToStr(l.data.raw)
|
|
@@ -557,201 +541,57 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
557
541
|
return mergeProcessResults(await Promise.all(promises))
|
|
558
542
|
}
|
|
559
543
|
|
|
560
|
-
async
|
|
561
|
-
request: ProcessTransactionsRequest,
|
|
562
|
-
context: CallContext
|
|
563
|
-
): Promise<ProcessBindingResponse> {
|
|
564
|
-
if (!this.started) {
|
|
565
|
-
throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
const result = ProcessResult.fromPartial({})
|
|
569
|
-
|
|
570
|
-
if (request.chainId.toLowerCase().startsWith('sui') && SuiProcessorState.INSTANCE.getValues()) {
|
|
571
|
-
const processorPromises: Promise<void>[] = []
|
|
572
|
-
for (const txn of request.transactions) {
|
|
573
|
-
processorPromises.push(
|
|
574
|
-
new Promise((resolve, _) => {
|
|
575
|
-
for (const processor of SuiProcessorState.INSTANCE.getValues()) {
|
|
576
|
-
const res = processor.handleTransaction(
|
|
577
|
-
JSON.parse(new TextDecoder().decode(txn.raw)),
|
|
578
|
-
txn.slot ?? Long.fromNumber(0)
|
|
579
|
-
)
|
|
580
|
-
if (res) {
|
|
581
|
-
res.gauges.forEach((g) => result.gauges.push(g))
|
|
582
|
-
res.counters.forEach((c) => result.counters.push(c))
|
|
583
|
-
res.logs.forEach((l) => result.logs.push(l))
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
resolve()
|
|
587
|
-
})
|
|
588
|
-
)
|
|
589
|
-
}
|
|
590
|
-
await Promise.all(processorPromises)
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
recordRuntimeInfo(result, HandlerType.SUI_TRANSACTION)
|
|
594
|
-
return {
|
|
595
|
-
result,
|
|
596
|
-
configUpdated: false,
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
async processInstructions(
|
|
601
|
-
request: ProcessInstructionsRequest,
|
|
602
|
-
context: CallContext
|
|
603
|
-
): Promise<ProcessBindingResponse> {
|
|
604
|
-
if (!this.started) {
|
|
605
|
-
throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
const result = ProcessResult.fromPartial({})
|
|
609
|
-
|
|
610
|
-
// Only have instruction handlers for solana processors
|
|
611
|
-
if (SolanaProcessorState.INSTANCE.getValues()) {
|
|
612
|
-
const processorPromises: Promise<void>[] = []
|
|
613
|
-
for (const instruction of request.instructions) {
|
|
614
|
-
if (!instruction) {
|
|
615
|
-
throw new ServerError(Status.INVALID_ARGUMENT, 'instruction cannot be null')
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
processorPromises.push(
|
|
619
|
-
new Promise((resolve, _) => {
|
|
620
|
-
for (const processor of SolanaProcessorState.INSTANCE.getValues()) {
|
|
621
|
-
if (processor.address === instruction.programAccountId) {
|
|
622
|
-
let parsedInstruction: SolInstruction | null = null
|
|
623
|
-
if (instruction.parsed) {
|
|
624
|
-
parsedInstruction = processor.getParsedInstruction(
|
|
625
|
-
JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
626
|
-
)
|
|
627
|
-
} else if (instruction.instructionData) {
|
|
628
|
-
parsedInstruction = processor.getParsedInstruction(instruction.instructionData)
|
|
629
|
-
}
|
|
630
|
-
if (parsedInstruction == null) {
|
|
631
|
-
continue
|
|
632
|
-
}
|
|
633
|
-
const insHandler = processor.getInstructionHandler(parsedInstruction)
|
|
634
|
-
if (insHandler == null) {
|
|
635
|
-
continue
|
|
636
|
-
}
|
|
637
|
-
const res = processor.handleInstruction(
|
|
638
|
-
parsedInstruction,
|
|
639
|
-
instruction.accounts,
|
|
640
|
-
insHandler,
|
|
641
|
-
instruction.slot
|
|
642
|
-
)
|
|
643
|
-
res.gauges.forEach((g) => result.gauges.push(g))
|
|
644
|
-
res.counters.forEach((c) => result.counters.push(c))
|
|
645
|
-
res.logs.forEach((l) => result.logs.push(l))
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
resolve()
|
|
649
|
-
})
|
|
650
|
-
)
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
await Promise.all(processorPromises)
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
recordRuntimeInfo(result, HandlerType.SOL_INSTRUCTIONS)
|
|
657
|
-
return {
|
|
658
|
-
result,
|
|
659
|
-
configUpdated: false,
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
async processInstructionsNew(request: DataBinding): Promise<ProcessResult> {
|
|
664
|
-
if (!this.started) {
|
|
665
|
-
throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
|
|
666
|
-
}
|
|
544
|
+
async procecessSolInstruSolctions(request: DataBinding): Promise<ProcessResult> {
|
|
667
545
|
if (!request.data) {
|
|
668
546
|
throw new ServerError(Status.INVALID_ARGUMENT, 'instruction data cannot be empty')
|
|
669
547
|
}
|
|
670
548
|
|
|
671
|
-
const jsonString = Utf8ArrayToStr(request.data.raw)
|
|
672
|
-
|
|
549
|
+
// const jsonString = new TextDecoder().decode(request.data.raw) // Utf8ArrayToStr(request.data.raw)
|
|
550
|
+
|
|
551
|
+
const instruction: Instruction = Instruction.decode(request.data.raw) // JSON.parse(jsonString)
|
|
673
552
|
const promises: Promise<ProcessResult>[] = []
|
|
674
553
|
|
|
675
554
|
// Only have instruction handlers for solana processors
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
if (instruction.parsed) {
|
|
686
|
-
parsedInstruction = processor.getParsedInstruction(
|
|
687
|
-
JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
688
|
-
)
|
|
689
|
-
} else if (instruction.instructionData) {
|
|
690
|
-
parsedInstruction = processor.getParsedInstruction(instruction.instructionData)
|
|
691
|
-
}
|
|
692
|
-
if (parsedInstruction == null) {
|
|
693
|
-
continue
|
|
694
|
-
}
|
|
695
|
-
const insHandler = processor.getInstructionHandler(parsedInstruction)
|
|
696
|
-
if (insHandler == null) {
|
|
697
|
-
continue
|
|
698
|
-
}
|
|
699
|
-
const res = await processor.handleInstruction(
|
|
700
|
-
parsedInstruction,
|
|
701
|
-
instruction.accounts,
|
|
702
|
-
insHandler,
|
|
703
|
-
instruction.slot
|
|
704
|
-
)
|
|
705
|
-
|
|
706
|
-
promises.push(Promise.resolve(res))
|
|
555
|
+
for (const processor of SolanaProcessorState.INSTANCE.getValues()) {
|
|
556
|
+
if (processor.address === instruction.programAccountId) {
|
|
557
|
+
let parsedInstruction: SolInstruction | null = null
|
|
558
|
+
if (instruction.parsed) {
|
|
559
|
+
// const decoded = new TextDecoder().decode(instruction.parsed)
|
|
560
|
+
if (!(instruction.parsed instanceof Uint8Array)) {
|
|
561
|
+
// const parsed = instruction.parsed as Uint8Array
|
|
562
|
+
const values = Object.entries(instruction.parsed).map(([key, value]) => value) as number[]
|
|
563
|
+
instruction.parsed = Uint8Array.from(values)
|
|
707
564
|
}
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
return mergeProcessResults(await Promise.all(promises))
|
|
712
|
-
}
|
|
713
565
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}
|
|
733
|
-
const jsonString = Utf8ArrayToStr(binding.block.raw)
|
|
734
|
-
|
|
735
|
-
const block: Block = JSON.parse(jsonString)
|
|
566
|
+
const a1 = JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
567
|
+
parsedInstruction = processor.getParsedInstruction(a1)
|
|
568
|
+
} else if (instruction.instructionData) {
|
|
569
|
+
parsedInstruction = processor.getParsedInstruction(instruction.instructionData)
|
|
570
|
+
}
|
|
571
|
+
if (parsedInstruction == null) {
|
|
572
|
+
continue
|
|
573
|
+
}
|
|
574
|
+
const insHandler = processor.getInstructionHandler(parsedInstruction)
|
|
575
|
+
if (insHandler == null) {
|
|
576
|
+
continue
|
|
577
|
+
}
|
|
578
|
+
const res = await processor.handleInstruction(
|
|
579
|
+
parsedInstruction,
|
|
580
|
+
instruction.accounts,
|
|
581
|
+
insHandler,
|
|
582
|
+
instruction.slot
|
|
583
|
+
)
|
|
736
584
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
const promise = this.blockHandlers[handlerId](block).catch((e) => {
|
|
740
|
-
throw new ServerError(Status.INTERNAL, 'error processing block: ' + block.number + '\n' + errorString(e))
|
|
741
|
-
})
|
|
742
|
-
promises.push(promise)
|
|
585
|
+
promises.push(Promise.resolve(res))
|
|
586
|
+
}
|
|
743
587
|
}
|
|
744
588
|
return mergeProcessResults(await Promise.all(promises))
|
|
745
589
|
}
|
|
746
590
|
|
|
747
|
-
|
|
748
|
-
async processBlockNew(binding: DataBinding): Promise<ProcessResult> {
|
|
591
|
+
async processBlock(binding: DataBinding): Promise<ProcessResult> {
|
|
749
592
|
if (!binding.data) {
|
|
750
593
|
throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
|
|
751
594
|
}
|
|
752
|
-
if (binding.handlerIds.length == 0) {
|
|
753
|
-
binding.handlerIds = [binding.handlerId]
|
|
754
|
-
}
|
|
755
595
|
|
|
756
596
|
const jsonString = Utf8ArrayToStr(binding.data.raw)
|
|
757
597
|
|
|
@@ -787,9 +627,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
787
627
|
if (!binding.data) {
|
|
788
628
|
throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be empty")
|
|
789
629
|
}
|
|
790
|
-
if (binding.handlerIds.length == 0) {
|
|
791
|
-
binding.handlerIds = [binding.handlerId]
|
|
792
|
-
}
|
|
793
630
|
const jsonString = Utf8ArrayToStr(binding.data.raw)
|
|
794
631
|
const trace: Trace = JSON.parse(jsonString)
|
|
795
632
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccountConfig,
|
|
3
|
-
BlockBinding,
|
|
4
3
|
ContractConfig,
|
|
5
4
|
DataBinding,
|
|
6
5
|
HandlerType,
|
|
6
|
+
Instruction,
|
|
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'
|
|
@@ -27,6 +24,7 @@ import { ProcessorServiceImpl } from '../service'
|
|
|
27
24
|
import { Trace } from '../core/trace'
|
|
28
25
|
import { setProvider } from '../provider'
|
|
29
26
|
import { account } from '../builtin/aptos/0x1'
|
|
27
|
+
import { TextEncoder } from 'util'
|
|
30
28
|
|
|
31
29
|
export const TEST_CONTEXT: CallContext = <CallContext>{}
|
|
32
30
|
|
|
@@ -75,13 +73,13 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
75
73
|
return this.service.getConfig(request, context)
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
processBlocks(request: ProcessBlocksRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
processInstructions(request: ProcessInstructionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
83
|
-
|
|
84
|
-
}
|
|
76
|
+
// processBlocks(request: ProcessBlocksRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
77
|
+
// return this.service.processBlocks(request, context)
|
|
78
|
+
// }
|
|
79
|
+
//
|
|
80
|
+
// processInstructions(request: ProcessInstructionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
81
|
+
// return this.service.processInstructions(request, context)
|
|
82
|
+
// }
|
|
85
83
|
|
|
86
84
|
processLogs(request: ProcessBindingsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
87
85
|
return this.service.processLogs(request, context)
|
|
@@ -90,10 +88,10 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
90
88
|
processTraces(request: ProcessBindingsRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
91
89
|
return this.service.processTraces(request, context)
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
processTransactions(request: ProcessTransactionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
95
|
-
|
|
96
|
-
}
|
|
91
|
+
//
|
|
92
|
+
// processTransactions(request: ProcessTransactionsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
|
|
93
|
+
// return this.service.processTransactions(request, context)
|
|
94
|
+
// }
|
|
97
95
|
|
|
98
96
|
testTrace(trace: Trace, network: Networkish = 1): Promise<ProcessBindingResponse> {
|
|
99
97
|
return this.testTraces([trace], network)
|
|
@@ -132,7 +130,6 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
132
130
|
data: {
|
|
133
131
|
raw: toBytes(trace),
|
|
134
132
|
},
|
|
135
|
-
handlerId: 0,
|
|
136
133
|
handlerIds: [config.handlerId],
|
|
137
134
|
handlerType: HandlerType.ETH_TRACE,
|
|
138
135
|
}
|
|
@@ -194,7 +191,6 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
194
191
|
data: {
|
|
195
192
|
raw: toBytes(log),
|
|
196
193
|
},
|
|
197
|
-
handlerId: 0,
|
|
198
194
|
handlerIds: [config.handlerId],
|
|
199
195
|
handlerType: HandlerType.ETH_LOG,
|
|
200
196
|
}
|
|
@@ -257,7 +253,6 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
257
253
|
raw: toBytes(log),
|
|
258
254
|
},
|
|
259
255
|
handlerIds: [config.handlerId],
|
|
260
|
-
handlerId: 0,
|
|
261
256
|
handlerType: HandlerType.ETH_LOG,
|
|
262
257
|
}
|
|
263
258
|
}
|
|
@@ -280,16 +275,17 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
280
275
|
}
|
|
281
276
|
bindings.push(binding)
|
|
282
277
|
}
|
|
283
|
-
return this.
|
|
284
|
-
|
|
278
|
+
return this.processBindings({
|
|
279
|
+
bindings: bindings,
|
|
285
280
|
})
|
|
286
281
|
}
|
|
287
282
|
|
|
288
|
-
buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1):
|
|
289
|
-
const binding:
|
|
290
|
-
|
|
283
|
+
buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1): DataBinding {
|
|
284
|
+
const binding: DataBinding = {
|
|
285
|
+
data: {
|
|
291
286
|
raw: toBytes(block),
|
|
292
287
|
},
|
|
288
|
+
handlerType: HandlerType.ETH_BLOCK,
|
|
293
289
|
handlerIds: [],
|
|
294
290
|
}
|
|
295
291
|
for (const contract of this.contractConfigs) {
|
|
@@ -311,6 +307,20 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
311
307
|
return binding
|
|
312
308
|
}
|
|
313
309
|
|
|
310
|
+
testInstructions(instructions: Instruction[]): Promise<ProcessBindingResponse> {
|
|
311
|
+
return this.processBindings({
|
|
312
|
+
bindings: instructions.map((instruction) => {
|
|
313
|
+
return {
|
|
314
|
+
data: {
|
|
315
|
+
raw: Instruction.encode(instruction).finish(),
|
|
316
|
+
},
|
|
317
|
+
handlerIds: [],
|
|
318
|
+
handlerType: HandlerType.SOL_INSTRUCTION,
|
|
319
|
+
}
|
|
320
|
+
}),
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
|
|
314
324
|
processBindings(
|
|
315
325
|
request: ProcessBindingsRequest,
|
|
316
326
|
context: CallContext = TEST_CONTEXT
|