@sentio/sdk 1.36.0-rc.6 → 1.36.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/core/account-processor.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +12 -5
- package/lib/gen/processor/protos/processor.js +30 -44
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/service.js +26 -8
- package/lib/service.js.map +1 -1
- package/lib/testing/test-processor-server.js +4 -6
- package/lib/testing/test-processor-server.js.map +1 -1
- package/package.json +1 -1
- package/src/core/account-processor.ts +1 -1
- package/src/gen/processor/protos/processor.ts +34 -49
- package/src/service.ts +26 -10
- package/src/testing/test-processor-server.ts +4 -6
|
@@ -474,22 +474,21 @@ export interface Data {
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
export interface Data_EthLog {
|
|
477
|
-
|
|
477
|
+
log: { [key: string]: any } | undefined;
|
|
478
478
|
transaction?: Uint8Array | undefined;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
export interface Data_EthBlock {
|
|
482
|
-
|
|
482
|
+
block: { [key: string]: any } | undefined;
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
export interface Data_EthTransaction {
|
|
486
|
-
|
|
487
|
-
transaction?: Uint8Array | undefined;
|
|
486
|
+
transaction: { [key: string]: any } | undefined;
|
|
488
487
|
transactionReceipt?: Uint8Array | undefined;
|
|
489
488
|
}
|
|
490
489
|
|
|
491
490
|
export interface Data_EthTrace {
|
|
492
|
-
|
|
491
|
+
trace: { [key: string]: any } | undefined;
|
|
493
492
|
transaction?: Uint8Array | undefined;
|
|
494
493
|
transactionReceipt?: Uint8Array | undefined;
|
|
495
494
|
}
|
|
@@ -3003,13 +3002,13 @@ export const Data = {
|
|
|
3003
3002
|
};
|
|
3004
3003
|
|
|
3005
3004
|
function createBaseData_EthLog(): Data_EthLog {
|
|
3006
|
-
return {
|
|
3005
|
+
return { log: undefined, transaction: undefined };
|
|
3007
3006
|
}
|
|
3008
3007
|
|
|
3009
3008
|
export const Data_EthLog = {
|
|
3010
3009
|
encode(message: Data_EthLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
3011
|
-
if (message.
|
|
3012
|
-
writer.uint32(
|
|
3010
|
+
if (message.log !== undefined) {
|
|
3011
|
+
Struct.encode(Struct.wrap(message.log), writer.uint32(26).fork()).ldelim();
|
|
3013
3012
|
}
|
|
3014
3013
|
if (message.transaction !== undefined) {
|
|
3015
3014
|
writer.uint32(18).bytes(message.transaction);
|
|
@@ -3024,8 +3023,8 @@ export const Data_EthLog = {
|
|
|
3024
3023
|
while (reader.pos < end) {
|
|
3025
3024
|
const tag = reader.uint32();
|
|
3026
3025
|
switch (tag >>> 3) {
|
|
3027
|
-
case
|
|
3028
|
-
message.
|
|
3026
|
+
case 3:
|
|
3027
|
+
message.log = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
3029
3028
|
break;
|
|
3030
3029
|
case 2:
|
|
3031
3030
|
message.transaction = reader.bytes();
|
|
@@ -3040,15 +3039,14 @@ export const Data_EthLog = {
|
|
|
3040
3039
|
|
|
3041
3040
|
fromJSON(object: any): Data_EthLog {
|
|
3042
3041
|
return {
|
|
3043
|
-
|
|
3042
|
+
log: isObject(object.log) ? object.log : undefined,
|
|
3044
3043
|
transaction: isSet(object.transaction) ? bytesFromBase64(object.transaction) : undefined,
|
|
3045
3044
|
};
|
|
3046
3045
|
},
|
|
3047
3046
|
|
|
3048
3047
|
toJSON(message: Data_EthLog): unknown {
|
|
3049
3048
|
const obj: any = {};
|
|
3050
|
-
message.
|
|
3051
|
-
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
|
|
3049
|
+
message.log !== undefined && (obj.log = message.log);
|
|
3052
3050
|
message.transaction !== undefined &&
|
|
3053
3051
|
(obj.transaction = message.transaction !== undefined ? base64FromBytes(message.transaction) : undefined);
|
|
3054
3052
|
return obj;
|
|
@@ -3056,20 +3054,20 @@ export const Data_EthLog = {
|
|
|
3056
3054
|
|
|
3057
3055
|
fromPartial(object: DeepPartial<Data_EthLog>): Data_EthLog {
|
|
3058
3056
|
const message = createBaseData_EthLog();
|
|
3059
|
-
message.
|
|
3057
|
+
message.log = object.log ?? undefined;
|
|
3060
3058
|
message.transaction = object.transaction ?? undefined;
|
|
3061
3059
|
return message;
|
|
3062
3060
|
},
|
|
3063
3061
|
};
|
|
3064
3062
|
|
|
3065
3063
|
function createBaseData_EthBlock(): Data_EthBlock {
|
|
3066
|
-
return {
|
|
3064
|
+
return { block: undefined };
|
|
3067
3065
|
}
|
|
3068
3066
|
|
|
3069
3067
|
export const Data_EthBlock = {
|
|
3070
3068
|
encode(message: Data_EthBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
3071
|
-
if (message.
|
|
3072
|
-
writer.uint32(
|
|
3069
|
+
if (message.block !== undefined) {
|
|
3070
|
+
Struct.encode(Struct.wrap(message.block), writer.uint32(18).fork()).ldelim();
|
|
3073
3071
|
}
|
|
3074
3072
|
return writer;
|
|
3075
3073
|
},
|
|
@@ -3081,8 +3079,8 @@ export const Data_EthBlock = {
|
|
|
3081
3079
|
while (reader.pos < end) {
|
|
3082
3080
|
const tag = reader.uint32();
|
|
3083
3081
|
switch (tag >>> 3) {
|
|
3084
|
-
case
|
|
3085
|
-
message.
|
|
3082
|
+
case 2:
|
|
3083
|
+
message.block = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
3086
3084
|
break;
|
|
3087
3085
|
default:
|
|
3088
3086
|
reader.skipType(tag & 7);
|
|
@@ -3093,34 +3091,30 @@ export const Data_EthBlock = {
|
|
|
3093
3091
|
},
|
|
3094
3092
|
|
|
3095
3093
|
fromJSON(object: any): Data_EthBlock {
|
|
3096
|
-
return {
|
|
3094
|
+
return { block: isObject(object.block) ? object.block : undefined };
|
|
3097
3095
|
},
|
|
3098
3096
|
|
|
3099
3097
|
toJSON(message: Data_EthBlock): unknown {
|
|
3100
3098
|
const obj: any = {};
|
|
3101
|
-
message.
|
|
3102
|
-
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
|
|
3099
|
+
message.block !== undefined && (obj.block = message.block);
|
|
3103
3100
|
return obj;
|
|
3104
3101
|
},
|
|
3105
3102
|
|
|
3106
3103
|
fromPartial(object: DeepPartial<Data_EthBlock>): Data_EthBlock {
|
|
3107
3104
|
const message = createBaseData_EthBlock();
|
|
3108
|
-
message.
|
|
3105
|
+
message.block = object.block ?? undefined;
|
|
3109
3106
|
return message;
|
|
3110
3107
|
},
|
|
3111
3108
|
};
|
|
3112
3109
|
|
|
3113
3110
|
function createBaseData_EthTransaction(): Data_EthTransaction {
|
|
3114
|
-
return {
|
|
3111
|
+
return { transaction: undefined, transactionReceipt: undefined };
|
|
3115
3112
|
}
|
|
3116
3113
|
|
|
3117
3114
|
export const Data_EthTransaction = {
|
|
3118
3115
|
encode(message: Data_EthTransaction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
3119
|
-
if (message.data.length !== 0) {
|
|
3120
|
-
writer.uint32(10).bytes(message.data);
|
|
3121
|
-
}
|
|
3122
3116
|
if (message.transaction !== undefined) {
|
|
3123
|
-
writer.uint32(
|
|
3117
|
+
Struct.encode(Struct.wrap(message.transaction), writer.uint32(34).fork()).ldelim();
|
|
3124
3118
|
}
|
|
3125
3119
|
if (message.transactionReceipt !== undefined) {
|
|
3126
3120
|
writer.uint32(26).bytes(message.transactionReceipt);
|
|
@@ -3135,11 +3129,8 @@ export const Data_EthTransaction = {
|
|
|
3135
3129
|
while (reader.pos < end) {
|
|
3136
3130
|
const tag = reader.uint32();
|
|
3137
3131
|
switch (tag >>> 3) {
|
|
3138
|
-
case
|
|
3139
|
-
message.
|
|
3140
|
-
break;
|
|
3141
|
-
case 2:
|
|
3142
|
-
message.transaction = reader.bytes();
|
|
3132
|
+
case 4:
|
|
3133
|
+
message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
3143
3134
|
break;
|
|
3144
3135
|
case 3:
|
|
3145
3136
|
message.transactionReceipt = reader.bytes();
|
|
@@ -3154,18 +3145,14 @@ export const Data_EthTransaction = {
|
|
|
3154
3145
|
|
|
3155
3146
|
fromJSON(object: any): Data_EthTransaction {
|
|
3156
3147
|
return {
|
|
3157
|
-
|
|
3158
|
-
transaction: isSet(object.transaction) ? bytesFromBase64(object.transaction) : undefined,
|
|
3148
|
+
transaction: isObject(object.transaction) ? object.transaction : undefined,
|
|
3159
3149
|
transactionReceipt: isSet(object.transactionReceipt) ? bytesFromBase64(object.transactionReceipt) : undefined,
|
|
3160
3150
|
};
|
|
3161
3151
|
},
|
|
3162
3152
|
|
|
3163
3153
|
toJSON(message: Data_EthTransaction): unknown {
|
|
3164
3154
|
const obj: any = {};
|
|
3165
|
-
message.
|
|
3166
|
-
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
|
|
3167
|
-
message.transaction !== undefined &&
|
|
3168
|
-
(obj.transaction = message.transaction !== undefined ? base64FromBytes(message.transaction) : undefined);
|
|
3155
|
+
message.transaction !== undefined && (obj.transaction = message.transaction);
|
|
3169
3156
|
message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt !== undefined
|
|
3170
3157
|
? base64FromBytes(message.transactionReceipt)
|
|
3171
3158
|
: undefined);
|
|
@@ -3174,7 +3161,6 @@ export const Data_EthTransaction = {
|
|
|
3174
3161
|
|
|
3175
3162
|
fromPartial(object: DeepPartial<Data_EthTransaction>): Data_EthTransaction {
|
|
3176
3163
|
const message = createBaseData_EthTransaction();
|
|
3177
|
-
message.data = object.data ?? new Uint8Array();
|
|
3178
3164
|
message.transaction = object.transaction ?? undefined;
|
|
3179
3165
|
message.transactionReceipt = object.transactionReceipt ?? undefined;
|
|
3180
3166
|
return message;
|
|
@@ -3182,13 +3168,13 @@ export const Data_EthTransaction = {
|
|
|
3182
3168
|
};
|
|
3183
3169
|
|
|
3184
3170
|
function createBaseData_EthTrace(): Data_EthTrace {
|
|
3185
|
-
return {
|
|
3171
|
+
return { trace: undefined, transaction: undefined, transactionReceipt: undefined };
|
|
3186
3172
|
}
|
|
3187
3173
|
|
|
3188
3174
|
export const Data_EthTrace = {
|
|
3189
3175
|
encode(message: Data_EthTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
3190
|
-
if (message.
|
|
3191
|
-
writer.uint32(
|
|
3176
|
+
if (message.trace !== undefined) {
|
|
3177
|
+
Struct.encode(Struct.wrap(message.trace), writer.uint32(34).fork()).ldelim();
|
|
3192
3178
|
}
|
|
3193
3179
|
if (message.transaction !== undefined) {
|
|
3194
3180
|
writer.uint32(18).bytes(message.transaction);
|
|
@@ -3206,8 +3192,8 @@ export const Data_EthTrace = {
|
|
|
3206
3192
|
while (reader.pos < end) {
|
|
3207
3193
|
const tag = reader.uint32();
|
|
3208
3194
|
switch (tag >>> 3) {
|
|
3209
|
-
case
|
|
3210
|
-
message.
|
|
3195
|
+
case 4:
|
|
3196
|
+
message.trace = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
3211
3197
|
break;
|
|
3212
3198
|
case 2:
|
|
3213
3199
|
message.transaction = reader.bytes();
|
|
@@ -3225,7 +3211,7 @@ export const Data_EthTrace = {
|
|
|
3225
3211
|
|
|
3226
3212
|
fromJSON(object: any): Data_EthTrace {
|
|
3227
3213
|
return {
|
|
3228
|
-
|
|
3214
|
+
trace: isObject(object.trace) ? object.trace : undefined,
|
|
3229
3215
|
transaction: isSet(object.transaction) ? bytesFromBase64(object.transaction) : undefined,
|
|
3230
3216
|
transactionReceipt: isSet(object.transactionReceipt) ? bytesFromBase64(object.transactionReceipt) : undefined,
|
|
3231
3217
|
};
|
|
@@ -3233,8 +3219,7 @@ export const Data_EthTrace = {
|
|
|
3233
3219
|
|
|
3234
3220
|
toJSON(message: Data_EthTrace): unknown {
|
|
3235
3221
|
const obj: any = {};
|
|
3236
|
-
message.
|
|
3237
|
-
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
|
|
3222
|
+
message.trace !== undefined && (obj.trace = message.trace);
|
|
3238
3223
|
message.transaction !== undefined &&
|
|
3239
3224
|
(obj.transaction = message.transaction !== undefined ? base64FromBytes(message.transaction) : undefined);
|
|
3240
3225
|
message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt !== undefined
|
|
@@ -3245,7 +3230,7 @@ export const Data_EthTrace = {
|
|
|
3245
3230
|
|
|
3246
3231
|
fromPartial(object: DeepPartial<Data_EthTrace>): Data_EthTrace {
|
|
3247
3232
|
const message = createBaseData_EthTrace();
|
|
3248
|
-
message.
|
|
3233
|
+
message.trace = object.trace ?? undefined;
|
|
3249
3234
|
message.transaction = object.transaction ?? undefined;
|
|
3250
3235
|
message.transactionReceipt = object.transactionReceipt ?? undefined;
|
|
3251
3236
|
return message;
|
package/src/service.ts
CHANGED
|
@@ -519,14 +519,19 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
const promises: Promise<ProcessResult>[] = []
|
|
522
|
-
|
|
523
|
-
|
|
522
|
+
let log: Log
|
|
523
|
+
if (request.data.ethLog) {
|
|
524
|
+
log = request.data.ethLog.log as Log
|
|
525
|
+
} else {
|
|
526
|
+
const jsonString = Utf8ArrayToStr(request.data.raw)
|
|
527
|
+
log = JSON.parse(jsonString)
|
|
528
|
+
}
|
|
524
529
|
|
|
525
530
|
for (const handlerId of request.handlerIds) {
|
|
526
531
|
const handler = this.eventHandlers[handlerId]
|
|
527
532
|
promises.push(
|
|
528
533
|
handler(log).catch((e) => {
|
|
529
|
-
throw new ServerError(Status.INTERNAL, 'error processing log: ' +
|
|
534
|
+
throw new ServerError(Status.INTERNAL, 'error processing log: ' + JSON.stringify(log) + '\n' + errorString(e))
|
|
530
535
|
})
|
|
531
536
|
)
|
|
532
537
|
}
|
|
@@ -574,10 +579,13 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
574
579
|
if (!binding.data) {
|
|
575
580
|
throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
|
|
576
581
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
582
|
+
let block: Block
|
|
583
|
+
if (binding.data.ethBlock) {
|
|
584
|
+
block = binding.data.ethBlock.block as Block
|
|
585
|
+
} else {
|
|
586
|
+
const jsonString = Utf8ArrayToStr(binding.data.raw)
|
|
587
|
+
block = JSON.parse(jsonString)
|
|
588
|
+
}
|
|
581
589
|
|
|
582
590
|
const promises: Promise<ProcessResult>[] = []
|
|
583
591
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -594,15 +602,23 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
594
602
|
if (!binding.data) {
|
|
595
603
|
throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be empty")
|
|
596
604
|
}
|
|
597
|
-
|
|
598
|
-
|
|
605
|
+
let trace: Trace
|
|
606
|
+
if (binding.data.ethTrace) {
|
|
607
|
+
trace = binding.data.ethTrace.trace as Trace
|
|
608
|
+
} else {
|
|
609
|
+
const jsonString = Utf8ArrayToStr(binding.data.raw)
|
|
610
|
+
trace = JSON.parse(jsonString)
|
|
611
|
+
}
|
|
599
612
|
|
|
600
613
|
const promises: Promise<ProcessResult>[] = []
|
|
601
614
|
|
|
602
615
|
for (const handlerId of binding.handlerIds) {
|
|
603
616
|
promises.push(
|
|
604
617
|
this.traceHandlers[handlerId](trace).catch((e) => {
|
|
605
|
-
throw new ServerError(
|
|
618
|
+
throw new ServerError(
|
|
619
|
+
Status.INTERNAL,
|
|
620
|
+
'error processing trace: ' + JSON.stringify(trace) + '\n' + errorString(e)
|
|
621
|
+
)
|
|
606
622
|
})
|
|
607
623
|
)
|
|
608
624
|
}
|
|
@@ -115,7 +115,7 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
115
115
|
return {
|
|
116
116
|
data: {
|
|
117
117
|
raw: new Uint8Array(),
|
|
118
|
-
ethTrace: {
|
|
118
|
+
ethTrace: { trace },
|
|
119
119
|
},
|
|
120
120
|
handlerIds: [config.handlerId],
|
|
121
121
|
handlerType: HandlerType.ETH_TRACE,
|
|
@@ -177,7 +177,7 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
177
177
|
return {
|
|
178
178
|
data: {
|
|
179
179
|
raw: new Uint8Array(),
|
|
180
|
-
ethLog: {
|
|
180
|
+
ethLog: { log },
|
|
181
181
|
},
|
|
182
182
|
handlerIds: [config.handlerId],
|
|
183
183
|
handlerType: HandlerType.ETH_LOG,
|
|
@@ -239,7 +239,7 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
239
239
|
return {
|
|
240
240
|
data: {
|
|
241
241
|
raw: new Uint8Array(),
|
|
242
|
-
ethLog: {
|
|
242
|
+
ethLog: { log },
|
|
243
243
|
},
|
|
244
244
|
handlerIds: [config.handlerId],
|
|
245
245
|
handlerType: HandlerType.ETH_LOG,
|
|
@@ -273,9 +273,7 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
273
273
|
const binding: DataBinding = {
|
|
274
274
|
data: {
|
|
275
275
|
raw: new Uint8Array(),
|
|
276
|
-
ethBlock: {
|
|
277
|
-
data: toBytes(block),
|
|
278
|
-
},
|
|
276
|
+
ethBlock: { block },
|
|
279
277
|
},
|
|
280
278
|
handlerType: HandlerType.ETH_BLOCK,
|
|
281
279
|
handlerIds: [],
|