@taquito/rpc 24.2.0 → 24.3.0-beta.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.
@@ -3,50 +3,6 @@ import BigNumber from 'bignumber.js';
3
3
  import { validateAddress, ValidationResult, validateContractAddress, validateProtocol, InvalidProtocolHashError } from '@taquito/utils';
4
4
  import { InvalidAddressError, InvalidContractAddressError } from '@taquito/core';
5
5
 
6
- /******************************************************************************
7
- Copyright (c) Microsoft Corporation.
8
-
9
- Permission to use, copy, modify, and/or distribute this software for any
10
- purpose with or without fee is hereby granted.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
- PERFORMANCE OF THIS SOFTWARE.
19
- ***************************************************************************** */
20
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
21
-
22
-
23
- function __rest(s, e) {
24
- var t = {};
25
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
26
- t[p] = s[p];
27
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
28
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
29
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
30
- t[p[i]] = s[p[i]];
31
- }
32
- return t;
33
- }
34
-
35
- function __awaiter(thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- }
44
-
45
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
46
- var e = new Error(message);
47
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
48
- };
49
-
50
6
  const defaultChain = 'main';
51
7
  const defaultRPCOptions = { block: 'head' };
52
8
  var RPCMethodName;
@@ -101,6 +57,7 @@ var RPCMethodName;
101
57
  RPCMethodName["GET_ALL_TICKET_BALANCES"] = "getAllTicketBalances";
102
58
  RPCMethodName["GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE"] = "getAdaptiveIssuanceLaunchCycle";
103
59
  RPCMethodName["GET_PENDING_OPERATIONS"] = "getPendingOperations";
60
+ RPCMethodName["GET_MEMPOOL_FILTER"] = "getMempoolFilter";
104
61
  RPCMethodName["GET_DESTINATION_INDEX"] = "getDestinationIndex";
105
62
  })(RPCMethodName || (RPCMethodName = {}));
106
63
 
@@ -135,7 +92,7 @@ function castToBigNumber(data, keys) {
135
92
 
136
93
  const defaultTtl = 1000;
137
94
  /***
138
- * @description RpcClientCache acts as a decorator over the RpcClient instance by caching responses for the period defined by the ttl.
95
+ * RpcClientCache acts as a decorator over the RpcClient instance by caching responses for the period defined by the ttl.
139
96
  */
140
97
  class RpcClientCache {
141
98
  /**
@@ -154,7 +111,7 @@ class RpcClientCache {
154
111
  return this._cache;
155
112
  }
156
113
  /**
157
- * @description Remove all the data in the cache.
114
+ * Remove all the data in the cache.
158
115
  *
159
116
  */
160
117
  deleteAllCachedData() {
@@ -205,819 +162,737 @@ class RpcClientCache {
205
162
  }
206
163
  /**
207
164
  * @param options contains generic configuration for rpc calls to specified block (default to head)
208
- * @description Get the block's hash, its unique identifier.
165
+ * Get the block's hash, its unique identifier.
209
166
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-hash
210
167
  */
211
- getBlockHash() {
212
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
213
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HASH, [
214
- block,
215
- ]);
216
- if (this.has(key)) {
217
- return this.get(key);
218
- }
219
- else {
220
- const response = this.rpcClient.getBlockHash({ block });
221
- this.put(key, response);
222
- return response;
223
- }
224
- });
168
+ async getBlockHash({ block } = defaultRPCOptions) {
169
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HASH, [
170
+ block,
171
+ ]);
172
+ if (this.has(key)) {
173
+ return this.get(key);
174
+ }
175
+ else {
176
+ const response = this.rpcClient.getBlockHash({ block });
177
+ this.put(key, response);
178
+ return response;
179
+ }
225
180
  }
226
181
  /**
227
182
  * @param options contains generic configuration for rpc calls to specified block (default to head)
228
- * @description List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
183
+ * List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
229
184
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-live-blocks
230
185
  */
231
- getLiveBlocks() {
232
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
233
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_LIVE_BLOCKS, [
234
- block,
235
- ]);
236
- if (this.has(key)) {
237
- return this.get(key);
238
- }
239
- else {
240
- const response = this.rpcClient.getLiveBlocks({ block });
241
- this.put(key, response);
242
- return response;
243
- }
244
- });
186
+ async getLiveBlocks({ block } = defaultRPCOptions) {
187
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_LIVE_BLOCKS, [
188
+ block,
189
+ ]);
190
+ if (this.has(key)) {
191
+ return this.get(key);
192
+ }
193
+ else {
194
+ const response = this.rpcClient.getLiveBlocks({ block });
195
+ this.put(key, response);
196
+ return response;
197
+ }
245
198
  }
246
199
  /**
247
200
  * @param address address from which we want to retrieve the spendable balance
248
201
  * @param options contains generic configuration for rpc calls to specified block (default to head)
249
- * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
202
+ * The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
250
203
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance
251
204
  */
252
- getBalance(address_1) {
253
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
254
- this.validateAddress(address);
255
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALANCE, [
256
- block,
257
- address,
258
- ]);
259
- if (this.has(key)) {
260
- return this.get(key);
261
- }
262
- else {
263
- const response = this.rpcClient.getBalance(address, { block });
264
- this.put(key, response);
265
- return response;
266
- }
267
- });
205
+ async getBalance(address, { block } = defaultRPCOptions) {
206
+ this.validateAddress(address);
207
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALANCE, [
208
+ block,
209
+ address,
210
+ ]);
211
+ if (this.has(key)) {
212
+ return this.get(key);
213
+ }
214
+ else {
215
+ const response = this.rpcClient.getBalance(address, { block });
216
+ this.put(key, response);
217
+ return response;
218
+ }
268
219
  }
269
220
  /**
270
221
  * @param address address from which we want to retrieve the balance
271
222
  * @param options contains generic configuration for rpc calls to specified block (default to head)
272
- * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
273
- */
274
- getSpendable(address_1) {
275
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
276
- this.validateAddress(address);
277
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SPENDABLE, [
278
- block,
279
- address,
280
- ]);
281
- if (this.has(key)) {
282
- return this.get(key);
283
- }
284
- else {
285
- const response = this.rpcClient.getSpendable(address, { block });
286
- this.put(key, response);
287
- return response;
288
- }
289
- });
223
+ * The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
224
+ */
225
+ async getSpendable(address, { block } = defaultRPCOptions) {
226
+ this.validateAddress(address);
227
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SPENDABLE, [
228
+ block,
229
+ address,
230
+ ]);
231
+ if (this.has(key)) {
232
+ return this.get(key);
233
+ }
234
+ else {
235
+ const response = this.rpcClient.getSpendable(address, { block });
236
+ this.put(key, response);
237
+ return response;
238
+ }
290
239
  }
291
240
  /**
292
241
  * @param address address from which we want to retrieve balance and frozen bonds
293
242
  * @param options contains generic configuration for rpc calls to specified block (default to head)
294
- * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'spendable_and_frozen_bonds' RPC.
243
+ * The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'spendable_and_frozen_bonds' RPC.
295
244
  */
296
- getBalanceAndFrozenBonds(address_1) {
297
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
298
- this.validateAddress(address);
299
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALANCE_AND_FROZEN_BONDS, [block, address]);
300
- if (this.has(key)) {
301
- return this.get(key);
302
- }
303
- else {
304
- const response = this.rpcClient.getBalanceAndFrozenBonds(address, { block });
305
- this.put(key, response);
306
- return response;
307
- }
308
- });
245
+ async getBalanceAndFrozenBonds(address, { block } = defaultRPCOptions) {
246
+ this.validateAddress(address);
247
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALANCE_AND_FROZEN_BONDS, [block, address]);
248
+ if (this.has(key)) {
249
+ return this.get(key);
250
+ }
251
+ else {
252
+ const response = this.rpcClient.getBalanceAndFrozenBonds(address, { block });
253
+ this.put(key, response);
254
+ return response;
255
+ }
309
256
  }
310
257
  /**
311
258
  * @param address address from which we want to retrieve spendable and frozen bonds
312
259
  * @param options contains generic configuration for rpc calls to specified block (default to head)
313
- * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'balance_and_frozen_bonds' RPC.
260
+ * The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'balance_and_frozen_bonds' RPC.
314
261
  */
315
- getSpendableAndFrozenBonds(address_1) {
316
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
317
- this.validateAddress(address);
318
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SPENDABLE_AND_FROZEN_BONDS, [block, address]);
319
- if (this.has(key)) {
320
- return this.get(key);
321
- }
322
- else {
323
- const response = this.rpcClient.getSpendableAndFrozenBonds(address, { block });
324
- this.put(key, response);
325
- return response;
326
- }
327
- });
262
+ async getSpendableAndFrozenBonds(address, { block } = defaultRPCOptions) {
263
+ this.validateAddress(address);
264
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SPENDABLE_AND_FROZEN_BONDS, [block, address]);
265
+ if (this.has(key)) {
266
+ return this.get(key);
267
+ }
268
+ else {
269
+ const response = this.rpcClient.getSpendableAndFrozenBonds(address, { block });
270
+ this.put(key, response);
271
+ return response;
272
+ }
328
273
  }
329
274
  /**
330
275
  * @param address address from which we want to retrieve the full balance
331
276
  * @param options contains generic configuration for rpc calls to specified block (default to head)
332
- * @description Access the full balance of a contract, including frozen bonds and stake.
277
+ * Access the full balance of a contract, including frozen bonds and stake.
333
278
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
334
279
  */
335
- getFullBalance(address_1) {
336
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
337
- this.validateAddress(address);
338
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_FULL_BALANCE, [
339
- block,
340
- address,
341
- ]);
342
- if (this.has(key)) {
343
- return this.get(key);
344
- }
345
- else {
346
- const response = this.rpcClient.getFullBalance(address, { block });
347
- this.put(key, response);
348
- return response;
349
- }
350
- });
280
+ async getFullBalance(address, { block } = defaultRPCOptions) {
281
+ this.validateAddress(address);
282
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_FULL_BALANCE, [
283
+ block,
284
+ address,
285
+ ]);
286
+ if (this.has(key)) {
287
+ return this.get(key);
288
+ }
289
+ else {
290
+ const response = this.rpcClient.getFullBalance(address, { block });
291
+ this.put(key, response);
292
+ return response;
293
+ }
351
294
  }
352
295
  /**
353
296
  * @param address address from which we want to retrieve the staked balance
354
297
  * @param options contains generic configuration for rpc calls to specified block (default to head)
355
- * @description Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
298
+ * Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
356
299
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-staked-balance
357
300
  */
358
- getStakedBalance(address_1) {
359
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
360
- this.validateAddress(address);
361
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STAKED_BALANCE, [
362
- block,
363
- address,
364
- ]);
365
- if (this.has(key)) {
366
- return this.get(key);
367
- }
368
- else {
369
- const response = this.rpcClient.getStakedBalance(address, { block });
370
- this.put(key, response);
371
- return response;
372
- }
373
- });
301
+ async getStakedBalance(address, { block } = defaultRPCOptions) {
302
+ this.validateAddress(address);
303
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STAKED_BALANCE, [
304
+ block,
305
+ address,
306
+ ]);
307
+ if (this.has(key)) {
308
+ return this.get(key);
309
+ }
310
+ else {
311
+ const response = this.rpcClient.getStakedBalance(address, { block });
312
+ this.put(key, response);
313
+ return response;
314
+ }
374
315
  }
375
316
  /**
376
317
  * @param address address from which we want to retrieve the unstaked finalizable balance
377
318
  * @param options contains generic configuration for rpc calls to specified block (default to head)
378
- * @description Access the balance of a contract that was requested for an unstake operation, and is no longer frozen, which means it will appear in the spendable balance of the contract after any stake/unstake/finalize_unstake operation. Returns None if the contract is originated.
319
+ * Access the balance of a contract that was requested for an unstake operation, and is no longer frozen, which means it will appear in the spendable balance of the contract after any stake/unstake/finalize_unstake operation. Returns None if the contract is originated.
379
320
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-finalizable-balance
380
321
  */
381
- getUnstakedFinalizableBalance(address_1) {
382
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
383
- this.validateAddress(address);
384
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_UNSTAKED_FINALIZABLE_BALANCE, [block, address]);
385
- if (this.has(key)) {
386
- return this.get(key);
387
- }
388
- else {
389
- const response = this.rpcClient.getUnstakedFinalizableBalance(address, { block });
390
- this.put(key, response);
391
- return response;
392
- }
393
- });
322
+ async getUnstakedFinalizableBalance(address, { block } = defaultRPCOptions) {
323
+ this.validateAddress(address);
324
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_UNSTAKED_FINALIZABLE_BALANCE, [block, address]);
325
+ if (this.has(key)) {
326
+ return this.get(key);
327
+ }
328
+ else {
329
+ const response = this.rpcClient.getUnstakedFinalizableBalance(address, { block });
330
+ this.put(key, response);
331
+ return response;
332
+ }
394
333
  }
395
334
  /**
396
335
  * @param address address from which we want to retrieve the unstaked frozen balance
397
336
  * @param options contains generic configuration for rpc calls to specified block (default to head)
398
- * @description Access the balance of a contract that was requested for an unstake operation, but is still frozen for the duration of the slashing period. Returns None if the contract is originated.
337
+ * Access the balance of a contract that was requested for an unstake operation, but is still frozen for the duration of the slashing period. Returns None if the contract is originated.
399
338
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-frozen-balance
400
339
  */
401
- getUnstakedFrozenBalance(address_1) {
402
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
403
- this.validateAddress(address);
404
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_UNSTAKED_FROZEN_BALANCE, [block, address]);
405
- if (this.has(key)) {
406
- return this.get(key);
407
- }
408
- else {
409
- const response = this.rpcClient.getUnstakedFrozenBalance(address, { block });
410
- this.put(key, response);
411
- return response;
412
- }
413
- });
340
+ async getUnstakedFrozenBalance(address, { block } = defaultRPCOptions) {
341
+ this.validateAddress(address);
342
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_UNSTAKED_FROZEN_BALANCE, [block, address]);
343
+ if (this.has(key)) {
344
+ return this.get(key);
345
+ }
346
+ else {
347
+ const response = this.rpcClient.getUnstakedFrozenBalance(address, { block });
348
+ this.put(key, response);
349
+ return response;
350
+ }
414
351
  }
415
352
  /**
416
353
  * @param address address from which we want to retrieve the unstake requests
417
354
  * @param options contains generic configuration for rpc calls to specified block (default to head)
418
- * @description Access the unstake requests of the contract. The requests that appear in the finalizable field can be finalized, which means that the contract can transfer these (no longer frozen) funds to their spendable balance with a [finalize_unstake] operation call. Returns null if there is no unstake request pending.
355
+ * Access the unstake requests of the contract. The requests that appear in the finalizable field can be finalized, which means that the contract can transfer these (no longer frozen) funds to their spendable balance with a [finalize_unstake] operation call. Returns null if there is no unstake request pending.
419
356
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstake-requests
420
357
  */
421
- getUnstakeRequests(address_1) {
422
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
423
- this.validateAddress(address);
424
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_UNSTAKE_REQUESTS, [block, address]);
425
- if (this.has(key)) {
426
- return this.get(key);
427
- }
428
- else {
429
- const response = this.rpcClient.getUnstakeRequests(address, { block });
430
- this.put(key, response);
431
- return response;
432
- }
433
- });
358
+ async getUnstakeRequests(address, { block } = defaultRPCOptions) {
359
+ this.validateAddress(address);
360
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_UNSTAKE_REQUESTS, [block, address]);
361
+ if (this.has(key)) {
362
+ return this.get(key);
363
+ }
364
+ else {
365
+ const response = this.rpcClient.getUnstakeRequests(address, { block });
366
+ this.put(key, response);
367
+ return response;
368
+ }
434
369
  }
