@airgap/coinlib-core 0.13.7-beta.2 → 0.13.7-beta.4

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.
Files changed (96) hide show
  1. package/airgap-coinlib-core.min.js +1413 -815
  2. package/package.json +1 -1
  3. package/protocols/ICoinBaseProtocol.d.ts +15 -15
  4. package/protocols/ICoinSubProtocol.d.ts +3 -3
  5. package/protocols/aeternity/AeternityProtocol.d.ts +31 -31
  6. package/protocols/aeternity/AeternityProtocol.js +142 -55
  7. package/protocols/aeternity/AeternityProtocol.js.map +1 -1
  8. package/protocols/bitcoin/BitcoinProtocol.d.ts +31 -31
  9. package/protocols/bitcoin/BitcoinProtocol.js +157 -67
  10. package/protocols/bitcoin/BitcoinProtocol.js.map +1 -1
  11. package/protocols/bitcoin/BitcoinSegwitProtocol.d.ts +4 -4
  12. package/protocols/bitcoin/BitcoinSegwitProtocol.js +15 -15
  13. package/protocols/bitcoin/BitcoinSegwitProtocol.js.map +1 -1
  14. package/protocols/bitcoin/BitcoinTestnetProtocol.d.ts +3 -6
  15. package/protocols/bitcoin/BitcoinTestnetProtocol.js +3 -6
  16. package/protocols/bitcoin/BitcoinTestnetProtocol.js.map +1 -1
  17. package/protocols/cosmos/CosmosProtocol.d.ts +29 -29
  18. package/protocols/cosmos/CosmosProtocol.js +129 -39
  19. package/protocols/cosmos/CosmosProtocol.js.map +1 -1
  20. package/protocols/ethereum/BaseEthereumProtocol.d.ts +31 -31
  21. package/protocols/ethereum/BaseEthereumProtocol.js +148 -58
  22. package/protocols/ethereum/BaseEthereumProtocol.js.map +1 -1
  23. package/protocols/ethereum/EthereumProtocol.d.ts +4 -6
  24. package/protocols/ethereum/EthereumProtocol.js +6 -8
  25. package/protocols/ethereum/EthereumProtocol.js.map +1 -1
  26. package/protocols/ethereum/clients/info-clients/EtherscanInfoClient.js +4 -4
  27. package/protocols/ethereum/clients/info-clients/EtherscanInfoClient.js.map +1 -1
  28. package/protocols/ethereum/erc20/GenericERC20.d.ts +8 -9
  29. package/protocols/ethereum/erc20/GenericERC20.js +42 -25
  30. package/protocols/ethereum/erc20/GenericERC20.js.map +1 -1
  31. package/protocols/groestlcoin/GroestlcoinProtocol.d.ts +15 -29
  32. package/protocols/groestlcoin/GroestlcoinProtocol.js +17 -31
  33. package/protocols/groestlcoin/GroestlcoinProtocol.js.map +1 -1
  34. package/protocols/substrate/SubstrateDelegateProtocol.js +32 -32
  35. package/protocols/substrate/SubstrateDelegateProtocol.js.map +1 -1
  36. package/protocols/substrate/SubstrateProtocol.d.ts +31 -31
  37. package/protocols/substrate/SubstrateProtocol.js +143 -43
  38. package/protocols/substrate/SubstrateProtocol.js.map +1 -1
  39. package/protocols/substrate/astar/AstarProtocol.d.ts +15 -28
  40. package/protocols/substrate/astar/AstarProtocol.js +17 -30
  41. package/protocols/substrate/astar/AstarProtocol.js.map +1 -1
  42. package/protocols/substrate/astar/shiden/ShidenProtocol.d.ts +12 -22
  43. package/protocols/substrate/astar/shiden/ShidenProtocol.js +14 -24
  44. package/protocols/substrate/astar/shiden/ShidenProtocol.js.map +1 -1
  45. package/protocols/substrate/kusama/KusamaProtocol.d.ts +15 -28
  46. package/protocols/substrate/kusama/KusamaProtocol.js +17 -30
  47. package/protocols/substrate/kusama/KusamaProtocol.js.map +1 -1
  48. package/protocols/substrate/moonbeam/MoonbeamProtocol.d.ts +15 -28
  49. package/protocols/substrate/moonbeam/MoonbeamProtocol.js +44 -57
  50. package/protocols/substrate/moonbeam/MoonbeamProtocol.js.map +1 -1
  51. package/protocols/substrate/moonbeam/moonbase/MoonbaseProtocol.d.ts +11 -20
  52. package/protocols/substrate/moonbeam/moonbase/MoonbaseProtocol.js +13 -22
  53. package/protocols/substrate/moonbeam/moonbase/MoonbaseProtocol.js.map +1 -1
  54. package/protocols/substrate/moonbeam/moonriver/MoonriverProtocol.d.ts +11 -20
  55. package/protocols/substrate/moonbeam/moonriver/MoonriverProtocol.js +13 -22
  56. package/protocols/substrate/moonbeam/moonriver/MoonriverProtocol.js.map +1 -1
  57. package/protocols/substrate/polkadot/PolkadotProtocol.d.ts +15 -28
  58. package/protocols/substrate/polkadot/PolkadotProtocol.js +17 -30
  59. package/protocols/substrate/polkadot/PolkadotProtocol.js.map +1 -1
  60. package/protocols/tezos/TezosProtocol.d.ts +31 -31
  61. package/protocols/tezos/TezosProtocol.js +165 -75
  62. package/protocols/tezos/TezosProtocol.js.map +1 -1
  63. package/protocols/tezos/fa/TezosFA1Protocol.js +2 -2
  64. package/protocols/tezos/fa/TezosFA1Protocol.js.map +1 -1
  65. package/protocols/tezos/fa/TezosFA2Protocol.d.ts +3 -3
  66. package/protocols/tezos/fa/TezosFA2Protocol.js +14 -8
  67. package/protocols/tezos/fa/TezosFA2Protocol.js.map +1 -1
  68. package/protocols/tezos/fa/TezosFAProtocol.d.ts +9 -9
  69. package/protocols/tezos/fa/TezosFAProtocol.js +54 -36
  70. package/protocols/tezos/fa/TezosFAProtocol.js.map +1 -1
  71. package/protocols/tezos/kt/TezosKtProtocol.d.ts +7 -6
  72. package/protocols/tezos/kt/TezosKtProtocol.js +27 -8
  73. package/protocols/tezos/kt/TezosKtProtocol.js.map +1 -1
  74. package/protocols/tezos/sapling/TezosSaplingProtocol.d.ts +31 -31
  75. package/protocols/tezos/sapling/TezosSaplingProtocol.js +145 -55
  76. package/protocols/tezos/sapling/TezosSaplingProtocol.js.map +1 -1
  77. package/serializer/unsigned-transactions/xtz-btc-transactions.validator.js +1 -1
  78. package/serializer/unsigned-transactions/xtz-btc-transactions.validator.js.map +1 -1
  79. package/serializer/validators/validators.js +5 -5
  80. package/serializer/validators/validators.js.map +1 -1
  81. package/serializer-v3/unsigned-transactions/xtz-btc-transactions.validator.js +1 -1
  82. package/serializer-v3/unsigned-transactions/xtz-btc-transactions.validator.js.map +1 -1
  83. package/serializer-v3/validators/validators.js +5 -5
  84. package/serializer-v3/validators/validators.js.map +1 -1
  85. package/utils/protocolsByIdentifier.js +4 -4
  86. package/utils/protocolsByIdentifier.js.map +1 -1
  87. package/utils/supportedProtocols.js +9 -9
  88. package/utils/supportedProtocols.js.map +1 -1
  89. package/wallet/AirGapCoinWallet.js +2 -2
  90. package/wallet/AirGapCoinWallet.js.map +1 -1
  91. package/wallet/AirGapMarketWallet.js +1 -1
  92. package/wallet/AirGapMarketWallet.js.map +1 -1
  93. package/wallet/AirGapNFTWallet.js +1 -1
  94. package/wallet/AirGapNFTWallet.js.map +1 -1
  95. package/wallet/AirGapWallet.js +3 -3
  96. package/wallet/AirGapWallet.js.map +1 -1
