@taquito/rpc 10.2.0 → 11.0.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.
@@ -152,11 +152,16 @@
152
152
  }
153
153
  };
154
154
  RpcClientCache.prototype.formatCacheKey = function (rpcUrl, rpcMethodName, rpcMethodParams, rpcMethodData) {
155
- var paramsToString = "";
155
+ var paramsToString = '';
156
156
  rpcMethodParams.forEach(function (param) {
157
- paramsToString = (typeof param === 'object') ? paramsToString + JSON.stringify(param) + '/' : paramsToString + param + '/';
157
+ paramsToString =
158
+ typeof param === 'object'
159
+ ? paramsToString + JSON.stringify(param) + '/'
160
+ : paramsToString + param + '/';
158
161
  });
159
- return rpcMethodData ? rpcUrl + "/" + rpcMethodName + "/" + paramsToString + "/" + JSON.stringify(rpcMethodData) : rpcUrl + "/" + rpcMethodName + "/" + paramsToString;
162
+ return rpcMethodData
163
+ ? rpcUrl + "/" + rpcMethodName + "/" + paramsToString + "/" + JSON.stringify(rpcMethodData)
164
+ : rpcUrl + "/" + rpcMethodName + "/" + paramsToString;
160
165
  };
161
166
  RpcClientCache.prototype.has = function (key) {
162
167
  return key in this._cache;
@@ -190,16 +195,14 @@
190
195
  return __awaiter(this, void 0, void 0, function () {
191
196
  var key, response;
192
197
  return __generator(this, function (_c) {
193
- switch (_c.label) {
194
- case 0:
195
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlockHash', [block]);
196
- if (!this.has(key)) return [3 /*break*/, 1];
197
- return [2 /*return*/, this.get(key)];
198
- case 1: return [4 /*yield*/, this.rpcClient.getBlockHash({ block: block })];
199
- case 2:
200
- response = _c.sent();
201
- this.put(key, response);
202
- return [2 /*return*/, response];
198
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlockHash', [block]);
199
+ if (this.has(key)) {
200
+ return [2 /*return*/, this.get(key)];
201
+ }
202
+ else {
203
+ response = this.rpcClient.getBlockHash({ block: block });
204
+ this.put(key, response);
205
+ return [2 /*return*/, response];
203
206
  }
204
207
  });
205
208
  });
@@ -217,16 +220,14 @@
217
220
  return __awaiter(this, void 0, void 0, function () {
218
221
  var key, response;
219
222
  return __generator(this, function (_c) {
220
- switch (_c.label) {
221
- case 0:
222
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getLiveBlocks', [block]);
223
- if (!this.has(key)) return [3 /*break*/, 1];
224
- return [2 /*return*/, this.get(key)];
225
- case 1: return [4 /*yield*/, this.rpcClient.getLiveBlocks({ block: block })];
226
- case 2:
227
- response = _c.sent();
228
- this.put(key, response);
229
- return [2 /*return*/, response];
223
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getLiveBlocks', [block]);
224
+ if (this.has(key)) {
225
+ return [2 /*return*/, this.get(key)];
226
+ }
227
+ else {
228
+ response = this.rpcClient.getLiveBlocks({ block: block });
229
+ this.put(key, response);
230
+ return [2 /*return*/, response];
230
231
  }
231
232
  });
232
233
  });
@@ -245,16 +246,14 @@
245
246
  return __awaiter(this, void 0, void 0, function () {
246
247
  var key, response;
247
248
  return __generator(this, function (_c) {
248
- switch (_c.label) {
249
- case 0:
250
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBalance', [block, address]);
251
- if (!this.has(key)) return [3 /*break*/, 1];
252
- return [2 /*return*/, this.get(key)];
253
- case 1: return [4 /*yield*/, this.rpcClient.getBalance(address, { block: block })];
254
- case 2:
255
- response = _c.sent();
256
- this.put(key, response);
257
- return [2 /*return*/, response];
249
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBalance', [block, address]);
250
+ if (this.has(key)) {
251
+ return [2 /*return*/, this.get(key)];
252
+ }
253
+ else {
254
+ response = this.rpcClient.getBalance(address, { block: block });
255
+ this.put(key, response);
256
+ return [2 /*return*/, response];
258
257
  }
259
258
  });
260
259
  });
@@ -273,16 +272,14 @@
273
272
  return __awaiter(this, void 0, void 0, function () {
274
273
  var key, response;
275
274
  return __generator(this, function (_c) {
276
- switch (_c.label) {
277
- case 0:
278
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getStorage', [block, address]);
279
- if (!this.has(key)) return [3 /*break*/, 1];
280
- return [2 /*return*/, this.get(key)];
281
- case 1: return [4 /*yield*/, this.rpcClient.getStorage(address, { block: block })];
282
- case 2:
283
- response = _c.sent();
284
- this.put(key, response);
285
- return [2 /*return*/, response];
275
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getStorage', [block, address]);
276
+ if (this.has(key)) {
277
+ return [2 /*return*/, this.get(key)];
278
+ }
279
+ else {
280
+ response = this.rpcClient.getStorage(address, { block: block });
281
+ this.put(key, response);
282
+ return [2 /*return*/, response];
286
283
  }
287
284
  });
288
285
  });
@@ -301,16 +298,45 @@
301
298
  return __awaiter(this, void 0, void 0, function () {
302
299
  var key, response;
303
300
  return __generator(this, function (_c) {
304
- switch (_c.label) {
305
- case 0:
306
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getScript', [block, address]);
307
- if (!this.has(key)) return [3 /*break*/, 1];
308
- return [2 /*return*/, this.get(key)];
309
- case 1: return [4 /*yield*/, this.rpcClient.getScript(address, { block: block })];
310
- case 2:
311
- response = _c.sent();
312
- this.put(key, response);
313
- return [2 /*return*/, response];
301
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getScript', [block, address]);
302
+ if (this.has(key)) {
303
+ return [2 /*return*/, this.get(key)];
304
+ }
305
+ else {
306
+ response = this.rpcClient.getScript(address, { block: block });
307
+ this.put(key, response);
308
+ return [2 /*return*/, response];
309
+ }
310
+ });
311
+ });
312
+ };
313
+ /**
314
+ *
315
+ * @param address contract address from which we want to retrieve the script
316
+ * @param unparsingMode default is { unparsing_mode: "Readable" }
317
+ * @param options contains generic configuration for rpc calls
318
+ *
319
+ * @description Access the script of the contract and normalize it using the requested unparsing mode.
320
+ *
321
+ */
322
+ RpcClientCache.prototype.getNormalizedScript = function (address, unparsingMode, _a) {
323
+ if (unparsingMode === void 0) { unparsingMode = { unparsing_mode: 'Readable' }; }
324
+ var _b = _a === void 0 ? defaultRPCOptions : _a, block = _b.block;
325
+ return __awaiter(this, void 0, void 0, function () {
326
+ var key, response;
327
+ return __generator(this, function (_c) {
328
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getNormalizedScript', [
329
+ block,
330
+ address,
331
+ unparsingMode,
332
+ ]);
333
+ if (this.has(key)) {
334
+ return [2 /*return*/, this.get(key)];
335
+ }
336
+ else {
337
+ response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block: block });
338
+ this.put(key, response);
339
+ return [2 /*return*/, response];
314
340
  }
315
341
  });
316
342
  });
@@ -329,16 +355,14 @@
329
355
  return __awaiter(this, void 0, void 0, function () {
330
356
  var key, response;
331
357
  return __generator(this, function (_c) {
332
- switch (_c.label) {
333
- case 0:
334
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getContract', [block, address]);
335
- if (!this.has(key)) return [3 /*break*/, 1];
336
- return [2 /*return*/, this.get(key)];
337
- case 1: return [4 /*yield*/, this.rpcClient.getContract(address, { block: block })];
338
- case 2:
339
- response = _c.sent();
340
- this.put(key, response);
341
- return [2 /*return*/, response];
358
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getContract', [block, address]);
359
+ if (this.has(key)) {
360
+ return [2 /*return*/, this.get(key)];
361
+ }
362
+ else {
363
+ response = this.rpcClient.getContract(address, { block: block });
364
+ this.put(key, response);
365
+ return [2 /*return*/, response];
342
366
  }
343
367
  });
344
368
  });
@@ -357,16 +381,14 @@
357
381
  return __awaiter(this, void 0, void 0, function () {
358
382
  var key, response;
359
383
  return __generator(this, function (_c) {
360
- switch (_c.label) {
361
- case 0:
362
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getManagerKey', [block, address]);
363
- if (!this.has(key)) return [3 /*break*/, 1];
364
- return [2 /*return*/, this.get(key)];
365
- case 1: return [4 /*yield*/, this.rpcClient.getManagerKey(address, { block: block })];
366
- case 2:
367
- response = _c.sent();
368
- this.put(key, response);
369
- return [2 /*return*/, response];
384
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getManagerKey', [block, address]);
385
+ if (this.has(key)) {
386
+ return [2 /*return*/, this.get(key)];
387
+ }
388
+ else {
389
+ response = this.rpcClient.getManagerKey(address, { block: block });
390
+ this.put(key, response);
391
+ return [2 /*return*/, response];
370
392
  }
371
393
  });
372
394
  });
@@ -385,16 +407,14 @@
385
407
  return __awaiter(this, void 0, void 0, function () {
386
408
  var key, response;
387
409
  return __generator(this, function (_c) {
388
- switch (_c.label) {
389
- case 0:
390
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getDelegate', [block, address]);
391
- if (!this.has(key)) return [3 /*break*/, 1];
392
- return [2 /*return*/, this.get(key)];
393
- case 1: return [4 /*yield*/, this.rpcClient.getDelegate(address, { block: block })];
394
- case 2:
395
- response = _c.sent();
396
- this.put(key, response);
397
- return [2 /*return*/, response];
410
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getDelegate', [block, address]);
411
+ if (this.has(key)) {
412
+ return [2 /*return*/, this.get(key)];
413
+ }
414
+ else {
415
+ response = this.rpcClient.getDelegate(address, { block: block });
416
+ this.put(key, response);
417
+ return [2 /*return*/, response];
398
418
  }
399
419
  });
400
420
  });
@@ -415,16 +435,18 @@
415
435
  return __awaiter(this, void 0, void 0, function () {
416
436
  var keyUrl, response;
417
437
  return __generator(this, function (_c) {
418
- switch (_c.label) {
419
- case 0:
420
- keyUrl = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBigMapKey', [block, address, key]);
421
- if (!this.has(keyUrl)) return [3 /*break*/, 1];
422
- return [2 /*return*/, this.get(keyUrl)];
423
- case 1: return [4 /*yield*/, this.rpcClient.getBigMapKey(address, key, { block: block })];
424
- case 2:
425
- response = _c.sent();
426
- this.put(keyUrl, response);
427
- return [2 /*return*/, response];
438
+ keyUrl = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBigMapKey', [
439
+ block,
440
+ address,
441
+ key,
442
+ ]);
443
+ if (this.has(keyUrl)) {
444
+ return [2 /*return*/, this.get(keyUrl)];
445
+ }
446
+ else {
447
+ response = this.rpcClient.getBigMapKey(address, key, { block: block });
448
+ this.put(keyUrl, response);
449
+ return [2 /*return*/, response];
428
450
  }
429
451
  });
430
452
  });
@@ -444,16 +466,14 @@
444
466
  return __awaiter(this, void 0, void 0, function () {
445
467
  var key, response;
446
468
  return __generator(this, function (_c) {
447
- switch (_c.label) {
448
- case 0:
449
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBigMapExpr', [block, id, expr]);
450
- if (!this.has(key)) return [3 /*break*/, 1];
451
- return [2 /*return*/, this.get(key)];
452
- case 1: return [4 /*yield*/, this.rpcClient.getBigMapExpr(id, expr, { block: block })];
453
- case 2:
454
- response = _c.sent();
455
- this.put(key, response);
456
- return [2 /*return*/, response];
469
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBigMapExpr', [block, id, expr]);
470
+ if (this.has(key)) {
471
+ return [2 /*return*/, this.get(key)];
472
+ }
473
+ else {
474
+ response = this.rpcClient.getBigMapExpr(id, expr, { block: block });
475
+ this.put(key, response);
476
+ return [2 /*return*/, response];
457
477
  }
458
478
  });
459
479
  });
@@ -472,16 +492,14 @@
472
492
  return __awaiter(this, void 0, void 0, function () {
473
493
  var key, response;
474
494
  return __generator(this, function (_c) {
475
- switch (_c.label) {
476
- case 0:
477
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getDelegates', [block, address]);
478
- if (!this.has(key)) return [3 /*break*/, 1];
479
- return [2 /*return*/, this.get(key)];
480
- case 1: return [4 /*yield*/, this.rpcClient.getDelegates(address, { block: block })];
481
- case 2:
482
- response = _c.sent();
483
- this.put(key, response);
484
- return [2 /*return*/, response];
495
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getDelegates', [block, address]);
496
+ if (this.has(key)) {
497
+ return [2 /*return*/, this.get(key)];
498
+ }
499
+ else {
500
+ response = this.rpcClient.getDelegates(address, { block: block });
501
+ this.put(key, response);
502
+ return [2 /*return*/, response];
485
503
  }
486
504
  });
487
505
  });
@@ -499,16 +517,14 @@
499
517
  return __awaiter(this, void 0, void 0, function () {
500
518
  var key, response;
501
519
  return __generator(this, function (_c) {
502
- switch (_c.label) {
503
- case 0:
504
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getConstants', [block]);
505
- if (!this.has(key)) return [3 /*break*/, 1];
506
- return [2 /*return*/, this.get(key)];
507
- case 1: return [4 /*yield*/, this.rpcClient.getConstants({ block: block })];
508
- case 2:
509
- response = _c.sent();
510
- this.put(key, response);
511
- return [2 /*return*/, response];
520
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getConstants', [block]);
521
+ if (this.has(key)) {
522
+ return [2 /*return*/, this.get(key)];
523
+ }
524
+ else {
525
+ response = this.rpcClient.getConstants({ block: block });
526
+ this.put(key, response);
527
+ return [2 /*return*/, response];
512
528
  }
513
529
  });
514
530
  });
@@ -529,16 +545,14 @@
529
545
  return __awaiter(this, void 0, void 0, function () {
530
546
  var key, response;
531
547
  return __generator(this, function (_c) {
532
- switch (_c.label) {
533
- case 0:
534
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlock', [block]);
535
- if (!this.has(key)) return [3 /*break*/, 1];
536
- return [2 /*return*/, this.get(key)];
537
- case 1: return [4 /*yield*/, this.rpcClient.getBlock({ block: block })];
538
- case 2:
539
- response = _c.sent();
540
- this.put(key, response);
541
- return [2 /*return*/, response];
548
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlock', [block]);
549
+ if (this.has(key)) {
550
+ return [2 /*return*/, this.get(key)];
551
+ }
552
+ else {
553
+ response = this.rpcClient.getBlock({ block: block });
554
+ this.put(key, response);
555
+ return [2 /*return*/, response];
542
556
  }
543
557
  });
544
558
  });
@@ -556,16 +570,14 @@
556
570
  return __awaiter(this, void 0, void 0, function () {
557
571
  var key, response;
558
572
  return __generator(this, function (_c) {
559
- switch (_c.label) {
560
- case 0:
561
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlockHeader', [block]);
562
- if (!this.has(key)) return [3 /*break*/, 1];
563
- return [2 /*return*/, this.get(key)];
564
- case 1: return [4 /*yield*/, this.rpcClient.getBlockHeader({ block: block })];
565
- case 2:
566
- response = _c.sent();
567
- this.put(key, response);
568
- return [2 /*return*/, response];
573
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlockHeader', [block]);
574
+ if (this.has(key)) {
575
+ return [2 /*return*/, this.get(key)];
576
+ }
577
+ else {
578
+ response = this.rpcClient.getBlockHeader({ block: block });
579
+ this.put(key, response);
580
+ return [2 /*return*/, response];
569
581
  }
570
582
  });
571
583
  });
@@ -583,16 +595,14 @@
583
595
  return __awaiter(this, void 0, void 0, function () {
584
596
  var key, response;
585
597
  return __generator(this, function (_c) {
586
- switch (_c.label) {
587
- case 0:
588
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlockMetadata', [block]);
589
- if (!this.has(key)) return [3 /*break*/, 1];
590
- return [2 /*return*/, this.get(key)];
591
- case 1: return [4 /*yield*/, this.rpcClient.getBlockMetadata({ block: block })];
592
- case 2:
593
- response = _c.sent();
594
- this.put(key, response);
595
- return [2 /*return*/, response];
598
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBlockMetadata', [block]);
599
+ if (this.has(key)) {
600
+ return [2 /*return*/, this.get(key)];
601
+ }
602
+ else {
603
+ response = this.rpcClient.getBlockMetadata({ block: block });
604
+ this.put(key, response);
605
+ return [2 /*return*/, response];
596
606
  }
597
607
  });
598
608
  });
@@ -612,16 +622,14 @@
612
622
  return __awaiter(this, void 0, void 0, function () {
613
623
  var key, response;
614
624
  return __generator(this, function (_c) {
615
- switch (_c.label) {
616
- case 0:
617
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBakingRights', [block, args]);
618
- if (!this.has(key)) return [3 /*break*/, 1];
619
- return [2 /*return*/, this.get(key)];
620
- case 1: return [4 /*yield*/, this.rpcClient.getBakingRights(args, { block: block })];
621
- case 2:
622
- response = _c.sent();
623
- this.put(key, response);
624
- return [2 /*return*/, response];
625
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBakingRights', [block, args]);
626
+ if (this.has(key)) {
627
+ return [2 /*return*/, this.get(key)];
628
+ }
629
+ else {
630
+ response = this.rpcClient.getBakingRights(args, { block: block });
631
+ this.put(key, response);
632
+ return [2 /*return*/, response];
625
633
  }
626
634
  });
627
635
  });
@@ -641,16 +649,17 @@
641
649
  return __awaiter(this, void 0, void 0, function () {
642
650
  var key, response;
643
651
  return __generator(this, function (_c) {
644
- switch (_c.label) {
645
- case 0:
646
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEndorsingRights', [block, args]);
647
- if (!this.has(key)) return [3 /*break*/, 1];
648
- return [2 /*return*/, this.get(key)];
649
- case 1: return [4 /*yield*/, this.rpcClient.getEndorsingRights(args, { block: block })];
650
- case 2:
651
- response = _c.sent();
652
- this.put(key, response);
653
- return [2 /*return*/, response];
652
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEndorsingRights', [
653
+ block,
654
+ args,
655
+ ]);
656
+ if (this.has(key)) {
657
+ return [2 /*return*/, this.get(key)];
658
+ }
659
+ else {
660
+ response = this.rpcClient.getEndorsingRights(args, { block: block });
661
+ this.put(key, response);
662
+ return [2 /*return*/, response];
654
663
  }
655
664
  });
656
665
  });
@@ -667,16 +676,14 @@
667
676
  return __awaiter(this, void 0, void 0, function () {
668
677
  var key, response;
669
678
  return __generator(this, function (_c) {
670
- switch (_c.label) {
671
- case 0:
672
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBallotList', [block]);
673
- if (!this.has(key)) return [3 /*break*/, 1];
674
- return [2 /*return*/, this.get(key)];
675
- case 1: return [4 /*yield*/, this.rpcClient.getBallotList({ block: block })];
676
- case 2:
677
- response = _c.sent();
678
- this.put(key, response);
679
- return [2 /*return*/, response];
679
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBallotList', [block]);
680
+ if (this.has(key)) {
681
+ return [2 /*return*/, this.get(key)];
682
+ }
683
+ else {
684
+ response = this.rpcClient.getBallotList({ block: block });
685
+ this.put(key, response);
686
+ return [2 /*return*/, response];
680
687
  }
681
688
  });
682
689
  });
@@ -694,16 +701,14 @@
694
701
  return __awaiter(this, void 0, void 0, function () {
695
702
  var key, response;
696
703
  return __generator(this, function (_c) {
697
- switch (_c.label) {
698
- case 0:
699
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBallots', [block]);
700
- if (!this.has(key)) return [3 /*break*/, 1];
701
- return [2 /*return*/, this.get(key)];
702
- case 1: return [4 /*yield*/, this.rpcClient.getBallots({ block: block })];
703
- case 2:
704
- response = _c.sent();
705
- this.put(key, response);
706
- return [2 /*return*/, response];
704
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBallots', [block]);
705
+ if (this.has(key)) {
706
+ return [2 /*return*/, this.get(key)];
707
+ }
708
+ else {
709
+ response = this.rpcClient.getBallots({ block: block });
710
+ this.put(key, response);
711
+ return [2 /*return*/, response];
707
712
  }
708
713
  });
709
714
  });
@@ -723,16 +728,14 @@
723
728
  return __awaiter(this, void 0, void 0, function () {
724
729
  var key, response;
725
730
  return __generator(this, function (_c) {
726
- switch (_c.label) {
727
- case 0:
728
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentPeriodKind', [block]);
729
- if (!this.has(key)) return [3 /*break*/, 1];
730
- return [2 /*return*/, this.get(key)];
731
- case 1: return [4 /*yield*/, this.rpcClient.getCurrentPeriodKind({ block: block })];
732
- case 2:
733
- response = _c.sent();
734
- this.put(key, response);
735
- return [2 /*return*/, response];
731
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentPeriodKind', [block]);
732
+ if (this.has(key)) {
733
+ return [2 /*return*/, this.get(key)];
734
+ }
735
+ else {
736
+ response = this.rpcClient.getCurrentPeriodKind({ block: block });
737
+ this.put(key, response);
738
+ return [2 /*return*/, response];
736
739
  }
737
740
  });
738
741
  });
@@ -750,16 +753,14 @@
750
753
  return __awaiter(this, void 0, void 0, function () {
751
754
  var key, response;
752
755
  return __generator(this, function (_c) {
753
- switch (_c.label) {
754
- case 0:
755
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentProposal', [block]);
756
- if (!this.has(key)) return [3 /*break*/, 1];
757
- return [2 /*return*/, this.get(key)];
758
- case 1: return [4 /*yield*/, this.rpcClient.getCurrentProposal({ block: block })];
759
- case 2:
760
- response = _c.sent();
761
- this.put(key, response);
762
- return [2 /*return*/, response];
756
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentProposal', [block]);
757
+ if (this.has(key)) {
758
+ return [2 /*return*/, this.get(key)];
759
+ }
760
+ else {
761
+ response = this.rpcClient.getCurrentProposal({ block: block });
762
+ this.put(key, response);
763
+ return [2 /*return*/, response];
763
764
  }
764
765
  });
765
766
  });
@@ -777,16 +778,14 @@
777
778
  return __awaiter(this, void 0, void 0, function () {
778
779
  var key, response;
779
780
  return __generator(this, function (_c) {
780
- switch (_c.label) {
781
- case 0:
782
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentQuorum', [block]);
783
- if (!this.has(key)) return [3 /*break*/, 1];
784
- return [2 /*return*/, this.get(key)];
785
- case 1: return [4 /*yield*/, this.rpcClient.getCurrentQuorum({ block: block })];
786
- case 2:
787
- response = _c.sent();
788
- this.put(key, response);
789
- return [2 /*return*/, response];
781
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentQuorum', [block]);
782
+ if (this.has(key)) {
783
+ return [2 /*return*/, this.get(key)];
784
+ }
785
+ else {
786
+ response = this.rpcClient.getCurrentQuorum({ block: block });
787
+ this.put(key, response);
788
+ return [2 /*return*/, response];
790
789
  }
791
790
  });
792
791
  });
@@ -804,16 +803,14 @@
804
803
  return __awaiter(this, void 0, void 0, function () {
805
804
  var key, response;
806
805
  return __generator(this, function (_c) {
807
- switch (_c.label) {
808
- case 0:
809
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getVotesListings', [block]);
810
- if (!this.has(key)) return [3 /*break*/, 1];
811
- return [2 /*return*/, this.get(key)];
812
- case 1: return [4 /*yield*/, this.rpcClient.getVotesListings({ block: block })];
813
- case 2:
814
- response = _c.sent();
815
- this.put(key, response);
816
- return [2 /*return*/, response];
806
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getVotesListings', [block]);
807
+ if (this.has(key)) {
808
+ return [2 /*return*/, this.get(key)];
809
+ }
810
+ else {
811
+ response = this.rpcClient.getVotesListings({ block: block });
812
+ this.put(key, response);
813
+ return [2 /*return*/, response];
817
814
  }
818
815
  });
819
816
  });
@@ -831,16 +828,14 @@
831
828
  return __awaiter(this, void 0, void 0, function () {
832
829
  var key, response;
833
830
  return __generator(this, function (_c) {
834
- switch (_c.label) {
835
- case 0:
836
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getProposals', [block]);
837
- if (!this.has(key)) return [3 /*break*/, 1];
838
- return [2 /*return*/, this.get(key)];
839
- case 1: return [4 /*yield*/, this.rpcClient.getProposals({ block: block })];
840
- case 2:
841
- response = _c.sent();
842
- this.put(key, response);
843
- return [2 /*return*/, response];
831
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getProposals', [block]);
832
+ if (this.has(key)) {
833
+ return [2 /*return*/, this.get(key)];
834
+ }
835
+ else {
836
+ response = this.rpcClient.getProposals({ block: block });
837
+ this.put(key, response);
838
+ return [2 /*return*/, response];
844
839
  }
845
840
  });
846
841
  });
@@ -909,16 +904,17 @@
909
904
  return __awaiter(this, void 0, void 0, function () {
910
905
  var key, response;
911
906
  return __generator(this, function (_c) {
912
- switch (_c.label) {
913
- case 0:
914
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEntrypoints', [block, contract]);
915
- if (!this.has(key)) return [3 /*break*/, 1];
916
- return [2 /*return*/, this.get(key)];
917
- case 1: return [4 /*yield*/, this.rpcClient.getEntrypoints(contract, { block: block })];
918
- case 2:
919
- response = _c.sent();
920
- this.put(key, response);
921
- return [2 /*return*/, response];
907
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEntrypoints', [
908
+ block,
909
+ contract,
910
+ ]);
911
+ if (this.has(key)) {
912
+ return [2 /*return*/, this.get(key)];
913
+ }
914
+ else {
915
+ response = this.rpcClient.getEntrypoints(contract, { block: block });
916
+ this.put(key, response);
917
+ return [2 /*return*/, response];
922
918
  }
923
919
  });
924
920
  });
@@ -959,16 +955,14 @@
959
955
  return __awaiter(this, void 0, void 0, function () {
960
956
  var key, response;
961
957
  return __generator(this, function (_a) {
962
- switch (_a.label) {
963
- case 0:
964
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getChainId', []);
965
- if (!this.has(key)) return [3 /*break*/, 1];
966
- return [2 /*return*/, this.get(key)];
967
- case 1: return [4 /*yield*/, this.rpcClient.getChainId()];
968
- case 2:
969
- response = _a.sent();
970
- this.put(key, response);
971
- return [2 /*return*/, response];
958
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getChainId', []);
959
+ if (this.has(key)) {
960
+ return [2 /*return*/, this.get(key)];
961
+ }
962
+ else {
963
+ response = this.rpcClient.getChainId();
964
+ this.put(key, response);
965
+ return [2 /*return*/, response];
972
966
  }
973
967
  });
974
968
  });
@@ -989,16 +983,14 @@
989
983
  return __awaiter(this, void 0, void 0, function () {
990
984
  var key, response;
991
985
  return __generator(this, function (_c) {
992
- switch (_c.label) {
993
- case 0:
994
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'packData', [block, data]);
995
- if (!this.has(key)) return [3 /*break*/, 1];
996
- return [2 /*return*/, this.get(key)];
997
- case 1: return [4 /*yield*/, this.rpcClient.packData(data, { block: block })];
998
- case 2:
999
- response = _c.sent();
1000
- this.put(key, response);
1001
- return [2 /*return*/, response];
986
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'packData', [block, data]);
987
+ if (this.has(key)) {
988
+ return [2 /*return*/, this.get(key)];
989
+ }
990
+ else {
991
+ response = this.rpcClient.packData(data, { block: block });
992
+ this.put(key, response);
993
+ return [2 /*return*/, response];
1002
994
  }
1003
995
  });
1004
996
  });
@@ -1025,16 +1017,14 @@
1025
1017
  return __awaiter(this, void 0, void 0, function () {
1026
1018
  var key, response;
1027
1019
  return __generator(this, function (_c) {
1028
- switch (_c.label) {
1029
- case 0:
1030
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentPeriod', [block]);
1031
- if (!this.has(key)) return [3 /*break*/, 1];
1032
- return [2 /*return*/, this.get(key)];
1033
- case 1: return [4 /*yield*/, this.rpcClient.getCurrentPeriod({ block: block })];
1034
- case 2:
1035
- response = _c.sent();
1036
- this.put(key, response);
1037
- return [2 /*return*/, response];
1020
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getCurrentPeriod', [block]);
1021
+ if (this.has(key)) {
1022
+ return [2 /*return*/, this.get(key)];
1023
+ }
1024
+ else {
1025
+ response = this.rpcClient.getCurrentPeriod({ block: block });
1026
+ this.put(key, response);
1027
+ return [2 /*return*/, response];
1038
1028
  }
1039
1029
  });
1040
1030
  });
@@ -1054,16 +1044,14 @@
1054
1044
  return __awaiter(this, void 0, void 0, function () {
1055
1045
  var key, response;
1056
1046
  return __generator(this, function (_c) {
1057
- switch (_c.label) {
1058
- case 0:
1059
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSuccessorPeriod', [block]);
1060
- if (!this.has(key)) return [3 /*break*/, 1];
1061
- return [2 /*return*/, this.get(key)];
1062
- case 1: return [4 /*yield*/, this.rpcClient.getSuccessorPeriod({ block: block })];
1063
- case 2:
1064
- response = _c.sent();
1065
- this.put(key, response);
1066
- return [2 /*return*/, response];
1047
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSuccessorPeriod', [block]);
1048
+ if (this.has(key)) {
1049
+ return [2 /*return*/, this.get(key)];
1050
+ }
1051
+ else {
1052
+ response = this.rpcClient.getSuccessorPeriod({ block: block });
1053
+ this.put(key, response);
1054
+ return [2 /*return*/, response];
1067
1055
  }
1068
1056
  });
1069
1057
  });
@@ -1082,16 +1070,14 @@
1082
1070
  return __awaiter(this, void 0, void 0, function () {
1083
1071
  var key, response;
1084
1072
  return __generator(this, function (_c) {
1085
- switch (_c.label) {
1086
- case 0:
1087
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSaplingDiffById', [block, id]);
1088
- if (!this.has(key)) return [3 /*break*/, 1];
1089
- return [2 /*return*/, this.get(key)];
1090
- case 1: return [4 /*yield*/, this.rpcClient.getSaplingDiffById(id, { block: block })];
1091
- case 2:
1092
- response = _c.sent();
1093
- this.put(key, response);
1094
- return [2 /*return*/, response];
1073
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSaplingDiffById', [block, id]);
1074
+ if (this.has(key)) {
1075
+ return [2 /*return*/, this.get(key)];
1076
+ }
1077
+ else {
1078
+ response = this.rpcClient.getSaplingDiffById(id, { block: block });
1079
+ this.put(key, response);
1080
+ return [2 /*return*/, response];
1095
1081
  }
1096
1082
  });
1097
1083
  });
@@ -1110,16 +1096,17 @@
1110
1096
  return __awaiter(this, void 0, void 0, function () {
1111
1097
  var key, response;
1112
1098
  return __generator(this, function (_c) {
1113
- switch (_c.label) {
1114
- case 0:
1115
- key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSaplingDiffByContract', [block, contract]);
1116
- if (!this.has(key)) return [3 /*break*/, 1];
1117
- return [2 /*return*/, this.get(key)];
1118
- case 1: return [4 /*yield*/, this.rpcClient.getSaplingDiffByContract(contract, { block: block })];
1119
- case 2:
1120
- response = _c.sent();
1121
- this.put(key, response);
1122
- return [2 /*return*/, response];
1099
+ key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSaplingDiffByContract', [
1100
+ block,
1101
+ contract,
1102
+ ]);
1103
+ if (this.has(key)) {
1104
+ return [2 /*return*/, this.get(key)];
1105
+ }
1106
+ else {
1107
+ response = this.rpcClient.getSaplingDiffByContract(contract, { block: block });
1108
+ this.put(key, response);
1109
+ return [2 /*return*/, response];
1123
1110
  }
1124
1111
  });
1125
1112
  });
@@ -1142,13 +1129,14 @@
1142
1129
  OpKind["PROPOSALS"] = "proposals";
1143
1130
  OpKind["BALLOT"] = "ballot";
1144
1131
  OpKind["FAILING_NOOP"] = "failing_noop";
1132
+ OpKind["REGISTER_GLOBAL_CONSTANT"] = "register_global_constant";
1145
1133
  })(exports.OpKind || (exports.OpKind = {}));
1146
1134
 
1147
1135
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
1148
1136
  /* tslint:disable */
1149
1137
  var VERSION = {
1150
- "commitHash": "68be71fd14ffd87bd0a0f91dab60d69c8665e88c",
1151
- "version": "10.2.0"
1138
+ "commitHash": "f7dbf5647ce1a35266ad921e6dd2aeef0b4aff93",
1139
+ "version": "11.0.0"
1152
1140
  };
1153
1141
  /* tslint:enable */
1154
1142
 
@@ -1292,6 +1280,27 @@
1292
1280
  });
1293
1281
  });
1294
1282
  };
1283
+ /**
1284
+ *
1285
+ * @param address contract address from which we want to retrieve the script
1286
+ * @param unparsingMode default is { unparsing_mode: "Readable" }
1287
+ * @param options contains generic configuration for rpc calls
1288
+ *
1289
+ * @description Access the script of the contract and normalize it using the requested unparsing mode.
1290
+ *
1291
+ */
1292
+ RpcClient.prototype.getNormalizedScript = function (address, unparsingMode, _a) {
1293
+ if (unparsingMode === void 0) { unparsingMode = { unparsing_mode: 'Readable' }; }
1294
+ var _b = _a === void 0 ? defaultRPCOptions : _a, block = _b.block;
1295
+ return __awaiter(this, void 0, void 0, function () {
1296
+ return __generator(this, function (_c) {
1297
+ return [2 /*return*/, this.httpBackend.createRequest({
1298
+ url: this.createURL("/chains/" + this.chain + "/blocks/" + block + "/context/contracts/" + address + "/script/normalized"),
1299
+ method: 'POST',
1300
+ }, unparsingMode)];
1301
+ });
1302
+ });
1303
+ };
1295
1304
  /**
1296
1305
  *
1297
1306
  * @param address contract address from which we want to retrieve
@@ -1450,7 +1459,7 @@
1450
1459
  'deposit',
1451
1460
  'deposits',
1452
1461
  'fees',
1453
- 'rewards'
1462
+ 'rewards',
1454
1463
  ]);
1455
1464
  return __assign(__assign({}, rest), { deposit: castedToBigNumber.deposit, deposits: castedToBigNumber.deposits, fees: castedToBigNumber.fees, rewards: castedToBigNumber.rewards });
1456
1465
  }),
@@ -1458,7 +1467,7 @@
1458
1467
  delegated_contracts: response.delegated_contracts,
1459
1468
  delegated_balance: new BigNumber__default['default'](response.delegated_balance),
1460
1469
  grace_period: response.grace_period,
1461
- voting_power: response.voting_power
1470
+ voting_power: response.voting_power,
1462
1471
  }];
1463
1472
  }
1464
1473
  });
@@ -1501,7 +1510,13 @@
1501
1510
  'baking_reward_per_endorsement',
1502
1511
  'delay_per_missing_endorsement',
1503
1512
  'minimal_block_delay',
1504
- 'liquidity_baking_subsidy'
1513
+ 'liquidity_baking_subsidy',
1514
+ 'cache_layout',
1515
+ 'baking_reward_fixed_portion',
1516
+ 'baking_reward_bonus_per_slot',
1517
+ 'endorsing_reward_per_slot',
1518
+ 'round_durations',
1519
+ 'double_baking_punishment'
1505
1520
  ]);
1506
1521
  return [2 /*return*/, __assign(__assign({}, response), castedResponse)];
1507
1522
  }
@@ -1975,9 +1990,14 @@
1975
1990
  * @param options contains generic configuration for rpc calls
1976
1991
  *
1977
1992
  * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
1993
+ * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the the RPC to pack.
1994
+ * This precaution helps protect you and your applications users from RPC nodes that have been compromised.
1995
+ * A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint.
1996
+ * A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package.
1978
1997
  *
1979
1998
  * @example packData({ data: { string: "test" }, type: { prim: "string" } })
1980
1999
  *
2000
+ *
1981
2001
  * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data
1982
2002
  */
1983
2003
  RpcClient.prototype.packData = function (data, _a) {