@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.
@@ -1,24 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
2
  Object.defineProperty(exports, "__esModule", { value: true });
23
3
  exports.RpcClientCache = void 0;
24
4
  const rpc_client_interface_1 = require("./../rpc-client-interface");
@@ -27,7 +7,7 @@ const core_1 = require("@taquito/core");
27
7
  const utils_1 = require("@taquito/utils");
28
8
  const defaultTtl = 1000;
29
9
  /***
30
- * @description RpcClientCache acts as a decorator over the RpcClient instance by caching responses for the period defined by the ttl.
10
+ * RpcClientCache acts as a decorator over the RpcClient instance by caching responses for the period defined by the ttl.
31
11
  */
32
12
  class RpcClientCache {
33
13
  /**
@@ -46,7 +26,7 @@ class RpcClientCache {
46
26
  return this._cache;
47
27
  }
48
28
  /**
49
- * @description Remove all the data in the cache.
29
+ * Remove all the data in the cache.
50
30
  *
51
31
  */
52
32
  deleteAllCachedData() {
@@ -97,819 +77,737 @@ class RpcClientCache {
97
77
  }
98
78
  /**
99
79
  * @param options contains generic configuration for rpc calls to specified block (default to head)
100
- * @description Get the block's hash, its unique identifier.
80
+ * Get the block's hash, its unique identifier.
101
81
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-hash
102
82
  */
103
- getBlockHash() {
104
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
105
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK_HASH, [
106
- block,
107
- ]);
108
- if (this.has(key)) {
109
- return this.get(key);
110
- }
111
- else {
112
- const response = this.rpcClient.getBlockHash({ block });
113
- this.put(key, response);
114
- return response;
115
- }
116
- });
83
+ async getBlockHash({ block } = rpc_client_interface_2.defaultRPCOptions) {
84
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK_HASH, [
85
+ block,
86
+ ]);
87
+ if (this.has(key)) {
88
+ return this.get(key);
89
+ }
90
+ else {
91
+ const response = this.rpcClient.getBlockHash({ block });
92
+ this.put(key, response);
93
+ return response;
94
+ }
117
95
  }
118
96
  /**
119
97
  * @param options contains generic configuration for rpc calls to specified block (default to head)
120
- * @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.
98
+ * 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.
121
99
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-live-blocks
122
100
  */
123
- getLiveBlocks() {
124
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
125
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_LIVE_BLOCKS, [
126
- block,
127
- ]);
128
- if (this.has(key)) {
129
- return this.get(key);
130
- }
131
- else {
132
- const response = this.rpcClient.getLiveBlocks({ block });
133
- this.put(key, response);
134
- return response;
135
- }
136
- });
101
+ async getLiveBlocks({ block } = rpc_client_interface_2.defaultRPCOptions) {
102
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_LIVE_BLOCKS, [
103
+ block,
104
+ ]);
105
+ if (this.has(key)) {
106
+ return this.get(key);
107
+ }
108
+ else {
109
+ const response = this.rpcClient.getLiveBlocks({ block });
110
+ this.put(key, response);
111
+ return response;
112
+ }
137
113
  }
138
114
  /**
139
115
  * @param address address from which we want to retrieve the spendable balance
140
116
  * @param options contains generic configuration for rpc calls to specified block (default to head)
141
- * @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.
117
+ * 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.
142
118
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance
143
119
  */
144
- getBalance(address_1) {
145
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
146
- this.validateAddress(address);
147
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALANCE, [
148
- block,
149
- address,
150
- ]);
151
- if (this.has(key)) {
152
- return this.get(key);
153
- }
154
- else {
155
- const response = this.rpcClient.getBalance(address, { block });
156
- this.put(key, response);
157
- return response;
158
- }
159
- });
120
+ async getBalance(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
121
+ this.validateAddress(address);
122
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALANCE, [
123
+ block,
124
+ address,
125
+ ]);
126
+ if (this.has(key)) {
127
+ return this.get(key);
128
+ }
129
+ else {
130
+ const response = this.rpcClient.getBalance(address, { block });
131
+ this.put(key, response);
132
+ return response;
133
+ }
160
134
  }
161
135
  /**
162
136
  * @param address address from which we want to retrieve the balance
163
137
  * @param options contains generic configuration for rpc calls to specified block (default to head)
164
- * @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.
138
+ * 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.
165
139
  */
166
- getSpendable(address_1) {
167
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
168
- this.validateAddress(address);
169
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SPENDABLE, [
170
- block,
171
- address,
172
- ]);
173
- if (this.has(key)) {
174
- return this.get(key);
175
- }
176
- else {
177
- const response = this.rpcClient.getSpendable(address, { block });
178
- this.put(key, response);
179
- return response;
180
- }
181
- });
140
+ async getSpendable(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
141
+ this.validateAddress(address);
142
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SPENDABLE, [
143
+ block,
144
+ address,
145
+ ]);
146
+ if (this.has(key)) {
147
+ return this.get(key);
148
+ }
149
+ else {
150
+ const response = this.rpcClient.getSpendable(address, { block });
151
+ this.put(key, response);
152
+ return response;
153
+ }
182
154
  }
183
155
  /**
184
156
  * @param address address from which we want to retrieve balance and frozen bonds
185
157
  * @param options contains generic configuration for rpc calls to specified block (default to head)
186
- * @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.
158
+ * 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.
187
159
  */
188
- getBalanceAndFrozenBonds(address_1) {
189
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
190
- this.validateAddress(address);
191
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALANCE_AND_FROZEN_BONDS, [block, address]);
192
- if (this.has(key)) {
193
- return this.get(key);
194
- }
195
- else {
196
- const response = this.rpcClient.getBalanceAndFrozenBonds(address, { block });
197
- this.put(key, response);
198
- return response;
199
- }
200
- });
160
+ async getBalanceAndFrozenBonds(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
161
+ this.validateAddress(address);
162
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALANCE_AND_FROZEN_BONDS, [block, address]);
163
+ if (this.has(key)) {
164
+ return this.get(key);
165
+ }
166
+ else {
167
+ const response = this.rpcClient.getBalanceAndFrozenBonds(address, { block });
168
+ this.put(key, response);
169
+ return response;
170
+ }
201
171
  }
202
172
  /**
203
173
  * @param address address from which we want to retrieve spendable and frozen bonds
204
174
  * @param options contains generic configuration for rpc calls to specified block (default to head)
205
- * @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.
175
+ * 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.
206
176
  */
207
- getSpendableAndFrozenBonds(address_1) {
208
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
209
- this.validateAddress(address);
210
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SPENDABLE_AND_FROZEN_BONDS, [block, address]);
211
- if (this.has(key)) {
212
- return this.get(key);
213
- }
214
- else {
215
- const response = this.rpcClient.getSpendableAndFrozenBonds(address, { block });
216
- this.put(key, response);
217
- return response;
218
- }
219
- });
177
+ async getSpendableAndFrozenBonds(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
178
+ this.validateAddress(address);
179
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SPENDABLE_AND_FROZEN_BONDS, [block, address]);
180
+ if (this.has(key)) {
181
+ return this.get(key);
182
+ }
183
+ else {
184
+ const response = this.rpcClient.getSpendableAndFrozenBonds(address, { block });
185
+ this.put(key, response);
186
+ return response;
187
+ }
220
188
  }
221
189
  /**
222
190
  * @param address address from which we want to retrieve the full balance
223
191
  * @param options contains generic configuration for rpc calls to specified block (default to head)
224
- * @description Access the full balance of a contract, including frozen bonds and stake.
192
+ * Access the full balance of a contract, including frozen bonds and stake.
225
193
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
226
194
  */