435
370
  /**
436
371
  * @param address contract address from which we want to retrieve the storage
437
372
  * @param options contains generic configuration for rpc calls to specified block (default to head)
438
- * @description Access the data of the contract.
373
+ * Access the data of the contract.
439
374
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-storage
440
375
  */
441
- getStorage(address_1) {
442
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
443
- this.validateContract(address);
444
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE, [
445
- block,
446
- address,
447
- ]);
448
- if (this.has(key)) {
449
- return this.get(key);
450
- }
451
- else {
452
- const response = this.rpcClient.getStorage(address, { block });
453
- this.put(key, response);
454
- return response;
455
- }
456
- });
376
+ async getStorage(address, { block } = defaultRPCOptions) {
377
+ this.validateContract(address);
378
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE, [
379
+ block,
380
+ address,
381
+ ]);
382
+ if (this.has(key)) {
383
+ return this.get(key);
384
+ }
385
+ else {
386
+ const response = this.rpcClient.getStorage(address, { block });
387
+ this.put(key, response);
388
+ return response;
389
+ }
457
390
  }
458
391
  /**
459
392
  * @param address contract address from which we want to retrieve the script
460
393
  * @param options contains generic configuration for rpc calls to specified block (default to head)
461
- * @description Access the code and data of the contract.
394
+ * Access the code and data of the contract.
462
395
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-script
463
396
  */
464
- getScript(address_1) {
465
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
466
- this.validateContract(address);
467
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SCRIPT, [
468
- block,
469
- address,
470
- ]);
471
- if (this.has(key)) {
472
- return this.get(key);
473
- }
474
- else {
475
- const response = this.rpcClient.getScript(address, { block });
476
- this.put(key, response);
477
- return response;
478
- }
479
- });
397
+ async getScript(address, { block } = defaultRPCOptions) {
398
+ this.validateContract(address);
399
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SCRIPT, [
400
+ block,
401
+ address,
402
+ ]);
403
+ if (this.has(key)) {
404
+ return this.get(key);
405
+ }
406
+ else {
407
+ const response = this.rpcClient.getScript(address, { block });
408
+ this.put(key, response);
409
+ return response;
410
+ }
480
411
  }
481
412
  /**
482
413
  * @param address contract address from which we want to retrieve the script
483
414
  * @param unparsingMode default is { unparsing_mode: "Readable" }
484
415
  * @param options contains generic configuration for rpc calls to specified block (default to head)
485
- * @description Access the script of the contract and normalize it using the requested unparsing mode.
416
+ * Access the script of the contract and normalize it using the requested unparsing mode.
486
417
  */
487
- getNormalizedScript(address_1) {
488
- return __awaiter(this, arguments, void 0, function* (address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = defaultRPCOptions) {
489
- this.validateContract(address);
490
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_NORMALIZED_SCRIPT, [block, address], unparsingMode);
491
- if (this.has(key)) {
492
- return this.get(key);
493
- }
494
- else {
495
- const response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block });
496
- this.put(key, response);
497
- return response;
498
- }
499
- });
418
+ async getNormalizedScript(address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = defaultRPCOptions) {
419
+ this.validateContract(address);
420
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_NORMALIZED_SCRIPT, [block, address], unparsingMode);
421
+ if (this.has(key)) {
422
+ return this.get(key);
423
+ }
424
+ else {
425
+ const response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block });
426
+ this.put(key, response);
427
+ return response;
428
+ }
500
429
  }
501
430
  /**
502
431
  * @param address contract address from which we want to retrieve
503
432
  * @param options contains generic configuration for rpc calls to specified block (default to head)
504
- * @description Access the complete status of a contract.
433
+ * Access the complete status of a contract.
505
434
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id
506
435
  */
507
- getContract(address_1) {
508
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
509
- this.validateAddress(address);
510
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONTRACT, [
511
- block,
512
- address,
513
- ]);
514
- if (this.has(key)) {
515
- return this.get(key);
516
- }
517
- else {
518
- const response = this.rpcClient.getContract(address, { block });
519
- this.put(key, response);
520
- return response;
521
- }
522
- });
436
+ async getContract(address, { block } = defaultRPCOptions) {
437
+ this.validateAddress(address);
438
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONTRACT, [
439
+ block,
440
+ address,
441
+ ]);
442
+ if (this.has(key)) {
443
+ return this.get(key);
444
+ }
445
+ else {
446
+ const response = this.rpcClient.getContract(address, { block });
447
+ this.put(key, response);
448
+ return response;
449
+ }
523
450
  }
524
451
  /**
525
452
  * @param address contract address from which we want to retrieve the manager
526
453
  * @param options contains generic configuration for rpc calls to specified block (default to head)
527
- * @description Access the manager of an implicit contract
454
+ * Access the manager of an implicit contract
528
455
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-manager-key
529
456
  */
530
- getManagerKey(address_1) {
531
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
532
- this.validateAddress(address);
533
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_MANAGER_KEY, [
534
- block,
535
- address,
536
- ]);
537
- if (this.has(key)) {
538
- return this.get(key);
539
- }
540
- else {
541
- const response = this.rpcClient.getManagerKey(address, { block });
542
- this.put(key, response);
543
- return response;
544
- }
545
- });
457
+ async getManagerKey(address, { block } = defaultRPCOptions) {
458
+ this.validateAddress(address);
459
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_MANAGER_KEY, [
460
+ block,
461
+ address,
462
+ ]);
463
+ if (this.has(key)) {
464
+ return this.get(key);
465
+ }
466
+ else {
467
+ const response = this.rpcClient.getManagerKey(address, { block });
468
+ this.put(key, response);
469
+ return response;
470
+ }
546
471
  }
547
472
  /**
548
473
  * @param address contract address from which we want to retrieve the delegate (baker)
549
474
  * @param options contains generic configuration for rpc calls to specified block (default to head)
550
- * @description Access the delegate of a contract, if any
475
+ * Access the delegate of a contract, if any
551
476
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-delegate
552
477
  */
553
- getDelegate(address_1) {
554
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
555
- this.validateAddress(address);
556
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DELEGATE, [
557
- block,
558
- address,
559
- ]);
560
- if (this.has(key)) {
561
- return this.get(key);
562
- }
563
- else {
564
- const response = this.rpcClient.getDelegate(address, { block });
565
- this.put(key, response);
566
- return response;
567
- }
568
- });
478
+ async getDelegate(address, { block } = defaultRPCOptions) {
479
+ this.validateAddress(address);
480
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DELEGATE, [
481
+ block,
482
+ address,
483
+ ]);
484
+ if (this.has(key)) {
485
+ return this.get(key);
486
+ }
487
+ else {
488
+ const response = this.rpcClient.getDelegate(address, { block });
489
+ this.put(key, response);
490
+ return response;
491
+ }
569
492
  }
570
493
  /**
571
494
  * @param id Big Map ID
572
495
  * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method))
573
496
  * @param options contains generic configuration for rpc calls to specified block (default to head)
574
- * @description Access the value associated with a key in a big map.
497
+ * Access the value associated with a key in a big map.
575
498
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr
576
499
  */
577
- getBigMapExpr(id_1, expr_1) {
578
- return __awaiter(this, arguments, void 0, function* (id, expr, { block } = defaultRPCOptions) {
579
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BIG_MAP_EXPR, [
580
- block,
581
- id,
582
- expr,
583
- ]);
584
- if (this.has(key)) {
585
- return this.get(key);
586
- }
587
- else {
588
- const response = this.rpcClient.getBigMapExpr(id, expr, { block });
589
- this.put(key, response);
590
- return response;
591
- }
592
- });
500
+ async getBigMapExpr(id, expr, { block } = defaultRPCOptions) {
501
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BIG_MAP_EXPR, [
502
+ block,
503
+ id,
504
+ expr,
505
+ ]);
506
+ if (this.has(key)) {
507
+ return this.get(key);
508
+ }
509
+ else {
510
+ const response = this.rpcClient.getBigMapExpr(id, expr, { block });
511
+ this.put(key, response);
512
+ return response;
513
+ }
593
514
  }
594
515
  /**
595
516
  * @param args contains optional query arguments (active, inactive, with_minimal_stake, without_minimal_stake)
596
517
  * @param options contains generic configuration for rpc calls to specified block (default to head)
597
- * @description Lists all registered delegates by default with query arguments to filter unneeded values.
518
+ * Lists all registered delegates by default with query arguments to filter unneeded values.
598
519
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
599
520
  */
600
- getAllDelegates() {
601
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = defaultRPCOptions) {
602
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ALL_DELEGATES, [
603
- block,
604
- args,
605
- ]);
606
- if (this.has(key)) {
607
- return this.get(key);
608
- }
609
- else {
610
- const response = this.rpcClient.getAllDelegates(args, { block });
611
- this.put(key, response);
612
- return response;
613
- }
614
- });
521
+ async getAllDelegates(args = {}, { block } = defaultRPCOptions) {
522
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ALL_DELEGATES, [
523
+ block,
524
+ args,
525
+ ]);
526
+ if (this.has(key)) {
527
+ return this.get(key);
528
+ }
529
+ else {
530
+ const response = this.rpcClient.getAllDelegates(args, { block });
531
+ this.put(key, response);
532
+ return response;
533
+ }
615
534
  }
616
535
  /**
617
536
  * @param address delegate address which we want to retrieve
618
537
  * @param options contains generic configuration for rpc calls to specified block (default to head)
619
- * @description Everything about a delegate
538
+ * Everything about a delegate
620
539
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
621
540
  */
622
- getDelegates(address_1) {
623
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
624
- this.validateAddress(address);
625
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DELEGATES, [
626
- block,
627
- address,
628
- ]);
629
- if (this.has(key)) {
630
- return this.get(key);
631
- }
632
- else {
633
- const response = this.rpcClient.getDelegates(address, { block });
634
- this.put(key, response);
635
- return response;
636
- }
637
- });
541
+ async getDelegates(address, { block } = defaultRPCOptions) {
542
+ this.validateAddress(address);
543
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DELEGATES, [
544
+ block,
545
+ address,
546
+ ]);
547
+ if (this.has(key)) {
548
+ return this.get(key);
549
+ }
550
+ else {
551
+ const response = this.rpcClient.getDelegates(address, { block });
552
+ this.put(key, response);
553
+ return response;
554
+ }
638
555
  }
639
556
  /**
640
557
  * @param address delegate address which we want to retrieve
641
558
  * @param options contains generic configuration for rpc calls to specified block (default to head)
642
- * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period
559
+ * Returns the delegate info (e.g. voting power) found in the listings of the current voting period
643
560
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-voting-info
644
561
  */
645
- getVotingInfo(address_1) {
646
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
647
- this.validateAddress(address);
648
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_VOTING_INFO, [
649
- block,
650
- address,
651
- ]);
652
- if (this.has(key)) {
653
- return this.get(key);
654
- }
655
- else {
656
- const response = this.rpcClient.getVotingInfo(address, { block });
657
- this.put(key, response);
658
- return response;
659
- }
660
- });
562
+ async getVotingInfo(address, { block } = defaultRPCOptions) {
563
+ this.validateAddress(address);
564
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_VOTING_INFO, [
565
+ block,
566
+ address,
567
+ ]);
568
+ if (this.has(key)) {
569
+ return this.get(key);
570
+ }
571
+ else {
572
+ const response = this.rpcClient.getVotingInfo(address, { block });
573
+ this.put(key, response);
574
+ return response;
575
+ }
661
576
  }
662
577
  /**
663
578
  * @param options contains generic configuration for rpc calls to specified block (default to head)
664
- * @description All constants
579
+ * All constants
665
580
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-constants
666
581
  */
667
- getConstants() {
668
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
669
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONSTANTS, [
670
- block,
671
- ]);
672
- if (this.has(key)) {
673
- return this.get(key);
674
- }
675
- else {
676
- const response = this.rpcClient.getConstants({ block });
677
- this.put(key, response);
678
- return response;
679
- }
680
- });
582
+ async getConstants({ block } = defaultRPCOptions) {
583
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CONSTANTS, [
584
+ block,
585
+ ]);
586
+ if (this.has(key)) {
587
+ return this.get(key);
588
+ }
589
+ else {
590
+ const response = this.rpcClient.getConstants({ block });
591
+ this.put(key, response);
592
+ return response;
593
+ }
681
594
  }
682
595
  /**
683
596
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version.
684
- * @description All the information about a block
597
+ * All the information about a block
685
598
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id
686
599
  * @example getBlock() will default to `/main/chains/block/head?version=1`
687
600
  * @example getBlock({ block: 'head~2') will return an offset of 2 from head blocks
688
601
  * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash..
689
602
  */
690
- getBlock() {
691
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
692
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK, [block]);
693
- if (this.has(key)) {
694
- return this.get(key);
695
- }
696
- else {
697
- const response = this.rpcClient.getBlock({ block });
698
- this.put(key, response);
699
- return response;
700
- }
701
- });
603
+ async getBlock({ block } = defaultRPCOptions) {
604
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK, [block]);
605
+ if (this.has(key)) {
606
+ return this.get(key);
607
+ }
608
+ else {
609
+ const response = this.rpcClient.getBlock({ block });
610
+ this.put(key, response);
611
+ return response;
612
+ }
702
613
  }
703
614
  /**
704
615
  * @param options contains generic configuration for rpc calls to specified block (default to head)
705
- * @description The whole block header
616
+ * The whole block header
706
617
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-header
707
618
  */
708
- getBlockHeader() {
709
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
710
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HEADER, [
711
- block,
712
- ]);
713
- if (this.has(key)) {
714
- return this.get(key);
715
- }
716
- else {
717
- const response = this.rpcClient.getBlockHeader({ block });
718
- this.put(key, response);
719
- return response;
720
- }
721
- });
619
+ async getBlockHeader({ block } = defaultRPCOptions) {
620
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_HEADER, [
621
+ block,
622
+ ]);
623
+ if (this.has(key)) {
624
+ return this.get(key);
625
+ }
626
+ else {
627
+ const response = this.rpcClient.getBlockHeader({ block });
628
+ this.put(key, response);
629
+ return response;
630
+ }
722
631
  }
723
632
  /**
724
633
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version
725
- * @description All the metadata associated to the block
634
+ * All the metadata associated to the block
726
635
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-metadata
727
636
  */
728
- getBlockMetadata() {
729
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
730
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_METADATA, [
731
- block,
732
- ]);
733
- if (this.has(key)) {
734
- return this.get(key);
735
- }
736
- else {
737
- const response = this.rpcClient.getBlockMetadata({ block });
738
- this.put(key, response);
739
- return response;
740
- }
741
- });
637
+ async getBlockMetadata({ block } = defaultRPCOptions) {
638
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BLOCK_METADATA, [
639
+ block,
640
+ ]);
641
+ if (this.has(key)) {
642
+ return this.get(key);
643
+ }
644
+ else {
645
+ const response = this.rpcClient.getBlockMetadata({ block });
646
+ this.put(key, response);
647
+ return response;
648
+ }
742
649
  }