@@ -123,49 +123,34 @@ var TezosNetwork;
123
123
  })(TezosNetwork = exports.TezosNetwork || (exports.TezosNetwork = {}));
124
124
  var TezosProtocol = /** @class */ (function (_super) {
125
125
  __extends(TezosProtocol, _super);
126
- function TezosProtocol(_options) {
127
- if (_options === void 0) { _options = new TezosProtocolOptions_1.TezosProtocolOptions(); }
126
+ function TezosProtocol(options) {
127
+ if (options === void 0) { options = new TezosProtocolOptions_1.TezosProtocolOptions(); }
128
128
  var _this = _super.call(this) || this;
129
- _this._options = _options;
130
- _this._symbol = 'XTZ';
131
- _this.symbol = Promise.resolve(_this._symbol);
132
- _this._name = 'Tezos';
133
- _this.name = Promise.resolve(_this._name);
134
- _this._marketSymbol = 'xtz';
135
- _this.marketSymbol = Promise.resolve(_this._marketSymbol);
136
- _this._feeSymbol = 'xtz';
137
- _this.feeSymbol = Promise.resolve(_this._feeSymbol);
138
- _this._decimals = 6;
139
- _this.decimals = Promise.resolve(_this._decimals);
140
- _this._feeDecimals = 6; // micro tez is the smallest, 1000000 microtez is 1 tez
141
- _this.feeDecimals = Promise.resolve(_this._feeDecimals);
142
- _this._identifier = ProtocolSymbols_1.MainProtocolSymbols.XTZ;
143
- _this.identifier = Promise.resolve(_this._identifier);
129
+ _this.options = options;
130
+ _this.symbol = 'XTZ';
131
+ _this.name = 'Tezos';
132
+ _this.marketSymbol = 'xtz';
133
+ _this.feeSymbol = 'xtz';
134
+ _this.decimals = 6;
135
+ _this.feeDecimals = 6; // micro tez is the smallest, 1000000 microtez is 1 tez
136
+ _this.identifier = ProtocolSymbols_1.MainProtocolSymbols.XTZ;
144
137
  // tezbox default
145
- _this._feeDefaults = {
138
+ _this.feeDefaults = {
146
139
  low: '0.001420',
147
140
  medium: '0.001520',
148
141
  high: '0.003000'
149
142
  };
150
- _this.feeDefaults = Promise.resolve(_this._feeDefaults);
151
- _this._units = [
143
+ _this.units = [
152
144
  {
153
145
  unitSymbol: 'XTZ',
154
146
  factor: '1'
155
147
  }
156
148
  ];
157
- _this.units = Promise.resolve(_this._units);
158
- _this._supportsHD = false;
159
- _this.supportsHD = Promise.resolve(_this._supportsHD);
160
- _this._standardDerivationPath = "m/44h/1729h/0h/0h";
161
- _this.standardDerivationPath = Promise.resolve(_this._standardDerivationPath);
162
- _this._addressIsCaseSensitive = true;
163
- _this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
164
- _this._addressValidationPattern = '^((tz1|tz2|tz3|KT1)[1-9A-Za-z]{33}|zet1[1-9A-Za-z]{65})$';
165
- _this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
166
- _this._addressPlaceholder = 'tz1...';
167
- _this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
168
- _this.options = Promise.resolve(_this._options);
149
+ _this.supportsHD = false;
150
+ _this.standardDerivationPath = "m/44h/1729h/0h/0h";
151
+ _this.addressIsCaseSensitive = true;
152
+ _this.addressValidationPattern = '^((tz1|tz2|tz3|KT1)[1-9A-Za-z]{33}|zet1[1-9A-Za-z]{65})$';
153
+ _this.addressPlaceholder = 'tz1...';
169
154
  // https://gitlab.com/tezos/tezos/-/blob/master/docs/whitedoc/proof_of_stake.rst
170
155
  // cycle has 4096 blocks, which are at least one minute apart
171
156
  _this.minCycleDuration = 4096 * 60 * 1000; // ms
@@ -181,22 +166,127 @@ var TezosProtocol = /** @class */ (function (_super) {
181
166
  Object.defineProperty(TezosProtocol.prototype, "jsonRPCAPI", {
182
167
  // TODO: Should we remove these getters and replace the calls to `this._options.network...`?
183
168
  get: function () {
184
- return this._options.network.rpcUrl;
169
+ return this.options.network.rpcUrl;
185
170
  },
186
171
  enumerable: false,
187
172
  configurable: true
188
173
  });
174
+ TezosProtocol.prototype.getSymbol = function () {
175
+ return __awaiter(this, void 0, void 0, function () {
176
+ return __generator(this, function (_a) {
177
+ return [2 /*return*/, this.symbol];
178
+ });
179
+ });
180
+ };
181
+ TezosProtocol.prototype.getName = function () {
182
+ return __awaiter(this, void 0, void 0, function () {
183
+ return __generator(this, function (_a) {
184
+ return [2 /*return*/, this.name];
185
+ });
186
+ });
187
+ };
188
+ TezosProtocol.prototype.getMarketSymbol = function () {
189
+ return __awaiter(this, void 0, void 0, function () {
190
+ return __generator(this, function (_a) {
191
+ return [2 /*return*/, this.marketSymbol];
192
+ });
193
+ });
194
+ };
195
+ TezosProtocol.prototype.getFeeSymbol = function () {
196
+ return __awaiter(this, void 0, void 0, function () {
197
+ return __generator(this, function (_a) {
198
+ return [2 /*return*/, this.feeSymbol];
199
+ });
200
+ });
201
+ };
202
+ TezosProtocol.prototype.getDecimals = function () {
203
+ return __awaiter(this, void 0, void 0, function () {
204
+ return __generator(this, function (_a) {
205
+ return [2 /*return*/, this.decimals];
206
+ });
207
+ });
208
+ };
209
+ TezosProtocol.prototype.getFeeDecimals = function () {
210
+ return __awaiter(this, void 0, void 0, function () {
211
+ return __generator(this, function (_a) {
212
+ return [2 /*return*/, this.feeDecimals];
213
+ });
214
+ });
215
+ };
216
+ TezosProtocol.prototype.getIdentifier = function () {
217
+ return __awaiter(this, void 0, void 0, function () {
218
+ return __generator(this, function (_a) {
219
+ return [2 /*return*/, this.identifier];
220
+ });
221
+ });
222
+ };
223
+ TezosProtocol.prototype.getFeeDefaults = function () {
224
+ return __awaiter(this, void 0, void 0, function () {
225
+ return __generator(this, function (_a) {
226
+ return [2 /*return*/, this.feeDefaults];
227
+ });
228
+ });
229
+ };
230
+ TezosProtocol.prototype.getUnits = function () {
231
+ return __awaiter(this, void 0, void 0, function () {
232
+ return __generator(this, function (_a) {
233
+ return [2 /*return*/, this.units];
234
+ });
235
+ });
236
+ };
237
+ TezosProtocol.prototype.getSupportsHD = function () {
238
+ return __awaiter(this, void 0, void 0, function () {
239
+ return __generator(this, function (_a) {
240
+ return [2 /*return*/, this.supportsHD];
241
+ });
242
+ });
243
+ };
244
+ TezosProtocol.prototype.getStandardDerivationPath = function () {
245
+ return __awaiter(this, void 0, void 0, function () {
246
+ return __generator(this, function (_a) {
247
+ return [2 /*return*/, this.standardDerivationPath];
248
+ });
249
+ });
250
+ };
251
+ TezosProtocol.prototype.getAddressIsCaseSensitive = function () {
252
+ return __awaiter(this, void 0, void 0, function () {
253
+ return __generator(this, function (_a) {
254
+ return [2 /*return*/, this.addressIsCaseSensitive];
255
+ });
256
+ });
257
+ };
258
+ TezosProtocol.prototype.getAddressValidationPattern = function () {
259
+ return __awaiter(this, void 0, void 0, function () {
260
+ return __generator(this, function (_a) {
261
+ return [2 /*return*/, this.addressValidationPattern];
262
+ });
263
+ });
264
+ };
265
+ TezosProtocol.prototype.getAddressPlaceholder = function () {
266
+ return __awaiter(this, void 0, void 0, function () {
267
+ return __generator(this, function (_a) {
268
+ return [2 /*return*/, this.addressPlaceholder];
269
+ });
270
+ });
271
+ };
272
+ TezosProtocol.prototype.getOptions = function () {
273
+ return __awaiter(this, void 0, void 0, function () {
274
+ return __generator(this, function (_a) {
275
+ return [2 /*return*/, this.options];
276
+ });
277
+ });
278
+ };
189
279
  TezosProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
190
280
  return __awaiter(this, void 0, void 0, function () {
191
281
  return __generator(this, function (_a) {
192
- return [2 /*return*/, this._options.network.blockExplorer.getAddressLink(address)];
282
+ return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
193
283
  });
194
284
  });
195
285
  };
196
286
  TezosProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
197
287
  return __awaiter(this, void 0, void 0, function () {
198
288
  return __generator(this, function (_a) {
199
- return [2 /*return*/, this._options.network.blockExplorer.getTransactionLink(txId)];
289
+ return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
200
290
  });
201
291
  });
202
292
  };
@@ -301,11 +391,11 @@ var TezosProtocol = /** @class */ (function (_super) {
301
391
  switch (_b.label) {
302
392
  case 0:
303
393
  address = addresses[0];
304
- return [4 /*yield*/, this._options.network.extras.indexerClient.getTransactions(address, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
394
+ return [4 /*yield*/, this.options.network.extras.indexerClient.getTransactions(address, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
305
395
  case 1:
306
396
  results = _b.sent();
307
397
  return [2 /*return*/, {
308
- transactions: results.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this._identifier, network: _this._options.network })); }),
398
+ transactions: results.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.identifier, network: _this.options.network })); }),
309
399
  cursor: { offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + results.length }
310
400
  }];
311
401
  }
@@ -432,7 +522,7 @@ var TezosProtocol = /** @class */ (function (_super) {
432
522
  assertNever(tezosOperation.kind);
433
523
  throw new index_4.NotFoundError(coinlib_error_1.Domain.TEZOS, 'no operation to unforge found');
434
524
  case 8: return [2 /*return*/, partialTxs.map(function (partialTx) {
435
- return __assign({ amount: '0', fee: operation !== undefined ? new bignumber_1.default(operation.fee).toString(10) : '0', from: [], isInbound: false, protocolIdentifier: _this._identifier, network: _this._options.network, to: [], transactionDetails: tezosOperation }, partialTx);
525
+ return __assign({ amount: '0', fee: operation !== undefined ? new bignumber_1.default(operation.fee).toString(10) : '0', from: [], isInbound: false, protocolIdentifier: _this.identifier, network: _this.options.network, to: [], transactionDetails: tezosOperation }, partialTx);
436
526
  })];
437
527
  }
438
528
  });
@@ -457,7 +547,7 @@ var TezosProtocol = /** @class */ (function (_super) {
457
547
  _a.label = 2;
458
548
  case 2:
459
549
  _a.trys.push([2, 4, , 5]);
460
- return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/balance")];
550
+ return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/balance")];
461
551
  case 3:
462
552
  data = (_a.sent()).data;
463
553
  balance = balance.plus(new bignumber_1.default(data));
@@ -534,7 +624,7 @@ var TezosProtocol = /** @class */ (function (_super) {
534
624
  return [4 /*yield*/, this.estimateFeeDefaultsFromPublicKey(publicKey, recipients, [balance.toFixed()])];
535
625
  case 2:
536
626
  estimatedFeeDefaults = _a.sent();
537
- maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this._decimals);
627
+ maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.decimals);
538
628
  if (maxFee.gte(balance)) {
539
629
  maxFee = new bignumber_1.default(0);
540
630
  }
@@ -611,9 +701,9 @@ var TezosProtocol = /** @class */ (function (_super) {
611
701
  mediumFee = lowFee.plus(lowFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
612
702
  highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
613
703
  return [2 /*return*/, {
614
- low: lowFee.shiftedBy(-this._feeDecimals).toFixed(),
615
- medium: mediumFee.shiftedBy(-this._feeDecimals).toFixed(),
616
- high: highFee.shiftedBy(-this._feeDecimals).toFixed()
704
+ low: lowFee.shiftedBy(-this.feeDecimals).toFixed(),
705
+ medium: mediumFee.shiftedBy(-this.feeDecimals).toFixed(),
706
+ high: highFee.shiftedBy(-this.feeDecimals).toFixed()
617
707
  }];
618
708
  }
619
709
  });
@@ -669,9 +759,9 @@ var TezosProtocol = /** @class */ (function (_super) {
669
759
  }
670
760
  address = addresses[addressIndex];
671
761
  return [4 /*yield*/, Promise.all([
672
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
673
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
674
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
762
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
763
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
764
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
675
765
  ]).catch(function (error) {
676
766
  throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
677
767
  })];
@@ -825,7 +915,7 @@ var TezosProtocol = /** @class */ (function (_super) {
825
915
  var activeBakers;
826
916
  return __generator(this, function (_a) {
827
917
  switch (_a.label) {
828
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/delegates?active")];
918
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates?active")];
829
919
  case 1:
830
920
  activeBakers = (_a.sent()).data;
831
921
  return [2 /*return*/, activeBakers[0] || ''];
@@ -851,7 +941,7 @@ var TezosProtocol = /** @class */ (function (_super) {
851
941
  var data;
852
942
  return __generator(this, function (_a) {
853
943
  switch (_a.label) {
854
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)];
944
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)];
855
945
  case 1:
856
946
  data = (_a.sent()).data;
857
947
  return [2 /*return*/, data.delegate ? [data.delegate] : []];
@@ -864,7 +954,7 @@ var TezosProtocol = /** @class */ (function (_super) {
864
954
  var response, isBakingActive;
865
955
  return __generator(this, function (_a) {
866
956
  switch (_a.label) {
867
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + address + "/deactivated")];
957
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + address + "/deactivated")];
868
958
  case 1:
869
959
  response = _a.sent();
870
960
  isBakingActive = !response.data;
@@ -894,7 +984,7 @@ var TezosProtocol = /** @class */ (function (_super) {
894
984
  var data;
895
985
  return __generator(this, function (_a) {
896
986
  switch (_a.label) {
897
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)];
987
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)];
898
988
  case 1:
899
989
  data = (_a.sent()).data;
900
990
  return [2 /*return*/, !!data.delegate];
@@ -964,7 +1054,7 @@ var TezosProtocol = /** @class */ (function (_super) {
964
1054
  return __generator(this, function (_a) {
965
1055
  switch (_a.label) {
966
1056
  case 0: return [4 /*yield*/, Promise.all([
967
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)
1057
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)
968
1058
  // this.getDelegationRewardsForAddress(address).catch(() => [] as DelegationRewardInfo[])
969
1059
  ])];
970
1060
  case 1:
@@ -1049,9 +1139,9 @@ var TezosProtocol = /** @class */ (function (_super) {
1049
1139
  case 1:
1050
1140
  address = _f.sent();
1051
1141
  return [4 /*yield*/, Promise.all([
1052
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
1053
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
1054
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
1142
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
1143
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
1144
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
1055
1145
  ]).catch(function (error) {
1056
1146
  throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1057
1147
  })];
@@ -1199,7 +1289,7 @@ var TezosProtocol = /** @class */ (function (_super) {
1199
1289
  var counter = startingCounter ? startingCounter.plus(i).toString() : op.counter;
1200
1290
  return __assign(__assign({}, operation), { gas_limit: gas_limit, counter: counter });
1201
1291
  });
1202
- return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head")];
1292
+ return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head")];
1203
1293
  case 1:
1204
1294
  block = (_a.sent()).data;
1205
1295
  body = {
@@ -1215,7 +1305,7 @@ var TezosProtocol = /** @class */ (function (_super) {
1215
1305
  forgedOperation = _a.sent();
1216
1306
  gasLimitTotal = 0;
1217
1307
  return [4 /*yield*/, index_1.default
1218
- .post(this._options.network.rpcUrl + "/chains/main/blocks/head/helpers/scripts/run_operation", body, {
1308
+ .post(this.options.network.rpcUrl + "/chains/main/blocks/head/helpers/scripts/run_operation", body, {
1219
1309
  headers: { 'Content-Type': 'application/json' }
1220
1310
  })
1221
1311
  .catch(function (runOperationError) {
@@ -1305,11 +1395,11 @@ var TezosProtocol = /** @class */ (function (_super) {
1305
1395
  var data, delegatedOpLevel, delegatedDate, recentTransactionData;
1306
1396
  return __generator(this, function (_a) {
1307
1397
  switch (_a.label) {
1308
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + delegatedAddress)];
1398
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + delegatedAddress)];
1309
1399
  case 1:
1310
1400
  data = (_a.sent()).data;
1311
1401
  if (!(data.delegate && fetchExtraInfo)) return [3 /*break*/, 3];
1312
- return [4 /*yield*/, this._options.network.extras.indexerClient.getDelegationInfo(delegatedAddress)];
1402
+ return [4 /*yield*/, this.options.network.extras.indexerClient.getDelegationInfo(delegatedAddress)];
1313
1403
  case 2:
1314
1404
  recentTransactionData = _a.sent();
1315
1405
  if (recentTransactionData) {
@@ -1340,13 +1430,13 @@ var TezosProtocol = /** @class */ (function (_super) {
1340
1430
  }
1341
1431
  return [4 /*yield*/, Promise.all([
1342
1432
  index_1.default
1343
- .get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/balance")
1433
+ .get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/balance")
1344
1434
  .catch(function (_error) { return undefined; }),
1345
1435
  index_1.default
1346
- .get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/full_balance")
1436
+ .get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/full_balance")
1347
1437
  .catch(function (_error) { return undefined; }),
1348
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/delegated_balance"),
1349
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/staking_balance")
1438
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/delegated_balance"),
1439
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/staking_balance")
1350
1440
  ]).catch(function (error) {
1351
1441
  throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1352
1442
  })];
@@ -1448,9 +1538,9 @@ var TezosProtocol = /** @class */ (function (_super) {
1448
1538
  case 1:
1449
1539
  tzAddress = _d.sent();
1450
1540
  return [4 /*yield*/, Promise.all([
1451
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + tzAddress + "/counter"),
1452
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
1453
- index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + tzAddress + "/manager_key")
1541
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + tzAddress + "/counter"),
1542
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
1543
+ index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + tzAddress + "/manager_key")
1454
1544
  ]).catch(function (error) {
1455
1545
  throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1456
1546
  })];
@@ -1550,7 +1640,7 @@ var TezosProtocol = /** @class */ (function (_super) {
1550
1640
  case 0:
1551
1641
  payload = rawTransaction;
1552
1642
  return [4 /*yield*/, index_1.default
1553
- .post(this._options.network.rpcUrl + "/injection/operation?chain=main", JSON.stringify(payload), {
1643
+ .post(this.options.network.rpcUrl + "/injection/operation?chain=main", JSON.stringify(payload), {
1554
1644
  headers: { 'content-type': 'application/json' }
1555
1645
  })
1556
1646
  .catch(function (error) {
@@ -1623,7 +1713,7 @@ var TezosProtocol = /** @class */ (function (_super) {
1623
1713
  var response;
1624
1714
  return __generator(this, function (_a) {
1625
1715
  switch (_a.label) {
1626
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/" + blockHash + "/votes/listings")];
1716
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/" + blockHash + "/votes/listings")];
1627
1717
  case 1:
1628
1718
  response = _a.sent();
1629
1719
  return [2 /*return*/, response.data];
@@ -1648,9 +1738,9 @@ var TezosProtocol = /** @class */ (function (_super) {
1648
1738
  TezosProtocol.prototype.timeIntervalBetweenCycles = function (fromCycle, toCycle) {
1649
1739
  var cycle1 = Math.min(fromCycle, toCycle);
1650
1740
  var cycle2 = Math.max(fromCycle, toCycle);
1651
- var timeBetweenBlocks = TezosProtocol.TIME_BETWEEN_BLOCKS[this._options.network.extras.network];
1652
- var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this._options.network.extras.network];
1653
- if (this._options.network.extras.network === TezosNetwork.MAINNET && cycle2 > TezosProtocol.FIRST_010_CYCLE) {
1741
+ var timeBetweenBlocks = TezosProtocol.TIME_BETWEEN_BLOCKS[this.options.network.extras.network];
1742
+ var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
1743
+ if (this.options.network.extras.network === TezosNetwork.MAINNET && cycle2 > TezosProtocol.FIRST_010_CYCLE) {
1654
1744
  if (cycle1 < TezosProtocol.FIRST_010_CYCLE) {
1655
1745
  return (((TezosProtocol.FIRST_010_CYCLE - cycle1) * blocksPerCycle[0] * timeBetweenBlocks[0] +
1656
1746
  (cycle2 - TezosProtocol.FIRST_010_CYCLE) * blocksPerCycle[1] * timeBetweenBlocks[1]) *
@@ -1661,15 +1751,15 @@ var TezosProtocol = /** @class */ (function (_super) {
1661
1751
  return (cycle2 - cycle1) * blocksPerCycle[0] * timeBetweenBlocks[0] * 1000;
1662
1752
  };
1663
1753
  TezosProtocol.prototype.cycleToBlockLevel = function (cycle) {
1664
- var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this._options.network.extras.network];
1665
- if (this._options.network.extras.network === TezosNetwork.MAINNET && cycle > TezosProtocol.FIRST_010_CYCLE) {
1754
+ var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
1755
+ if (this.options.network.extras.network === TezosNetwork.MAINNET && cycle > TezosProtocol.FIRST_010_CYCLE) {
1666
1756
  return TezosProtocol.FIRST_010_CYCLE * blocksPerCycle[0] + (cycle - TezosProtocol.FIRST_010_CYCLE) * blocksPerCycle[1] + 1;
1667
1757
  }
1668
1758
  return cycle * blocksPerCycle[0] + 1;
1669
1759
  };
1670
1760
  TezosProtocol.prototype.blockLevelToCycle = function (blockLevel) {
1671
- var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this._options.network.extras.network];
1672
- if (this._options.network.extras.network === TezosNetwork.MAINNET) {
1761
+ var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
1762
+ if (this.options.network.extras.network === TezosNetwork.MAINNET) {
1673
1763
  var last009BlockLevel = TezosProtocol.FIRST_010_CYCLE * blocksPerCycle[0];
1674
1764
  if (blockLevel > last009BlockLevel) {
1675
1765
  var deltaLevels = blockLevel - last009BlockLevel;
@@ -1691,7 +1781,7 @@ var TezosProtocol = /** @class */ (function (_super) {
1691
1781
  var result;
1692
1782
  return __generator(this, function (_a) {
1693
1783
  switch (_a.label) {
1694
- case 0: return [4 /*yield*/, index_1.default.get(this._options.network.rpcUrl + "/chains/main/blocks/" + block + "/metadata")];
1784
+ case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/" + block + "/metadata")];
1695
1785
  case 1:
1696
1786
  result = _a.sent();
1697
1787
  return [2 /*return*/, result.data];