227
- getFullBalance(address_1) {
228
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
229
- this.validateAddress(address);
230
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_FULL_BALANCE, [
231
- block,
232
- address,
233
- ]);
234
- if (this.has(key)) {
235
- return this.get(key);
236
- }
237
- else {
238
- const response = this.rpcClient.getFullBalance(address, { block });
239
- this.put(key, response);
240
- return response;
241
- }
242
- });
195
+ async getFullBalance(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
196
+ this.validateAddress(address);
197
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_FULL_BALANCE, [
198
+ block,
199
+ address,
200
+ ]);
201
+ if (this.has(key)) {
202
+ return this.get(key);
203
+ }
204
+ else {
205
+ const response = this.rpcClient.getFullBalance(address, { block });
206
+ this.put(key, response);
207
+ return response;
208
+ }
243
209
  }
244
210
  /**
245
211
  * @param address address from which we want to retrieve the staked balance
246
212
  * @param options contains generic configuration for rpc calls to specified block (default to head)
247
- * @description Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
213
+ * Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
248
214
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-staked-balance
249
215
  */
250
- getStakedBalance(address_1) {
251
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
252
- this.validateAddress(address);
253
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STAKED_BALANCE, [
254
- block,
255
- address,
256
- ]);
257
- if (this.has(key)) {
258
- return this.get(key);
259
- }
260
- else {
261
- const response = this.rpcClient.getStakedBalance(address, { block });
262
- this.put(key, response);
263
- return response;
264
- }
265
- });
216
+ async getStakedBalance(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
217
+ this.validateAddress(address);
218
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STAKED_BALANCE, [
219
+ block,
220
+ address,
221
+ ]);
222
+ if (this.has(key)) {
223
+ return this.get(key);
224
+ }
225
+ else {
226
+ const response = this.rpcClient.getStakedBalance(address, { block });
227
+ this.put(key, response);
228
+ return response;
229
+ }
266
230
  }
267
231
  /**
268
232
  * @param address address from which we want to retrieve the unstaked finalizable balance
269
233
  * @param options contains generic configuration for rpc calls to specified block (default to head)
270
- * @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.
234
+ * 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.
271
235
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-finalizable-balance
272
236
  */
273
- getUnstakedFinalizableBalance(address_1) {
274
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
275
- this.validateAddress(address);
276
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_UNSTAKED_FINALIZABLE_BALANCE, [block, address]);
277
- if (this.has(key)) {
278
- return this.get(key);
279
- }
280
- else {
281
- const response = this.rpcClient.getUnstakedFinalizableBalance(address, { block });
282
- this.put(key, response);
283
- return response;
284
- }
285
- });
237
+ async getUnstakedFinalizableBalance(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
238
+ this.validateAddress(address);
239
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_UNSTAKED_FINALIZABLE_BALANCE, [block, address]);
240
+ if (this.has(key)) {
241
+ return this.get(key);
242
+ }
243
+ else {
244
+ const response = this.rpcClient.getUnstakedFinalizableBalance(address, { block });
245
+ this.put(key, response);
246
+ return response;
247
+ }
286
248
  }
287
249
  /**
288
250
  * @param address address from which we want to retrieve the unstaked frozen balance
289
251
  * @param options contains generic configuration for rpc calls to specified block (default to head)
290
- * @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.
252
+ * 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.
291
253
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-frozen-balance
292
254
  */
293
- getUnstakedFrozenBalance(address_1) {
294
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
295
- this.validateAddress(address);
296
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_UNSTAKED_FROZEN_BALANCE, [block, address]);
297
- if (this.has(key)) {
298
- return this.get(key);
299
- }
300
- else {
301
- const response = this.rpcClient.getUnstakedFrozenBalance(address, { block });
302
- this.put(key, response);
303
- return response;
304
- }
305
- });
255
+ async getUnstakedFrozenBalance(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
256
+ this.validateAddress(address);
257
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_UNSTAKED_FROZEN_BALANCE, [block, address]);
258
+ if (this.has(key)) {
259
+ return this.get(key);
260
+ }
261
+ else {
262
+ const response = this.rpcClient.getUnstakedFrozenBalance(address, { block });
263
+ this.put(key, response);
264
+ return response;
265
+ }
306
266
  }
307
267
  /**
308
268
  * @param address address from which we want to retrieve the unstake requests
309
269
  * @param options contains generic configuration for rpc calls to specified block (default to head)
310
- * @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.
270
+ * 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.
311
271
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstake-requests
312
272
  */
313
- getUnstakeRequests(address_1) {
314
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
315
- this.validateAddress(address);
316
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_UNSTAKE_REQUESTS, [block, address]);
317
- if (this.has(key)) {
318
- return this.get(key);
319
- }
320
- else {
321
- const response = this.rpcClient.getUnstakeRequests(address, { block });
322
- this.put(key, response);
323
- return response;
324
- }
325
- });
273
+ async getUnstakeRequests(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
274
+ this.validateAddress(address);
275
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_UNSTAKE_REQUESTS, [block, address]);
276
+ if (this.has(key)) {
277
+ return this.get(key);
278
+ }
279
+ else {
280
+ const response = this.rpcClient.getUnstakeRequests(address, { block });
281
+ this.put(key, response);
282
+ return response;
283
+ }
326
284
  }
327
285
  /**
328
286
  * @param address contract address from which we want to retrieve the storage
329
287
  * @param options contains generic configuration for rpc calls to specified block (default to head)
330
- * @description Access the data of the contract.
288
+ * Access the data of the contract.
331
289
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-storage
332
290
  */
333
- getStorage(address_1) {
334
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
335
- this.validateContract(address);
336
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STORAGE, [
337
- block,
338
- address,
339
- ]);
340
- if (this.has(key)) {
341
- return this.get(key);
342
- }
343
- else {
344
- const response = this.rpcClient.getStorage(address, { block });
345
- this.put(key, response);
346
- return response;
347
- }
348
- });
291
+ async getStorage(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
292
+ this.validateContract(address);
293
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STORAGE, [
294
+ block,
295
+ address,
296
+ ]);
297
+ if (this.has(key)) {
298
+ return this.get(key);
299
+ }
300
+ else {
301
+ const response = this.rpcClient.getStorage(address, { block });
302
+ this.put(key, response);
303
+ return response;
304
+ }
349
305
  }
350
306
  /**
351
307
  * @param address contract address from which we want to retrieve the script
352
308
  * @param options contains generic configuration for rpc calls to specified block (default to head)
353
- * @description Access the code and data of the contract.
309
+ * Access the code and data of the contract.
354
310
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-script
355
311
  */
356
- getScript(address_1) {
357
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
358
- this.validateContract(address);
359
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SCRIPT, [
360
- block,
361
- address,
362
- ]);
363
- if (this.has(key)) {
364
- return this.get(key);
365
- }
366
- else {
367
- const response = this.rpcClient.getScript(address, { block });
368
- this.put(key, response);
369
- return response;
370
- }
371
- });
312
+ async getScript(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
313
+ this.validateContract(address);
314
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SCRIPT, [
315
+ block,
316
+ address,
317
+ ]);
318
+ if (this.has(key)) {
319
+ return this.get(key);
320
+ }
321
+ else {
322
+ const response = this.rpcClient.getScript(address, { block });
323
+ this.put(key, response);
324
+ return response;
325
+ }
372
326
  }
373
327
  /**
374
328
  * @param address contract address from which we want to retrieve the script
375
329
  * @param unparsingMode default is { unparsing_mode: "Readable" }
376
330
  * @param options contains generic configuration for rpc calls to specified block (default to head)
377
- * @description Access the script of the contract and normalize it using the requested unparsing mode.
331
+ * Access the script of the contract and normalize it using the requested unparsing mode.
378
332
  */