743
650
  /**
744
651
  * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round)
745
652
  * @param options contains generic configuration for rpc calls to specified block (default to head)
746
- * @description Retrieves the list of delegates allowed to bake a block.
653
+ * Retrieves the list of delegates allowed to bake a block.
747
654
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
748
655
  */
749
- getBakingRights() {
750
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = defaultRPCOptions) {
751
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BAKING_RIGHTS, [
752
- block,
753
- args,
754
- ]);
755
- if (this.has(key)) {
756
- return this.get(key);
757
- }
758
- else {
759
- const response = this.rpcClient.getBakingRights(args, { block });
760
- this.put(key, response);
761
- return response;
762
- }
763
- });
656
+ async getBakingRights(args = {}, { block } = defaultRPCOptions) {
657
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BAKING_RIGHTS, [
658
+ block,
659
+ args,
660
+ ]);
661
+ if (this.has(key)) {
662
+ return this.get(key);
663
+ }
664
+ else {
665
+ const response = this.rpcClient.getBakingRights(args, { block });
666
+ this.put(key, response);
667
+ return response;
668
+ }
764
669
  }
765
670
  /**
766
671
  * @param args contains optional query arguments (level, cycle, delegate, and consensus_key)
767
672
  * @param options contains generic configuration for rpc calls to specified block (default to head)
768
- * @description Retrieves the delegates allowed to attest a block
673
+ * Retrieves the delegates allowed to attest a block
769
674
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
770
675
  */
771
- getAttestationRights() {
772
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = defaultRPCOptions) {
773
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ATTESTATION_RIGHTS, [block, args]);
774
- if (this.has(key)) {
775
- return this.get(key);
776
- }
777
- else {
778
- const response = this.rpcClient.getAttestationRights(args, { block });
779
- this.put(key, response);
780
- return response;
781
- }
782
- });
676
+ async getAttestationRights(args = {}, { block } = defaultRPCOptions) {
677
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ATTESTATION_RIGHTS, [block, args]);
678
+ if (this.has(key)) {
679
+ return this.get(key);
680
+ }
681
+ else {
682
+ const response = this.rpcClient.getAttestationRights(args, { block });
683
+ this.put(key, response);
684
+ return response;
685
+ }
783
686
  }
784
687
  /**
785
688
  * @param options contains generic configuration for rpc calls to specified block (default to head)
786
- * @description Ballots casted so far during a voting period
689
+ * Ballots casted so far during a voting period
787
690
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballot-list
788
691
  */
789
- getBallotList() {
790
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
791
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOT_LIST, [
792
- block,
793
- ]);
794
- if (this.has(key)) {
795
- return this.get(key);
796
- }
797
- else {
798
- const response = this.rpcClient.getBallotList({ block });
799
- this.put(key, response);
800
- return response;
801
- }
802
- });
692
+ async getBallotList({ block } = defaultRPCOptions) {
693
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOT_LIST, [
694
+ block,
695
+ ]);
696
+ if (this.has(key)) {
697
+ return this.get(key);
698
+ }
699
+ else {
700
+ const response = this.rpcClient.getBallotList({ block });
701
+ this.put(key, response);
702
+ return response;
703
+ }
803
704
  }
804
705
  /**
805
706
  * @param options contains generic configuration for rpc calls to specified block (default to head)
806
- * @description Sum of ballots casted so far during a voting period
707
+ * Sum of ballots casted so far during a voting period
807
708
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballots
808
709
  */
809
- getBallots() {
810
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
811
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOTS, [block]);
812
- if (this.has(key)) {
813
- return this.get(key);
814
- }
815
- else {
816
- const response = this.rpcClient.getBallots({ block });
817
- this.put(key, response);
818
- return response;
819
- }
820
- });
710
+ async getBallots({ block } = defaultRPCOptions) {
711
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_BALLOTS, [block]);
712
+ if (this.has(key)) {
713
+ return this.get(key);
714
+ }
715
+ else {
716
+ const response = this.rpcClient.getBallots({ block });
717
+ this.put(key, response);
718
+ return response;
719
+ }
821
720
  }
822
721
  /**
823
722
  * @param options contains generic configuration for rpc calls to specified block (default to head)
824
- * @description Current proposal under evaluation.
723
+ * Current proposal under evaluation.
825
724
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-proposal
826
725
  */
827
- getCurrentProposal() {
828
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
829
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_PROPOSAL, [block]);
830
- if (this.has(key)) {
831
- return this.get(key);
832
- }
833
- else {
834
- const response = this.rpcClient.getCurrentProposal({ block });
835
- this.put(key, response);
836
- return response;
837
- }
838
- });
726
+ async getCurrentProposal({ block, } = defaultRPCOptions) {
727
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_PROPOSAL, [block]);
728
+ if (this.has(key)) {
729
+ return this.get(key);
730
+ }
731
+ else {
732
+ const response = this.rpcClient.getCurrentProposal({ block });
733
+ this.put(key, response);
734
+ return response;
735
+ }
839
736
  }
840
737
  /**
841
738
  * @param options contains generic configuration for rpc calls to specified block (default to head)
842
- * @description Current expected quorum.
739
+ * Current expected quorum.
843
740
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-quorum
844
741
  */
845
- getCurrentQuorum() {
846
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
847
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_QUORUM, [
848
- block,
849
- ]);
850
- if (this.has(key)) {
851
- return this.get(key);
852
- }
853
- else {
854
- const response = this.rpcClient.getCurrentQuorum({ block });
855
- this.put(key, response);
856
- return response;
857
- }
858
- });
742
+ async getCurrentQuorum({ block, } = defaultRPCOptions) {
743
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_QUORUM, [
744
+ block,
745
+ ]);
746
+ if (this.has(key)) {
747
+ return this.get(key);
748
+ }
749
+ else {
750
+ const response = this.rpcClient.getCurrentQuorum({ block });
751
+ this.put(key, response);
752
+ return response;
753
+ }
859
754
  }
860
755
  /**
861
756
  * @param options contains generic configuration for rpc calls to specified block (default to head)
862
- * @description List of delegates with their voting power
757
+ * List of delegates with their voting power
863
758
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-listings
864
759
  */
865
- getVotesListings() {
866
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
867
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_VOTES_LISTINGS, [
868
- block,
869
- ]);
870
- if (this.has(key)) {
871
- return this.get(key);
872
- }
873
- else {
874
- const response = this.rpcClient.getVotesListings({ block });
875
- this.put(key, response);
876
- return response;
877
- }
878
- });
760
+ async getVotesListings({ block, } = defaultRPCOptions) {
761
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_VOTES_LISTINGS, [
762
+ block,
763
+ ]);
764
+ if (this.has(key)) {
765
+ return this.get(key);
766
+ }
767
+ else {
768
+ const response = this.rpcClient.getVotesListings({ block });
769
+ this.put(key, response);
770
+ return response;
771
+ }
879
772
  }
880
773
  /**
881
774
  * @param options contains generic configuration for rpc calls to specified block (default to head)
882
- * @description List of proposals with number of supporters
775
+ * List of proposals with number of supporters
883
776
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-proposals
884
777
  */
885
- getProposals() {
886
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
887
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROPOSALS, [
888
- block,
889
- ]);
890
- if (this.has(key)) {
891
- return this.get(key);
892
- }
893
- else {
894
- const response = this.rpcClient.getProposals({ block });
895
- this.put(key, response);
896
- return response;
897
- }
898
- });
778
+ async getProposals({ block } = defaultRPCOptions) {
779
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROPOSALS, [
780
+ block,
781
+ ]);
782
+ if (this.has(key)) {
783
+ return this.get(key);
784
+ }
785
+ else {
786
+ const response = this.rpcClient.getProposals({ block });
787
+ this.put(key, response);
788
+ return response;
789
+ }
899
790
  }
900
791
  /**
901
792
  * @param data operation contents to forge
902
793
  * @param options contains generic configuration for rpc calls to specified block (default to head)
903
- * @description Forge an operation returning the unsigned bytes
794
+ * Forge an operation returning the unsigned bytes
904
795
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
905
796
  */
906
- forgeOperations(data_1) {
907
- return __awaiter(this, arguments, void 0, function* (data, { block } = defaultRPCOptions) {
908
- return this.rpcClient.forgeOperations(data, { block });
909
- });
797
+ async forgeOperations(data, { block } = defaultRPCOptions) {
798
+ return this.rpcClient.forgeOperations(data, { block });
910
799
  }
911
800
  /**
912
801
  * @param signedOpBytes signed bytes to inject
913
- * @description Inject an operation in node and broadcast it and return the ID of the operation
802
+ * Inject an operation in node and broadcast it and return the ID of the operation
914
803
  * @see https://tezos.gitlab.io/shell/rpc.html#post-injection-operation
915
804
  */
916
- injectOperation(signedOpBytes) {
917
- return __awaiter(this, void 0, void 0, function* () {
918
- return this.rpcClient.injectOperation(signedOpBytes);
919
- });
805
+ async injectOperation(signedOpBytes) {
806
+ return this.rpcClient.injectOperation(signedOpBytes);
920
807
  }
921
808
  /**
922
809
  * @param ops Operations to apply
923
810
  * @param options contains generic configuration for rpc calls to specified block and version
924
- * @description Simulate the application of the operations with the context of the given block and return the result of each operation application
811
+ * Simulate the application of the operations with the context of the given block and return the result of each operation application
925
812
  * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-helpers-preapply-operations
926
813
  */
927
- preapplyOperations(ops_1) {
928
- return __awaiter(this, arguments, void 0, function* (ops, { block } = defaultRPCOptions) {
929
- return this.rpcClient.preapplyOperations(ops, { block });
930
- });
814
+ async preapplyOperations(ops, { block } = defaultRPCOptions) {
815
+ return this.rpcClient.preapplyOperations(ops, { block });
931
816
  }
932
817
  /**
933
818
  * @param contract address of the contract we want to get the entrypoints of
934
819
  * @param options contains generic configuration for rpc calls to specified block (default to head)
935
- * @description Return the list of entrypoints of the contract
820
+ * Return the list of entrypoints of the contract
936
821
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-entrypoints
937
- * @version 005_PsBABY5H
938
- */
939
- getEntrypoints(contract_1) {
940
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
941
- this.validateContract(contract);
942
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ENTRYPOINTS, [
943
- block,
944
- contract,
945
- ]);
946
- if (this.has(key)) {
947
- return this.get(key);
948
- }
949
- else {
950
- const response = this.rpcClient.getEntrypoints(contract, { block });
951
- this.put(key, response);
952
- return response;
953
- }
954
- });
822
+ * @remarks version 005_PsBABY5H
823
+ */
824
+ async getEntrypoints(contract, { block } = defaultRPCOptions) {
825
+ this.validateContract(contract);
826
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ENTRYPOINTS, [
827
+ block,
828
+ contract,
829
+ ]);
830
+ if (this.has(key)) {
831
+ return this.get(key);
832
+ }
833
+ else {
834
+ const response = this.rpcClient.getEntrypoints(contract, { block });
835
+ this.put(key, response);
836
+ return response;
837
+ }
955
838
  }
956
839
  /**
957
840
  * @param op Operation to simulate
958
841
  * @param options contains generic configuration for rpc calls to specified block and version
959
- * @description Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result.
842
+ * Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result.
960
843
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
961
844
  */
962
- simulateOperation(op_1) {
963
- return __awaiter(this, arguments, void 0, function* (op, { block } = defaultRPCOptions) {
964
- return this.rpcClient.simulateOperation(op, { block });
965
- });
845
+ async simulateOperation(op, { block } = defaultRPCOptions) {
846
+ return this.rpcClient.simulateOperation(op, { block });
966
847
  }
967
848
  /**
968
849
  * @param code Code to run
969
850
  * @param options contains generic configuration for rpc calls to specified block (default to head)
970
- * @description Run a Michelson script in the current context
851
+ * Run a Michelson script in the current context
971
852
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
972
853
  */
973
- runCode(code_1) {
974
- return __awaiter(this, arguments, void 0, function* (code, { block } = defaultRPCOptions) {
975
- return this.rpcClient.runCode(code, { block });
976
- });
854
+ async runCode(code, { block } = defaultRPCOptions) {
855
+ return this.rpcClient.runCode(code, { block });
977
856
  }
978
857
  /**
979
858
  * @param viewScriptParams Parameters of the script view to run
980
859
  * @param options contains generic configuration for rpc calls to specified block (default to head)
981
- * @description Simulate a call to a michelson view
860
+ * Simulate a call to a michelson view
982
861
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
983
862
  */
984
- runScriptView(_a, _b) {
985
- return __awaiter(this, void 0, void 0, function* () {
986
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
987
- var _c = _b === void 0 ? defaultRPCOptions : _b, block = _c.block;
988
- return this.rpcClient.runScriptView(Object.assign({ unparsing_mode }, rest), { block });
989
- });
863
+ async runScriptView({ unparsing_mode = 'Readable', ...rest }, { block } = defaultRPCOptions) {
864
+ return this.rpcClient.runScriptView({
865
+ unparsing_mode,
866
+ ...rest,
867
+ }, { block });
990
868
  }
991
869
  /**
992
870
  * @param viewParams Parameters of the view to run
993
871
  * @param options contains generic configuration for rpc calls to specified block (default to head)
994
- * @description Simulate a call to a view following the TZIP-4 standard.
872
+ * Simulate a call to a view following the TZIP-4 standard.
995
873
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
996
874
  */
997
- runView(_a, _b) {
998
- return __awaiter(this, void 0, void 0, function* () {
999
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
1000
- var _c = _b === void 0 ? defaultRPCOptions : _b, block = _c.block;
1001
- return this.rpcClient.runView(Object.assign({ unparsing_mode }, rest), { block });
1002
- });
875
+ async runView({ unparsing_mode = 'Readable', ...rest }, { block } = defaultRPCOptions) {
876
+ return this.rpcClient.runView({
877
+ unparsing_mode,
878
+ ...rest,
879
+ }, { block });
1003
880
  }
1004
- getChainId() {
1005
- return __awaiter(this, void 0, void 0, function* () {
1006
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CHAIN_ID, []);
1007
- if (this.has(key)) {
1008
- return this.get(key);
1009
- }
1010
- else {
1011
- const response = this.rpcClient.getChainId();
1012
- this.put(key, response);
1013
- return response;
1014
- }
1015
- });
881
+ async getChainId() {
882
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CHAIN_ID, []);
883
+ if (this.has(key)) {
884
+ return this.get(key);
885
+ }
886
+ else {
887
+ const response = this.rpcClient.getChainId();
888
+ this.put(key, response);
889
+ return response;
890
+ }
1016
891
  }
1017
892
  /**
1018
893
  * @param data Data to pack
1019
894
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1020
- * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
895
+ * Computes the serialized version of a data expression using the same algorithm as script instruction PACK
1021
896
  * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the RPC to pack.
1022
897
  * This precaution helps protect you and your applications users from RPC nodes that have been compromised.
1023
898
  * 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.
@@ -1025,319 +900,304 @@ class RpcClientCache {
1025
900
  * @example packData({ data: { string: "test" }, type: { prim: "string" } })
1026
901
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1027
902
  */
1028
- packData(data_1) {
1029
- return __awaiter(this, arguments, void 0, function* (data, { block } = defaultRPCOptions) {
1030
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.PACK_DATA, [block], data);
1031
- if (this.has(key)) {
1032
- return this.get(key);
1033
- }
1034
- else {
1035
- const response = this.rpcClient.packData(data, { block });
1036
- this.put(key, response);
1037
- return response;
1038
- }
1039
- });
903
+ async packData(data, { block } = defaultRPCOptions) {
904
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.PACK_DATA, [block], data);
905
+ if (this.has(key)) {
906
+ return this.get(key);
907
+ }
908
+ else {
909
+ const response = this.rpcClient.packData(data, { block });
910
+ this.put(key, response);
911
+ return response;
912
+ }
1040
913
  }
1041
914
  /**
1042
915
  *
1043
- * @description Return rpc root url
916
+ * Return rpc root url
1044
917
  */
1045
918
  getRpcUrl() {
1046
919
  return this.rpcClient.getRpcUrl();
1047
920
  }
1048
921
  /**
1049
922
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1050
- * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
923
+ * Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
1051
924
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-period
1052
925
  */
1053
- getCurrentPeriod() {
1054
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
1055
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_PERIOD, [
1056
- block,
1057
- ]);
1058
- if (this.has(key)) {
1059
- return this.get(key);
1060
- }
1061
- else {
1062
- const response = this.rpcClient.getCurrentPeriod({ block });
1063
- this.put(key, response);
1064
- return response;
1065
- }
1066
- });
926
+ async getCurrentPeriod({ block, } = defaultRPCOptions) {
927
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_CURRENT_PERIOD, [
928
+ block,
929
+ ]);
930
+ if (this.has(key)) {
931
+ return this.get(key);
932
+ }
933
+ else {
934
+ const response = this.rpcClient.getCurrentPeriod({ block });
935
+ this.put(key, response);
936
+ return response;
937
+ }
1067
938
  }
