@sentio/sdk 0.1.2 → 0.1.5

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.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ProcessorDefinition = exports.CounterResult = exports.HistogramResult = exports.MetricValue = exports.RecordMetaData_LabelsEntry = exports.RecordMetaData = exports.O11yResult = exports.Block = exports.Transaction = exports.Log = exports.LogBinding = exports.ProcessBlockResponse = exports.ProcessBlockRequest = exports.ProcessTransactionResponse = exports.ProcessTransactionRequest = exports.ProcessLogResponse = exports.ProcessLogRequest = exports.Topic = exports.TransactionHandlerConfig = exports.HandlerCondition = exports.LogHandlerConfig = exports.BlockHandlerConfig = exports.ContractInfo = exports.ContractConfig = exports.ProcessConfigResponse = exports.ProcessConfigRequest = exports.ProjectConfig = void 0;
6
+ exports.ProcessorDefinition = exports.CounterResult = exports.HistogramResult = exports.MetricValue = exports.RecordMetaData_LabelsEntry = exports.RecordMetaData = exports.O11yResult = exports.Block = exports.Instruction = exports.Transaction = exports.Log = exports.LogBinding = exports.ProcessBlockResponse = exports.ProcessBlockRequest = exports.ProcessInstructionResponse = exports.ProcessTransactionResponse = exports.ProcessInstructionRequest = exports.ProcessTransactionRequest = exports.ProcessLogResponse = exports.ProcessLogRequest = exports.Topic = exports.InstructionHandlerConfig = exports.TransactionHandlerConfig = exports.HandlerCondition = exports.LogHandlerConfig = exports.BlockHandlerConfig = exports.ContractInfo = exports.ContractConfig = exports.ProcessConfigResponse = exports.ProcessConfigRequest = exports.ProjectConfig = void 0;
7
7
  const long_1 = __importDefault(require("long"));
8
8
  const empty_1 = require("../../google/protobuf/empty");
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
@@ -168,6 +168,8 @@ function createBaseContractConfig() {
168
168
  startBlock: long_1.default.UZERO,
169
169
  endBlock: long_1.default.UZERO,
170
170
  chunkSize: 0,
171
+ transactionConfig: [],
172
+ instructionConfig: [],
171
173
  };
172
174
  }