379
- getNormalizedScript(address_1) {
380
- return __awaiter(this, arguments, void 0, function* (address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = rpc_client_interface_2.defaultRPCOptions) {
381
- this.validateContract(address);
382
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_NORMALIZED_SCRIPT, [block, address], unparsingMode);
383
- if (this.has(key)) {
384
- return this.get(key);
385
- }
386
- else {
387
- const response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block });
388
- this.put(key, response);
389
- return response;
390
- }
391
- });
333
+ async getNormalizedScript(address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = rpc_client_interface_2.defaultRPCOptions) {
334
+ this.validateContract(address);
335
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_NORMALIZED_SCRIPT, [block, address], unparsingMode);
336
+ if (this.has(key)) {
337
+ return this.get(key);
338
+ }
339
+ else {
340
+ const response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block });
341
+ this.put(key, response);
342
+ return response;
343
+ }
392
344
  }
393
345
  /**
394
346
  * @param address contract address from which we want to retrieve
395
347
  * @param options contains generic configuration for rpc calls to specified block (default to head)
396
- * @description Access the complete status of a contract.
348
+ * Access the complete status of a contract.
397
349
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id
398
350
  */
399
- getContract(address_1) {
400
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
401
- this.validateAddress(address);
402
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CONTRACT, [
403
- block,
404
- address,
405
- ]);
406
- if (this.has(key)) {
407
- return this.get(key);
408
- }
409
- else {
410
- const response = this.rpcClient.getContract(address, { block });
411
- this.put(key, response);
412
- return response;
413
- }
414
- });
351
+ async getContract(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
352
+ this.validateAddress(address);
353
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CONTRACT, [
354
+ block,
355
+ address,
356
+ ]);
357
+ if (this.has(key)) {
358
+ return this.get(key);
359
+ }
360
+ else {
361
+ const response = this.rpcClient.getContract(address, { block });
362
+ this.put(key, response);
363
+ return response;
364
+ }
415
365
  }
416
366
  /**
417
367
  * @param address contract address from which we want to retrieve the manager
418
368
  * @param options contains generic configuration for rpc calls to specified block (default to head)
419
- * @description Access the manager of an implicit contract
369
+ * Access the manager of an implicit contract
420
370
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-manager-key
421
371
  */
422
- getManagerKey(address_1) {
423
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
424
- this.validateAddress(address);
425
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_MANAGER_KEY, [
426
- block,
427
- address,
428
- ]);
429
- if (this.has(key)) {
430
- return this.get(key);
431
- }
432
- else {
433
- const response = this.rpcClient.getManagerKey(address, { block });
434
- this.put(key, response);
435
- return response;
436
- }
437
- });
372
+ async getManagerKey(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
373
+ this.validateAddress(address);
374
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_MANAGER_KEY, [
375
+ block,
376
+ address,
377
+ ]);
378
+ if (this.has(key)) {
379
+ return this.get(key);
380
+ }
381
+ else {
382
+ const response = this.rpcClient.getManagerKey(address, { block });
383
+ this.put(key, response);
384
+ return response;
385
+ }
438
386
  }
439
387
  /**
440
388
  * @param address contract address from which we want to retrieve the delegate (baker)
441
389
  * @param options contains generic configuration for rpc calls to specified block (default to head)
442
- * @description Access the delegate of a contract, if any
390
+ * Access the delegate of a contract, if any
443
391
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-delegate
444
392
  */
445
- getDelegate(address_1) {
446
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
447
- this.validateAddress(address);
448
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_DELEGATE, [
449
- block,
450
- address,
451
- ]);
452
- if (this.has(key)) {
453
- return this.get(key);
454
- }
455
- else {
456
- const response = this.rpcClient.getDelegate(address, { block });
457
- this.put(key, response);
458
- return response;
459
- }
460
- });
393
+ async getDelegate(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
394
+ this.validateAddress(address);
395
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_DELEGATE, [
396
+ block,
397
+ address,
398
+ ]);
399
+ if (this.has(key)) {
400
+ return this.get(key);
401
+ }
402
+ else {
403
+ const response = this.rpcClient.getDelegate(address, { block });
404
+ this.put(key, response);
405
+ return response;
406
+ }
461
407
  }
462
408
  /**
463
409
  * @param id Big Map ID
464
410
  * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method))
465
411
  * @param options contains generic configuration for rpc calls to specified block (default to head)
466
- * @description Access the value associated with a key in a big map.
412
+ * Access the value associated with a key in a big map.
467
413
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr
468
414
  */
469
- getBigMapExpr(id_1, expr_1) {
470
- return __awaiter(this, arguments, void 0, function* (id, expr, { block } = rpc_client_interface_2.defaultRPCOptions) {
471
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BIG_MAP_EXPR, [
472
- block,
473
- id,
474
- expr,
475
- ]);
476
- if (this.has(key)) {
477
- return this.get(key);
478
- }
479
- else {
480
- const response = this.rpcClient.getBigMapExpr(id, expr, { block });
481
- this.put(key, response);
482
- return response;
483
- }
484
- });
415
+ async getBigMapExpr(id, expr, { block } = rpc_client_interface_2.defaultRPCOptions) {
416
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BIG_MAP_EXPR, [
417
+ block,
418
+ id,
419
+ expr,
420
+ ]);
421
+ if (this.has(key)) {
422
+ return this.get(key);
423
+ }
424
+ else {
425
+ const response = this.rpcClient.getBigMapExpr(id, expr, { block });
426
+ this.put(key, response);
427
+ return response;
428
+ }
485
429
  }
486
430
  /**
487
431
  * @param args contains optional query arguments (active, inactive, with_minimal_stake, without_minimal_stake)
488
432
  * @param options contains generic configuration for rpc calls to specified block (default to head)
489
- * @description Lists all registered delegates by default with query arguments to filter unneeded values.
433
+ * Lists all registered delegates by default with query arguments to filter unneeded values.
490
434
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
491
435
  */
492
- getAllDelegates() {
493
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = rpc_client_interface_2.defaultRPCOptions) {
494
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ALL_DELEGATES, [
495
- block,
496
- args,
497
- ]);
498
- if (this.has(key)) {
499
- return this.get(key);
500
- }
501
- else {
502
- const response = this.rpcClient.getAllDelegates(args, { block });
503
- this.put(key, response);
504
- return response;
505
- }
506
- });
436
+ async getAllDelegates(args = {}, { block } = rpc_client_interface_2.defaultRPCOptions) {
437
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ALL_DELEGATES, [
438
+ block,
439
+ args,
440
+ ]);
441
+ if (this.has(key)) {
442
+ return this.get(key);
443
+ }
444
+ else {
445
+ const response = this.rpcClient.getAllDelegates(args, { block });
446
+ this.put(key, response);
447
+ return response;
448
+ }
507
449
  }
508
450
  /**
509
451
  * @param address delegate address which we want to retrieve
510
452
  * @param options contains generic configuration for rpc calls to specified block (default to head)
511
- * @description Everything about a delegate
453
+ * Everything about a delegate
512
454
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
513
455
  */
514
- getDelegates(address_1) {
515
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
516
- this.validateAddress(address);
517
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_DELEGATES, [
518
- block,
519
- address,
520
- ]);
521
- if (this.has(key)) {
522
- return this.get(key);
523
- }
524
- else {
525
- const response = this.rpcClient.getDelegates(address, { block });
526
- this.put(key, response);
527
- return response;
528
- }
529
- });
456
+ async getDelegates(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
457
+ this.validateAddress(address);
458
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_DELEGATES, [
459
+ block,
460
+ address,
461
+ ]);
462
+ if (this.has(key)) {
463
+ return this.get(key);
464
+ }
465
+ else {
466
+ const response = this.rpcClient.getDelegates(address, { block });
467
+ this.put(key, response);
468
+ return response;
469
+ }
530
470
  }
531
471
  /**
532
472
  * @param address delegate address which we want to retrieve
533
473
  * @param options contains generic configuration for rpc calls to specified block (default to head)
534
- * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period
474
+ * Returns the delegate info (e.g. voting power) found in the listings of the current voting period
535
475
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-voting-info
536
476
  */
