@sentio/sdk 1.33.2 → 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/gen/processor/protos/processor.d.ts +1 -171
- package/lib/gen/processor/protos/processor.js +8 -431
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/service.d.ts +3 -7
- package/lib/service.js +30 -151
- 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/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/processor/protos/processor.ts +6 -573
- package/src/service.ts +38 -200
- package/src/testing/test-processor-server.ts +33 -23
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'
|
|
@@ -154,7 +150,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
154
150
|
address: processor.config.address,
|
|
155
151
|
abi: '',
|
|
156
152
|
},
|
|
157
|
-
blockConfigs: [],
|
|
158
153
|
intervalConfigs: [],
|
|
159
154
|
logConfigs: [],
|
|
160
155
|
traceConfigs: [],
|
|
@@ -284,7 +279,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
284
279
|
address: solanaProcessor.address,
|
|
285
280
|
abi: '',
|
|
286
281
|
},
|
|
287
|
-
blockConfigs: [],
|
|
288
282
|
logConfigs: [],
|
|
289
283
|
traceConfigs: [],
|
|
290
284
|
intervalConfigs: [],
|
|
@@ -311,7 +305,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
311
305
|
address: suiProcessor.address,
|
|
312
306
|
abi: '',
|
|
313
307
|
},
|
|
314
|
-
blockConfigs: [],
|
|
315
308
|
logConfigs: [],
|
|
316
309
|
intervalConfigs: [],
|
|
317
310
|
traceConfigs: [],
|
|
@@ -334,7 +327,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
334
327
|
address: aptosProcessor.config.address,
|
|
335
328
|
abi: '',
|
|
336
329
|
},
|
|
337
|
-
blockConfigs: [],
|
|
338
330
|
intervalConfigs: [],
|
|
339
331
|
logConfigs: [],
|
|
340
332
|
traceConfigs: [],
|
|
@@ -472,10 +464,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
472
464
|
}
|
|
473
465
|
|
|
474
466
|
async processBinding(request: DataBinding, options?: CallContext): Promise<ProcessResult> {
|
|
475
|
-
if (request.handlerIds.length == 0) {
|
|
476
|
-
request.handlerIds = [request.handlerId]
|
|
477
|
-
}
|
|
478
|
-
|
|
479
467
|
const processBindingInternal = (request: DataBinding) => {
|
|
480
468
|
switch (request.handlerType) {
|
|
481
469
|
case HandlerType.APT_CALL:
|
|
@@ -489,10 +477,10 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
489
477
|
case HandlerType.ETH_TRACE:
|
|
490
478
|
return this.processTrace(request)
|
|
491
479
|
case HandlerType.ETH_BLOCK:
|
|
492
|
-
return this.
|
|
493
|
-
case HandlerType.
|
|
494
|
-
return this.
|
|
495
|
-
// TODO migrate
|
|
480
|
+
return this.processBlock(request)
|
|
481
|
+
case HandlerType.SOL_INSTRUCTION:
|
|
482
|
+
return this.procecessSolInstruSolctions(request)
|
|
483
|
+
// TODO migrate SUI cases
|
|
496
484
|
// case HandlerType.INSTRUCTION:
|
|
497
485
|
// return this.processInstruction(request)
|
|
498
486
|
default:
|
|
@@ -537,9 +525,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
537
525
|
if (!l.data) {
|
|
538
526
|
throw new ServerError(Status.INVALID_ARGUMENT, "Log can't be null")
|
|
539
527
|
}
|
|
540
|
-
if (l.handlerIds.length == 0) {
|
|
541
|
-
l.handlerIds = [l.handlerId]
|
|
542
|
-
}
|
|
543
528
|
|
|
544
529
|
const promises: Promise<ProcessResult>[] = []
|
|
545
530
|
const jsonString = Utf8ArrayToStr(l.data.raw)
|
|
@@ -556,201 +541,57 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
556
541
|
return mergeProcessResults(await Promise.all(promises))
|
|
557
542
|
}
|
|
558
543
|
|
|
559
|
-
async
|
|
560
|
-
request: ProcessTransactionsRequest,
|
|
561
|
-
context: CallContext
|
|
562
|
-
): Promise<ProcessBindingResponse> {
|
|
563
|
-
if (!this.started) {
|
|
564
|
-
throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
const result = ProcessResult.fromPartial({})
|
|
568
|
-
|
|
569
|
-
if (request.chainId.toLowerCase().startsWith('sui') && SuiProcessorState.INSTANCE.getValues()) {
|
|
570
|
-
const processorPromises: Promise<void>[] = []
|
|
571
|
-
for (const txn of request.transactions) {
|
|
572
|
-
processorPromises.push(
|
|
573
|
-
new Promise((resolve, _) => {
|
|
574
|
-
for (const processor of SuiProcessorState.INSTANCE.getValues()) {
|
|
575
|
-
const res = processor.handleTransaction(
|
|
576
|
-
JSON.parse(new TextDecoder().decode(txn.raw)),
|
|
577
|
-
txn.slot ?? Long.fromNumber(0)
|
|
578
|
-
)
|
|
579
|
-
if (res) {
|
|
580
|
-
res.gauges.forEach((g) => result.gauges.push(g))
|
|
581
|
-
res.counters.forEach((c) => result.counters.push(c))
|
|
582
|
-
res.logs.forEach((l) => result.logs.push(l))
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
resolve()
|
|
586
|
-
})
|
|
587
|
-
)
|
|
588
|
-
}
|
|
589
|
-
await Promise.all(processorPromises)
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
recordRuntimeInfo(result, HandlerType.SUI_TRANSACTION)
|
|
593
|
-
return {
|
|
594
|
-
result,
|
|
595
|
-
configUpdated: false,
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
async processInstructions(
|
|
600
|
-
request: ProcessInstructionsRequest,
|
|
601
|
-
context: CallContext
|
|
602
|
-
): Promise<ProcessBindingResponse> {
|
|
603
|
-
if (!this.started) {
|
|
604
|
-
throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
const result = ProcessResult.fromPartial({})
|
|
608
|
-
|
|
609
|
-
// Only have instruction handlers for solana processors
|
|
610
|
-
if (SolanaProcessorState.INSTANCE.getValues()) {
|
|
611
|
-
const processorPromises: Promise<void>[] = []
|
|
612
|
-
for (const instruction of request.instructions) {
|
|
613
|
-
if (!instruction) {
|
|
614
|
-
throw new ServerError(Status.INVALID_ARGUMENT, 'instruction cannot be null')
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
processorPromises.push(
|
|
618
|
-
new Promise((resolve, _) => {
|
|
619
|
-
for (const processor of SolanaProcessorState.INSTANCE.getValues()) {
|
|
620
|
-
if (processor.address === instruction.programAccountId) {
|
|
621
|
-
let parsedInstruction: SolInstruction | null = null
|
|
622
|
-
if (instruction.parsed) {
|
|
623
|
-
parsedInstruction = processor.getParsedInstruction(
|
|
624
|
-
JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
625
|
-
)
|
|
626
|
-
} else if (instruction.instructionData) {
|
|
627
|
-
parsedInstruction = processor.getParsedInstruction(instruction.instructionData)
|
|
628
|
-
}
|
|
629
|
-
if (parsedInstruction == null) {
|
|
630
|
-
continue
|
|
631
|
-
}
|
|
632
|
-
const insHandler = processor.getInstructionHandler(parsedInstruction)
|
|
633
|
-
if (insHandler == null) {
|
|
634
|
-
continue
|
|
635
|
-
}
|
|
636
|
-
const res = processor.handleInstruction(
|
|
637
|
-
parsedInstruction,
|
|
638
|
-
instruction.accounts,
|
|
639
|
-
insHandler,
|
|
640
|
-
instruction.slot
|
|
641
|
-
)
|
|
642
|
-
res.gauges.forEach((g) => result.gauges.push(g))
|
|
643
|
-
res.counters.forEach((c) => result.counters.push(c))
|
|
644
|
-
res.logs.forEach((l) => result.logs.push(l))
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
resolve()
|
|
648
|
-
})
|
|
649
|
-
)
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
await Promise.all(processorPromises)
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
recordRuntimeInfo(result, HandlerType.SOL_INSTRUCTIONS)
|
|
656
|
-
return {
|
|
657
|
-
result,
|
|
658
|
-
configUpdated: false,
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
async processInstructionsNew(request: DataBinding): Promise<ProcessResult> {
|
|
663
|
-
if (!this.started) {
|
|
664
|
-
throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
|
|
665
|
-
}
|
|
544
|
+
async procecessSolInstruSolctions(request: DataBinding): Promise<ProcessResult> {
|
|
666
545
|
if (!request.data) {
|
|
667
546
|
throw new ServerError(Status.INVALID_ARGUMENT, 'instruction data cannot be empty')
|
|
668
547
|
}
|
|
669
548
|
|
|
670
|
-
const jsonString = Utf8ArrayToStr(request.data.raw)
|
|
671
|
-
|
|
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)
|
|
672
552
|
const promises: Promise<ProcessResult>[] = []
|
|
673
553
|
|
|
674
554
|
// Only have instruction handlers for solana processors
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
if (instruction.parsed) {
|
|
685
|
-
parsedInstruction = processor.getParsedInstruction(
|
|
686
|
-
JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
687
|
-
)
|
|
688
|
-
} else if (instruction.instructionData) {
|
|
689
|
-
parsedInstruction = processor.getParsedInstruction(instruction.instructionData)
|
|
690
|
-
}
|
|
691
|
-
if (parsedInstruction == null) {
|
|
692
|
-
continue
|
|
693
|
-
}
|
|
694
|
-
const insHandler = processor.getInstructionHandler(parsedInstruction)
|
|
695
|
-
if (insHandler == null) {
|
|
696
|
-
continue
|
|
697
|
-
}
|
|
698
|
-
const res = await processor.handleInstruction(
|
|
699
|
-
parsedInstruction,
|
|
700
|
-
instruction.accounts,
|
|
701
|
-
insHandler,
|
|
702
|
-
instruction.slot
|
|
703
|
-
)
|
|
704
|
-
|
|
705
|
-
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)
|
|
706
564
|
}
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return mergeProcessResults(await Promise.all(promises))
|
|
711
|
-
}
|
|
712
565
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
const jsonString = Utf8ArrayToStr(binding.block.raw)
|
|
733
|
-
|
|
734
|
-
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
|
+
)
|
|
735
584
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
const promise = this.blockHandlers[handlerId](block).catch((e) => {
|
|
739
|
-
throw new ServerError(Status.INTERNAL, 'error processing block: ' + block.number + '\n' + errorString(e))
|
|
740
|
-
})
|
|
741
|
-
promises.push(promise)
|
|
585
|
+
promises.push(Promise.resolve(res))
|
|
586
|
+
}
|
|
742
587
|
}
|
|
743
588
|
return mergeProcessResults(await Promise.all(promises))
|
|
744
589
|
}
|
|
745
590
|
|
|
746
|
-
|
|
747
|
-
async processBlockNew(binding: DataBinding): Promise<ProcessResult> {
|
|
591
|
+
async processBlock(binding: DataBinding): Promise<ProcessResult> {
|
|
748
592
|
if (!binding.data) {
|
|
749
593
|
throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
|
|
750
594
|
}
|
|
751
|
-
if (binding.handlerIds.length == 0) {
|
|
752
|
-
binding.handlerIds = [binding.handlerId]
|
|
753
|
-
}
|
|
754
595
|
|
|
755
596
|
const jsonString = Utf8ArrayToStr(binding.data.raw)
|
|
756
597
|
|
|
@@ -786,9 +627,6 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
786
627
|
if (!binding.data) {
|
|
787
628
|
throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be empty")
|
|
788
629
|
}
|
|
789
|
-
if (binding.handlerIds.length == 0) {
|
|
790
|
-
binding.handlerIds = [binding.handlerId]
|
|
791
|
-
}
|
|
792
630
|
const jsonString = Utf8ArrayToStr(binding.data.raw)
|
|
793
631
|
const trace: Trace = JSON.parse(jsonString)
|
|
794
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
|