1068
939
  /**
1069
940
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1070
- * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block
941
+ * Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block
1071
942
  * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head.
1072
943
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-successor-period
1073
944
  */
1074
- getSuccessorPeriod() {
1075
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
1076
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SUCCESSOR_PERIOD, [block]);
1077
- if (this.has(key)) {
1078
- return this.get(key);
1079
- }
1080
- else {
1081
- const response = this.rpcClient.getSuccessorPeriod({ block });
1082
- this.put(key, response);
1083
- return response;
1084
- }
1085
- });
945
+ async getSuccessorPeriod({ block, } = defaultRPCOptions) {
946
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SUCCESSOR_PERIOD, [block]);
947
+ if (this.has(key)) {
948
+ return this.get(key);
949
+ }
950
+ else {
951
+ const response = this.rpcClient.getSuccessorPeriod({ block });
952
+ this.put(key, response);
953
+ return response;
954
+ }
1086
955
  }
1087
956
  /**
1088
957
  * @param id Sapling state ID
1089
958
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1090
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
1091
- * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff
1092
- */
1093
- getSaplingDiffById(id_1) {
1094
- return __awaiter(this, arguments, void 0, function* (id, { block } = defaultRPCOptions) {
1095
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SAPLING_DIFF_BY_ID, [block, id]);
1096
- if (this.has(key)) {
1097
- return this.get(key);
1098
- }
1099
- else {
1100
- const response = this.rpcClient.getSaplingDiffById(id, { block });
1101
- this.put(key, response);
1102
- return response;
1103
- }
1104
- });
959
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
960
+ * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff
961
+ */
962
+ async getSaplingDiffById(id, { block } = defaultRPCOptions) {
963
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SAPLING_DIFF_BY_ID, [block, id]);
964
+ if (this.has(key)) {
965
+ return this.get(key);
966
+ }
967
+ else {
968
+ const response = this.rpcClient.getSaplingDiffById(id, { block });
969
+ this.put(key, response);
970
+ return response;
971
+ }
1105
972
  }
1106
973
  /**
1107
974
  * @param contract address of the contract we want to get the sapling diff
1108
975
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1109
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
976
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
1110
977
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff
1111
978
  */
1112
- getSaplingDiffByContract(contract_1) {
1113
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
1114
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SAPLING_DIFF_BY_CONTRACT, [block, contract]);
1115
- if (this.has(key)) {
1116
- return this.get(key);
1117
- }
1118
- else {
1119
- const response = this.rpcClient.getSaplingDiffByContract(contract, { block });
1120
- this.put(key, response);
1121
- return response;
1122
- }
1123
- });
979
+ async getSaplingDiffByContract(contract, { block } = defaultRPCOptions) {
980
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_SAPLING_DIFF_BY_CONTRACT, [block, contract]);
981
+ if (this.has(key)) {
982
+ return this.get(key);
983
+ }
984
+ else {
985
+ const response = this.rpcClient.getSaplingDiffByContract(contract, { block });
986
+ this.put(key, response);
987
+ return response;
988
+ }
1124
989
  }
1125
990
  /**
1126
991
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1127
- * @description get current and next protocol
992
+ * get current and next protocol
1128
993
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
1129
994
  */
1130
- getProtocols() {
1131
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
1132
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROTOCOLS, [
1133
- block,
1134
- ]);
1135
- if (this.has(key)) {
1136
- return this.get(key);
1137
- }
1138
- else {
1139
- const response = this.rpcClient.getProtocols({ block });
1140
- this.put(key, response);
1141
- return response;
1142
- }
1143
- });
995
+ async getProtocols({ block } = defaultRPCOptions) {
996
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROTOCOLS, [
997
+ block,
998
+ ]);
999
+ if (this.has(key)) {
1000
+ return this.get(key);
1001
+ }
1002
+ else {
1003
+ const response = this.rpcClient.getProtocols({ block });
1004
+ this.put(key, response);
1005
+ return response;
1006
+ }
1144
1007
  }
1145
1008
  /**
1146
- * @param options contains generic configuration for rpc calls to specified block (default to head)
1147
- * @description get current and next protocol
1009
+ * @param protocol the protocol hash to look up (default to empty string)
1010
+ * get current and next protocol
1148
1011
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
1149
1012
  */
1150
- getProtocolActivations() {
1151
- return __awaiter(this, arguments, void 0, function* (protocol = '') {
1152
- if (protocol) {
1153
- const protocolValidation = validateProtocol(protocol);
1154
- if (protocolValidation !== ValidationResult.VALID) {
1155
- throw new InvalidProtocolHashError(protocol, protocolValidation);
1156
- }
1013
+ async getProtocolActivations(protocol = '') {
1014
+ if (protocol) {
1015
+ const protocolValidation = validateProtocol(protocol);
1016
+ if (protocolValidation !== ValidationResult.VALID) {
1017
+ throw new InvalidProtocolHashError(protocol, protocolValidation);
1157
1018
  }
1158
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROTOCOL_ACTIVATIONS, [protocol]);
1159
- if (this.has(key)) {
1160
- return this.get(key);
1161
- }
1162
- else {
1163
- const response = this.rpcClient.getProtocolActivations(protocol);
1164
- this.put(key, response);
1165
- return response;
1166
- }
1167
- });
1019
+ }
1020
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PROTOCOL_ACTIVATIONS, [protocol]);
1021
+ if (this.has(key)) {
1022
+ return this.get(key);
1023
+ }
1024
+ else {
1025
+ const response = this.rpcClient.getProtocolActivations(protocol);
1026
+ this.put(key, response);
1027
+ return response;
1028
+ }
1168
1029
  }
1169
1030
  /**
1170
1031
  * @param contract address of the contract we want to retrieve storage information of
1171
1032
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1172
- * @description Access the used storage space of the contract
1033
+ * Access the used storage space of the contract
1173
1034
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1174
1035
  */
1175
- getStorageUsedSpace(contract_1) {
1176
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
1177
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE_USED_SPACE, [block, contract]);
1178
- if (this.has(key)) {
1179
- return this.get(key);
1180
- }
1181
- else {
1182
- const response = this.rpcClient.getStorageUsedSpace(contract, { block });
1183
- this.put(key, response);
1184
- return response;
1185
- }
1186
- });
1036
+ async getStorageUsedSpace(contract, { block } = defaultRPCOptions) {
1037
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE_USED_SPACE, [block, contract]);
1038
+ if (this.has(key)) {
1039
+ return this.get(key);
1040
+ }
1041
+ else {
1042
+ const response = this.rpcClient.getStorageUsedSpace(contract, { block });
1043
+ this.put(key, response);
1044
+ return response;
1045
+ }
1187
1046
  }
1188
1047
  /**
1189
1048
  * @param contract address of the contract we want to retrieve storage information of
1190
1049
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1191
- = * @description Access the paid storage space of the contract
1050
+ = * Access the paid storage space of the contract
1192
1051
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1193
1052
  */
1194
- getStoragePaidSpace(contract_1) {
1195
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
1196
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE_PAID_SPACE, [block, contract]);
1197
- if (this.has(key)) {
1198
- return this.get(key);
1199
- }
1200
- else {
1201
- const response = this.rpcClient.getStoragePaidSpace(contract, { block });
1202
- this.put(key, response);
1203
- return response;
1204
- }
1205
- });
1053
+ async getStoragePaidSpace(contract, { block } = defaultRPCOptions) {
1054
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_STORAGE_PAID_SPACE, [block, contract]);
1055
+ if (this.has(key)) {
1056
+ return this.get(key);
1057
+ }
1058
+ else {
1059
+ const response = this.rpcClient.getStoragePaidSpace(contract, { block });
1060
+ this.put(key, response);
1061
+ return response;
1062
+ }
1206
1063
  }
1207
1064
  /**
1208
1065
  * @param contract implicit or originated address we want to retrieve ticket balance of
1209
1066
  * @param ticket object to specify a ticket by ticketer, content type and content
1210
1067
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1211
- * @description Access the contract's balance of ticket with specified ticketer, content type, and content.
1068
+ * Access the contract's balance of ticket with specified ticketer, content type, and content.
1212
1069
  * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } }
1213
1070
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1214
1071
  */
1215
- getTicketBalance(contract_1, ticket_1) {
1216
- return __awaiter(this, arguments, void 0, function* (contract, ticket, { block } = defaultRPCOptions) {
1217
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_TICKET_BALANCE, [block, contract], ticket);
1218
- if (this.has(key)) {
1219
- return this.get(key);
1220
- }
1221
- else {
1222
- const response = this.rpcClient.getTicketBalance(contract, ticket, { block });
1223
- this.put(key, response);
1224
- return response;
1225
- }
1226
- });
1072
+ async getTicketBalance(contract, ticket, { block } = defaultRPCOptions) {
1073
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_TICKET_BALANCE, [block, contract], ticket);
1074
+ if (this.has(key)) {
1075
+ return this.get(key);
1076
+ }
1077
+ else {
1078
+ const response = this.rpcClient.getTicketBalance(contract, ticket, { block });
1079
+ this.put(key, response);
1080
+ return response;
1081
+ }
1227
1082
  }
1228
1083
  /**
1229
1084
  * @param contract originated address we want to retrieve ticket balances of
1230
1085
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1231
- * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage.
1086
+ * Access the complete list of tickets owned by the given contract by scanning the contract's storage.
1232
1087
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1233
1088
  */
1234
- getAllTicketBalances(contract_1) {
1235
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
1236
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ALL_TICKET_BALANCES, [block, contract]);
1237
- if (this.has(key)) {
1238
- return this.get(key);
1239
- }
1240
- else {
1241
- const response = this.rpcClient.getAllTicketBalances(contract, { block });
1242
- this.put(key, response);
1243
- return response;
1244
- }
1245
- });
1089
+ async getAllTicketBalances(contract, { block } = defaultRPCOptions) {
1090
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ALL_TICKET_BALANCES, [block, contract]);
1091
+ if (this.has(key)) {
1092
+ return this.get(key);
1093
+ }
1094
+ else {
1095
+ const response = this.rpcClient.getAllTicketBalances(contract, { block });
1096
+ this.put(key, response);
1097
+ return response;
1098
+ }
1246
1099
  }
1247
1100
  /**
1248
- * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
1101
+ * Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
1249
1102
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1250
1103
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-adaptive-issuance-launch-cycle
1251
1104
  */
1252
- getAdaptiveIssuanceLaunchCycle() {
1253
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
1254
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE, [block]);
1255
- if (this.has(key)) {
1256
- return this.get(key);
1257
- }
1258
- else {
1259
- const response = this.rpcClient.getAdaptiveIssuanceLaunchCycle({ block });
1260
- this.put(key, response);
1261
- return response;
1262
- }
1263
- });
1105
+ async getAdaptiveIssuanceLaunchCycle({ block, } = defaultRPCOptions) {
1106
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE, [block]);
1107
+ if (this.has(key)) {
1108
+ return this.get(key);
1109
+ }
1110
+ else {
1111
+ const response = this.rpcClient.getAdaptiveIssuanceLaunchCycle({ block });
1112
+ this.put(key, response);
1113
+ return response;
1114
+ }
1264
1115
  }
1265
1116
  /**
1266
- * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
1117
+ * List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
1267
1118
  * @param args has 5 optional properties
1268
1119
  * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined }
1269
1120
  */
1270
- getPendingOperations() {
1271
- return __awaiter(this, arguments, void 0, function* (args = {}) {
1272
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PENDING_OPERATIONS, [args]);
1273
- if (this.has(key)) {
1274
- return this.get(key);
1275
- }
1276
- else {
1277
- const response = this.rpcClient.getPendingOperations(args);
1278
- this.put(key, response);
1279
- return response;
1280
- }
1281
- });
1121
+ async getPendingOperations(args = {}) {
1122
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PENDING_OPERATIONS, [args]);
1123
+ if (this.has(key)) {
1124
+ return this.get(key);
1125
+ }
1126
+ else {
1127
+ const response = this.rpcClient.getPendingOperations(args);
1128
+ this.put(key, response);
1129
+ return response;
1130
+ }
1131
+ }
1132
+ /**
1133
+ * Returns the current mempool fee filter configuration.
1134
+ * @param args optional query arguments for the mempool/filter endpoint
1135
+ */
1136
+ async getMempoolFilter(args = {}) {
1137
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_MEMPOOL_FILTER, [
1138
+ args,
1139
+ ]);
1140
+ if (this.has(key)) {
1141
+ return this.get(key);
1142
+ }
1143
+ else {
1144
+ const response = this.rpcClient.getMempoolFilter(args);
1145
+ this.put(key, response);
1146
+ return response;
1147
+ }
1282
1148
  }
1283
1149
  /**
1284
1150
  * @param delegate delegate address which we want to retrieve active staking parameters
1285
1151
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1286
- * @description Returns the currently active staking parameters for the given delegate
1152
+ * Returns the currently active staking parameters for the given delegate
1287
1153
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-active-staking-parameters
1288
1154
  */
1289
- getActiveStakingParameters(delegate_1) {
1290
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = defaultRPCOptions) {
1291
- this.validateAddress(delegate);
1292
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ACTIVE_STAKING_PARAMETERS, [block, delegate]);
1293
- if (this.has(key)) {
1294
- return this.get(key);
1295
- }
1296
- else {
1297
- const response = this.rpcClient.getActiveStakingParameters(delegate, { block });
1298
- this.put(key, response);
1299
- return response;
1300
- }
1301
- });
1155
+ async getActiveStakingParameters(delegate, { block } = defaultRPCOptions) {
1156
+ this.validateAddress(delegate);
1157
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_ACTIVE_STAKING_PARAMETERS, [block, delegate]);
1158
+ if (this.has(key)) {
1159
+ return this.get(key);
1160
+ }
1161
+ else {
1162
+ const response = this.rpcClient.getActiveStakingParameters(delegate, { block });
1163
+ this.put(key, response);
1164
+ return response;
1165
+ }
1302
1166
  }