537
- getVotingInfo(address_1) {
538
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_2.defaultRPCOptions) {
539
- this.validateAddress(address);
540
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_VOTING_INFO, [
541
- block,
542
- address,
543
- ]);
544
- if (this.has(key)) {
545
- return this.get(key);
546
- }
547
- else {
548
- const response = this.rpcClient.getVotingInfo(address, { block });
549
- this.put(key, response);
550
- return response;
551
- }
552
- });
477
+ async getVotingInfo(address, { block } = rpc_client_interface_2.defaultRPCOptions) {
478
+ this.validateAddress(address);
479
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_VOTING_INFO, [
480
+ block,
481
+ address,
482
+ ]);
483
+ if (this.has(key)) {
484
+ return this.get(key);
485
+ }
486
+ else {
487
+ const response = this.rpcClient.getVotingInfo(address, { block });
488
+ this.put(key, response);
489
+ return response;
490
+ }
553
491
  }
554
492
  /**
555
493
  * @param options contains generic configuration for rpc calls to specified block (default to head)
556
- * @description All constants
494
+ * All constants
557
495
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-constants
558
496
  */
559
- getConstants() {
560
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
561
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CONSTANTS, [
562
- block,
563
- ]);
564
- if (this.has(key)) {
565
- return this.get(key);
566
- }
567
- else {
568
- const response = this.rpcClient.getConstants({ block });
569
- this.put(key, response);
570
- return response;
571
- }
572
- });
497
+ async getConstants({ block } = rpc_client_interface_2.defaultRPCOptions) {
498
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CONSTANTS, [
499
+ block,
500
+ ]);
501
+ if (this.has(key)) {
502
+ return this.get(key);
503
+ }
504
+ else {
505
+ const response = this.rpcClient.getConstants({ block });
506
+ this.put(key, response);
507
+ return response;
508
+ }
573
509
  }
574
510
  /**
575
511
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version.
576
- * @description All the information about a block
512
+ * All the information about a block
577
513
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id
578
514
  * @example getBlock() will default to `/main/chains/block/head?version=1`
579
515
  * @example getBlock({ block: 'head~2') will return an offset of 2 from head blocks
580
516
  * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash..
581
517
  */
582
- getBlock() {
583
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
584
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK, [block]);
585
- if (this.has(key)) {
586
- return this.get(key);
587
- }
588
- else {
589
- const response = this.rpcClient.getBlock({ block });
590
- this.put(key, response);
591
- return response;
592
- }
593
- });
518
+ async getBlock({ block } = rpc_client_interface_2.defaultRPCOptions) {
519
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK, [block]);
520
+ if (this.has(key)) {
521
+ return this.get(key);
522
+ }
523
+ else {
524
+ const response = this.rpcClient.getBlock({ block });
525
+ this.put(key, response);
526
+ return response;
527
+ }
594
528
  }
595
529
  /**
596
530
  * @param options contains generic configuration for rpc calls to specified block (default to head)
597
- * @description The whole block header
531
+ * The whole block header
598
532
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-header
599
533
  */
600
- getBlockHeader() {
601
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
602
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK_HEADER, [
603
- block,
604
- ]);
605
- if (this.has(key)) {
606
- return this.get(key);
607
- }
608
- else {
609
- const response = this.rpcClient.getBlockHeader({ block });
610
- this.put(key, response);
611
- return response;
612
- }
613
- });
534
+ async getBlockHeader({ block } = rpc_client_interface_2.defaultRPCOptions) {
535
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK_HEADER, [
536
+ block,
537
+ ]);
538
+ if (this.has(key)) {
539
+ return this.get(key);
540
+ }
541
+ else {
542
+ const response = this.rpcClient.getBlockHeader({ block });
543
+ this.put(key, response);
544
+ return response;
545
+ }
614
546
  }
615
547
  /**
616
548
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version
617
- * @description All the metadata associated to the block
549
+ * All the metadata associated to the block
618
550
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-metadata
619
551
  */
620
- getBlockMetadata() {
621
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
622
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK_METADATA, [
623
- block,
624
- ]);
625
- if (this.has(key)) {
626
- return this.get(key);
627
- }
628
- else {
629
- const response = this.rpcClient.getBlockMetadata({ block });
630
- this.put(key, response);
631
- return response;
632
- }
633
- });
552
+ async getBlockMetadata({ block } = rpc_client_interface_2.defaultRPCOptions) {
553
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BLOCK_METADATA, [
554
+ block,
555
+ ]);
556
+ if (this.has(key)) {
557
+ return this.get(key);
558
+ }
559
+ else {
560
+ const response = this.rpcClient.getBlockMetadata({ block });
561
+ this.put(key, response);
562
+ return response;
563
+ }
634
564
  }
635
565
  /**
636
566
  * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round)
637
567
  * @param options contains generic configuration for rpc calls to specified block (default to head)
638
- * @description Retrieves the list of delegates allowed to bake a block.
568
+ * Retrieves the list of delegates allowed to bake a block.
639
569
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
640
570
  */
641
- getBakingRights() {
642
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = rpc_client_interface_2.defaultRPCOptions) {
643
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BAKING_RIGHTS, [
644
- block,
645
- args,
646
- ]);
647
- if (this.has(key)) {
648
- return this.get(key);
649
- }
650
- else {
651
- const response = this.rpcClient.getBakingRights(args, { block });
652
- this.put(key, response);
653
- return response;
654
- }
655
- });
571
+ async getBakingRights(args = {}, { block } = rpc_client_interface_2.defaultRPCOptions) {
572
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BAKING_RIGHTS, [
573
+ block,
574
+ args,
575
+ ]);
576
+ if (this.has(key)) {
577
+ return this.get(key);
578
+ }
579
+ else {
580
+ const response = this.rpcClient.getBakingRights(args, { block });
581
+ this.put(key, response);
582
+ return response;
583
+ }
656
584
  }
657
585
  /**
658
586
  * @param args contains optional query arguments (level, cycle, delegate, and consensus_key)
659
587
  * @param options contains generic configuration for rpc calls to specified block (default to head)
660
- * @description Retrieves the delegates allowed to attest a block
588
+ * Retrieves the delegates allowed to attest a block
661
589
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
662
590
  */
663
- getAttestationRights() {
664
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = rpc_client_interface_2.defaultRPCOptions) {
665
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ATTESTATION_RIGHTS, [block, args]);
666
- if (this.has(key)) {
667
- return this.get(key);
668
- }
669
- else {
670
- const response = this.rpcClient.getAttestationRights(args, { block });
671
- this.put(key, response);
672
- return response;
673
- }
674
- });
591
+ async getAttestationRights(args = {}, { block } = rpc_client_interface_2.defaultRPCOptions) {
592
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ATTESTATION_RIGHTS, [block, args]);
593
+ if (this.has(key)) {
594
+ return this.get(key);
595
+ }
596
+ else {
597
+ const response = this.rpcClient.getAttestationRights(args, { block });
598
+ this.put(key, response);
599
+ return response;
600
+ }
675
601
  }
676
602
  /**
677
603
  * @param options contains generic configuration for rpc calls to specified block (default to head)
678
- * @description Ballots casted so far during a voting period
604
+ * Ballots casted so far during a voting period
679
605
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballot-list
680
606
  */
681
- getBallotList() {
682
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
683
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALLOT_LIST, [
684
- block,
685
- ]);
686
- if (this.has(key)) {
687
- return this.get(key);
688
- }
689
- else {
690
- const response = this.rpcClient.getBallotList({ block });
691
- this.put(key, response);
692
- return response;
693
- }
694
- });
607
+ async getBallotList({ block } = rpc_client_interface_2.defaultRPCOptions) {
608
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALLOT_LIST, [
609
+ block,
610
+ ]);
611
+ if (this.has(key)) {
612
+ return this.get(key);
613
+ }
614
+ else {
615
+ const response = this.rpcClient.getBallotList({ block });
616
+ this.put(key, response);
617
+ return response;
618
+ }
695
619
  }