173
175
  exports.ContractConfig = {
@@ -190,6 +192,12 @@ exports.ContractConfig = {
190
192
  if (message.chunkSize !== 0) {
191
193
  writer.uint32(48).int32(message.chunkSize);
192
194
  }
195
+ for (const v of message.transactionConfig) {
196
+ exports.TransactionHandlerConfig.encode(v, writer.uint32(58).fork()).ldelim();
197
+ }
198
+ for (const v of message.instructionConfig) {
199
+ exports.InstructionHandlerConfig.encode(v, writer.uint32(66).fork()).ldelim();
200
+ }
193
201
  return writer;
194
202
  },
195
203
  decode(input, length) {
@@ -217,6 +225,12 @@ exports.ContractConfig = {
217
225
  case 6:
218
226
  message.chunkSize = reader.int32();
219
227
  break;
228
+ case 7:
229
+ message.transactionConfig.push(exports.TransactionHandlerConfig.decode(reader, reader.uint32()));
230
+ break;
231
+ case 8:
232
+ message.instructionConfig.push(exports.InstructionHandlerConfig.decode(reader, reader.uint32()));
233
+ break;
220
234
  default:
221
235
  reader.skipType(tag & 7);
222
236
  break;
@@ -242,6 +256,12 @@ exports.ContractConfig = {
242
256
  ? long_1.default.fromValue(object.endBlock)
243
257
  : long_1.default.UZERO,
244
258
  chunkSize: isSet(object.chunkSize) ? Number(object.chunkSize) : 0,
259
+ transactionConfig: Array.isArray(object?.transactionConfig)
260
+ ? object.transactionConfig.map((e) => exports.TransactionHandlerConfig.fromJSON(e))
261
+ : [],
262
+ instructionConfig: Array.isArray(object?.instructionConfig)
263
+ ? object.instructionConfig.map((e) => exports.InstructionHandlerConfig.fromJSON(e))
264
+ : [],
245
265
  };
246
266
  },
247
267
  toJSON(message) {
@@ -266,6 +286,18 @@ exports.ContractConfig = {
266
286
  (obj.endBlock = (message.endBlock || long_1.default.UZERO).toString());
267
287
  message.chunkSize !== undefined &&
268
288
  (obj.chunkSize = Math.round(message.chunkSize));
289
+ if (message.transactionConfig) {
290
+ obj.transactionConfig = message.transactionConfig.map((e) => e ? exports.TransactionHandlerConfig.toJSON(e) : undefined);
291
+ }
292
+ else {
293
+ obj.transactionConfig = [];
294
+ }
295
+ if (message.instructionConfig) {
296
+ obj.instructionConfig = message.instructionConfig.map((e) => e ? exports.InstructionHandlerConfig.toJSON(e) : undefined);
297
+ }
298
+ else {
299
+ obj.instructionConfig = [];
300
+ }
269
301
  return obj;
270
302
  },
271
303
  fromPartial(object) {
@@ -289,6 +321,10 @@ exports.ContractConfig = {
289
321
  ? long_1.default.fromValue(object.endBlock)
290
322
  : long_1.default.UZERO;
291
323
  message.chunkSize = object.chunkSize ?? 0;
324
+ message.transactionConfig =
325
+ object.transactionConfig?.map((e) => exports.TransactionHandlerConfig.fromPartial(e)) || [];
326
+ message.instructionConfig =
327
+ object.instructionConfig?.map((e) => exports.InstructionHandlerConfig.fromPartial(e)) || [];
292
328
  return message;
293
329
  },
294
330
  };
@@ -562,6 +598,59 @@ exports.TransactionHandlerConfig = {
562
598
  return message;
563
599
  },
564
600
  };
601
+ function createBaseInstructionHandlerConfig() {
602
+ return { handlerName: "", address: "" };
603
+ }
604
+ exports.InstructionHandlerConfig = {
605
+ encode(message, writer = minimal_1.default.Writer.create()) {
606
+ if (message.handlerName !== "") {
607
+ writer.uint32(10).string(message.handlerName);
608
+ }
609
+ if (message.address !== "") {
610
+ writer.uint32(18).string(message.address);
611
+ }
612
+ return writer;
613
+ },
614
+ decode(input, length) {
615
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
616
+ let end = length === undefined ? reader.len : reader.pos + length;
617
+ const message = createBaseInstructionHandlerConfig();
618
+ while (reader.pos < end) {
619
+ const tag = reader.uint32();
620
+ switch (tag >>> 3) {
621
+ case 1:
622
+ message.handlerName = reader.string();
623
+ break;
624
+ case 2:
625
+ message.address = reader.string();
626
+ break;
627
+ default:
628
+ reader.skipType(tag & 7);
629
+ break;
630
+ }
631
+ }
632
+ return message;
633
+ },
634
+ fromJSON(object) {
635
+ return {
636
+ handlerName: isSet(object.handlerName) ? String(object.handlerName) : "",
637
+ address: isSet(object.address) ? String(object.address) : "",
638
+ };
639
+ },
640
+ toJSON(message) {
641
+ const obj = {};
642
+ message.handlerName !== undefined &&
643
+ (obj.handlerName = message.handlerName);
644
+ message.address !== undefined && (obj.address = message.address);
645
+ return obj;
646
+ },
647
+ fromPartial(object) {
648
+ const message = createBaseInstructionHandlerConfig();
649
+ message.handlerName = object.handlerName ?? "";
650
+ message.address = object.address ?? "";
651
+ return message;
652
+ },
653
+ };
565
654
  function createBaseTopic() {
566
655
  return { hashes: [] };
567
656
  }
@@ -764,6 +853,57 @@ exports.ProcessTransactionRequest = {
764
853
  return message;
765
854
  },
766
855
  };
856
+ function createBaseProcessInstructionRequest() {
857
+ return { instruction: undefined };
858
+ }
859
+ exports.ProcessInstructionRequest = {
860
+ encode(message, writer = minimal_1.default.Writer.create()) {
861
+ if (message.instruction !== undefined) {
862
+ exports.Instruction.encode(message.instruction, writer.uint32(10).fork()).ldelim();
863
+ }
864
+ return writer;
865
+ },
866
+ decode(input, length) {
867
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
868
+ let end = length === undefined ? reader.len : reader.pos + length;
869
+ const message = createBaseProcessInstructionRequest();
870
+ while (reader.pos < end) {
871
+ const tag = reader.uint32();
872
+ switch (tag >>> 3) {
873
+ case 1:
874
+ message.instruction = exports.Instruction.decode(reader, reader.uint32());
875
+ break;
876
+ default:
877
+ reader.skipType(tag & 7);
878
+ break;
879
+ }
880
+ }
881
+ return message;
882
+ },
883
+ fromJSON(object) {
884
+ return {
885
+ instruction: isSet(object.instruction)
886
+ ? exports.Instruction.fromJSON(object.instruction)
887
+ : undefined,
888
+ };
889
+ },
890
+ toJSON(message) {
891
+ const obj = {};
892
+ message.instruction !== undefined &&
893
+ (obj.instruction = message.instruction
894
+ ? exports.Instruction.toJSON(message.instruction)
895
+ : undefined);
896
+ return obj;
897
+ },
898
+ fromPartial(object) {
899
+ const message = createBaseProcessInstructionRequest();
900
+ message.instruction =
901
+ object.instruction !== undefined && object.instruction !== null
902
+ ? exports.Instruction.fromPartial(object.instruction)
903
+ : undefined;
904
+ return message;
905
+ },
906
+ };
767
907
  function createBaseProcessTransactionResponse() {
768
908
  return { result: undefined };
769
909
  }
@@ -815,6 +955,57 @@ exports.ProcessTransactionResponse = {
815
955
  return message;
816
956
  },
817
957
  };