1303
1167
  /**
1304
1168
  * @param delegate delegate address which we want to retrieve pending staking parameters
1305
1169
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1306
- * @description Returns the pending values for the given delegate's staking parameters
1170
+ * Returns the pending values for the given delegate's staking parameters
1307
1171
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-pending-staking-parameters
1308
1172
  */
1309
- getPendingStakingParameters(delegate_1) {
1310
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = defaultRPCOptions) {
1311
- this.validateAddress(delegate);
1312
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PENDING_STAKING_PARAMETERS, [block, delegate]);
1313
- if (this.has(key)) {
1314
- return this.get(key);
1315
- }
1316
- else {
1317
- const response = this.rpcClient.getPendingStakingParameters(delegate, { block });
1318
- this.put(key, response);
1319
- return response;
1320
- }
1321
- });
1173
+ async getPendingStakingParameters(delegate, { block } = defaultRPCOptions) {
1174
+ this.validateAddress(delegate);
1175
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_PENDING_STAKING_PARAMETERS, [block, delegate]);
1176
+ if (this.has(key)) {
1177
+ return this.get(key);
1178
+ }
1179
+ else {
1180
+ const response = this.rpcClient.getPendingStakingParameters(delegate, { block });
1181
+ this.put(key, response);
1182
+ return response;
1183
+ }
1322
1184
  }
1323
1185
  /**
1324
1186
  * @param destination address to retrieve the index for
1325
1187
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1326
- * @description Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
1188
+ * Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
1327
1189
  * @see https://octez.tezos.com/docs/alpha/rpc.html#get-block-id-context-destination-destination-id-index
1328
1190
  */
1329
- getDestinationIndex(destination_1) {
1330
- return __awaiter(this, arguments, void 0, function* (destination, { block } = defaultRPCOptions) {
1331
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DESTINATION_INDEX, [block, destination]);
1332
- if (this.has(key)) {
1333
- return this.get(key);
1334
- }
1335
- else {
1336
- const response = this.rpcClient.getDestinationIndex(destination, { block });
1337
- this.put(key, response);
1338
- return response;
1339
- }
1340
- });
1191
+ async getDestinationIndex(destination, { block } = defaultRPCOptions) {
1192
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), RPCMethodName.GET_DESTINATION_INDEX, [block, destination]);
1193
+ if (this.has(key)) {
1194
+ return this.get(key);
1195
+ }
1196
+ else {
1197
+ const response = this.rpcClient.getDestinationIndex(destination, { block });
1198
+ this.put(key, response);
1199
+ return response;
1200
+ }
1341
1201
  }
1342
1202
  }
1343
1203
 
@@ -1502,12 +1362,16 @@ var OpKind;
1502
1362
 
1503
1363
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
1504
1364
  const VERSION = {
1505
- "commitHash": "105a7b15cfb862a0732c204e0e9741098d697775",
1506
- "version": "24.2.0"
1365
+ "commitHash": "27675679db6515e8b092195ef5c58c2c0ea5f5c8",
1366
+ "version": "24.3.0-beta.0"
1507
1367
  };
1508
1368
 
1369
+ /**
1370
+ * @packageDocumentation
1371
+ * @module @taquito/rpc
1372
+ */
1509
1373
  /***
1510
- * @description RpcClient allows interaction with Tezos network through an rpc node
1374
+ * RpcClient allows interaction with Tezos network through an rpc node
1511
1375
  */
1512
1376
  class RpcClient {
1513
1377
  /**
@@ -1548,743 +1412,681 @@ class RpcClient {
1548
1412
  }
1549
1413
  /**
1550
1414
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1551
- * @description Get the block's hash, its unique identifier.
1415
+ * Get the block's hash, its unique identifier.
1552
1416
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-hash
1553
1417
  */
1554
- getBlockHash() {
1555
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
1556
- const hash = yield this.httpBackend.createRequest({
1557
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/hash`),
1558
- method: 'GET',
1559
- });
1560
- return hash;
1418
+ async getBlockHash({ block } = defaultRPCOptions) {
1419
+ const hash = await this.httpBackend.createRequest({
1420
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/hash`),
1421
+ method: 'GET',
1561
1422
  });
1423
+ return hash;
1562
1424
  }
1563
1425
  /**
1564
1426
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1565
- * @description List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
1427
+ * List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
1566
1428
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-live-blocks
1567
1429
  */
1568
- getLiveBlocks() {
1569
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
1570
- const blocks = yield this.httpBackend.createRequest({
1571
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/live_blocks`),
1572
- method: 'GET',
1573
- });
1574
- return blocks;
1430
+ async getLiveBlocks({ block } = defaultRPCOptions) {
1431
+ const blocks = await this.httpBackend.createRequest({
1432
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/live_blocks`),
1433
+ method: 'GET',
1575
1434
  });
1435
+ return blocks;
1576
1436
  }
1577
1437
  /**
1578
1438
  * @param address address from which we want to retrieve the spendable balance
1579
1439
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1580
- * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
1440
+ * The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
1581
1441
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance
1582
1442
  */
1583
- getBalance(address_1) {
1584
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1585
- this.validateAddress(address);
1586
- const balance = yield this.httpBackend.createRequest({
1587
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance`),
1588
- method: 'GET',
1589
- });
1590
- return new BigNumber(balance);
1443
+ async getBalance(address, { block } = defaultRPCOptions) {
1444
+ this.validateAddress(address);
1445
+ const balance = await this.httpBackend.createRequest({
1446
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance`),
1447
+ method: 'GET',
1591
1448
  });
1449
+ return new BigNumber(balance);
1592
1450
  }
1593
1451
  /**
1594
1452
  * @param address address from which we want to retrieve the spendable balance
1595
1453
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1596
- * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
1454
+ * The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
1597
1455
  */
1598
- getSpendable(address_1) {
1599
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1600
- this.validateAddress(address);
1601
- const balance = yield this.httpBackend.createRequest({
1602
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable`),
1603
- method: 'GET',
1604
- });
1605
- return new BigNumber(balance);
1456
+ async getSpendable(address, { block } = defaultRPCOptions) {
1457
+ this.validateAddress(address);
1458
+ const balance = await this.httpBackend.createRequest({
1459
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable`),
1460
+ method: 'GET',
1606
1461
  });
1462
+ return new BigNumber(balance);
1607
1463
  }
1608
1464
  /**
1609
1465
  * @param address address from which we want to retrieve balance and frozen bonds
1610
1466
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1611
- * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'spendable_and_frozen_bonds' RPC.
1467
+ * The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'spendable_and_frozen_bonds' RPC.
1612
1468
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
1613
1469
  */
1614
- getBalanceAndFrozenBonds(address_1) {
1615
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1616
- this.validateAddress(address);
1617
- const balance = yield this.httpBackend.createRequest({
1618
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance_and_frozen_bonds`),
1619
- method: 'GET',
1620
- });
1621
- return new BigNumber(balance);
1470
+ async getBalanceAndFrozenBonds(address, { block } = defaultRPCOptions) {
1471
+ this.validateAddress(address);
1472
+ const balance = await this.httpBackend.createRequest({
1473
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance_and_frozen_bonds`),
1474
+ method: 'GET',
1622
1475
  });
1476
+ return new BigNumber(balance);
1623
1477
  }
1624
1478
  /**
1625
1479
  * @param address address from which we want to retrieve spendable and frozen bonds
1626
1480
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1627
- * @description The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'balance_and_frozen_bonds' RPC.
1481
+ * The sum (in mutez) of the spendable balance and frozen bonds of a contract. Corresponds to the contract's full balance from which staked funds and unstake requests have been excluded. Identical to the 'balance_and_frozen_bonds' RPC.
1628
1482
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
1629
1483
  */
1630
- getSpendableAndFrozenBonds(address_1) {
1631
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1632
- this.validateAddress(address);
1633
- const balance = yield this.httpBackend.createRequest({
1634
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable_and_frozen_bonds`),
1635
- method: 'GET',
1636
- });
1637
- return new BigNumber(balance);
1484
+ async getSpendableAndFrozenBonds(address, { block } = defaultRPCOptions) {
1485
+ this.validateAddress(address);
1486
+ const balance = await this.httpBackend.createRequest({
1487
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable_and_frozen_bonds`),
1488
+ method: 'GET',
1638
1489
  });
1490
+ return new BigNumber(balance);
1639
1491
  }
1640
1492
  /**
1641
1493
  * @param address address from which we want to retrieve the full balance
1642
1494
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1643
- * @description Access the full balance of a contract, including frozen bonds and stake.
1495
+ * Access the full balance of a contract, including frozen bonds and stake.
1644
1496
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
1645
1497
  */
1646
- getFullBalance(address_1) {
1647
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1648
- this.validateAddress(address);
1649
- const balance = yield this.httpBackend.createRequest({
1650
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/full_balance`),
1651
- method: 'GET',
1652
- });
1653
- return new BigNumber(balance);
1498
+ async getFullBalance(address, { block } = defaultRPCOptions) {
1499
+ this.validateAddress(address);
1500
+ const balance = await this.httpBackend.createRequest({
1501
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/full_balance`),
1502
+ method: 'GET',
1654
1503
  });
1504
+ return new BigNumber(balance);
1655
1505
  }
1656
1506
  /**
1657
1507
  * @param address address from which we want to retrieve the staked balance
1658
1508
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1659
- * @description Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
1509
+ * Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
1660
1510
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-staked-balance
1661
1511
  */
1662
- getStakedBalance(address_1) {
1663
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1664
- this.validateAddress(address);
1665
- const balance = yield this.httpBackend.createRequest({
1666
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/staked_balance`),
1667
- method: 'GET',
1668
- });
1669
- return new BigNumber(balance);
1512
+ async getStakedBalance(address, { block } = defaultRPCOptions) {
1513
+ this.validateAddress(address);
1514
+ const balance = await this.httpBackend.createRequest({
1515
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/staked_balance`),
1516
+ method: 'GET',
1670
1517
  });
1518
+ return new BigNumber(balance);
1671
1519
  }
1672
1520
  /**
1673
1521
  * @param address address from which we want to retrieve the unstaked finalizable balance
1674
1522
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1675
- * @description Access the balance of a contract that was requested for an unstake operation, and is no longer frozen, which means it will appear in the spendable balance of the contract after any stake/unstake/finalize_unstake operation. Returns None if the contract is originated.
1523
+ * Access the balance of a contract that was requested for an unstake operation, and is no longer frozen, which means it will appear in the spendable balance of the contract after any stake/unstake/finalize_unstake operation. Returns None if the contract is originated.
1676
1524
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-finalizable-balance
1677
1525
  */
1678
- getUnstakedFinalizableBalance(address_1) {
1679
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1680
- this.validateAddress(address);
1681
- const balance = yield this.httpBackend.createRequest({
1682
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_finalizable_balance`),
1683
- method: 'GET',
1684
- });
1685
- return new BigNumber(balance);
1526
+ async getUnstakedFinalizableBalance(address, { block } = defaultRPCOptions) {
1527
+ this.validateAddress(address);
1528
+ const balance = await this.httpBackend.createRequest({
1529
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_finalizable_balance`),
1530
+ method: 'GET',
1686
1531
  });
1532
+ return new BigNumber(balance);
1687
1533
  }
1688
1534
  /**
1689
1535
  * @param address address from which we want to retrieve the unstaked frozen balance
1690
1536
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1691
- * @description Access the balance of a contract that was requested for an unstake operation, but is still frozen for the duration of the slashing period. Returns None if the contract is originated.
1537
+ * Access the balance of a contract that was requested for an unstake operation, but is still frozen for the duration of the slashing period. Returns None if the contract is originated.
1692
1538
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-frozen-balance
1693
1539
  */
1694
- getUnstakedFrozenBalance(address_1) {
1695
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1696
- this.validateAddress(address);
1697
- const balance = yield this.httpBackend.createRequest({
1698
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_frozen_balance`),
1699
- method: 'GET',
1700
- });
1701
- return new BigNumber(balance);
1540
+ async getUnstakedFrozenBalance(address, { block } = defaultRPCOptions) {
1541
+ this.validateAddress(address);
1542
+ const balance = await this.httpBackend.createRequest({
1543
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_frozen_balance`),
1544
+ method: 'GET',
1702
1545
  });
1546
+ return new BigNumber(balance);
1703
1547
  }
1704
1548
  /**
1705
1549
  * @param address address from which we want to retrieve the unstaked requests
1706
1550
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1707
- * @description Access the unstake requests of the contract. The requests that appear in the finalizable field can be finalized, which means that the contract can transfer these (no longer frozen) funds to their spendable balance with a [finalize_unstake] operation call. Returns null if there is no unstake request pending.
1551
+ * Access the unstake requests of the contract. The requests that appear in the finalizable field can be finalized, which means that the contract can transfer these (no longer frozen) funds to their spendable balance with a [finalize_unstake] operation call. Returns null if there is no unstake request pending.
1708
1552
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstake-requests
1709
1553
  */
1710
- getUnstakeRequests(address_1) {
1711
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1712
- this.validateAddress(address);
1713
- const response = yield this.httpBackend.createRequest({
1714
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstake_requests`),
1715
- method: 'GET',
1716
- });
1717
- return response === null
1718
- ? null
1719
- : {
1720
- finalizable: response.finalizable.map((_a) => {
1721
- var { amount } = _a, rest = __rest(_a, ["amount"]);
1554
+ async getUnstakeRequests(address, { block } = defaultRPCOptions) {
1555
+ this.validateAddress(address);
1556
+ const response = await this.httpBackend.createRequest({
1557
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstake_requests`),
1558
+ method: 'GET',
1559
+ });
1560
+ return response === null
1561
+ ? null
1562
+ : {
1563
+ finalizable: response.finalizable.map(({ amount, ...rest }) => {
1564
+ const castedToBigNumber = castToBigNumber({ amount }, ['amount']);
1565
+ return {
1566
+ ...rest,
1567
+ amount: castedToBigNumber.amount,
1568
+ };
1569
+ }),
1570
+ unfinalizable: {
1571
+ delegate: response.unfinalizable.delegate,
1572
+ requests: response.unfinalizable.requests.map(({ amount, cycle }) => {
1722
1573
  const castedToBigNumber = castToBigNumber({ amount }, ['amount']);
1723
- return Object.assign(Object.assign({}, rest), { amount: castedToBigNumber.amount });
1574
+ return {
1575
+ cycle,
1576
+ amount: castedToBigNumber.amount,
1577
+ };
1724
1578
  }),
1725
- unfinalizable: {
1726
- delegate: response.unfinalizable.delegate,
1727
- requests: response.unfinalizable.requests.map(({ amount, cycle }) => {
1728
- const castedToBigNumber = castToBigNumber({ amount }, ['amount']);
1729
- return {
1730
- cycle,
1731
- amount: castedToBigNumber.amount,
1732
- };
1733
- }),
1734
- },
1735
- };
1736
- });
1579
+ },
1580
+ };
1737
1581
  }
1738
1582
  /**
1739
1583
  * @param address contract address from which we want to retrieve the storage
1740
1584
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1741
- * @description Access the data of the contract.
1585
+ * Access the data of the contract.
1742
1586
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-storage
1743
1587
  */
1744
- getStorage(address_1) {
1745
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1746
- this.validateContract(address);
1747
- return this.httpBackend.createRequest({
1748
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/storage`),
1749
- method: 'GET',
1750
- });
1588
+ async getStorage(address, { block } = defaultRPCOptions) {
1589
+ this.validateContract(address);
1590
+ return this.httpBackend.createRequest({
1591
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/storage`),
1592
+ method: 'GET',
1751
1593
  });