696
620
  /**
697
621
  * @param options contains generic configuration for rpc calls to specified block (default to head)
698
- * @description Sum of ballots casted so far during a voting period
622
+ * Sum of ballots casted so far during a voting period
699
623
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballots
700
624
  */
701
- getBallots() {
702
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
703
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALLOTS, [block]);
704
- if (this.has(key)) {
705
- return this.get(key);
706
- }
707
- else {
708
- const response = this.rpcClient.getBallots({ block });
709
- this.put(key, response);
710
- return response;
711
- }
712
- });
625
+ async getBallots({ block } = rpc_client_interface_2.defaultRPCOptions) {
626
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_BALLOTS, [block]);
627
+ if (this.has(key)) {
628
+ return this.get(key);
629
+ }
630
+ else {
631
+ const response = this.rpcClient.getBallots({ block });
632
+ this.put(key, response);
633
+ return response;
634
+ }
713
635
  }
714
636
  /**
715
637
  * @param options contains generic configuration for rpc calls to specified block (default to head)
716
- * @description Current proposal under evaluation.
638
+ * Current proposal under evaluation.
717
639
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-proposal
718
640
  */
719
- getCurrentProposal() {
720
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_2.defaultRPCOptions) {
721
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CURRENT_PROPOSAL, [block]);
722
- if (this.has(key)) {
723
- return this.get(key);
724
- }
725
- else {
726
- const response = this.rpcClient.getCurrentProposal({ block });
727
- this.put(key, response);
728
- return response;
729
- }
730
- });
641
+ async getCurrentProposal({ block, } = rpc_client_interface_2.defaultRPCOptions) {
642
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CURRENT_PROPOSAL, [block]);
643
+ if (this.has(key)) {
644
+ return this.get(key);
645
+ }
646
+ else {
647
+ const response = this.rpcClient.getCurrentProposal({ block });
648
+ this.put(key, response);
649
+ return response;
650
+ }
731
651
  }
732
652
  /**
733
653
  * @param options contains generic configuration for rpc calls to specified block (default to head)
734
- * @description Current expected quorum.
654
+ * Current expected quorum.
735
655
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-quorum
736
656
  */
737
- getCurrentQuorum() {
738
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_2.defaultRPCOptions) {
739
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CURRENT_QUORUM, [
740
- block,
741
- ]);
742
- if (this.has(key)) {
743
- return this.get(key);
744
- }
745
- else {
746
- const response = this.rpcClient.getCurrentQuorum({ block });
747
- this.put(key, response);
748
- return response;
749
- }
750
- });
657
+ async getCurrentQuorum({ block, } = rpc_client_interface_2.defaultRPCOptions) {
658
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CURRENT_QUORUM, [
659
+ block,
660
+ ]);
661
+ if (this.has(key)) {
662
+ return this.get(key);
663
+ }
664
+ else {
665
+ const response = this.rpcClient.getCurrentQuorum({ block });
666
+ this.put(key, response);
667
+ return response;
668
+ }
751
669
  }
752
670
  /**
753
671
  * @param options contains generic configuration for rpc calls to specified block (default to head)
754
- * @description List of delegates with their voting power
672
+ * List of delegates with their voting power
755
673
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-listings
756
674
  */
757
- getVotesListings() {
758
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_2.defaultRPCOptions) {
759
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_VOTES_LISTINGS, [
760
- block,
761
- ]);
762
- if (this.has(key)) {
763
- return this.get(key);
764
- }
765
- else {
766
- const response = this.rpcClient.getVotesListings({ block });
767
- this.put(key, response);
768
- return response;
769
- }
770
- });
675
+ async getVotesListings({ block, } = rpc_client_interface_2.defaultRPCOptions) {
676
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_VOTES_LISTINGS, [
677
+ block,
678
+ ]);
679
+ if (this.has(key)) {
680
+ return this.get(key);
681
+ }
682
+ else {
683
+ const response = this.rpcClient.getVotesListings({ block });
684
+ this.put(key, response);
685
+ return response;
686
+ }
771
687
  }
772
688
  /**
773
689
  * @param options contains generic configuration for rpc calls to specified block (default to head)
774
- * @description List of proposals with number of supporters
690
+ * List of proposals with number of supporters
775
691
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-proposals
776
692
  */
777
- getProposals() {
778
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
779
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.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
- }
790
- });
693
+ async getProposals({ block } = rpc_client_interface_2.defaultRPCOptions) {
694
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PROPOSALS, [
695
+ block,
696
+ ]);
697
+ if (this.has(key)) {
698
+ return this.get(key);
699
+ }
700
+ else {
701
+ const response = this.rpcClient.getProposals({ block });
702
+ this.put(key, response);
703
+ return response;
704
+ }
791
705
  }
792
706
  /**
793
707
  * @param data operation contents to forge
794
708
  * @param options contains generic configuration for rpc calls to specified block (default to head)
795
- * @description Forge an operation returning the unsigned bytes
709
+ * Forge an operation returning the unsigned bytes
796
710
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
797
711
  */
798
- forgeOperations(data_1) {
799
- return __awaiter(this, arguments, void 0, function* (data, { block } = rpc_client_interface_2.defaultRPCOptions) {
800
- return this.rpcClient.forgeOperations(data, { block });
801
- });
712
+ async forgeOperations(data, { block } = rpc_client_interface_2.defaultRPCOptions) {
713
+ return this.rpcClient.forgeOperations(data, { block });
802
714
  }
803
715
  /**
804
716
  * @param signedOpBytes signed bytes to inject
805
- * @description Inject an operation in node and broadcast it and return the ID of the operation
717
+ * Inject an operation in node and broadcast it and return the ID of the operation
806
718
  * @see https://tezos.gitlab.io/shell/rpc.html#post-injection-operation
807
719
  */
808
- injectOperation(signedOpBytes) {
809
- return __awaiter(this, void 0, void 0, function* () {
810
- return this.rpcClient.injectOperation(signedOpBytes);
811
- });
720
+ async injectOperation(signedOpBytes) {
721
+ return this.rpcClient.injectOperation(signedOpBytes);
812
722
  }
813
723
  /**
814
724
  * @param ops Operations to apply
815
725
  * @param options contains generic configuration for rpc calls to specified block and version
816
- * @description Simulate the application of the operations with the context of the given block and return the result of each operation application
726
+ * Simulate the application of the operations with the context of the given block and return the result of each operation application
817
727
  * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-helpers-preapply-operations
818
728
  */
819
- preapplyOperations(ops_1) {
820
- return __awaiter(this, arguments, void 0, function* (ops, { block } = rpc_client_interface_2.defaultRPCOptions) {
821
- return this.rpcClient.preapplyOperations(ops, { block });
822
- });
729
+ async preapplyOperations(ops, { block } = rpc_client_interface_2.defaultRPCOptions) {
730
+ return this.rpcClient.preapplyOperations(ops, { block });
823
731
  }
824
732
  /**
825
733
  * @param contract address of the contract we want to get the entrypoints of
826
734
  * @param options contains generic configuration for rpc calls to specified block (default to head)
827
- * @description Return the list of entrypoints of the contract
735
+ * Return the list of entrypoints of the contract
828
736
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-entrypoints
829
- * @version 005_PsBABY5H
737
+ * @remarks version 005_PsBABY5H
830
738
  */
831
- getEntrypoints(contract_1) {
832
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
833
- this.validateContract(contract);
834
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ENTRYPOINTS, [
835
- block,
836
- contract,
837
- ]);
838
- if (this.has(key)) {
839
- return this.get(key);
840
- }
841
- else {
842
- const response = this.rpcClient.getEntrypoints(contract, { block });
843
- this.put(key, response);
844
- return response;
845
- }
846
- });
739
+ async getEntrypoints(contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
740
+ this.validateContract(contract);
741
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ENTRYPOINTS, [
742
+ block,
743
+ contract,
744
+ ]);
745
+ if (this.has(key)) {
746
+ return this.get(key);
747
+ }
748
+ else {
749
+ const response = this.rpcClient.getEntrypoints(contract, { block });
750
+ this.put(key, response);
751
+ return response;
752
+ }
847
753
  }