958
+ function createBaseProcessInstructionResponse() {
959
+ return { result: undefined };
960
+ }
961
+ exports.ProcessInstructionResponse = {
962
+ encode(message, writer = minimal_1.default.Writer.create()) {
963
+ if (message.result !== undefined) {
964
+ exports.O11yResult.encode(message.result, writer.uint32(10).fork()).ldelim();
965
+ }
966
+ return writer;
967
+ },
968
+ decode(input, length) {
969
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
970
+ let end = length === undefined ? reader.len : reader.pos + length;
971
+ const message = createBaseProcessInstructionResponse();
972
+ while (reader.pos < end) {
973
+ const tag = reader.uint32();
974
+ switch (tag >>> 3) {
975
+ case 1:
976
+ message.result = exports.O11yResult.decode(reader, reader.uint32());
977
+ break;
978
+ default:
979
+ reader.skipType(tag & 7);
980
+ break;
981
+ }
982
+ }
983
+ return message;
984
+ },
985
+ fromJSON(object) {
986
+ return {
987
+ result: isSet(object.result)
988
+ ? exports.O11yResult.fromJSON(object.result)
989
+ : undefined,
990
+ };
991
+ },
992
+ toJSON(message) {
993
+ const obj = {};
994
+ message.result !== undefined &&
995
+ (obj.result = message.result
996
+ ? exports.O11yResult.toJSON(message.result)
997
+ : undefined);
998
+ return obj;
999
+ },
1000
+ fromPartial(object) {
1001
+ const message = createBaseProcessInstructionResponse();
1002
+ message.result =
1003
+ object.result !== undefined && object.result !== null
1004
+ ? exports.O11yResult.fromPartial(object.result)
1005
+ : undefined;
1006
+ return message;
1007
+ },
1008
+ };
818
1009
  function createBaseProcessBlockRequest() {
819
1010
  return { block: undefined, chainId: 0 };
820
1011
  }
@@ -1025,7 +1216,7 @@ exports.Log = {
1025
1216
  },
1026
1217
  };
1027
1218
  function createBaseTransaction() {
1028
- return { txHash: "", raw: new Uint8Array() };
1219
+ return { txHash: "", raw: new Uint8Array(), programAccountId: "" };
1029
1220
  }
