@sentio/sdk 1.20.2 → 1.21.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/aptos-processor.d.ts +10 -10
- package/lib/aptos/aptos-processor.js +65 -13
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/bind-options.d.ts +0 -6
- package/lib/aptos/bind-options.js +1 -8
- package/lib/aptos/bind-options.js.map +1 -1
- package/lib/aptos/context.d.ts +5 -4
- package/lib/aptos/context.js +9 -6
- package/lib/aptos/context.js.map +1 -1
- package/lib/aptos/index.d.ts +3 -2
- package/lib/aptos/index.js +1 -2
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos/runtime.d.ts +2 -0
- package/lib/aptos/runtime.js +16 -0
- package/lib/aptos/runtime.js.map +1 -0
- package/lib/aptos/types.d.ts +28 -0
- package/lib/aptos/types.js +159 -0
- package/lib/aptos/types.js.map +1 -0
- package/lib/aptos/utils.d.ts +6 -0
- package/lib/aptos/utils.js +19 -0
- package/lib/aptos/utils.js.map +1 -0
- package/lib/aptos-codegen/codegen.d.ts +5 -2
- package/lib/aptos-codegen/codegen.js +194 -17
- package/lib/aptos-codegen/codegen.js.map +1 -1
- package/lib/aptos-codegen/typegen.d.ts +18 -0
- package/lib/aptos-codegen/typegen.js +196 -0
- package/lib/aptos-codegen/typegen.js.map +1 -0
- package/lib/binds.d.ts +2 -3
- package/lib/binds.js +6 -33
- package/lib/binds.js.map +1 -1
- package/lib/builtin/aptos/0x1.d.ts +1624 -0
- package/lib/builtin/aptos/0x1.js +2502 -0
- package/lib/builtin/aptos/0x1.js.map +1 -0
- package/lib/builtin/aptos/0x3.d.ts +414 -0
- package/lib/builtin/aptos/0x3.js +461 -0
- package/lib/builtin/aptos/0x3.js.map +1 -0
- package/lib/builtin/internal/eacaggregatorproxy_processor.d.ts +2 -2
- package/lib/builtin/internal/eacaggregatorproxy_processor.js +12 -11
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.d.ts +2 -2
- package/lib/builtin/internal/erc20_processor.js +12 -11
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.d.ts +2 -2
- package/lib/builtin/internal/erc20bytes_processor.js +12 -11
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.d.ts +2 -2
- package/lib/builtin/internal/weth9_processor.js +12 -11
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/builtin/solana/types.d.ts +5 -5
- package/lib/builtin/solana/wormhole-processor.d.ts +6 -6
- package/lib/builtin/solana/wormhole-processor.js +15 -12
- package/lib/builtin/solana/wormhole-processor.js.map +1 -1
- package/lib/cli/build.js +17 -16
- package/lib/cli/build.js.map +1 -1
- package/lib/core/base-processor-template.d.ts +7 -7
- package/lib/core/base-processor-template.js.map +1 -1
- package/lib/core/base-processor.d.ts +5 -6
- package/lib/core/base-processor.js +6 -4
- package/lib/core/base-processor.js.map +1 -1
- package/lib/core/big-decimal.d.ts +1 -0
- package/lib/core/big-decimal.js +6 -0
- package/lib/core/big-decimal.js.map +1 -0
- package/lib/core/bind-options.d.ts +0 -2
- package/lib/core/bind-options.js +4 -4
- package/lib/core/bind-options.js.map +1 -1
- package/lib/core/context.d.ts +14 -11
- package/lib/core/context.js +28 -19
- package/lib/core/context.js.map +1 -1
- package/lib/core/generic-processor.js +5 -5
- package/lib/core/generic-processor.js.map +1 -1
- package/lib/core/index.d.ts +5 -5
- package/lib/core/index.js +6 -6
- package/lib/core/index.js.map +1 -1
- package/lib/core/logger.d.ts +2 -3
- package/lib/core/logger.js +6 -6
- package/lib/core/logger.js.map +1 -1
- package/lib/core/metadata.d.ts +7 -4
- package/lib/core/metadata.js +13 -10
- package/lib/core/metadata.js.map +1 -1
- package/lib/core/meter.d.ts +4 -7
- package/lib/core/meter.js +12 -13
- package/lib/core/meter.js.map +1 -1
- package/lib/core/solana-processor.d.ts +7 -4
- package/lib/core/solana-processor.js +14 -20
- package/lib/core/solana-processor.js.map +1 -1
- package/lib/core/sui-processor.d.ts +5 -4
- package/lib/core/sui-processor.js +10 -17
- package/lib/core/sui-processor.js.map +1 -1
- package/lib/error.d.ts +2 -2
- package/lib/error.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +23 -12
- package/lib/gen/processor/protos/processor.js +129 -57
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/processor-state.d.ts +1 -1
- package/lib/processor-state.js.map +1 -1
- package/lib/service.js +13 -12
- package/lib/service.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +14 -15
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/test-abi-code-gen.js.map +1 -1
- package/lib/testing/metric-utils.js +2 -2
- package/lib/testing/metric-utils.js.map +1 -1
- package/lib/tests/aptos.test.js +95 -2
- package/lib/tests/aptos.test.js.map +1 -1
- package/lib/tests/erc20.js +1 -1
- package/lib/tests/erc20.js.map +1 -1
- package/lib/tests/erc20.test.js +3 -4
- package/lib/tests/erc20.test.js.map +1 -1
- package/lib/tests/solana.test.js +5 -1
- package/lib/tests/solana.test.js.map +1 -1
- package/lib/tests/souffl3.js +17 -4
- package/lib/tests/souffl3.js.map +1 -1
- package/lib/tests/sui.test.js +1 -4
- package/lib/tests/sui.test.js.map +1 -1
- package/lib/tests/types/aptos/souffle.d.ts +311 -22
- package/lib/tests/types/aptos/souffle.js +140 -4
- package/lib/tests/types/aptos/souffle.js.map +1 -1
- package/lib/tests/types/solana/basic_1_processor.d.ts +2 -2
- package/lib/tests/types/solana/basic_1_processor.js +4 -4
- package/lib/tests/types/solana/basic_1_processor.js.map +1 -1
- package/lib/tests/wormhole-token-bridge.js +2 -1
- package/lib/tests/wormhole-token-bridge.js.map +1 -1
- package/lib/utils/chain.d.ts +1 -0
- package/lib/utils/chain.js +15 -1
- package/lib/utils/chain.js.map +1 -1
- package/lib/utils/conversion.d.ts +1 -1
- package/lib/utils/conversion.js.map +1 -1
- package/package.json +3 -2
- package/src/abis/aptos/0x1.json +9205 -0
- package/src/abis/aptos/0x3.json +1515 -0
- package/src/aptos/aptos-processor.ts +79 -18
- package/src/aptos/bind-options.ts +0 -7
- package/src/aptos/context.ts +11 -8
- package/src/aptos/index.ts +3 -2
- package/src/aptos/runtime.ts +13 -0
- package/src/aptos/types.ts +203 -0
- package/src/aptos/utils.ts +18 -0
- package/src/aptos-codegen/codegen.ts +221 -18
- package/src/aptos-codegen/typegen.test.ts +29 -0
- package/src/aptos-codegen/typegen.ts +216 -0
- package/src/binds.ts +5 -39
- package/src/builtin/aptos/0x1.ts +3760 -0
- package/src/builtin/aptos/0x3.ts +798 -0
- package/src/builtin/internal/eacaggregatorproxy_processor.ts +14 -31
- package/src/builtin/internal/erc20_processor.ts +14 -25
- package/src/builtin/internal/erc20bytes_processor.ts +14 -25
- package/src/builtin/internal/weth9_processor.ts +14 -25
- package/src/builtin/solana/wormhole-processor.ts +21 -18
- package/src/cli/build.ts +19 -17
- package/src/core/base-processor-template.ts +7 -7
- package/src/core/base-processor.ts +30 -9
- package/src/core/big-decimal.ts +1 -0
- package/src/core/bind-options.ts +3 -2
- package/src/core/context.ts +40 -24
- package/src/core/generic-processor.ts +6 -7
- package/src/core/index.ts +5 -5
- package/src/core/logger.ts +7 -7
- package/src/core/metadata.ts +14 -12
- package/src/core/meter.ts +12 -14
- package/src/core/solana-processor.ts +24 -21
- package/src/core/sui-processor.ts +10 -21
- package/src/error.ts +2 -2
- package/src/gen/processor/protos/processor.ts +158 -68
- package/src/index.ts +1 -2
- package/src/processor-state.ts +1 -1
- package/src/service.ts +22 -15
- package/src/target-ethers-sentio/codegen.ts +14 -15
- package/src/test-abi-code-gen.ts +1 -0
- package/src/testing/metric-utils.ts +2 -2
- package/src/tests/aptos.test.ts +102 -3
- package/src/tests/erc20.test.ts +3 -4
- package/src/tests/erc20.ts +1 -1
- package/src/tests/solana.test.ts +5 -1
- package/src/tests/souffl3.ts +21 -6
- package/src/tests/sui.test.ts +1 -4
- package/src/tests/types/aptos/souffle.ts +422 -40
- package/src/tests/types/solana/basic_1_processor.ts +6 -6
- package/src/tests/wormhole-token-bridge.ts +2 -1
- package/src/types/global.d.ts +1 -1
- package/src/utils/chain.ts +14 -0
- package/src/utils/conversion.ts +1 -1
- package/lib/contract-namer.d.ts +0 -6
- package/lib/contract-namer.js +0 -20
- package/lib/contract-namer.js.map +0 -1
- package/src/aptos-codegen/codgen.test.ts +0 -11
- package/src/contract-namer.ts +0 -17
|
@@ -135,6 +135,7 @@ export interface ProcessConfigResponse {
|
|
|
135
135
|
config: ProjectConfig | undefined;
|
|
136
136
|
contractConfigs: ContractConfig[];
|
|
137
137
|
templateInstances: TemplateInstance[];
|
|
138
|
+
accountConfigs: AccountConfig[];
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
export interface ContractConfig {
|
|
@@ -150,6 +151,8 @@ export interface ContractConfig {
|
|
|
150
151
|
processorType: string;
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
export interface AccountConfig {}
|
|
155
|
+
|
|
153
156
|
export interface ContractInfo {
|
|
154
157
|
name: string;
|
|
155
158
|
chainId: string;
|
|
@@ -248,6 +251,7 @@ export interface Instruction {
|
|
|
248
251
|
instructionData: string;
|
|
249
252
|
slot: Long;
|
|
250
253
|
programAccountId: string;
|
|
254
|
+
accounts: string[];
|
|
251
255
|
parsed?: Uint8Array | undefined;
|
|
252
256
|
}
|
|
253
257
|
|
|
@@ -276,21 +280,22 @@ export interface ProcessResult {
|
|
|
276
280
|
logs: LogResult[];
|
|
277
281
|
}
|
|
278
282
|
|
|
279
|
-
export interface
|
|
283
|
+
export interface DataDescriptor {
|
|
280
284
|
name: string;
|
|
281
|
-
unit: string;
|
|
282
285
|
description: string;
|
|
286
|
+
unit: string;
|
|
283
287
|
sparse: boolean;
|
|
284
288
|
}
|
|
285
289
|
|
|
286
290
|
export interface RecordMetaData {
|
|
287
|
-
|
|
291
|
+
address: string;
|
|
292
|
+
contractName: string;
|
|
288
293
|
blockNumber: Long;
|
|
289
294
|
transactionHash: string;
|
|
295
|
+
chainId: string;
|
|
290
296
|
transactionIndex: number;
|
|
291
297
|
logIndex: number;
|
|
292
|
-
|
|
293
|
-
descriptor: MetricDescriptor | undefined;
|
|
298
|
+
dataDescriptor: DataDescriptor | undefined;
|
|
294
299
|
labels: { [key: string]: string };
|
|
295
300
|
}
|
|
296
301
|
|
|
@@ -328,7 +333,6 @@ export interface CounterResult {
|
|
|
328
333
|
}
|
|
329
334
|
|
|
330
335
|
export interface LogResult {
|
|
331
|
-
name: string;
|
|
332
336
|
metadata: RecordMetaData | undefined;
|
|
333
337
|
level: LogLevel;
|
|
334
338
|
message: string;
|
|
@@ -443,7 +447,12 @@ export const ProcessConfigRequest = {
|
|
|
443
447
|
};
|
|
444
448
|
|
|
445
449
|
function createBaseProcessConfigResponse(): ProcessConfigResponse {
|
|
446
|
-
return {
|
|
450
|
+
return {
|
|
451
|
+
config: undefined,
|
|
452
|
+
contractConfigs: [],
|
|
453
|
+
templateInstances: [],
|
|
454
|
+
accountConfigs: [],
|
|
455
|
+
};
|
|
447
456
|
}
|
|
448
457
|
|
|
449
458
|
export const ProcessConfigResponse = {
|
|
@@ -460,6 +469,9 @@ export const ProcessConfigResponse = {
|
|
|
460
469
|
for (const v of message.templateInstances) {
|
|
461
470
|
TemplateInstance.encode(v!, writer.uint32(26).fork()).ldelim();
|
|
462
471
|
}
|
|
472
|
+
for (const v of message.accountConfigs) {
|
|
473
|
+
AccountConfig.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
474
|
+
}
|
|
463
475
|
return writer;
|
|
464
476
|
},
|
|
465
477
|
|
|
@@ -486,6 +498,11 @@ export const ProcessConfigResponse = {
|
|
|
486
498
|
TemplateInstance.decode(reader, reader.uint32())
|
|
487
499
|
);
|
|
488
500
|
break;
|
|
501
|
+
case 4:
|
|
502
|
+
message.accountConfigs.push(
|
|
503
|
+
AccountConfig.decode(reader, reader.uint32())
|
|
504
|
+
);
|
|
505
|
+
break;
|
|
489
506
|
default:
|
|
490
507
|
reader.skipType(tag & 7);
|
|
491
508
|
break;
|
|
@@ -505,6 +522,9 @@ export const ProcessConfigResponse = {
|
|
|
505
522
|
templateInstances: Array.isArray(object?.templateInstances)
|
|
506
523
|
? object.templateInstances.map((e: any) => TemplateInstance.fromJSON(e))
|
|
507
524
|
: [],
|
|
525
|
+
accountConfigs: Array.isArray(object?.accountConfigs)
|
|
526
|
+
? object.accountConfigs.map((e: any) => AccountConfig.fromJSON(e))
|
|
527
|
+
: [],
|
|
508
528
|
};
|
|
509
529
|
},
|
|
510
530
|
|
|
@@ -528,6 +548,13 @@ export const ProcessConfigResponse = {
|
|
|
528
548
|
} else {
|
|
529
549
|
obj.templateInstances = [];
|
|
530
550
|
}
|
|
551
|
+
if (message.accountConfigs) {
|
|
552
|
+
obj.accountConfigs = message.accountConfigs.map((e) =>
|
|
553
|
+
e ? AccountConfig.toJSON(e) : undefined
|
|
554
|
+
);
|
|
555
|
+
} else {
|
|
556
|
+
obj.accountConfigs = [];
|
|
557
|
+
}
|
|
531
558
|
return obj;
|
|
532
559
|
},
|
|
533
560
|
|
|
@@ -544,6 +571,8 @@ export const ProcessConfigResponse = {
|
|
|
544
571
|
message.templateInstances =
|
|
545
572
|
object.templateInstances?.map((e) => TemplateInstance.fromPartial(e)) ||
|
|
546
573
|
[];
|
|
574
|
+
message.accountConfigs =
|
|
575
|
+
object.accountConfigs?.map((e) => AccountConfig.fromPartial(e)) || [];
|
|
547
576
|
return message;
|
|
548
577
|
},
|
|
549
578
|
};
|
|
@@ -793,6 +822,48 @@ export const ContractConfig = {
|
|
|
793
822
|
},
|
|
794
823
|
};
|
|
795
824
|
|
|
825
|
+
function createBaseAccountConfig(): AccountConfig {
|
|
826
|
+
return {};
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export const AccountConfig = {
|
|
830
|
+
encode(
|
|
831
|
+
_: AccountConfig,
|
|
832
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
833
|
+
): _m0.Writer {
|
|
834
|
+
return writer;
|
|
835
|
+
},
|
|
836
|
+
|
|
837
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): AccountConfig {
|
|
838
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
839
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
840
|
+
const message = createBaseAccountConfig();
|
|
841
|
+
while (reader.pos < end) {
|
|
842
|
+
const tag = reader.uint32();
|
|
843
|
+
switch (tag >>> 3) {
|
|
844
|
+
default:
|
|
845
|
+
reader.skipType(tag & 7);
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return message;
|
|
850
|
+
},
|
|
851
|
+
|
|
852
|
+
fromJSON(_: any): AccountConfig {
|
|
853
|
+
return {};
|
|
854
|
+
},
|
|
855
|
+
|
|
856
|
+
toJSON(_: AccountConfig): unknown {
|
|
857
|
+
const obj: any = {};
|
|
858
|
+
return obj;
|
|
859
|
+
},
|
|
860
|
+
|
|
861
|
+
fromPartial(_: DeepPartial<AccountConfig>): AccountConfig {
|
|
862
|
+
const message = createBaseAccountConfig();
|
|
863
|
+
return message;
|
|
864
|
+
},
|
|
865
|
+
};
|
|
866
|
+
|
|
796
867
|
function createBaseContractInfo(): ContractInfo {
|
|
797
868
|
return { name: "", chainId: "", address: "", abi: "" };
|
|
798
869
|
}
|
|
@@ -2156,6 +2227,7 @@ function createBaseInstruction(): Instruction {
|
|
|
2156
2227
|
instructionData: "",
|
|
2157
2228
|
slot: Long.UZERO,
|
|
2158
2229
|
programAccountId: "",
|
|
2230
|
+
accounts: [],
|
|
2159
2231
|
parsed: undefined,
|
|
2160
2232
|
};
|
|
2161
2233
|
}
|
|
@@ -2174,6 +2246,9 @@ export const Instruction = {
|
|
|
2174
2246
|
if (message.programAccountId !== "") {
|
|
2175
2247
|
writer.uint32(26).string(message.programAccountId);
|
|
2176
2248
|
}
|
|
2249
|
+
for (const v of message.accounts) {
|
|
2250
|
+
writer.uint32(42).string(v!);
|
|
2251
|
+
}
|
|
2177
2252
|
if (message.parsed !== undefined) {
|
|
2178
2253
|
writer.uint32(34).bytes(message.parsed);
|
|
2179
2254
|
}
|
|
@@ -2196,6 +2271,9 @@ export const Instruction = {
|
|
|
2196
2271
|
case 3:
|
|
2197
2272
|
message.programAccountId = reader.string();
|
|
2198
2273
|
break;
|
|
2274
|
+
case 5:
|
|
2275
|
+
message.accounts.push(reader.string());
|
|
2276
|
+
break;
|
|
2199
2277
|
case 4:
|
|
2200
2278
|
message.parsed = reader.bytes();
|
|
2201
2279
|
break;
|
|
@@ -2216,6 +2294,9 @@ export const Instruction = {
|
|
|
2216
2294
|
programAccountId: isSet(object.programAccountId)
|
|
2217
2295
|
? String(object.programAccountId)
|
|
2218
2296
|
: "",
|
|
2297
|
+
accounts: Array.isArray(object?.accounts)
|
|
2298
|
+
? object.accounts.map((e: any) => String(e))
|
|
2299
|
+
: [],
|
|
2219
2300
|
parsed: isSet(object.parsed) ? bytesFromBase64(object.parsed) : undefined,
|
|
2220
2301
|
};
|
|
2221
2302
|
},
|
|
@@ -2228,6 +2309,11 @@ export const Instruction = {
|
|
|
2228
2309
|
(obj.slot = (message.slot || Long.UZERO).toString());
|
|
2229
2310
|
message.programAccountId !== undefined &&
|
|
2230
2311
|
(obj.programAccountId = message.programAccountId);
|
|
2312
|
+
if (message.accounts) {
|
|
2313
|
+
obj.accounts = message.accounts.map((e) => e);
|
|
2314
|
+
} else {
|
|
2315
|
+
obj.accounts = [];
|
|
2316
|
+
}
|
|
2231
2317
|
message.parsed !== undefined &&
|
|
2232
2318
|
(obj.parsed =
|
|
2233
2319
|
message.parsed !== undefined
|
|
@@ -2244,6 +2330,7 @@ export const Instruction = {
|
|
|
2244
2330
|
? Long.fromValue(object.slot)
|
|
2245
2331
|
: Long.UZERO;
|
|
2246
2332
|
message.programAccountId = object.programAccountId ?? "";
|
|
2333
|
+
message.accounts = object.accounts?.map((e) => e) || [];
|
|
2247
2334
|
message.parsed = object.parsed ?? undefined;
|
|
2248
2335
|
return message;
|
|
2249
2336
|
},
|
|
@@ -2608,46 +2695,46 @@ export const ProcessResult = {
|
|
|
2608
2695
|
},
|
|
2609
2696
|
};
|
|
2610
2697
|
|
|
2611
|
-
function
|
|
2612
|
-
return { name: "",
|
|
2698
|
+
function createBaseDataDescriptor(): DataDescriptor {
|
|
2699
|
+
return { name: "", description: "", unit: "", sparse: false };
|
|
2613
2700
|
}
|
|
2614
2701
|
|
|
2615
|
-
export const
|
|
2702
|
+
export const DataDescriptor = {
|
|
2616
2703
|
encode(
|
|
2617
|
-
message:
|
|
2704
|
+
message: DataDescriptor,
|
|
2618
2705
|
writer: _m0.Writer = _m0.Writer.create()
|
|
2619
2706
|
): _m0.Writer {
|
|
2620
2707
|
if (message.name !== "") {
|
|
2621
2708
|
writer.uint32(10).string(message.name);
|
|
2622
2709
|
}
|
|
2623
|
-
if (message.unit !== "") {
|
|
2624
|
-
writer.uint32(18).string(message.unit);
|
|
2625
|
-
}
|
|
2626
2710
|
if (message.description !== "") {
|
|
2627
2711
|
writer.uint32(26).string(message.description);
|
|
2628
2712
|
}
|
|
2713
|
+
if (message.unit !== "") {
|
|
2714
|
+
writer.uint32(18).string(message.unit);
|
|
2715
|
+
}
|
|
2629
2716
|
if (message.sparse === true) {
|
|
2630
2717
|
writer.uint32(32).bool(message.sparse);
|
|
2631
2718
|
}
|
|
2632
2719
|
return writer;
|
|
2633
2720
|
},
|
|
2634
2721
|
|
|
2635
|
-
decode(input: _m0.Reader | Uint8Array, length?: number):
|
|
2722
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): DataDescriptor {
|
|
2636
2723
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
2637
2724
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2638
|
-
const message =
|
|
2725
|
+
const message = createBaseDataDescriptor();
|
|
2639
2726
|
while (reader.pos < end) {
|
|
2640
2727
|
const tag = reader.uint32();
|
|
2641
2728
|
switch (tag >>> 3) {
|
|
2642
2729
|
case 1:
|
|
2643
2730
|
message.name = reader.string();
|
|
2644
2731
|
break;
|
|
2645
|
-
case 2:
|
|
2646
|
-
message.unit = reader.string();
|
|
2647
|
-
break;
|
|
2648
2732
|
case 3:
|
|
2649
2733
|
message.description = reader.string();
|
|
2650
2734
|
break;
|
|
2735
|
+
case 2:
|
|
2736
|
+
message.unit = reader.string();
|
|
2737
|
+
break;
|
|
2651
2738
|
case 4:
|
|
2652
2739
|
message.sparse = reader.bool();
|
|
2653
2740
|
break;
|
|
@@ -2659,30 +2746,30 @@ export const MetricDescriptor = {
|
|
|
2659
2746
|
return message;
|
|
2660
2747
|
},
|
|
2661
2748
|
|
|
2662
|
-
fromJSON(object: any):
|
|
2749
|
+
fromJSON(object: any): DataDescriptor {
|
|
2663
2750
|
return {
|
|
2664
2751
|
name: isSet(object.name) ? String(object.name) : "",
|
|
2665
|
-
unit: isSet(object.unit) ? String(object.unit) : "",
|
|
2666
2752
|
description: isSet(object.description) ? String(object.description) : "",
|
|
2753
|
+
unit: isSet(object.unit) ? String(object.unit) : "",
|
|
2667
2754
|
sparse: isSet(object.sparse) ? Boolean(object.sparse) : false,
|
|
2668
2755
|
};
|
|
2669
2756
|
},
|
|
2670
2757
|
|
|
2671
|
-
toJSON(message:
|
|
2758
|
+
toJSON(message: DataDescriptor): unknown {
|
|
2672
2759
|
const obj: any = {};
|
|
2673
2760
|
message.name !== undefined && (obj.name = message.name);
|
|
2674
|
-
message.unit !== undefined && (obj.unit = message.unit);
|
|
2675
2761
|
message.description !== undefined &&
|
|
2676
2762
|
(obj.description = message.description);
|
|
2763
|
+
message.unit !== undefined && (obj.unit = message.unit);
|
|
2677
2764
|
message.sparse !== undefined && (obj.sparse = message.sparse);
|
|
2678
2765
|
return obj;
|
|
2679
2766
|
},
|
|
2680
2767
|
|
|
2681
|
-
fromPartial(object: DeepPartial<
|
|
2682
|
-
const message =
|
|
2768
|
+
fromPartial(object: DeepPartial<DataDescriptor>): DataDescriptor {
|
|
2769
|
+
const message = createBaseDataDescriptor();
|
|
2683
2770
|
message.name = object.name ?? "";
|
|
2684
|
-
message.unit = object.unit ?? "";
|
|
2685
2771
|
message.description = object.description ?? "";
|
|
2772
|
+
message.unit = object.unit ?? "";
|
|
2686
2773
|
message.sparse = object.sparse ?? false;
|
|
2687
2774
|
return message;
|
|
2688
2775
|
},
|
|
@@ -2690,13 +2777,14 @@ export const MetricDescriptor = {
|
|
|
2690
2777
|
|
|
2691
2778
|
function createBaseRecordMetaData(): RecordMetaData {
|
|
2692
2779
|
return {
|
|
2693
|
-
|
|
2780
|
+
address: "",
|
|
2781
|
+
contractName: "",
|
|
2694
2782
|
blockNumber: Long.UZERO,
|
|
2695
2783
|
transactionHash: "",
|
|
2784
|
+
chainId: "",
|
|
2696
2785
|
transactionIndex: 0,
|
|
2697
2786
|
logIndex: 0,
|
|
2698
|
-
|
|
2699
|
-
descriptor: undefined,
|
|
2787
|
+
dataDescriptor: undefined,
|
|
2700
2788
|
labels: {},
|
|
2701
2789
|
};
|
|
2702
2790
|
}
|
|
@@ -2706,8 +2794,11 @@ export const RecordMetaData = {
|
|
|
2706
2794
|
message: RecordMetaData,
|
|
2707
2795
|
writer: _m0.Writer = _m0.Writer.create()
|
|
2708
2796
|
): _m0.Writer {
|
|
2709
|
-
if (message.
|
|
2710
|
-
writer.uint32(10).string(message.
|
|
2797
|
+
if (message.address !== "") {
|
|
2798
|
+
writer.uint32(10).string(message.address);
|
|
2799
|
+
}
|
|
2800
|
+
if (message.contractName !== "") {
|
|
2801
|
+
writer.uint32(74).string(message.contractName);
|
|
2711
2802
|
}
|
|
2712
2803
|
if (!message.blockNumber.isZero()) {
|
|
2713
2804
|
writer.uint32(16).uint64(message.blockNumber);
|
|
@@ -2715,18 +2806,18 @@ export const RecordMetaData = {
|
|
|
2715
2806
|
if (message.transactionHash !== "") {
|
|
2716
2807
|
writer.uint32(50).string(message.transactionHash);
|
|
2717
2808
|
}
|
|
2809
|
+
if (message.chainId !== "") {
|
|
2810
|
+
writer.uint32(42).string(message.chainId);
|
|
2811
|
+
}
|
|
2718
2812
|
if (message.transactionIndex !== 0) {
|
|
2719
2813
|
writer.uint32(24).int32(message.transactionIndex);
|
|
2720
2814
|
}
|
|
2721
2815
|
if (message.logIndex !== 0) {
|
|
2722
2816
|
writer.uint32(32).int32(message.logIndex);
|
|
2723
2817
|
}
|
|
2724
|
-
if (message.
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
if (message.descriptor !== undefined) {
|
|
2728
|
-
MetricDescriptor.encode(
|
|
2729
|
-
message.descriptor,
|
|
2818
|
+
if (message.dataDescriptor !== undefined) {
|
|
2819
|
+
DataDescriptor.encode(
|
|
2820
|
+
message.dataDescriptor,
|
|
2730
2821
|
writer.uint32(66).fork()
|
|
2731
2822
|
).ldelim();
|
|
2732
2823
|
}
|
|
@@ -2747,7 +2838,10 @@ export const RecordMetaData = {
|
|
|
2747
2838
|
const tag = reader.uint32();
|
|
2748
2839
|
switch (tag >>> 3) {
|
|
2749
2840
|
case 1:
|
|
2750
|
-
message.
|
|
2841
|
+
message.address = reader.string();
|
|
2842
|
+
break;
|
|
2843
|
+
case 9:
|
|
2844
|
+
message.contractName = reader.string();
|
|
2751
2845
|
break;
|
|
2752
2846
|
case 2:
|
|
2753
2847
|
message.blockNumber = reader.uint64() as Long;
|
|
@@ -2755,17 +2849,20 @@ export const RecordMetaData = {
|
|
|
2755
2849
|
case 6:
|
|
2756
2850
|
message.transactionHash = reader.string();
|
|
2757
2851
|
break;
|
|
2852
|
+
case 5:
|
|
2853
|
+
message.chainId = reader.string();
|
|
2854
|
+
break;
|
|
2758
2855
|
case 3:
|
|
2759
2856
|
message.transactionIndex = reader.int32();
|
|
2760
2857
|
break;
|
|
2761
2858
|
case 4:
|
|
2762
2859
|
message.logIndex = reader.int32();
|
|
2763
2860
|
break;
|
|
2764
|
-
case 5:
|
|
2765
|
-
message.chainId = reader.string();
|
|
2766
|
-
break;
|
|
2767
2861
|
case 8:
|
|
2768
|
-
message.
|
|
2862
|
+
message.dataDescriptor = DataDescriptor.decode(
|
|
2863
|
+
reader,
|
|
2864
|
+
reader.uint32()
|
|
2865
|
+
);
|
|
2769
2866
|
break;
|
|
2770
2867
|
case 7:
|
|
2771
2868
|
const entry7 = RecordMetaData_LabelsEntry.decode(
|
|
@@ -2786,8 +2883,9 @@ export const RecordMetaData = {
|
|
|
2786
2883
|
|
|
2787
2884
|
fromJSON(object: any): RecordMetaData {
|
|
2788
2885
|
return {
|
|
2789
|
-
|
|
2790
|
-
|
|
2886
|
+
address: isSet(object.address) ? String(object.address) : "",
|
|
2887
|
+
contractName: isSet(object.contractName)
|
|
2888
|
+
? String(object.contractName)
|
|
2791
2889
|
: "",
|
|
2792
2890
|
blockNumber: isSet(object.blockNumber)
|
|
2793
2891
|
? Long.fromValue(object.blockNumber)
|
|
@@ -2795,13 +2893,13 @@ export const RecordMetaData = {
|
|
|
2795
2893
|
transactionHash: isSet(object.transactionHash)
|
|
2796
2894
|
? String(object.transactionHash)
|
|
2797
2895
|
: "",
|
|
2896
|
+
chainId: isSet(object.chainId) ? String(object.chainId) : "",
|
|
2798
2897
|
transactionIndex: isSet(object.transactionIndex)
|
|
2799
2898
|
? Number(object.transactionIndex)
|
|
2800
2899
|
: 0,
|
|
2801
2900
|
logIndex: isSet(object.logIndex) ? Number(object.logIndex) : 0,
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
? MetricDescriptor.fromJSON(object.descriptor)
|
|
2901
|
+
dataDescriptor: isSet(object.dataDescriptor)
|
|
2902
|
+
? DataDescriptor.fromJSON(object.dataDescriptor)
|
|
2805
2903
|
: undefined,
|
|
2806
2904
|
labels: isObject(object.labels)
|
|
2807
2905
|
? Object.entries(object.labels).reduce<{ [key: string]: string }>(
|
|
@@ -2817,20 +2915,21 @@ export const RecordMetaData = {
|
|
|
2817
2915
|
|
|
2818
2916
|
toJSON(message: RecordMetaData): unknown {
|
|
2819
2917
|
const obj: any = {};
|
|
2820
|
-
message.
|
|
2821
|
-
|
|
2918
|
+
message.address !== undefined && (obj.address = message.address);
|
|
2919
|
+
message.contractName !== undefined &&
|
|
2920
|
+
(obj.contractName = message.contractName);
|
|
2822
2921
|
message.blockNumber !== undefined &&
|
|
2823
2922
|
(obj.blockNumber = (message.blockNumber || Long.UZERO).toString());
|
|
2824
2923
|
message.transactionHash !== undefined &&
|
|
2825
2924
|
(obj.transactionHash = message.transactionHash);
|
|
2925
|
+
message.chainId !== undefined && (obj.chainId = message.chainId);
|
|
2826
2926
|
message.transactionIndex !== undefined &&
|
|
2827
2927
|
(obj.transactionIndex = Math.round(message.transactionIndex));
|
|
2828
2928
|
message.logIndex !== undefined &&
|
|
2829
2929
|
(obj.logIndex = Math.round(message.logIndex));
|
|
2830
|
-
message.
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
? MetricDescriptor.toJSON(message.descriptor)
|
|
2930
|
+
message.dataDescriptor !== undefined &&
|
|
2931
|
+
(obj.dataDescriptor = message.dataDescriptor
|
|
2932
|
+
? DataDescriptor.toJSON(message.dataDescriptor)
|
|
2834
2933
|
: undefined);
|
|
2835
2934
|
obj.labels = {};
|
|
2836
2935
|
if (message.labels) {
|
|
@@ -2843,18 +2942,19 @@ export const RecordMetaData = {
|
|
|
2843
2942
|
|
|
2844
2943
|
fromPartial(object: DeepPartial<RecordMetaData>): RecordMetaData {
|
|
2845
2944
|
const message = createBaseRecordMetaData();
|
|
2846
|
-
message.
|
|
2945
|
+
message.address = object.address ?? "";
|
|
2946
|
+
message.contractName = object.contractName ?? "";
|
|
2847
2947
|
message.blockNumber =
|
|
2848
2948
|
object.blockNumber !== undefined && object.blockNumber !== null
|
|
2849
2949
|
? Long.fromValue(object.blockNumber)
|
|
2850
2950
|
: Long.UZERO;
|
|
2851
2951
|
message.transactionHash = object.transactionHash ?? "";
|
|
2952
|
+
message.chainId = object.chainId ?? "";
|
|
2852
2953
|
message.transactionIndex = object.transactionIndex ?? 0;
|
|
2853
2954
|
message.logIndex = object.logIndex ?? 0;
|
|
2854
|
-
message.
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
? MetricDescriptor.fromPartial(object.descriptor)
|
|
2955
|
+
message.dataDescriptor =
|
|
2956
|
+
object.dataDescriptor !== undefined && object.dataDescriptor !== null
|
|
2957
|
+
? DataDescriptor.fromPartial(object.dataDescriptor)
|
|
2858
2958
|
: undefined;
|
|
2859
2959
|
message.labels = Object.entries(object.labels ?? {}).reduce<{
|
|
2860
2960
|
[key: string]: string;
|
|
@@ -3365,7 +3465,6 @@ export const CounterResult = {
|
|
|
3365
3465
|
|
|
3366
3466
|
function createBaseLogResult(): LogResult {
|
|
3367
3467
|
return {
|
|
3368
|
-
name: "",
|
|
3369
3468
|
metadata: undefined,
|
|
3370
3469
|
level: 0,
|
|
3371
3470
|
message: "",
|
|
@@ -3379,9 +3478,6 @@ export const LogResult = {
|
|
|
3379
3478
|
message: LogResult,
|
|
3380
3479
|
writer: _m0.Writer = _m0.Writer.create()
|
|
3381
3480
|
): _m0.Writer {
|
|
3382
|
-
if (message.name !== "") {
|
|
3383
|
-
writer.uint32(42).string(message.name);
|
|
3384
|
-
}
|
|
3385
3481
|
if (message.metadata !== undefined) {
|
|
3386
3482
|
RecordMetaData.encode(
|
|
3387
3483
|
message.metadata,
|
|
@@ -3413,9 +3509,6 @@ export const LogResult = {
|
|
|
3413
3509
|
while (reader.pos < end) {
|
|
3414
3510
|
const tag = reader.uint32();
|
|
3415
3511
|
switch (tag >>> 3) {
|
|
3416
|
-
case 5:
|
|
3417
|
-
message.name = reader.string();
|
|
3418
|
-
break;
|
|
3419
3512
|
case 1:
|
|
3420
3513
|
message.metadata = RecordMetaData.decode(reader, reader.uint32());
|
|
3421
3514
|
break;
|
|
@@ -3441,7 +3534,6 @@ export const LogResult = {
|
|
|
3441
3534
|
|
|
3442
3535
|
fromJSON(object: any): LogResult {
|
|
3443
3536
|
return {
|
|
3444
|
-
name: isSet(object.name) ? String(object.name) : "",
|
|
3445
3537
|
metadata: isSet(object.metadata)
|
|
3446
3538
|
? RecordMetaData.fromJSON(object.metadata)
|
|
3447
3539
|
: undefined,
|
|
@@ -3456,7 +3548,6 @@ export const LogResult = {
|
|
|
3456
3548
|
|
|
3457
3549
|
toJSON(message: LogResult): unknown {
|
|
3458
3550
|
const obj: any = {};
|
|
3459
|
-
message.name !== undefined && (obj.name = message.name);
|
|
3460
3551
|
message.metadata !== undefined &&
|
|
3461
3552
|
(obj.metadata = message.metadata
|
|
3462
3553
|
? RecordMetaData.toJSON(message.metadata)
|
|
@@ -3473,7 +3564,6 @@ export const LogResult = {
|
|
|
3473
3564
|
|
|
3474
3565
|
fromPartial(object: DeepPartial<LogResult>): LogResult {
|
|
3475
3566
|
const message = createBaseLogResult();
|
|
3476
|
-
message.name = object.name ?? "";
|
|
3477
3567
|
message.metadata =
|
|
3478
3568
|
object.metadata !== undefined && object.metadata !== null
|
|
3479
3569
|
? RecordMetaData.fromPartial(object.metadata)
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export { ProcessorServiceImpl } from './service'
|
|
2
2
|
export { getProvider, setProvider, DummyProvider } from './provider'
|
|
3
|
-
export { ContractNamer } from './contract-namer'
|
|
4
3
|
export { transformEtherError } from './error'
|
|
5
4
|
export { ProcessorState } from './processor-state'
|
|
6
5
|
export { EthersError } from './error'
|
|
7
6
|
|
|
8
|
-
export { getProcessor, addProcessor, getContractByABI, addContractByABI
|
|
7
|
+
export { getProcessor, addProcessor, getContractByABI, addContractByABI } from './binds'
|
|
9
8
|
|
|
10
9
|
export * from './gen'
|
|
11
10
|
|
package/src/processor-state.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { AptosBaseProcessor } from './aptos'
|
|
11
11
|
|
|
12
12
|
import { BaseContract } from 'ethers'
|
|
13
|
-
import { TemplateInstance } from './gen
|
|
13
|
+
import { TemplateInstance } from './gen'
|
|
14
14
|
import { Provider } from '@ethersproject/providers'
|
|
15
15
|
|
|
16
16
|
export class ProcessorState {
|
package/src/service.ts
CHANGED
|
@@ -28,6 +28,8 @@ import { Empty } from './gen/google/protobuf/empty'
|
|
|
28
28
|
import Long from 'long'
|
|
29
29
|
import { TextDecoder } from 'util'
|
|
30
30
|
import { Trace } from './core'
|
|
31
|
+
import { SolanaInstructionHandler } from 'core/solana-processor'
|
|
32
|
+
import { Instruction } from '@project-serum/anchor'
|
|
31
33
|
|
|
32
34
|
const DEFAULT_MAX_BLOCK = Long.ZERO
|
|
33
35
|
|
|
@@ -65,6 +67,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
65
67
|
config: undefined,
|
|
66
68
|
contractConfigs: this.contractConfigs,
|
|
67
69
|
templateInstances: this.templateInstances,
|
|
70
|
+
accountConfigs: [],
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
|
|
@@ -211,7 +214,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
211
214
|
const contractConfig: ContractConfig = {
|
|
212
215
|
processorType: USER_PROCESSOR,
|
|
213
216
|
contract: {
|
|
214
|
-
name: aptosProcessor.
|
|
217
|
+
name: aptosProcessor.moduleName,
|
|
215
218
|
chainId: aptosProcessor.getChainId(),
|
|
216
219
|
address: aptosProcessor.config.address,
|
|
217
220
|
abi: '',
|
|
@@ -464,26 +467,30 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
464
467
|
new Promise((resolve, _) => {
|
|
465
468
|
for (const processor of global.PROCESSOR_STATE.solanaProcessors) {
|
|
466
469
|
if (processor.address === instruction.programAccountId) {
|
|
467
|
-
let
|
|
470
|
+
let parsedInstruction: Instruction | null = null
|
|
468
471
|
if (instruction.parsed) {
|
|
469
|
-
|
|
470
|
-
JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
471
|
-
instruction.slot
|
|
472
|
+
parsedInstruction = processor.getParsedInstruction(
|
|
473
|
+
JSON.parse(new TextDecoder().decode(instruction.parsed))
|
|
472
474
|
)
|
|
473
475
|
} else if (instruction.instructionData) {
|
|
474
|
-
|
|
475
|
-
}
|
|
476
|
+
parsedInstruction = processor.getParsedInstruction(instruction.instructionData)
|
|
477
|
+
}
|
|
478
|
+
if (parsedInstruction == null) {
|
|
476
479
|
continue
|
|
477
480
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
res.logs.forEach((l) => result.logs.push(l))
|
|
482
|
-
} else {
|
|
483
|
-
console.warn(
|
|
484
|
-
`Failed to decode the instruction: ${instruction.instructionData} with slot: ${instruction.slot}`
|
|
485
|
-
)
|
|
481
|
+
const insHandler = processor.getInstructionHandler(parsedInstruction)
|
|
482
|
+
if (insHandler == null) {
|
|
483
|
+
continue
|
|
486
484
|
}
|
|
485
|
+
const res = processor.handleInstruction(
|
|
486
|
+
parsedInstruction,
|
|
487
|
+
instruction.accounts,
|
|
488
|
+
insHandler,
|
|
489
|
+
instruction.slot
|
|
490
|
+
)
|
|
491
|
+
res.gauges.forEach((g) => result.gauges.push(g))
|
|
492
|
+
res.counters.forEach((c) => result.counters.push(c))
|
|
493
|
+
res.logs.forEach((l) => result.logs.push(l))
|
|
487
494
|
}
|
|
488
495
|
}
|
|
489
496
|
resolve()
|