848
754
  /**
849
755
  * @param op Operation to simulate
850
756
  * @param options contains generic configuration for rpc calls to specified block and version
851
- * @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.
757
+ * 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.
852
758
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
853
759
  */
854
- simulateOperation(op_1) {
855
- return __awaiter(this, arguments, void 0, function* (op, { block } = rpc_client_interface_2.defaultRPCOptions) {
856
- return this.rpcClient.simulateOperation(op, { block });
857
- });
760
+ async simulateOperation(op, { block } = rpc_client_interface_2.defaultRPCOptions) {
761
+ return this.rpcClient.simulateOperation(op, { block });
858
762
  }
859
763
  /**
860
764
  * @param code Code to run
861
765
  * @param options contains generic configuration for rpc calls to specified block (default to head)
862
- * @description Run a Michelson script in the current context
766
+ * Run a Michelson script in the current context
863
767
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
864
768
  */
865
- runCode(code_1) {
866
- return __awaiter(this, arguments, void 0, function* (code, { block } = rpc_client_interface_2.defaultRPCOptions) {
867
- return this.rpcClient.runCode(code, { block });
868
- });
769
+ async runCode(code, { block } = rpc_client_interface_2.defaultRPCOptions) {
770
+ return this.rpcClient.runCode(code, { block });
869
771
  }
870
772
  /**
871
773
  * @param viewScriptParams Parameters of the script view to run
872
774
  * @param options contains generic configuration for rpc calls to specified block (default to head)
873
- * @description Simulate a call to a michelson view
775
+ * Simulate a call to a michelson view
874
776
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
875
777
  */
876
- runScriptView(_a, _b) {
877
- return __awaiter(this, void 0, void 0, function* () {
878
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
879
- var _c = _b === void 0 ? rpc_client_interface_2.defaultRPCOptions : _b, block = _c.block;
880
- return this.rpcClient.runScriptView(Object.assign({ unparsing_mode }, rest), { block });
881
- });
778
+ async runScriptView({ unparsing_mode = 'Readable', ...rest }, { block } = rpc_client_interface_2.defaultRPCOptions) {
779
+ return this.rpcClient.runScriptView({
780
+ unparsing_mode,
781
+ ...rest,
782
+ }, { block });
882
783
  }
883
784
  /**
884
785
  * @param viewParams Parameters of the view to run
885
786
  * @param options contains generic configuration for rpc calls to specified block (default to head)
886
- * @description Simulate a call to a view following the TZIP-4 standard.
787
+ * Simulate a call to a view following the TZIP-4 standard.
887
788
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
888
789
  */
889
- runView(_a, _b) {
890
- return __awaiter(this, void 0, void 0, function* () {
891
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
892
- var _c = _b === void 0 ? rpc_client_interface_2.defaultRPCOptions : _b, block = _c.block;
893
- return this.rpcClient.runView(Object.assign({ unparsing_mode }, rest), { block });
894
- });
895
- }
896
- getChainId() {
897
- return __awaiter(this, void 0, void 0, function* () {
898
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CHAIN_ID, []);
899
- if (this.has(key)) {
900
- return this.get(key);
901
- }
902
- else {
903
- const response = this.rpcClient.getChainId();
904
- this.put(key, response);
905
- return response;
906
- }
907
- });
790
+ async runView({ unparsing_mode = 'Readable', ...rest }, { block } = rpc_client_interface_2.defaultRPCOptions) {
791
+ return this.rpcClient.runView({
792
+ unparsing_mode,
793
+ ...rest,
794
+ }, { block });
795
+ }
796
+ async getChainId() {
797
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CHAIN_ID, []);
798
+ if (this.has(key)) {
799
+ return this.get(key);
800
+ }
801
+ else {
802
+ const response = this.rpcClient.getChainId();
803
+ this.put(key, response);
804
+ return response;
805
+ }
908
806
  }
909
807
  /**
910
808
  * @param data Data to pack
911
809
  * @param options contains generic configuration for rpc calls to specified block (default to head)
912
- * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
810
+ * Computes the serialized version of a data expression using the same algorithm as script instruction PACK
913
811
  * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the RPC to pack.
914
812
  * This precaution helps protect you and your applications users from RPC nodes that have been compromised.
915
813
  * 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.
@@ -917,319 +815,304 @@ class RpcClientCache {
917
815
  * @example packData({ data: { string: "test" }, type: { prim: "string" } })
918
816
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
919
817
  */
920
- packData(data_1) {
921
- return __awaiter(this, arguments, void 0, function* (data, { block } = rpc_client_interface_2.defaultRPCOptions) {
922
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.PACK_DATA, [block], data);
923
- if (this.has(key)) {
924
- return this.get(key);
925
- }
926
- else {
927
- const response = this.rpcClient.packData(data, { block });
928
- this.put(key, response);
929
- return response;
930
- }
931
- });
818
+ async packData(data, { block } = rpc_client_interface_2.defaultRPCOptions) {
819
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.PACK_DATA, [block], data);
820
+ if (this.has(key)) {
821
+ return this.get(key);
822
+ }
823
+ else {
824
+ const response = this.rpcClient.packData(data, { block });
825
+ this.put(key, response);
826
+ return response;
827
+ }
932
828
  }
933
829
  /**
934
830
  *
935
- * @description Return rpc root url
831
+ * Return rpc root url
936
832
  */
937
833
  getRpcUrl() {
938
834
  return this.rpcClient.getRpcUrl();
939
835
  }
940
836
  /**
941
837
  * @param options contains generic configuration for rpc calls to specified block (default to head)
942
- * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
838
+ * Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
943
839
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-period
944
840
  */
945
- getCurrentPeriod() {
946
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_2.defaultRPCOptions) {
947
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CURRENT_PERIOD, [
948
- block,
949
- ]);
950
- if (this.has(key)) {
951
- return this.get(key);
952
- }
953
- else {
954
- const response = this.rpcClient.getCurrentPeriod({ block });
955
- this.put(key, response);
956
- return response;
957
- }
958
- });
841
+ async getCurrentPeriod({ block, } = rpc_client_interface_2.defaultRPCOptions) {
842
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_CURRENT_PERIOD, [
843
+ block,
844
+ ]);
845
+ if (this.has(key)) {
846
+ return this.get(key);
847
+ }
848
+ else {
849
+ const response = this.rpcClient.getCurrentPeriod({ block });
850
+ this.put(key, response);
851
+ return response;
852
+ }
959
853
  }
960
854
  /**
961
855
  * @param options contains generic configuration for rpc calls to specified block (default to head)
962
- * @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
856
+ * 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
963
857
  * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head.
964
858
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-successor-period
965
859
  */
966
- getSuccessorPeriod() {
967
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_2.defaultRPCOptions) {
968
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SUCCESSOR_PERIOD, [block]);
969
- if (this.has(key)) {
970
- return this.get(key);
971
- }
972
- else {
973
- const response = this.rpcClient.getSuccessorPeriod({ block });
974
- this.put(key, response);
975
- return response;
976
- }
977
- });
860
+ async getSuccessorPeriod({ block, } = rpc_client_interface_2.defaultRPCOptions) {
861
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SUCCESSOR_PERIOD, [block]);
862
+ if (this.has(key)) {
863
+ return this.get(key);
864
+ }
865
+ else {
866
+ const response = this.rpcClient.getSuccessorPeriod({ block });
867
+ this.put(key, response);
868
+ return response;
869
+ }
978
870
  }
979
871
  /**
980
872
  * @param id Sapling state ID
981
873
  * @param options contains generic configuration for rpc calls to specified block (default to head)
982
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
874
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
983
875
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff
984
876
  */