1030
1221
  exports.Transaction = {
1031
1222
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -1035,6 +1226,9 @@ exports.Transaction = {
1035
1226
  if (message.raw.length !== 0) {
1036
1227
  writer.uint32(18).bytes(message.raw);
1037
1228
  }
1229
+ if (message.programAccountId !== "") {
1230
+ writer.uint32(26).string(message.programAccountId);
1231
+ }
1038
1232
  return writer;
1039
1233
  },
1040
1234
  decode(input, length) {
@@ -1050,6 +1244,9 @@ exports.Transaction = {
1050
1244
  case 2:
1051
1245
  message.raw = reader.bytes();
1052
1246
  break;
1247
+ case 3:
1248
+ message.programAccountId = reader.string();
1249
+ break;
1053
1250
  default:
1054
1251
  reader.skipType(tag & 7);
1055
1252
  break;
@@ -1061,6 +1258,9 @@ exports.Transaction = {
1061
1258
  return {
1062
1259
  txHash: isSet(object.txHash) ? String(object.txHash) : "",
1063
1260
  raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(),
1261
+ programAccountId: isSet(object.programAccountId)
1262
+ ? String(object.programAccountId)
1263
+ : "",
1064
1264
  };
1065
1265
  },
1066
1266
  toJSON(message) {
@@ -1068,12 +1268,83 @@ exports.Transaction = {
1068
1268
  message.txHash !== undefined && (obj.txHash = message.txHash);
1069
1269
  message.raw !== undefined &&
1070
1270
  (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array()));
1271
+ message.programAccountId !== undefined &&
1272
+ (obj.programAccountId = message.programAccountId);
1071
1273
  return obj;
1072
1274
  },
1073
1275
  fromPartial(object) {
1074
1276
  const message = createBaseTransaction();
1075
1277
  message.txHash = object.txHash ?? "";
1076
1278
  message.raw = object.raw ?? new Uint8Array();
1279
+ message.programAccountId = object.programAccountId ?? "";
1280
+ return message;
1281
+ },
1282
+ };
1283
+ function createBaseInstruction() {
1284
+ return { instructionData: "", raw: new Uint8Array(), programAccountId: "" };
1285
+ }
1286
+ exports.Instruction = {
1287
+ encode(message, writer = minimal_1.default.Writer.create()) {
1288
+ if (message.instructionData !== "") {
1289
+ writer.uint32(10).string(message.instructionData);
1290
+ }
1291
+ if (message.raw.length !== 0) {
1292
+ writer.uint32(18).bytes(message.raw);
1293
+ }
1294
+ if (message.programAccountId !== "") {
1295
+ writer.uint32(26).string(message.programAccountId);
1296
+ }
1297
+ return writer;
1298
+ },
1299
+ decode(input, length) {
1300
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1301
+ let end = length === undefined ? reader.len : reader.pos + length;
1302
+ const message = createBaseInstruction();
1303
+ while (reader.pos < end) {
1304
+ const tag = reader.uint32();
1305
+ switch (tag >>> 3) {
1306
+ case 1:
1307
+ message.instructionData = reader.string();
1308
+ break;
1309
+ case 2:
1310
+ message.raw = reader.bytes();
1311
+ break;
1312
+ case 3:
1313
+ message.programAccountId = reader.string();
1314
+ break;
1315
+ default:
1316
+ reader.skipType(tag & 7);
1317
+ break;
1318
+ }
1319
+ }
1320
+ return message;
1321
+ },
1322
+ fromJSON(object) {
1323
+ return {
1324
+ instructionData: isSet(object.instructionData)
1325
+ ? String(object.instructionData)
1326
+ : "",
1327
+ raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(),
1328
+ programAccountId: isSet(object.programAccountId)
1329
+ ? String(object.programAccountId)
1330
+ : "",
1331
+ };
1332
+ },
1333
+ toJSON(message) {
1334
+ const obj = {};
1335
+ message.instructionData !== undefined &&
1336
+ (obj.instructionData = message.instructionData);
1337
+ message.raw !== undefined &&
1338
+ (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array()));
1339
+ message.programAccountId !== undefined &&
1340
+ (obj.programAccountId = message.programAccountId);
1341
+ return obj;
1342
+ },
1343
+ fromPartial(object) {
1344
+ const message = createBaseInstruction();
1345
+ message.instructionData = object.instructionData ?? "";
1346
+ message.raw = object.raw ?? new Uint8Array();
1347
+ message.programAccountId = object.programAccountId ?? "";
1077
1348
  return message;
1078
1349
  },
1079
1350
  };
@@ -1630,6 +1901,14 @@ exports.ProcessorDefinition = {
1630
1901
  responseStream: false,
1631
1902
  options: {},
1632
1903
  },
1904
+ processInstruction: {
1905
+ name: "ProcessInstruction",
1906
+ requestType: exports.ProcessInstructionRequest,
1907
+ requestStream: false,
1908
+ responseType: exports.ProcessInstructionResponse,
1909
+ responseStream: false,
1910
+ options: {},
1911
+ },
1633
1912
  },
1634
1913
  };
1635
1914
  var globalThis = (() => {