1752
1594
  }
1753
1595
  /**
1754
1596
  * @param address contract address from which we want to retrieve the script
1755
1597
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1756
- * @description Access the code and data of the contract.
1598
+ * Access the code and data of the contract.
1757
1599
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-script
1758
1600
  */
1759
- getScript(address_1) {
1760
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1761
- this.validateContract(address);
1762
- return this.httpBackend.createRequest({
1763
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script`),
1764
- method: 'GET',
1765
- });
1601
+ async getScript(address, { block } = defaultRPCOptions) {
1602
+ this.validateContract(address);
1603
+ return this.httpBackend.createRequest({
1604
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script`),
1605
+ method: 'GET',
1766
1606
  });
1767
1607
  }
1768
1608
  /**
1769
1609
  * @param address contract address from which we want to retrieve the script
1770
1610
  * @param unparsingMode default is { unparsing_mode: "Readable" }
1771
1611
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1772
- * @description Access the script of the contract and normalize it using the requested unparsing mode.
1612
+ * Access the script of the contract and normalize it using the requested unparsing mode.
1773
1613
  */
1774
- getNormalizedScript(address_1) {
1775
- return __awaiter(this, arguments, void 0, function* (address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = defaultRPCOptions) {
1776
- this.validateContract(address);
1777
- return this.httpBackend.createRequest({
1778
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script/normalized`),
1779
- method: 'POST',
1780
- }, unparsingMode);
1781
- });
1614
+ async getNormalizedScript(address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = defaultRPCOptions) {
1615
+ this.validateContract(address);
1616
+ return this.httpBackend.createRequest({
1617
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script/normalized`),
1618
+ method: 'POST',
1619
+ }, unparsingMode);
1782
1620
  }
1783
1621
  /**
1784
1622
  * @param address contract address from which we want to retrieve
1785
1623
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1786
- * @description Access the complete status of a contract.
1624
+ * Access the complete status of a contract.
1787
1625
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id
1788
1626
  */
1789
- getContract(address_1) {
1790
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1791
- this.validateAddress(address);
1792
- const contractResponse = yield this.httpBackend.createRequest({
1793
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}`),
1794
- method: 'GET',
1795
- });
1796
- return Object.assign(Object.assign({}, contractResponse), { balance: new BigNumber(contractResponse.balance) });
1627
+ async getContract(address, { block } = defaultRPCOptions) {
1628
+ this.validateAddress(address);
1629
+ const contractResponse = await this.httpBackend.createRequest({
1630
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}`),
1631
+ method: 'GET',
1797
1632
  });
1633
+ return {
1634
+ ...contractResponse,
1635
+ balance: new BigNumber(contractResponse.balance),
1636
+ };
1798
1637
  }
1799
1638
  /**
1800
1639
  * @param address contract address from which we want to retrieve the manager
1801
1640
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1802
- * @description Access the manager of an implicit contract
1641
+ * Access the manager of an implicit contract
1803
1642
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-manager-key
1804
1643
  */
1805
- getManagerKey(address_1) {
1806
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1807
- this.validateAddress(address);
1808
- return this.httpBackend.createRequest({
1809
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/manager_key`),
1810
- method: 'GET',
1811
- });
1644
+ async getManagerKey(address, { block } = defaultRPCOptions) {
1645
+ this.validateAddress(address);
1646
+ return this.httpBackend.createRequest({
1647
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/manager_key`),
1648
+ method: 'GET',
1812
1649
  });
1813
1650
  }
1814
1651
  /**
1815
1652
  * @param address contract address from which we want to retrieve the delegate (baker)
1816
1653
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1817
- * @description Access the delegate of a contract, if any
1654
+ * Access the delegate of a contract, if any
1818
1655
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-delegate
1819
1656
  */
1820
- getDelegate(address_1) {
1821
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1822
- this.validateAddress(address);
1823
- let delegate;
1824
- try {
1825
- delegate = yield this.httpBackend.createRequest({
1826
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/delegate`),
1827
- method: 'GET',
1828
- });
1657
+ async getDelegate(address, { block } = defaultRPCOptions) {
1658
+ this.validateAddress(address);
1659
+ let delegate;
1660
+ try {
1661
+ delegate = await this.httpBackend.createRequest({
1662
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/delegate`),
1663
+ method: 'GET',
1664
+ });
1665
+ }
1666
+ catch (ex) {
1667
+ if (ex instanceof HttpResponseError && ex.status === STATUS_CODE.NOT_FOUND) {
1668
+ delegate = null;
1829
1669
  }
1830
- catch (ex) {
1831
- if (ex instanceof HttpResponseError && ex.status === STATUS_CODE.NOT_FOUND) {
1832
- delegate = null;
1833
- }
1834
- else {
1835
- throw ex;
1836
- }
1670
+ else {
1671
+ throw ex;
1837
1672
  }
1838
- return delegate;
1839
- });
1673
+ }
1674
+ return delegate;
1840
1675
  }
1841
1676
  /**
1842
1677
  * @param id Big Map ID
1843
1678
  * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method))
1844
1679
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1845
- * @description Access the value associated with a key in a big map.
1680
+ * Access the value associated with a key in a big map.
1846
1681
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr
1847
1682
  */
1848
- getBigMapExpr(id_1, expr_1) {
1849
- return __awaiter(this, arguments, void 0, function* (id, expr, { block } = defaultRPCOptions) {
1850
- return this.httpBackend.createRequest({
1851
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/big_maps/${id}/${expr}`),
1852
- method: 'GET',
1853
- });
1683
+ async getBigMapExpr(id, expr, { block } = defaultRPCOptions) {
1684
+ return this.httpBackend.createRequest({
1685
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/big_maps/${id}/${expr}`),
1686
+ method: 'GET',
1854
1687
  });
1855
1688
  }
1856
1689
  /**
1857
1690
  * @param args contains optional query arguments (active, inactive, with_minimal_stake, without_minimal_stake)
1858
1691
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1859
- * @description Lists all registered delegates by default with query arguments to filter unneeded values.
1692
+ * Lists all registered delegates by default with query arguments to filter unneeded values.
1860
1693
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
1861
1694
  */
1862
- getAllDelegates() {
1863
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = defaultRPCOptions) {
1864
- return yield this.httpBackend.createRequest({
1865
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates`),
1866
- method: 'GET',
1867
- query: args,
1868
- });
1695
+ async getAllDelegates(args = {}, { block } = defaultRPCOptions) {
1696
+ return await this.httpBackend.createRequest({
1697
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates`),
1698
+ method: 'GET',
1699
+ query: args,
1869
1700
  });
1870
1701
  }
1871
1702
  /**
1872
1703
  * @param address delegate address which we want to retrieve
1873
1704
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1874
- * @description Everything about a delegate
1705
+ * Everything about a delegate
1875
1706
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
1876
1707
  */
1877
- getDelegates(address_1) {
1878
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1879
- this.validateAddress(address);
1880
- const response = yield this.httpBackend.createRequest({
1881
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}`),
1882
- method: 'GET',
1883
- });
1884
- const castedResponse = castToBigNumber(response, [
1885
- 'balance',
1886
- 'full_balance',
1887
- 'current_frozen_deposits',
1888
- 'frozen_deposits',
1889
- 'frozen_balance',
1890
- 'frozen_deposits_limit',
1891
- 'staking_balance',
1892
- 'delegated_balance',
1893
- 'voting_power',
1894
- 'total_delegated_stake',
1895
- 'staking_denominator',
1896
- ]);
1897
- if (response.frozen_balance_by_cycle) {
1898
- return Object.assign(Object.assign(Object.assign({}, response), castedResponse), { frozen_balance_by_cycle: response.frozen_balance_by_cycle.map((_a) => {
1899
- var { deposit, deposits, fees, rewards } = _a, rest = __rest(_a, ["deposit", "deposits", "fees", "rewards"]);
1900
- const castedToBigNumber = castToBigNumber({ deposit, deposits, fees, rewards }, [
1901
- 'deposit',
1902
- 'deposits',
1903
- 'fees',
1904
- 'rewards',
1905
- ]);
1906
- return Object.assign(Object.assign({}, rest), { deposit: castedToBigNumber.deposit, deposits: castedToBigNumber.deposits, fees: castedToBigNumber.fees, rewards: castedToBigNumber.rewards });
1907
- }) });
1908
- }
1909
- else {
1910
- return Object.assign(Object.assign({}, response), castedResponse);
1911
- }
1912
- });
1708
+ async getDelegates(address, { block } = defaultRPCOptions) {
1709
+ this.validateAddress(address);
1710
+ const response = await this.httpBackend.createRequest({
1711
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}`),
1712
+ method: 'GET',
1713
+ });
1714
+ const castedResponse = castToBigNumber(response, [
1715
+ 'balance',
1716
+ 'full_balance',
1717
+ 'current_frozen_deposits',
1718
+ 'frozen_deposits',
1719
+ 'frozen_balance',
1720
+ 'frozen_deposits_limit',
1721
+ 'staking_balance',
1722
+ 'delegated_balance',
1723
+ 'voting_power',
1724
+ 'total_delegated_stake',
1725
+ 'staking_denominator',
1726
+ ]);
1727
+ if (response.frozen_balance_by_cycle) {
1728
+ return {
1729
+ ...response,
1730
+ ...castedResponse,
1731
+ frozen_balance_by_cycle: response.frozen_balance_by_cycle.map(({ deposit, deposits, fees, rewards, ...rest }) => {
1732
+ const castedToBigNumber = castToBigNumber({ deposit, deposits, fees, rewards }, [
1733
+ 'deposit',
1734
+ 'deposits',
1735
+ 'fees',
1736
+ 'rewards',
1737
+ ]);
1738
+ return {
1739
+ ...rest,
1740
+ deposit: castedToBigNumber.deposit,
1741
+ deposits: castedToBigNumber.deposits,
1742
+ fees: castedToBigNumber.fees,
1743
+ rewards: castedToBigNumber.rewards,
1744
+ };
1745
+ }),
1746
+ };
1747
+ }
1748
+ else {
1749
+ return {
1750
+ ...response,
1751
+ ...castedResponse,
1752
+ };
1753
+ }
1913
1754
  }
1914
1755
  /**
1915
1756
  * @param address delegate address which we want to retrieve
1916
1757
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1917
- * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period
1758
+ * Returns the delegate info (e.g. voting power) found in the listings of the current voting period
1918
1759
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-voting-info
1919
1760
  */
1920
- getVotingInfo(address_1) {
1921
- return __awaiter(this, arguments, void 0, function* (address, { block } = defaultRPCOptions) {
1922
- this.validateAddress(address);
1923
- return yield this.httpBackend.createRequest({
1924
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}/voting_info`),
1925
- method: 'GET',
1926
- });
1761
+ async getVotingInfo(address, { block } = defaultRPCOptions) {
1762
+ this.validateAddress(address);
1763
+ return await this.httpBackend.createRequest({
1764
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}/voting_info`),
1765
+ method: 'GET',
1927
1766
  });
1928
1767
  }
1929
1768
  /**
1930
1769
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1931
- * @description All constants
1770
+ * All constants
1932
1771
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-constants
1933
1772
  */
1934
- getConstants() {
1935
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
1936
- const response = yield this.httpBackend.createRequest({
1937
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/constants`),
1938
- method: 'GET',
1939
- });
1940
- const castedResponse = castToBigNumber(response, [
1941
- 'time_between_blocks',
1942
- 'hard_gas_limit_per_operation',
1943
- 'hard_gas_limit_per_block',
1944
- 'proof_of_work_threshold',
1945
- 'tokens_per_roll',
1946
- 'seed_nonce_revelation_tip',
1947
- 'block_security_deposit',
1948
- 'endorsement_security_deposit',
1949
- 'block_reward',
1950
- 'endorsement_reward',
1951
- 'cost_per_byte',
1952
- 'hard_storage_limit_per_operation',
1953
- 'test_chain_duration',
1954
- 'baking_reward_per_endorsement',
1955
- 'delay_per_missing_endorsement',
1956
- 'minimal_block_delay',
1957
- 'liquidity_baking_subsidy',
1958
- 'cache_layout',
1959
- 'baking_reward_fixed_portion',
1960
- 'baking_reward_bonus_per_slot',
1961
- 'endorsing_reward_per_slot',
1962
- 'double_baking_punishment',
1963
- 'delay_increment_per_round',
1964
- 'tx_rollup_commitment_bond',
1965
- 'vdf_difficulty',
1966
- 'sc_rollup_stake_amount',
1967
- 'minimal_stake',
1968
- ]);
1969
- return Object.assign(Object.assign({}, response), castedResponse);
1970
- });
1773
+ async getConstants({ block } = defaultRPCOptions) {
1774
+ const response = await this.httpBackend.createRequest({
1775
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/constants`),
1776
+ method: 'GET',
1777
+ });
1778
+ const castedResponse = castToBigNumber(response, [
1779
+ 'time_between_blocks',
1780
+ 'hard_gas_limit_per_operation',
1781
+ 'hard_gas_limit_per_block',
1782
+ 'proof_of_work_threshold',
1783
+ 'tokens_per_roll',
1784
+ 'seed_nonce_revelation_tip',
1785
+ 'block_security_deposit',
1786
+ 'endorsement_security_deposit',
1787
+ 'block_reward',
1788
+ 'endorsement_reward',
1789
+ 'cost_per_byte',
1790
+ 'hard_storage_limit_per_operation',
1791
+ 'test_chain_duration',
1792
+ 'baking_reward_per_endorsement',
1793
+ 'delay_per_missing_endorsement',
1794
+ 'minimal_block_delay',
1795
+ 'liquidity_baking_subsidy',
1796
+ 'cache_layout',
1797
+ 'baking_reward_fixed_portion',
1798
+ 'baking_reward_bonus_per_slot',
1799
+ 'endorsing_reward_per_slot',
1800
+ 'double_baking_punishment',
1801
+ 'delay_increment_per_round',
1802
+ 'tx_rollup_commitment_bond',
1803
+ 'vdf_difficulty',
1804
+ 'sc_rollup_stake_amount',
1805
+ 'minimal_stake',
1806
+ ]);
1807
+ return {
1808
+ ...response,
1809
+ ...castedResponse,
1810
+ };
1971
1811
  }
1972
1812
  /**
1973
1813
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version.
1974
- * @description All the information about a block
1814
+ * All the information about a block
1975
1815
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id
1976
1816
  * @example getBlock() will default to `/main/chains/block/head?version=1`
1977
1817
  * @example getBlock({ block: 'head~2' }) will return an offset of 2 from head blocks
1978
1818
  * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash..
1979
1819
  */