985
- getSaplingDiffById(id_1) {
986
- return __awaiter(this, arguments, void 0, function* (id, { block } = rpc_client_interface_2.defaultRPCOptions) {
987
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SAPLING_DIFF_BY_ID, [block, id]);
988
- if (this.has(key)) {
989
- return this.get(key);
990
- }
991
- else {
992
- const response = this.rpcClient.getSaplingDiffById(id, { block });
993
- this.put(key, response);
994
- return response;
995
- }
996
- });
877
+ async getSaplingDiffById(id, { block } = rpc_client_interface_2.defaultRPCOptions) {
878
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SAPLING_DIFF_BY_ID, [block, id]);
879
+ if (this.has(key)) {
880
+ return this.get(key);
881
+ }
882
+ else {
883
+ const response = this.rpcClient.getSaplingDiffById(id, { block });
884
+ this.put(key, response);
885
+ return response;
886
+ }
997
887
  }
998
888
  /**
999
889
  * @param contract address of the contract we want to get the sapling diff
1000
890
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1001
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
891
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
1002
892
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff
1003
893
  */
1004
- getSaplingDiffByContract(contract_1) {
1005
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
1006
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SAPLING_DIFF_BY_CONTRACT, [block, contract]);
1007
- if (this.has(key)) {
1008
- return this.get(key);
1009
- }
1010
- else {
1011
- const response = this.rpcClient.getSaplingDiffByContract(contract, { block });
1012
- this.put(key, response);
1013
- return response;
1014
- }
1015
- });
894
+ async getSaplingDiffByContract(contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
895
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_SAPLING_DIFF_BY_CONTRACT, [block, contract]);
896
+ if (this.has(key)) {
897
+ return this.get(key);
898
+ }
899
+ else {
900
+ const response = this.rpcClient.getSaplingDiffByContract(contract, { block });
901
+ this.put(key, response);
902
+ return response;
903
+ }
1016
904
  }
1017
905
  /**
1018
906
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1019
- * @description get current and next protocol
907
+ * get current and next protocol
1020
908
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
1021
909
  */
1022
- getProtocols() {
1023
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_2.defaultRPCOptions) {
1024
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PROTOCOLS, [
1025
- block,
1026
- ]);
1027
- if (this.has(key)) {
1028
- return this.get(key);
1029
- }
1030
- else {
1031
- const response = this.rpcClient.getProtocols({ block });
1032
- this.put(key, response);
1033
- return response;
1034
- }
1035
- });
910
+ async getProtocols({ block } = rpc_client_interface_2.defaultRPCOptions) {
911
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PROTOCOLS, [
912
+ block,
913
+ ]);
914
+ if (this.has(key)) {
915
+ return this.get(key);
916
+ }
917
+ else {
918
+ const response = this.rpcClient.getProtocols({ block });
919
+ this.put(key, response);
920
+ return response;
921
+ }
1036
922
  }
1037
923
  /**
1038
- * @param options contains generic configuration for rpc calls to specified block (default to head)
1039
- * @description get current and next protocol
924
+ * @param protocol the protocol hash to look up (default to empty string)
925
+ * get current and next protocol
1040
926
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
1041
927
  */
1042
- getProtocolActivations() {
1043
- return __awaiter(this, arguments, void 0, function* (protocol = '') {
1044
- if (protocol) {
1045
- const protocolValidation = (0, utils_1.validateProtocol)(protocol);
1046
- if (protocolValidation !== utils_1.ValidationResult.VALID) {
1047
- throw new utils_1.InvalidProtocolHashError(protocol, protocolValidation);
1048
- }
1049
- }
1050
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PROTOCOL_ACTIVATIONS, [protocol]);
1051
- if (this.has(key)) {
1052
- return this.get(key);
1053
- }
1054
- else {
1055
- const response = this.rpcClient.getProtocolActivations(protocol);
1056
- this.put(key, response);
1057
- return response;
928
+ async getProtocolActivations(protocol = '') {
929
+ if (protocol) {
930
+ const protocolValidation = (0, utils_1.validateProtocol)(protocol);
931
+ if (protocolValidation !== utils_1.ValidationResult.VALID) {
932
+ throw new utils_1.InvalidProtocolHashError(protocol, protocolValidation);
1058
933
  }
1059
- });
934
+ }
935
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PROTOCOL_ACTIVATIONS, [protocol]);
936
+ if (this.has(key)) {
937
+ return this.get(key);
938
+ }
939
+ else {
940
+ const response = this.rpcClient.getProtocolActivations(protocol);
941
+ this.put(key, response);
942
+ return response;
943
+ }
1060
944
  }
1061
945
  /**
1062
946
  * @param contract address of the contract we want to retrieve storage information of
1063
947
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1064
- * @description Access the used storage space of the contract
948
+ * Access the used storage space of the contract
1065
949
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1066
950
  */
1067
- getStorageUsedSpace(contract_1) {
1068
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
1069
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STORAGE_USED_SPACE, [block, contract]);
1070
- if (this.has(key)) {
1071
- return this.get(key);
1072
- }
1073
- else {
1074
- const response = this.rpcClient.getStorageUsedSpace(contract, { block });
1075
- this.put(key, response);
1076
- return response;
1077
- }
1078
- });
951
+ async getStorageUsedSpace(contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
952
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STORAGE_USED_SPACE, [block, contract]);
953
+ if (this.has(key)) {
954
+ return this.get(key);
955
+ }
956
+ else {
957
+ const response = this.rpcClient.getStorageUsedSpace(contract, { block });
958
+ this.put(key, response);
959
+ return response;
960
+ }
1079
961
  }
1080
962
  /**
1081
963
  * @param contract address of the contract we want to retrieve storage information of
1082
964
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1083
- = * @description Access the paid storage space of the contract
965
+ = * Access the paid storage space of the contract
1084
966
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1085
967
  */
1086
- getStoragePaidSpace(contract_1) {
1087
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
1088
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STORAGE_PAID_SPACE, [block, contract]);
1089
- if (this.has(key)) {
1090
- return this.get(key);
1091
- }
1092
- else {
1093
- const response = this.rpcClient.getStoragePaidSpace(contract, { block });
1094
- this.put(key, response);
1095
- return response;
1096
- }
1097
- });
968
+ async getStoragePaidSpace(contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
969
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_STORAGE_PAID_SPACE, [block, contract]);
970
+ if (this.has(key)) {
971
+ return this.get(key);
972
+ }
973
+ else {
974
+ const response = this.rpcClient.getStoragePaidSpace(contract, { block });
975
+ this.put(key, response);
976
+ return response;
977
+ }
1098
978
  }
1099
979
  /**
1100
980
  * @param contract implicit or originated address we want to retrieve ticket balance of
1101
981
  * @param ticket object to specify a ticket by ticketer, content type and content
1102
982
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1103
- * @description Access the contract's balance of ticket with specified ticketer, content type, and content.
983
+ * Access the contract's balance of ticket with specified ticketer, content type, and content.
1104
984
  * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } }
1105
985
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1106
986
  */
1107
- getTicketBalance(contract_1, ticket_1) {
1108
- return __awaiter(this, arguments, void 0, function* (contract, ticket, { block } = rpc_client_interface_2.defaultRPCOptions) {
1109
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_TICKET_BALANCE, [block, contract], ticket);
1110
- if (this.has(key)) {
1111
- return this.get(key);
1112
- }
1113
- else {
1114
- const response = this.rpcClient.getTicketBalance(contract, ticket, { block });
1115
- this.put(key, response);
1116
- return response;
1117
- }
1118
- });
987
+ async getTicketBalance(contract, ticket, { block } = rpc_client_interface_2.defaultRPCOptions) {
988
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_TICKET_BALANCE, [block, contract], ticket);
989
+ if (this.has(key)) {
990
+ return this.get(key);
991
+ }
992
+ else {
993
+ const response = this.rpcClient.getTicketBalance(contract, ticket, { block });
994
+ this.put(key, response);
995
+ return response;
996
+ }
1119
997
  }