1980
- getBlock() {
1981
- return __awaiter(this, arguments, void 0, function* ({ block, version } = defaultRPCOptions) {
1982
- const requestOptions = {
1983
- url: this.createURL(`/chains/${this.chain}/blocks/${block}`),
1984
- method: 'GET',
1985
- };
1986
- if (version !== undefined) {
1987
- requestOptions.query = { version };
1988
- }
1989
- return yield this.httpBackend.createRequest(requestOptions);
1990
- });
1820
+ async getBlock({ block, version } = defaultRPCOptions) {
1821
+ const requestOptions = {
1822
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}`),
1823
+ method: 'GET',
1824
+ };
1825
+ if (version !== undefined) {
1826
+ requestOptions.query = { version };
1827
+ }
1828
+ return await this.httpBackend.createRequest(requestOptions);
1991
1829
  }
1992
1830
  /**
1993
1831
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1994
- * @description The whole block header
1832
+ * The whole block header
1995
1833
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-header
1996
1834
  */
1997
- getBlockHeader() {
1998
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
1999
- const response = yield this.httpBackend.createRequest({
2000
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/header`),
2001
- method: 'GET',
2002
- });
2003
- return response;
1835
+ async getBlockHeader({ block } = defaultRPCOptions) {
1836
+ const response = await this.httpBackend.createRequest({
1837
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/header`),
1838
+ method: 'GET',
2004
1839
  });
1840
+ return response;
2005
1841
  }
2006
1842
  /**
2007
1843
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version
2008
- * @description All the metadata associated to the block
1844
+ * All the metadata associated to the block
2009
1845
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-metadata
2010
1846
  */
2011
- getBlockMetadata() {
2012
- return __awaiter(this, arguments, void 0, function* ({ block, version, } = defaultRPCOptions) {
2013
- const requestOptions = {
2014
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/metadata`),
2015
- method: 'GET',
2016
- };
2017
- if (version !== undefined) {
2018
- requestOptions.query = { version };
2019
- }
2020
- return yield this.httpBackend.createRequest(requestOptions);
2021
- });
1847
+ async getBlockMetadata({ block, version, } = defaultRPCOptions) {
1848
+ const requestOptions = {
1849
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/metadata`),
1850
+ method: 'GET',
1851
+ };
1852
+ if (version !== undefined) {
1853
+ requestOptions.query = { version };
1854
+ }
1855
+ return await this.httpBackend.createRequest(requestOptions);
2022
1856
  }
2023
1857
  /**
2024
1858
  * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round)
2025
1859
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2026
- * @description Retrieves the list of delegates allowed to bake a block.
1860
+ * Retrieves the list of delegates allowed to bake a block.
2027
1861
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2028
1862
  */
2029
- getBakingRights() {
2030
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = defaultRPCOptions) {
2031
- const response = yield this.httpBackend.createRequest({
2032
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/baking_rights`),
2033
- method: 'GET',
2034
- query: args,
2035
- });
2036
- return response;
1863
+ async getBakingRights(args = {}, { block } = defaultRPCOptions) {
1864
+ const response = await this.httpBackend.createRequest({
1865
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/baking_rights`),
1866
+ method: 'GET',
1867
+ query: args,
2037
1868
  });
1869
+ return response;
2038
1870
  }
2039
1871
  /**
2040
1872
  * @param args contains optional query arguments (level, cycle, delegate, and consensus_key)
2041
1873
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2042
- * @description Retrieves the delegates allowed to attest a block
1874
+ * Retrieves the delegates allowed to attest a block
2043
1875
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2044
1876
  */
2045
- getAttestationRights() {
2046
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = defaultRPCOptions) {
2047
- const response = yield this.httpBackend.createRequest({
2048
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/attestation_rights`),
2049
- method: 'GET',
2050
- query: args,
2051
- });
2052
- return response;
1877
+ async getAttestationRights(args = {}, { block } = defaultRPCOptions) {
1878
+ const response = await this.httpBackend.createRequest({
1879
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/attestation_rights`),
1880
+ method: 'GET',
1881
+ query: args,
2053
1882
  });
1883
+ return response;
2054
1884
  }
2055
1885
  /**
2056
1886
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2057
- * @description Ballots casted so far during a voting period
1887
+ * Ballots casted so far during a voting period
2058
1888
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballot-list
2059
1889
  */
2060
- getBallotList() {
2061
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
2062
- const response = yield this.httpBackend.createRequest({
2063
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballot_list`),
2064
- method: 'GET',
2065
- });
2066
- return response;
1890
+ async getBallotList({ block } = defaultRPCOptions) {
1891
+ const response = await this.httpBackend.createRequest({
1892
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballot_list`),
1893
+ method: 'GET',
2067
1894
  });
1895
+ return response;
2068
1896
  }
2069
1897
  /**
2070
1898
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2071
- * @description Sum of ballots casted so far during a voting period
1899
+ * Sum of ballots casted so far during a voting period
2072
1900
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballots
2073
1901
  */
2074
- getBallots() {
2075
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
2076
- const response = yield this.httpBackend.createRequest({
2077
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballots`),
2078
- method: 'GET',
2079
- });
2080
- const casted = castToBigNumber(response, ['yay', 'nay', 'pass']);
2081
- return casted;
1902
+ async getBallots({ block } = defaultRPCOptions) {
1903
+ const response = await this.httpBackend.createRequest({
1904
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballots`),
1905
+ method: 'GET',
2082
1906
  });
1907
+ const casted = castToBigNumber(response, ['yay', 'nay', 'pass']);
1908
+ return casted;
2083
1909
  }
2084
1910
  /**
2085
1911
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2086
- * @description Current proposal under evaluation.
1912
+ * Current proposal under evaluation.
2087
1913
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-proposal
2088
1914
  */
2089
- getCurrentProposal() {
2090
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
2091
- const response = yield this.httpBackend.createRequest({
2092
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_proposal`),
2093
- method: 'GET',
2094
- });
2095
- return response;
1915
+ async getCurrentProposal({ block, } = defaultRPCOptions) {
1916
+ const response = await this.httpBackend.createRequest({
1917
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_proposal`),
1918
+ method: 'GET',
2096
1919
  });
1920
+ return response;
2097
1921
  }
2098
1922
  /**
2099
1923
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2100
- * @description Current expected quorum.
1924
+ * Current expected quorum.
2101
1925
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-quorum
2102
1926
  */
2103
- getCurrentQuorum() {
2104
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
2105
- const response = yield this.httpBackend.createRequest({
2106
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_quorum`),
2107
- method: 'GET',
2108
- });
2109
- return response;
1927
+ async getCurrentQuorum({ block, } = defaultRPCOptions) {
1928
+ const response = await this.httpBackend.createRequest({
1929
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_quorum`),
1930
+ method: 'GET',
2110
1931
  });
1932
+ return response;
2111
1933
  }
2112
1934
  /**
2113
1935
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2114
- * @description List of delegates with their voting power
1936
+ * List of delegates with their voting power
2115
1937
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-listings
2116
1938
  */
2117
- getVotesListings() {
2118
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
2119
- const response = yield this.httpBackend.createRequest({
2120
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/listings`),
2121
- method: 'GET',
2122
- });
2123
- response.map((item) => {
2124
- if (item.voting_power) {
2125
- item.voting_power = new BigNumber(item.voting_power);
2126
- }
2127
- return item;
2128
- });
2129
- return response;
1939
+ async getVotesListings({ block, } = defaultRPCOptions) {
1940
+ const response = await this.httpBackend.createRequest({
1941
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/listings`),
1942
+ method: 'GET',
1943
+ });
1944
+ response.map((item) => {
1945
+ if (item.voting_power) {
1946
+ item.voting_power = new BigNumber(item.voting_power);
1947
+ }
1948
+ return item;
2130
1949
  });
1950
+ return response;
2131
1951
  }
2132
1952
  /**
2133
1953
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2134
- * @description List of proposals with number of supporters
1954
+ * List of proposals with number of supporters
2135
1955
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-proposals
2136
1956
  */
2137
- getProposals() {
2138
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
2139
- const response = yield this.httpBackend.createRequest({
2140
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/proposals`),
2141
- method: 'GET',
2142
- });
2143
- response.map((item) => {
2144
- return (item[1] = new BigNumber(item[1]));
2145
- });
2146
- return response;
1957
+ async getProposals({ block } = defaultRPCOptions) {
1958
+ const response = await this.httpBackend.createRequest({
1959
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/proposals`),
1960
+ method: 'GET',
1961
+ });
1962
+ response.map((item) => {
1963
+ return (item[1] = new BigNumber(item[1]));
2147
1964
  });
1965
+ return response;
2148
1966
  }
2149
1967
  /**
2150
1968
  * @param data operation contents to forge
2151
1969
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2152
- * @description Forge an operation returning the unsigned bytes
1970
+ * Forge an operation returning the unsigned bytes
2153
1971
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2154
1972
  */
2155
- forgeOperations(data_1) {
2156
- return __awaiter(this, arguments, void 0, function* (data, { block } = defaultRPCOptions) {
2157
- return this.httpBackend.createRequest({
2158
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/forge/operations`),
2159
- method: 'POST',
2160
- }, data);
2161
- });
1973
+ async forgeOperations(data, { block } = defaultRPCOptions) {
1974
+ return this.httpBackend.createRequest({
1975
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/forge/operations`),
1976
+ method: 'POST',
1977
+ }, data);
2162
1978
  }
2163
1979
  /**
2164
1980
  * @param signedOpBytes signed bytes to inject
2165
- * @description Inject an operation in node and broadcast it and return the ID of the operation
1981
+ * Inject an operation in node and broadcast it and return the ID of the operation
2166
1982
  * @see https://tezos.gitlab.io/shell/rpc.html#post-injection-operation
2167
1983
  */
2168
- injectOperation(signedOpBytes) {
2169
- return __awaiter(this, void 0, void 0, function* () {
2170
- return this.httpBackend.createRequest({
2171
- url: this.createURL(`/injection/operation`),
2172
- method: 'POST',
2173
- }, signedOpBytes);
2174
- });
1984
+ async injectOperation(signedOpBytes) {
1985
+ return this.httpBackend.createRequest({
1986
+ url: this.createURL(`/injection/operation`),
1987
+ method: 'POST',
1988
+ }, signedOpBytes);
2175
1989
  }
2176
1990
  /**
2177
1991
  * @param ops Operations to apply
2178
1992
  * @param options contains generic configuration for rpc calls to specified block and version
2179
- * @description Simulate the application of the operations with the context of the given block and return the result of each operation application
1993
+ * Simulate the application of the operations with the context of the given block and return the result of each operation application
2180
1994
  * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-helpers-preapply-operations
2181
1995
  */
2182
- preapplyOperations(ops_1) {
2183
- return __awaiter(this, arguments, void 0, function* (ops, { block, version } = defaultRPCOptions) {
2184
- const requestOptions = {
2185
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/preapply/operations`),
2186
- method: 'POST',
2187
- };
2188
- if (version !== undefined) {
2189
- requestOptions.query = { version };
2190
- }
2191
- return yield this.httpBackend.createRequest(requestOptions, ops);
2192
- });
1996
+ async preapplyOperations(ops, { block, version } = defaultRPCOptions) {
1997
+ const requestOptions = {
1998
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/preapply/operations`),
1999
+ method: 'POST',
2000
+ };
2001
+ if (version !== undefined) {
2002
+ requestOptions.query = { version };
2003
+ }
2004
+ return await this.httpBackend.createRequest(requestOptions, ops);
2193
2005
  }
2194
2006
  /**
2195
2007
  * @param contract address of the contract we want to get the entrypoints of
2196
2008
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2197
- * @description Return the list of entrypoints of the contract
2009
+ * Return the list of entrypoints of the contract
2198
2010
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-entrypoints
2199
- * @version 005_PsBABY5H
2011
+ * @remarks version 005_PsBABY5H
2200
2012
  */
2201
- getEntrypoints(contract_1) {
2202
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
2203
- this.validateContract(contract);
2204
- const contractResponse = yield this.httpBackend.createRequest({
2205
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/entrypoints`),
2206
- method: 'GET',
2207
- });
2208
- return contractResponse;
2013
+ async getEntrypoints(contract, { block } = defaultRPCOptions) {
2014
+ this.validateContract(contract);
2015
+ const contractResponse = await this.httpBackend.createRequest({
2016
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/entrypoints`),
2017
+ method: 'GET',
2209
2018
  });
2019
+ return contractResponse;
2210
2020
  }
2211
2021
  /**
2212
2022
  * @param op Operation to simulate
2213
2023
  * @param options contains generic configuration for rpc calls to specified block and version
2214
- * @description Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result.
2024
+ * Simulate running an operation at some future moment (based on the number of blocks given in the `latency` argument), and return the operation application result.
2215
2025
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2216
2026
  */
2217
- simulateOperation(op_1) {
2218
- return __awaiter(this, arguments, void 0, function* (op, { block, version } = defaultRPCOptions) {
2219
- const requestOptions = {
2220
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/simulate_operation`),
2221
- method: 'POST',
2222
- };
2223
- if (version !== undefined) {
2224
- requestOptions.query = { version };
2225
- }
2226
- return yield this.httpBackend.createRequest(requestOptions, op);
2227
- });
2027
+ async simulateOperation(op, { block, version } = defaultRPCOptions) {
2028
+ const requestOptions = {
2029
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/simulate_operation`),
2030
+ method: 'POST',
2031
+ };
2032
+ if (version !== undefined) {
2033
+ requestOptions.query = { version };
2034
+ }
2035
+ return await this.httpBackend.createRequest(requestOptions, op);
2228
2036
  }
2229
2037
  /**
2230
2038
  * @param code Code to run
2231
2039
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2232
- * @description Run a Michelson script in the current context
2040
+ * Run a Michelson script in the current context
2233
2041
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2234
2042
  */
2235
- runCode(code_1) {
2236
- return __awaiter(this, arguments, void 0, function* (code, { block } = defaultRPCOptions) {
2237
- const response = yield this.httpBackend.createRequest({
2238
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_code`),
2239
- method: 'POST',
2240
- }, code);
2241
- return response;
2242
- });
2043
+ async runCode(code, { block } = defaultRPCOptions) {
2044
+ const response = await this.httpBackend.createRequest({
2045
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_code`),
2046
+ method: 'POST',
2047
+ }, code);
2048
+ return response;
2243
2049
  }
2244
2050
  /**
2245
2051
  * @param viewScriptParams Parameters of the script view to run
2246
2052
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2247
- * @description Simulate a call to a michelson view
2053
+ * Simulate a call to a michelson view
2248
2054
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2249
2055
  */
2250
- runScriptView(_a, _b) {
2251
- return __awaiter(this, void 0, void 0, function* () {
2252
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
2253
- var _c = _b === void 0 ? defaultRPCOptions : _b, block = _c.block;
2254
- return this.httpBackend.createRequest({
2255
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_script_view`),
2256
- method: 'POST',
2257
- }, Object.assign({ unparsing_mode }, rest));
2056
+ async runScriptView({ unparsing_mode = 'Readable', ...rest }, { block } = defaultRPCOptions) {
2057
+ return this.httpBackend.createRequest({
2058
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_script_view`),
2059
+ method: 'POST',
2060
+ }, {
2061
+ unparsing_mode,
2062
+ ...rest,
2258
2063
  });
2259
2064
  }
2260
2065
  /**
2261
2066
  * @param viewParams Parameters of the view to run
2262
2067
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2263
- * @description Simulate a call to a view following the TZIP-4 standard.
2068
+ * Simulate a call to a view following the TZIP-4 standard.
2264
2069
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2265
2070
  */
2266
- runView(_a, _b) {
2267
- return __awaiter(this, void 0, void 0, function* () {
2268
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
2269
- var _c = _b === void 0 ? defaultRPCOptions : _b, block = _c.block;
2270
- return this.httpBackend.createRequest({
2271
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_view`),
2272
- method: 'POST',
2273
- }, Object.assign({ unparsing_mode }, rest));
2071
+ async runView({ unparsing_mode = 'Readable', ...rest }, { block } = defaultRPCOptions) {
2072
+ return this.httpBackend.createRequest({
2073
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_view`),
2074
+ method: 'POST',
2075
+ }, {
2076
+ unparsing_mode,
2077
+ ...rest,
2274
2078
  });
2275
2079
  }
2276
- getChainId() {
2277
- return __awaiter(this, void 0, void 0, function* () {
2278
- return this.httpBackend.createRequest({
2279
- url: this.createURL(`/chains/${this.chain}/chain_id`),
2280
- method: 'GET',
2281
- });
2080
+ async getChainId() {
2081
+ return this.httpBackend.createRequest({
2082
+ url: this.createURL(`/chains/${this.chain}/chain_id`),
2083
+ method: 'GET',
2282
2084
  });
2283
2085
  }
2284
2086
  /**
2285
2087
  * @param data Data to pack
2286
2088
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2287
- * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
2089
+ * Computes the serialized version of a data expression using the same algorithm as script instruction PACK
2288
2090
  * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the RPC to pack.
2289
2091
  * This precaution helps protect you and your applications users from RPC nodes that have been compromised.
2290
2092
  * 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.
@@ -2292,242 +2094,226 @@ class RpcClient {
2292
2094
  * @example packData({ data: { string: "test" }, type: { prim: "string" } })
2293
2095
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2294
2096
  */
2295
- packData(data_1) {
2296
- return __awaiter(this, arguments, void 0, function* (data, { block } = defaultRPCOptions) {
2297
- const _a = yield this.httpBackend.createRequest({
2298
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/pack_data`),
2299
- method: 'POST',
2300
- }, data), { gas } = _a, rest = __rest(_a, ["gas"]);
2301
- let formattedGas = gas;
2302
- const tryBigNumber = new BigNumber(gas || '');
2303
- if (!tryBigNumber.isNaN()) {
2304
- formattedGas = tryBigNumber;
2305
- }
2306
- return Object.assign({ gas: formattedGas }, rest);
2307
- });
2097
+ async packData(data, { block } = defaultRPCOptions) {
2098
+ const { gas, ...rest } = await this.httpBackend.createRequest({
2099
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/pack_data`),
2100
+ method: 'POST',
2101
+ }, data);
2102
+ let formattedGas = gas;
2103
+ const tryBigNumber = new BigNumber(gas || '');
2104
+ if (!tryBigNumber.isNaN()) {
2105
+ formattedGas = tryBigNumber;
2106
+ }
2107
+ return { gas: formattedGas, ...rest };
2308
2108
  }
2309
2109
  /**
2310
2110
  *
2311
- * @description Return rpc root url
2111
+ * Return rpc root url
2312
2112
  */
2313
2113
  getRpcUrl() {
2314
2114
  return this.url;
2315
2115
  }
2316
2116
  /**
2317
2117
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2318
- * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
2118
+ * Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
2319
2119
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-period
2320
2120
  */
2321
- getCurrentPeriod() {
2322
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
2323
- const response = yield this.httpBackend.createRequest({
2324
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_period`),
2325
- method: 'GET',
2326
- });
2327
- return response;
2121
+ async getCurrentPeriod({ block, } = defaultRPCOptions) {
2122
+ const response = await this.httpBackend.createRequest({
2123
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_period`),
2124
+ method: 'GET',
2328
2125
  });
2126
+ return response;
2329
2127
  }
2330
2128
  /**
2331
2129
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2332
- * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block
2130
+ * Returns the voting period (index, kind, starting position) and related information (position, remaining) of the next block.Useful to craft operations that will be valid in the next block
2333
2131
  * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head.
2334
2132
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-successor-period
2335
2133
  */
2336
- getSuccessorPeriod() {
2337
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
2338
- const response = yield this.httpBackend.createRequest({
2339
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/successor_period`),
2340
- method: 'GET',
2341
- });
2342
- return response;
2134
+ async getSuccessorPeriod({ block, } = defaultRPCOptions) {
2135
+ const response = await this.httpBackend.createRequest({
2136
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/successor_period`),
2137
+ method: 'GET',
2343
2138
  });
2139
+ return response;
2344
2140
  }
2345
2141
  /**
2346
2142
  * @param id Sapling state ID
2347
2143
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2348
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
2144
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
2349
2145
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff
2350
2146
  */
2351
- getSaplingDiffById(id_1) {
2352
- return __awaiter(this, arguments, void 0, function* (id, { block } = defaultRPCOptions) {
2353
- return this.httpBackend.createRequest({
2354
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/sapling/${id}/get_diff`),
2355
- method: 'GET',
2356
- });
2147
+ async getSaplingDiffById(id, { block } = defaultRPCOptions) {
2148
+ return this.httpBackend.createRequest({
2149
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/sapling/${id}/get_diff`),
2150
+ method: 'GET',
2357
2151
  });
2358
2152
  }
2359
2153
  /**
2360
2154
  * @param contract address of the contract we want to get the sapling diff
2361
2155
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2362
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
2156
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
2363
2157
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff
2364
2158
  */
2365
- getSaplingDiffByContract(contract_1) {
2366
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
2367
- return this.httpBackend.createRequest({
2368
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/single_sapling_get_diff`),
2369
- method: 'GET',
2370
- });
2159
+ async getSaplingDiffByContract(contract, { block } = defaultRPCOptions) {
2160
+ return this.httpBackend.createRequest({
2161
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/single_sapling_get_diff`),
2162
+ method: 'GET',
2371
2163
  });
2372
2164
  }
2373
2165
  /**
2374
2166
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2375
- * @description get current and next protocol
2167
+ * get current and next protocol
2376
2168
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
2377
2169
  */
2378
- getProtocols() {
2379
- return __awaiter(this, arguments, void 0, function* ({ block } = defaultRPCOptions) {
2380
- return this.httpBackend.createRequest({
2381
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/protocols`),
2382
- method: 'GET',
2383
- });
2170
+ async getProtocols({ block } = defaultRPCOptions) {
2171
+ return this.httpBackend.createRequest({
2172
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/protocols`),
2173
+ method: 'GET',
2384
2174
  });
2385
2175
  }
2386
2176
  /**
2387
- * @param options contains generic configuration for rpc calls to specified block (default to head)
2388
- * @description get current and next protocol
2177
+ * @param protocol the protocol hash to look up (default to empty string)
2178
+ * get current and next protocol
2389
2179
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
2390
2180
  */
2391
- getProtocolActivations() {
2392
- return __awaiter(this, arguments, void 0, function* (protocol = '') {
2393
- if (protocol) {
2394
- const protocolValidation = validateProtocol(protocol);
2395
- if (protocolValidation !== ValidationResult.VALID) {
2396
- throw new InvalidProtocolHashError(protocol, protocolValidation);
2397
- }
2181
+ async getProtocolActivations(protocol = '') {
2182
+ if (protocol) {
2183
+ const protocolValidation = validateProtocol(protocol);
2184
+ if (protocolValidation !== ValidationResult.VALID) {
2185
+ throw new InvalidProtocolHashError(protocol, protocolValidation);
2398
2186
  }
2399
- return this.httpBackend.createRequest({
2400
- url: this.createURL(`/chains/${this.chain}/protocols/${protocol}`),
2401
- method: 'GET',
2402
- });
2187
+ }
2188
+ return this.httpBackend.createRequest({
2189
+ url: this.createURL(`/chains/${this.chain}/protocols/${protocol}`),
2190
+ method: 'GET',
2403
2191
  });
2404
2192
  }
2405
2193
  /**
2406
2194
  * @param contract address of the contract we want to retrieve storage information of
2407
2195
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2408
- * @description Access the used storage space of the contract
2196
+ * Access the used storage space of the contract
2409
2197
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2410
2198
  */
2411
- getStorageUsedSpace(contract_1) {
2412
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
2413
- return this.httpBackend.createRequest({
2414
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/used_space`),
2415
- method: 'GET',
2416
- });
2199
+ async getStorageUsedSpace(contract, { block } = defaultRPCOptions) {
2200
+ return this.httpBackend.createRequest({
2201
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/used_space`),
2202
+ method: 'GET',
2417
2203
  });
2418
2204
  }
2419
2205
  /**
2420
2206
  * @param contract address of the contract we want to retrieve storage information of
2421
2207
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2422
- * @description Access the paid storage space of the contract
2208
+ * Access the paid storage space of the contract
2423
2209
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
2424
2210
  */
2425
- getStoragePaidSpace(contract_1) {
2426
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
2427
- return this.httpBackend.createRequest({
2428
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/paid_space`),
2429
- method: 'GET',
2430
- });
2211
+ async getStoragePaidSpace(contract, { block } = defaultRPCOptions) {
2212
+ return this.httpBackend.createRequest({
2213
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/paid_space`),
2214
+ method: 'GET',
2431
2215
  });
2432
2216
  }
2433
2217
  /**
2434
2218
  * @param contract implicit or originated address we want to retrieve ticket balance of
2435
2219
  * @param ticket object to specify a ticket by ticketer, content type and content
2436
2220
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2437
- * @description Access the contract's balance of ticket with specified ticketer, content type, and content.
2221
+ * Access the contract's balance of ticket with specified ticketer, content type, and content.
2438
2222
  * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } }
2439
2223
  * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes
2440
2224
  */
2441
- getTicketBalance(contract_1, ticket_1) {
2442
- return __awaiter(this, arguments, void 0, function* (contract, ticket, { block } = defaultRPCOptions) {
2443
- return this.httpBackend.createRequest({
2444
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/ticket_balance`),
2445
- method: 'POST',
2446
- }, ticket);
2447
- });
2225
+ async getTicketBalance(contract, ticket, { block } = defaultRPCOptions) {
2226
+ return this.httpBackend.createRequest({
2227
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/ticket_balance`),
2228
+ method: 'POST',
2229
+ }, ticket);
2448
2230
  }
2449
2231
  /**
2450
2232
  * @param contract originated address we want to retrieve ticket balances of
2451
2233
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2452
- * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage.
2234
+ * Access the complete list of tickets owned by the given contract by scanning the contract's storage.
2453
2235
  * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes
2454
2236
  */
2455
- getAllTicketBalances(contract_1) {
2456
- return __awaiter(this, arguments, void 0, function* (contract, { block } = defaultRPCOptions) {
2457
- return this.httpBackend.createRequest({
2458
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/all_ticket_balances`),
2459
- method: 'GET',
2460
- });
2237
+ async getAllTicketBalances(contract, { block } = defaultRPCOptions) {
2238
+ return this.httpBackend.createRequest({
2239
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/all_ticket_balances`),
2240
+ method: 'GET',
2461
2241
  });
2462
2242
  }
2463
2243
  /**
2464
- * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
2244
+ * Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
2465
2245
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2466
2246
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-adaptive-issuance-launch-cycle
2467
2247
  */
2468
- getAdaptiveIssuanceLaunchCycle() {
2469
- return __awaiter(this, arguments, void 0, function* ({ block, } = defaultRPCOptions) {
2470
- return this.httpBackend.createRequest({
2471
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/adaptive_issuance_launch_cycle`),
2472
- method: 'GET',
2473
- });
2248
+ async getAdaptiveIssuanceLaunchCycle({ block, } = defaultRPCOptions) {
2249
+ return this.httpBackend.createRequest({
2250
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/adaptive_issuance_launch_cycle`),
2251
+ method: 'GET',
2474
2252
  });
2475
2253
  }
2476
2254
  /**
2477
- * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
2255
+ * List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
2478
2256
  * @param args has 5 optional properties
2479
2257
  * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined, source: undefined, operationHash: undefined }
2480
2258
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/tallinn-mempool-openapi-rc.json
2481
2259
  */
2482
- getPendingOperations() {
2483
- return __awaiter(this, arguments, void 0, function* (args = {}) {
2484
- return this.httpBackend.createRequest({
2485
- url: this.createURL(`/chains/${this.chain}/mempool/pending_operations`),
2486
- method: 'GET',
2487
- query: args,
2488
- });
2260
+ async getPendingOperations(args = {}) {
2261
+ return this.httpBackend.createRequest({
2262
+ url: this.createURL(`/chains/${this.chain}/mempool/pending_operations`),
2263
+ method: 'GET',
2264
+ query: args,
2265
+ });
2266
+ }
2267
+ /**
2268
+ * Returns the current mempool fee filter configuration.
2269
+ *
2270
+ * On Tezos L1 these values commonly resemble the historical fee defaults used by clients.
2271
+ * On Tezos X / Tezlink, the same fields are used for estimation but may differ materially,
2272
+ * especially the byte fee and the gas-price component.
2273
+ *
2274
+ * @param args optional query arguments for the mempool/filter endpoint
2275
+ */
2276
+ async getMempoolFilter(args = {}) {
2277
+ return this.httpBackend.createRequest({
2278
+ url: this.createURL(`/chains/${this.chain}/mempool/filter`),
2279
+ method: 'GET',
2280
+ query: args,
2489
2281
  });
2490
2282
  }
2491
2283
  /**
2492
2284
  * @param delegate delegate address which we want to retrieve active staking parameters
2493
2285
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2494
- * @description Returns the currently active staking parameters for the given delegate
2286
+ * Returns the currently active staking parameters for the given delegate
2495
2287
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-active-staking-parameters
2496
2288
  */
2497
- getActiveStakingParameters(delegate_1) {
2498
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = defaultRPCOptions) {
2499
- return yield this.httpBackend.createRequest({
2500
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/active_staking_parameters`),
2501
- method: 'GET',
2502
- });
2289
+ async getActiveStakingParameters(delegate, { block } = defaultRPCOptions) {
2290
+ return await this.httpBackend.createRequest({
2291
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/active_staking_parameters`),
2292
+ method: 'GET',
2503
2293
  });
2504
2294
  }
2505
2295
  /**
2506
2296
  * @param delegate delegate address which we want to retrieve pending staking parameters
2507
2297
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2508
- * @description Returns the pending values for the given delegate's staking parameters
2298
+ * Returns the pending values for the given delegate's staking parameters
2509
2299
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-pending-staking-parameters
2510
2300
  */
2511
- getPendingStakingParameters(delegate_1) {
2512
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = defaultRPCOptions) {
2513
- return yield this.httpBackend.createRequest({
2514
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/pending_staking_parameters`),
2515
- method: 'GET',
2516
- });
2301
+ async getPendingStakingParameters(delegate, { block } = defaultRPCOptions) {
2302
+ return await this.httpBackend.createRequest({
2303
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/pending_staking_parameters`),
2304
+ method: 'GET',
2517
2305
  });
2518
2306
  }
2519
2307
  /**
2520
2308
  * @param destination address to retrieve the index for
2521
2309
  * @param options contains generic configuration for rpc calls to specified block (default to head)
2522
- * @description Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
2310
+ * Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
2523
2311
  * @see https://octez.tezos.com/docs/alpha/rpc.html#get-block-id-context-destination-destination-id-index
2524
2312
  */
2525
- getDestinationIndex(destination_1) {
2526
- return __awaiter(this, arguments, void 0, function* (destination, { block } = defaultRPCOptions) {
2527
- return yield this.httpBackend.createRequest({
2528
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/destination/${destination}/index`),
2529
- method: 'GET',
2530
- });
2313
+ async getDestinationIndex(destination, { block } = defaultRPCOptions) {
2314
+ return await this.httpBackend.createRequest({
2315
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/destination/${destination}/index`),
2316
+ method: 'GET',
2531
2317
  });
2532
2318
  }
2533
2319
  }