1120
998
  /**
1121
999
  * @param contract originated address we want to retrieve ticket balances of
1122
1000
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1123
- * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage.
1001
+ * Access the complete list of tickets owned by the given contract by scanning the contract's storage.
1124
1002
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
1125
1003
  */
1126
- getAllTicketBalances(contract_1) {
1127
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
1128
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ALL_TICKET_BALANCES, [block, contract]);
1129
- if (this.has(key)) {
1130
- return this.get(key);
1131
- }
1132
- else {
1133
- const response = this.rpcClient.getAllTicketBalances(contract, { block });
1134
- this.put(key, response);
1135
- return response;
1136
- }
1137
- });
1004
+ async getAllTicketBalances(contract, { block } = rpc_client_interface_2.defaultRPCOptions) {
1005
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ALL_TICKET_BALANCES, [block, contract]);
1006
+ if (this.has(key)) {
1007
+ return this.get(key);
1008
+ }
1009
+ else {
1010
+ const response = this.rpcClient.getAllTicketBalances(contract, { block });
1011
+ this.put(key, response);
1012
+ return response;
1013
+ }
1138
1014
  }
1139
1015
  /**
1140
- * @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.
1016
+ * 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.
1141
1017
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1142
1018
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-adaptive-issuance-launch-cycle
1143
1019
  */
1144
- getAdaptiveIssuanceLaunchCycle() {
1145
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_2.defaultRPCOptions) {
1146
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE, [block]);
1147
- if (this.has(key)) {
1148
- return this.get(key);
1149
- }
1150
- else {
1151
- const response = this.rpcClient.getAdaptiveIssuanceLaunchCycle({ block });
1152
- this.put(key, response);
1153
- return response;
1154
- }
1155
- });
1020
+ async getAdaptiveIssuanceLaunchCycle({ block, } = rpc_client_interface_2.defaultRPCOptions) {
1021
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE, [block]);
1022
+ if (this.has(key)) {
1023
+ return this.get(key);
1024
+ }
1025
+ else {
1026
+ const response = this.rpcClient.getAdaptiveIssuanceLaunchCycle({ block });
1027
+ this.put(key, response);
1028
+ return response;
1029
+ }
1156
1030
  }
1157
1031
  /**
1158
- * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
1032
+ * List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
1159
1033
  * @param args has 5 optional properties
1160
1034
  * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined }
1161
1035
  */
1162
- getPendingOperations() {
1163
- return __awaiter(this, arguments, void 0, function* (args = {}) {
1164
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PENDING_OPERATIONS, [args]);
1165
- if (this.has(key)) {
1166
- return this.get(key);
1167
- }
1168
- else {
1169
- const response = this.rpcClient.getPendingOperations(args);
1170
- this.put(key, response);
1171
- return response;
1172
- }
1173
- });
1036
+ async getPendingOperations(args = {}) {
1037
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PENDING_OPERATIONS, [args]);
1038
+ if (this.has(key)) {
1039
+ return this.get(key);
1040
+ }
1041
+ else {
1042
+ const response = this.rpcClient.getPendingOperations(args);
1043
+ this.put(key, response);
1044
+ return response;
1045
+ }
1046
+ }
1047
+ /**
1048
+ * Returns the current mempool fee filter configuration.
1049
+ * @param args optional query arguments for the mempool/filter endpoint
1050
+ */
1051
+ async getMempoolFilter(args = {}) {
1052
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_MEMPOOL_FILTER, [
1053
+ args,
1054
+ ]);
1055
+ if (this.has(key)) {
1056
+ return this.get(key);
1057
+ }
1058
+ else {
1059
+ const response = this.rpcClient.getMempoolFilter(args);
1060
+ this.put(key, response);
1061
+ return response;
1062
+ }
1174
1063
  }
1175
1064
  /**
1176
1065
  * @param delegate delegate address which we want to retrieve active staking parameters
1177
1066
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1178
- * @description Returns the currently active staking parameters for the given delegate
1067
+ * Returns the currently active staking parameters for the given delegate
1179
1068
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-active-staking-parameters
1180
1069
  */
1181
- getActiveStakingParameters(delegate_1) {
1182
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = rpc_client_interface_2.defaultRPCOptions) {
1183
- this.validateAddress(delegate);
1184
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ACTIVE_STAKING_PARAMETERS, [block, delegate]);
1185
- if (this.has(key)) {
1186
- return this.get(key);
1187
- }
1188
- else {
1189
- const response = this.rpcClient.getActiveStakingParameters(delegate, { block });
1190
- this.put(key, response);
1191
- return response;
1192
- }
1193
- });
1070
+ async getActiveStakingParameters(delegate, { block } = rpc_client_interface_2.defaultRPCOptions) {
1071
+ this.validateAddress(delegate);
1072
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_ACTIVE_STAKING_PARAMETERS, [block, delegate]);
1073
+ if (this.has(key)) {
1074
+ return this.get(key);
1075
+ }
1076
+ else {
1077
+ const response = this.rpcClient.getActiveStakingParameters(delegate, { block });
1078
+ this.put(key, response);
1079
+ return response;
1080
+ }
1194
1081
  }
1195
1082
  /**
1196
1083
  * @param delegate delegate address which we want to retrieve pending staking parameters
1197
1084
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1198
- * @description Returns the pending values for the given delegate's staking parameters
1085
+ * Returns the pending values for the given delegate's staking parameters
1199
1086
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-pending-staking-parameters
1200
1087
  */
1201
- getPendingStakingParameters(delegate_1) {
1202
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = rpc_client_interface_2.defaultRPCOptions) {
1203
- this.validateAddress(delegate);
1204
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PENDING_STAKING_PARAMETERS, [block, delegate]);
1205
- if (this.has(key)) {
1206
- return this.get(key);
1207
- }
1208
- else {
1209
- const response = this.rpcClient.getPendingStakingParameters(delegate, { block });
1210
- this.put(key, response);
1211
- return response;
1212
- }
1213
- });
1088
+ async getPendingStakingParameters(delegate, { block } = rpc_client_interface_2.defaultRPCOptions) {
1089
+ this.validateAddress(delegate);
1090
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_PENDING_STAKING_PARAMETERS, [block, delegate]);
1091
+ if (this.has(key)) {
1092
+ return this.get(key);
1093
+ }
1094
+ else {
1095
+ const response = this.rpcClient.getPendingStakingParameters(delegate, { block });
1096
+ this.put(key, response);
1097
+ return response;
1098
+ }
1214
1099
  }
1215
1100
  /**
1216
1101
  * @param destination address to retrieve the index for
1217
1102
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1218
- * @description Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
1103
+ * Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
1219
1104
  * @see https://octez.tezos.com/docs/alpha/rpc.html#get-block-id-context-destination-destination-id-index
1220
1105
  */
1221
- getDestinationIndex(destination_1) {
1222
- return __awaiter(this, arguments, void 0, function* (destination, { block } = rpc_client_interface_2.defaultRPCOptions) {
1223
- const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_DESTINATION_INDEX, [block, destination]);
1224
- if (this.has(key)) {
1225
- return this.get(key);
1226
- }
1227
- else {
1228
- const response = this.rpcClient.getDestinationIndex(destination, { block });
1229
- this.put(key, response);
1230
- return response;
1231
- }
1232
- });
1106
+ async getDestinationIndex(destination, { block } = rpc_client_interface_2.defaultRPCOptions) {
1107
+ const key = this.formatCacheKey(this.rpcClient.getRpcUrl(), rpc_client_interface_1.RPCMethodName.GET_DESTINATION_INDEX, [block, destination]);
1108
+ if (this.has(key)) {
1109
+ return this.get(key);
1110
+ }
1111
+ else {
1112
+ const response = this.rpcClient.getDestinationIndex(destination, { block });
1113
+ this.put(key, response);
1114
+ return response;
1115
+ }
1233
1116
  }
1234
1117
  }
1235
1118
  exports.RpcClientCache = RpcClientCache;