@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.
@@ -13,26 +13,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
16
  Object.defineProperty(exports, "__esModule", { value: true });
37
17
  exports.RpcClient = exports.VERSION = exports.OpKind = exports.RpcClientCache = exports.defaultRPCOptions = exports.defaultChain = exports.castToBigNumber = void 0;
38
18
  /**
@@ -58,7 +38,7 @@ Object.defineProperty(exports, "OpKind", { enumerable: true, get: function () {
58
38
  var version_1 = require("./version");
59
39
  Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
60
40
  /***
61
- * @description RpcClient allows interaction with Tezos network through an rpc node
41
+ * RpcClient allows interaction with Tezos network through an rpc node
62
42
  */
63
43
  class RpcClient {
64
44
  /**
@@ -99,743 +79,681 @@ class RpcClient {
99
79
  }
100
80
  /**
101
81
  * @param options contains generic configuration for rpc calls to specified block (default to head)
102
- * @description Get the block's hash, its unique identifier.
82
+ * Get the block's hash, its unique identifier.
103
83
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-hash
104
84
  */
105
- getBlockHash() {
106
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
107
- const hash = yield this.httpBackend.createRequest({
108
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/hash`),
109
- method: 'GET',
110
- });
111
- return hash;
85
+ async getBlockHash({ block } = rpc_client_interface_1.defaultRPCOptions) {
86
+ const hash = await this.httpBackend.createRequest({
87
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/hash`),
88
+ method: 'GET',
112
89
  });
90
+ return hash;
113
91
  }
114
92
  /**
115
93
  * @param options contains generic configuration for rpc calls to specified block (default to head)
116
- * @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.
94
+ * 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.
117
95
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-live-blocks
118
96
  */
119
- getLiveBlocks() {
120
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
121
- const blocks = yield this.httpBackend.createRequest({
122
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/live_blocks`),
123
- method: 'GET',
124
- });
125
- return blocks;
97
+ async getLiveBlocks({ block } = rpc_client_interface_1.defaultRPCOptions) {
98
+ const blocks = await this.httpBackend.createRequest({
99
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/live_blocks`),
100
+ method: 'GET',
126
101
  });
102
+ return blocks;
127
103
  }
128
104
  /**
129
105
  * @param address address from which we want to retrieve the spendable balance
130
106
  * @param options contains generic configuration for rpc calls to specified block (default to head)
131
- * @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.
107
+ * 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.
132
108
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-balance
133
109
  */
134
- getBalance(address_1) {
135
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
136
- this.validateAddress(address);
137
- const balance = yield this.httpBackend.createRequest({
138
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance`),
139
- method: 'GET',
140
- });
141
- return new bignumber_js_1.default(balance);
110
+ async getBalance(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
111
+ this.validateAddress(address);
112
+ const balance = await this.httpBackend.createRequest({
113
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance`),
114
+ method: 'GET',
142
115
  });
116
+ return new bignumber_js_1.default(balance);
143
117
  }
144
118
  /**
145
119
  * @param address address from which we want to retrieve the spendable balance
146
120
  * @param options contains generic configuration for rpc calls to specified block (default to head)
147
- * @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.
121
+ * 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.
148
122
  */
149
- getSpendable(address_1) {
150
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
151
- this.validateAddress(address);
152
- const balance = yield this.httpBackend.createRequest({
153
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable`),
154
- method: 'GET',
155
- });
156
- return new bignumber_js_1.default(balance);
123
+ async getSpendable(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
124
+ this.validateAddress(address);
125
+ const balance = await this.httpBackend.createRequest({
126
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable`),
127
+ method: 'GET',
157
128
  });
129
+ return new bignumber_js_1.default(balance);
158
130
  }
159
131
  /**
160
132
  * @param address address from which we want to retrieve balance and frozen bonds
161
133
  * @param options contains generic configuration for rpc calls to specified block (default to head)
162
- * @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.
134
+ * 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.
163
135
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
164
136
  */
165
- getBalanceAndFrozenBonds(address_1) {
166
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
167
- this.validateAddress(address);
168
- const balance = yield this.httpBackend.createRequest({
169
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance_and_frozen_bonds`),
170
- method: 'GET',
171
- });
172
- return new bignumber_js_1.default(balance);
137
+ async getBalanceAndFrozenBonds(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
138
+ this.validateAddress(address);
139
+ const balance = await this.httpBackend.createRequest({
140
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/balance_and_frozen_bonds`),
141
+ method: 'GET',
173
142
  });
143
+ return new bignumber_js_1.default(balance);
174
144
  }
175
145
  /**
176
146
  * @param address address from which we want to retrieve spendable and frozen bonds
177
147
  * @param options contains generic configuration for rpc calls to specified block (default to head)
178
- * @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.
148
+ * 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.
179
149
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
180
150
  */
181
- getSpendableAndFrozenBonds(address_1) {
182
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
183
- this.validateAddress(address);
184
- const balance = yield this.httpBackend.createRequest({
185
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable_and_frozen_bonds`),
186
- method: 'GET',
187
- });
188
- return new bignumber_js_1.default(balance);
151
+ async getSpendableAndFrozenBonds(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
152
+ this.validateAddress(address);
153
+ const balance = await this.httpBackend.createRequest({
154
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/spendable_and_frozen_bonds`),
155
+ method: 'GET',
189
156
  });
157
+ return new bignumber_js_1.default(balance);
190
158
  }
191
159
  /**
192
160
  * @param address address from which we want to retrieve the full balance
193
161
  * @param options contains generic configuration for rpc calls to specified block (default to head)
194
- * @description Access the full balance of a contract, including frozen bonds and stake.
162
+ * Access the full balance of a contract, including frozen bonds and stake.
195
163
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-full-balance
196
164
  */
197
- getFullBalance(address_1) {
198
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
199
- this.validateAddress(address);
200
- const balance = yield this.httpBackend.createRequest({
201
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/full_balance`),
202
- method: 'GET',
203
- });
204
- return new bignumber_js_1.default(balance);
165
+ async getFullBalance(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
166
+ this.validateAddress(address);
167
+ const balance = await this.httpBackend.createRequest({
168
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/full_balance`),
169
+ method: 'GET',
205
170
  });
171
+ return new bignumber_js_1.default(balance);
206
172
  }
207
173
  /**
208
174
  * @param address address from which we want to retrieve the staked balance
209
175
  * @param options contains generic configuration for rpc calls to specified block (default to head)
210
- * @description Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
176
+ * Access the staked balance of a contract. Returns None if the contract is originated, or neither delegated nor a delegate.
211
177
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-staked-balance
212
178
  */
213
- getStakedBalance(address_1) {
214
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
215
- this.validateAddress(address);
216
- const balance = yield this.httpBackend.createRequest({
217
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/staked_balance`),
218
- method: 'GET',
219
- });
220
- return new bignumber_js_1.default(balance);
179
+ async getStakedBalance(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
180
+ this.validateAddress(address);
181
+ const balance = await this.httpBackend.createRequest({
182
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/staked_balance`),
183
+ method: 'GET',
221
184
  });
185
+ return new bignumber_js_1.default(balance);
222
186
  }
223
187
  /**
224
188
  * @param address address from which we want to retrieve the unstaked finalizable balance
225
189
  * @param options contains generic configuration for rpc calls to specified block (default to head)
226
- * @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.
190
+ * 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.
227
191
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-finalizable-balance
228
192
  */
229
- getUnstakedFinalizableBalance(address_1) {
230
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
231
- this.validateAddress(address);
232
- const balance = yield this.httpBackend.createRequest({
233
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_finalizable_balance`),
234
- method: 'GET',
235
- });
236
- return new bignumber_js_1.default(balance);
193
+ async getUnstakedFinalizableBalance(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
194
+ this.validateAddress(address);
195
+ const balance = await this.httpBackend.createRequest({
196
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_finalizable_balance`),
197
+ method: 'GET',
237
198
  });
199
+ return new bignumber_js_1.default(balance);
238
200
  }
239
201
  /**
240
202
  * @param address address from which we want to retrieve the unstaked frozen balance
241
203
  * @param options contains generic configuration for rpc calls to specified block (default to head)
242
- * @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.
204
+ * 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.
243
205
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstaked-frozen-balance
244
206
  */
245
- getUnstakedFrozenBalance(address_1) {
246
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
247
- this.validateAddress(address);
248
- const balance = yield this.httpBackend.createRequest({
249
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_frozen_balance`),
250
- method: 'GET',
251
- });
252
- return new bignumber_js_1.default(balance);
207
+ async getUnstakedFrozenBalance(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
208
+ this.validateAddress(address);
209
+ const balance = await this.httpBackend.createRequest({
210
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstaked_frozen_balance`),
211
+ method: 'GET',
253
212
  });
213
+ return new bignumber_js_1.default(balance);
254
214
  }
255
215
  /**
256
216
  * @param address address from which we want to retrieve the unstaked requests
257
217
  * @param options contains generic configuration for rpc calls to specified block (default to head)
258
- * @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.
218
+ * 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.
259
219
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-unstake-requests
260
220
  */
261
- getUnstakeRequests(address_1) {
262
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
263
- this.validateAddress(address);
264
- const response = yield this.httpBackend.createRequest({
265
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstake_requests`),
266
- method: 'GET',
267
- });
268
- return response === null
269
- ? null
270
- : {
271
- finalizable: response.finalizable.map((_a) => {
272
- var { amount } = _a, rest = __rest(_a, ["amount"]);
221
+ async getUnstakeRequests(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
222
+ this.validateAddress(address);
223
+ const response = await this.httpBackend.createRequest({
224
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/unstake_requests`),
225
+ method: 'GET',
226
+ });
227
+ return response === null
228
+ ? null
229
+ : {
230
+ finalizable: response.finalizable.map(({ amount, ...rest }) => {
231
+ const castedToBigNumber = (0, utils_1.castToBigNumber)({ amount }, ['amount']);
232
+ return {
233
+ ...rest,
234
+ amount: castedToBigNumber.amount,
235
+ };
236
+ }),
237
+ unfinalizable: {
238
+ delegate: response.unfinalizable.delegate,
239
+ requests: response.unfinalizable.requests.map(({ amount, cycle }) => {
273
240
  const castedToBigNumber = (0, utils_1.castToBigNumber)({ amount }, ['amount']);
274
- return Object.assign(Object.assign({}, rest), { amount: castedToBigNumber.amount });
241
+ return {
242
+ cycle,
243
+ amount: castedToBigNumber.amount,
244
+ };
275
245
  }),
276
- unfinalizable: {
277
- delegate: response.unfinalizable.delegate,
278
- requests: response.unfinalizable.requests.map(({ amount, cycle }) => {
279
- const castedToBigNumber = (0, utils_1.castToBigNumber)({ amount }, ['amount']);
280
- return {
281
- cycle,
282
- amount: castedToBigNumber.amount,
283
- };
284
- }),
285
- },
286
- };
287
- });
246
+ },
247
+ };
288
248
  }
289
249
  /**
290
250
  * @param address contract address from which we want to retrieve the storage
291
251
  * @param options contains generic configuration for rpc calls to specified block (default to head)
292
- * @description Access the data of the contract.
252
+ * Access the data of the contract.
293
253
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-storage
294
254
  */
295
- getStorage(address_1) {
296
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
297
- this.validateContract(address);
298
- return this.httpBackend.createRequest({
299
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/storage`),
300
- method: 'GET',
301
- });
255
+ async getStorage(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
256
+ this.validateContract(address);
257
+ return this.httpBackend.createRequest({
258
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/storage`),
259
+ method: 'GET',
302
260
  });
303
261
  }
304
262
  /**
305
263
  * @param address contract address from which we want to retrieve the script
306
264
  * @param options contains generic configuration for rpc calls to specified block (default to head)
307
- * @description Access the code and data of the contract.
265
+ * Access the code and data of the contract.
308
266
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-script
309
267
  */
310
- getScript(address_1) {
311
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
312
- this.validateContract(address);
313
- return this.httpBackend.createRequest({
314
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script`),
315
- method: 'GET',
316
- });
268
+ async getScript(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
269
+ this.validateContract(address);
270
+ return this.httpBackend.createRequest({
271
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script`),
272
+ method: 'GET',
317
273
  });
318
274
  }
319
275
  /**
320
276
  * @param address contract address from which we want to retrieve the script
321
277
  * @param unparsingMode default is { unparsing_mode: "Readable" }
322
278
  * @param options contains generic configuration for rpc calls to specified block (default to head)
323
- * @description Access the script of the contract and normalize it using the requested unparsing mode.
279
+ * Access the script of the contract and normalize it using the requested unparsing mode.
324
280
  */
325
- getNormalizedScript(address_1) {
326
- return __awaiter(this, arguments, void 0, function* (address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = rpc_client_interface_1.defaultRPCOptions) {
327
- this.validateContract(address);
328
- return this.httpBackend.createRequest({
329
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script/normalized`),
330
- method: 'POST',
331
- }, unparsingMode);
332
- });
281
+ async getNormalizedScript(address, unparsingMode = { unparsing_mode: 'Readable' }, { block } = rpc_client_interface_1.defaultRPCOptions) {
282
+ this.validateContract(address);
283
+ return this.httpBackend.createRequest({
284
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/script/normalized`),
285
+ method: 'POST',
286
+ }, unparsingMode);
333
287
  }
334
288
  /**
335
289
  * @param address contract address from which we want to retrieve
336
290
  * @param options contains generic configuration for rpc calls to specified block (default to head)
337
- * @description Access the complete status of a contract.
291
+ * Access the complete status of a contract.
338
292
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id
339
293
  */
340
- getContract(address_1) {
341
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
342
- this.validateAddress(address);
343
- const contractResponse = yield this.httpBackend.createRequest({
344
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}`),
345
- method: 'GET',
346
- });
347
- return Object.assign(Object.assign({}, contractResponse), { balance: new bignumber_js_1.default(contractResponse.balance) });
294
+ async getContract(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
295
+ this.validateAddress(address);
296
+ const contractResponse = await this.httpBackend.createRequest({
297
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}`),
298
+ method: 'GET',
348
299
  });
300
+ return {
301
+ ...contractResponse,
302
+ balance: new bignumber_js_1.default(contractResponse.balance),
303
+ };
349
304
  }
350
305
  /**
351
306
  * @param address contract address from which we want to retrieve the manager
352
307
  * @param options contains generic configuration for rpc calls to specified block (default to head)
353
- * @description Access the manager of an implicit contract
308
+ * Access the manager of an implicit contract
354
309
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-manager-key
355
310
  */
356
- getManagerKey(address_1) {
357
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
358
- this.validateAddress(address);
359
- return this.httpBackend.createRequest({
360
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/manager_key`),
361
- method: 'GET',
362
- });
311
+ async getManagerKey(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
312
+ this.validateAddress(address);
313
+ return this.httpBackend.createRequest({
314
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/manager_key`),
315
+ method: 'GET',
363
316
  });
364
317
  }
365
318
  /**
366
319
  * @param address contract address from which we want to retrieve the delegate (baker)
367
320
  * @param options contains generic configuration for rpc calls to specified block (default to head)
368
- * @description Access the delegate of a contract, if any
321
+ * Access the delegate of a contract, if any
369
322
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-delegate
370
323
  */
371
- getDelegate(address_1) {
372
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
373
- this.validateAddress(address);
374
- let delegate;
375
- try {
376
- delegate = yield this.httpBackend.createRequest({
377
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/delegate`),
378
- method: 'GET',
379
- });
324
+ async getDelegate(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
325
+ this.validateAddress(address);
326
+ let delegate;
327
+ try {
328
+ delegate = await this.httpBackend.createRequest({
329
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${address}/delegate`),
330
+ method: 'GET',
331
+ });
332
+ }
333
+ catch (ex) {
334
+ if (ex instanceof http_utils_1.HttpResponseError && ex.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
335
+ delegate = null;
380
336
  }
381
- catch (ex) {
382
- if (ex instanceof http_utils_1.HttpResponseError && ex.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
383
- delegate = null;
384
- }
385
- else {
386
- throw ex;
387
- }
337
+ else {
338
+ throw ex;
388
339
  }
389
- return delegate;
390
- });
340
+ }
341
+ return delegate;
391
342
  }
392
343
  /**
393
344
  * @param id Big Map ID
394
345
  * @param expr Expression hash to query (A b58check encoded Blake2b hash of the expression (The expression can be packed using the pack_data method))
395
346
  * @param options contains generic configuration for rpc calls to specified block (default to head)
396
- * @description Access the value associated with a key in a big map.
347
+ * Access the value associated with a key in a big map.
397
348
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr
398
349
  */
399
- getBigMapExpr(id_1, expr_1) {
400
- return __awaiter(this, arguments, void 0, function* (id, expr, { block } = rpc_client_interface_1.defaultRPCOptions) {
401
- return this.httpBackend.createRequest({
402
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/big_maps/${id}/${expr}`),
403
- method: 'GET',
404
- });
350
+ async getBigMapExpr(id, expr, { block } = rpc_client_interface_1.defaultRPCOptions) {
351
+ return this.httpBackend.createRequest({
352
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/big_maps/${id}/${expr}`),
353
+ method: 'GET',
405
354
  });
406
355
  }
407
356
  /**
408
357
  * @param args contains optional query arguments (active, inactive, with_minimal_stake, without_minimal_stake)
409
358
  * @param options contains generic configuration for rpc calls to specified block (default to head)
410
- * @description Lists all registered delegates by default with query arguments to filter unneeded values.
359
+ * Lists all registered delegates by default with query arguments to filter unneeded values.
411
360
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
412
361
  */
413
- getAllDelegates() {
414
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = rpc_client_interface_1.defaultRPCOptions) {
415
- return yield this.httpBackend.createRequest({
416
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates`),
417
- method: 'GET',
418
- query: args,
419
- });
362
+ async getAllDelegates(args = {}, { block } = rpc_client_interface_1.defaultRPCOptions) {
363
+ return await this.httpBackend.createRequest({
364
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates`),
365
+ method: 'GET',
366
+ query: args,
420
367
  });
421
368
  }
422
369
  /**
423
370
  * @param address delegate address which we want to retrieve
424
371
  * @param options contains generic configuration for rpc calls to specified block (default to head)
425
- * @description Everything about a delegate
372
+ * Everything about a delegate
426
373
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh
427
374
  */
428
- getDelegates(address_1) {
429
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
430
- this.validateAddress(address);
431
- const response = yield this.httpBackend.createRequest({
432
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}`),
433
- method: 'GET',
434
- });
435
- const castedResponse = (0, utils_1.castToBigNumber)(response, [
436
- 'balance',
437
- 'full_balance',
438
- 'current_frozen_deposits',
439
- 'frozen_deposits',
440
- 'frozen_balance',
441
- 'frozen_deposits_limit',
442
- 'staking_balance',
443
- 'delegated_balance',
444
- 'voting_power',
445
- 'total_delegated_stake',
446
- 'staking_denominator',
447
- ]);
448
- if (response.frozen_balance_by_cycle) {
449
- return Object.assign(Object.assign(Object.assign({}, response), castedResponse), { frozen_balance_by_cycle: response.frozen_balance_by_cycle.map((_a) => {
450
- var { deposit, deposits, fees, rewards } = _a, rest = __rest(_a, ["deposit", "deposits", "fees", "rewards"]);
451
- const castedToBigNumber = (0, utils_1.castToBigNumber)({ deposit, deposits, fees, rewards }, [
452
- 'deposit',
453
- 'deposits',
454
- 'fees',
455
- 'rewards',
456
- ]);
457
- return Object.assign(Object.assign({}, rest), { deposit: castedToBigNumber.deposit, deposits: castedToBigNumber.deposits, fees: castedToBigNumber.fees, rewards: castedToBigNumber.rewards });
458
- }) });
459
- }
460
- else {
461
- return Object.assign(Object.assign({}, response), castedResponse);
462
- }
463
- });
375
+ async getDelegates(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
376
+ this.validateAddress(address);
377
+ const response = await this.httpBackend.createRequest({
378
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}`),
379
+ method: 'GET',
380
+ });
381
+ const castedResponse = (0, utils_1.castToBigNumber)(response, [
382
+ 'balance',
383
+ 'full_balance',
384
+ 'current_frozen_deposits',
385
+ 'frozen_deposits',
386
+ 'frozen_balance',
387
+ 'frozen_deposits_limit',
388
+ 'staking_balance',
389
+ 'delegated_balance',
390
+ 'voting_power',
391
+ 'total_delegated_stake',
392
+ 'staking_denominator',
393
+ ]);
394
+ if (response.frozen_balance_by_cycle) {
395
+ return {
396
+ ...response,
397
+ ...castedResponse,
398
+ frozen_balance_by_cycle: response.frozen_balance_by_cycle.map(({ deposit, deposits, fees, rewards, ...rest }) => {
399
+ const castedToBigNumber = (0, utils_1.castToBigNumber)({ deposit, deposits, fees, rewards }, [
400
+ 'deposit',
401
+ 'deposits',
402
+ 'fees',
403
+ 'rewards',
404
+ ]);
405
+ return {
406
+ ...rest,
407
+ deposit: castedToBigNumber.deposit,
408
+ deposits: castedToBigNumber.deposits,
409
+ fees: castedToBigNumber.fees,
410
+ rewards: castedToBigNumber.rewards,
411
+ };
412
+ }),
413
+ };
414
+ }
415
+ else {
416
+ return {
417
+ ...response,
418
+ ...castedResponse,
419
+ };
420
+ }
464
421
  }
465
422
  /**
466
423
  * @param address delegate address which we want to retrieve
467
424
  * @param options contains generic configuration for rpc calls to specified block (default to head)
468
- * @description Returns the delegate info (e.g. voting power) found in the listings of the current voting period
425
+ * Returns the delegate info (e.g. voting power) found in the listings of the current voting period
469
426
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-voting-info
470
427
  */
471
- getVotingInfo(address_1) {
472
- return __awaiter(this, arguments, void 0, function* (address, { block } = rpc_client_interface_1.defaultRPCOptions) {
473
- this.validateAddress(address);
474
- return yield this.httpBackend.createRequest({
475
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}/voting_info`),
476
- method: 'GET',
477
- });
428
+ async getVotingInfo(address, { block } = rpc_client_interface_1.defaultRPCOptions) {
429
+ this.validateAddress(address);
430
+ return await this.httpBackend.createRequest({
431
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${address}/voting_info`),
432
+ method: 'GET',
478
433
  });
479
434
  }
480
435
  /**
481
436
  * @param options contains generic configuration for rpc calls to specified block (default to head)
482
- * @description All constants
437
+ * All constants
483
438
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-constants
484
439
  */
485
- getConstants() {
486
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
487
- const response = yield this.httpBackend.createRequest({
488
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/constants`),
489
- method: 'GET',
490
- });
491
- const castedResponse = (0, utils_1.castToBigNumber)(response, [
492
- 'time_between_blocks',
493
- 'hard_gas_limit_per_operation',
494
- 'hard_gas_limit_per_block',
495
- 'proof_of_work_threshold',
496
- 'tokens_per_roll',
497
- 'seed_nonce_revelation_tip',
498
- 'block_security_deposit',
499
- 'endorsement_security_deposit',
500
- 'block_reward',
501
- 'endorsement_reward',
502
- 'cost_per_byte',
503
- 'hard_storage_limit_per_operation',
504
- 'test_chain_duration',
505
- 'baking_reward_per_endorsement',
506
- 'delay_per_missing_endorsement',
507
- 'minimal_block_delay',
508
- 'liquidity_baking_subsidy',
509
- 'cache_layout',
510
- 'baking_reward_fixed_portion',
511
- 'baking_reward_bonus_per_slot',
512
- 'endorsing_reward_per_slot',
513
- 'double_baking_punishment',
514
- 'delay_increment_per_round',
515
- 'tx_rollup_commitment_bond',
516
- 'vdf_difficulty',
517
- 'sc_rollup_stake_amount',
518
- 'minimal_stake',
519
- ]);
520
- return Object.assign(Object.assign({}, response), castedResponse);
521
- });
440
+ async getConstants({ block } = rpc_client_interface_1.defaultRPCOptions) {
441
+ const response = await this.httpBackend.createRequest({
442
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/constants`),
443
+ method: 'GET',
444
+ });
445
+ const castedResponse = (0, utils_1.castToBigNumber)(response, [
446
+ 'time_between_blocks',
447
+ 'hard_gas_limit_per_operation',
448
+ 'hard_gas_limit_per_block',
449
+ 'proof_of_work_threshold',
450
+ 'tokens_per_roll',
451
+ 'seed_nonce_revelation_tip',
452
+ 'block_security_deposit',
453
+ 'endorsement_security_deposit',
454
+ 'block_reward',
455
+ 'endorsement_reward',
456
+ 'cost_per_byte',
457
+ 'hard_storage_limit_per_operation',
458
+ 'test_chain_duration',
459
+ 'baking_reward_per_endorsement',
460
+ 'delay_per_missing_endorsement',
461
+ 'minimal_block_delay',
462
+ 'liquidity_baking_subsidy',
463
+ 'cache_layout',
464
+ 'baking_reward_fixed_portion',
465
+ 'baking_reward_bonus_per_slot',
466
+ 'endorsing_reward_per_slot',
467
+ 'double_baking_punishment',
468
+ 'delay_increment_per_round',
469
+ 'tx_rollup_commitment_bond',
470
+ 'vdf_difficulty',
471
+ 'sc_rollup_stake_amount',
472
+ 'minimal_stake',
473
+ ]);
474
+ return {
475
+ ...response,
476
+ ...castedResponse,
477
+ };
522
478
  }
523
479
  /**
524
480
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version.
525
- * @description All the information about a block
481
+ * All the information about a block
526
482
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id
527
483
  * @example getBlock() will default to `/main/chains/block/head?version=1`
528
484
  * @example getBlock({ block: 'head~2' }) will return an offset of 2 from head blocks
529
485
  * @example getBlock({ block: 'BL8fTiWcSxWCjiMVnDkbh6EuhqVPZzgWheJ2dqwrxYRm9AephXh~2' }) will return an offset of 2 blocks from given block hash..
530
486
  */
531
- getBlock() {
532
- return __awaiter(this, arguments, void 0, function* ({ block, version } = rpc_client_interface_1.defaultRPCOptions) {
533
- const requestOptions = {
534
- url: this.createURL(`/chains/${this.chain}/blocks/${block}`),
535
- method: 'GET',
536
- };
537
- if (version !== undefined) {
538
- requestOptions.query = { version };
539
- }
540
- return yield this.httpBackend.createRequest(requestOptions);
541
- });
487
+ async getBlock({ block, version } = rpc_client_interface_1.defaultRPCOptions) {
488
+ const requestOptions = {
489
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}`),
490
+ method: 'GET',
491
+ };
492
+ if (version !== undefined) {
493
+ requestOptions.query = { version };
494
+ }
495
+ return await this.httpBackend.createRequest(requestOptions);
542
496
  }
543
497
  /**
544
498
  * @param options contains generic configuration for rpc calls to specified block (default to head)
545
- * @description The whole block header
499
+ * The whole block header
546
500
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-header
547
501
  */
548
- getBlockHeader() {
549
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
550
- const response = yield this.httpBackend.createRequest({
551
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/header`),
552
- method: 'GET',
553
- });
554
- return response;
502
+ async getBlockHeader({ block } = rpc_client_interface_1.defaultRPCOptions) {
503
+ const response = await this.httpBackend.createRequest({
504
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/header`),
505
+ method: 'GET',
555
506
  });
507
+ return response;
556
508
  }
557
509
  /**
558
510
  * @param options contains generic configuration for rpc calls to specified block (default to head) and version
559
- * @description All the metadata associated to the block
511
+ * All the metadata associated to the block
560
512
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-metadata
561
513
  */
562
- getBlockMetadata() {
563
- return __awaiter(this, arguments, void 0, function* ({ block, version, } = rpc_client_interface_1.defaultRPCOptions) {
564
- const requestOptions = {
565
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/metadata`),
566
- method: 'GET',
567
- };
568
- if (version !== undefined) {
569
- requestOptions.query = { version };
570
- }
571
- return yield this.httpBackend.createRequest(requestOptions);
572
- });
514
+ async getBlockMetadata({ block, version, } = rpc_client_interface_1.defaultRPCOptions) {
515
+ const requestOptions = {
516
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/metadata`),
517
+ method: 'GET',
518
+ };
519
+ if (version !== undefined) {
520
+ requestOptions.query = { version };
521
+ }
522
+ return await this.httpBackend.createRequest(requestOptions);
573
523
  }
574
524
  /**
575
525
  * @param args contains optional query arguments (level, cycle, delegate, consensus_key, and max_round)
576
526
  * @param options contains generic configuration for rpc calls to specified block (default to head)
577
- * @description Retrieves the list of delegates allowed to bake a block.
527
+ * Retrieves the list of delegates allowed to bake a block.
578
528
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
579
529
  */
580
- getBakingRights() {
581
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = rpc_client_interface_1.defaultRPCOptions) {
582
- const response = yield this.httpBackend.createRequest({
583
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/baking_rights`),
584
- method: 'GET',
585
- query: args,
586
- });
587
- return response;
530
+ async getBakingRights(args = {}, { block } = rpc_client_interface_1.defaultRPCOptions) {
531
+ const response = await this.httpBackend.createRequest({
532
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/baking_rights`),
533
+ method: 'GET',
534
+ query: args,
588
535
  });
536
+ return response;
589
537
  }
590
538
  /**
591
539
  * @param args contains optional query arguments (level, cycle, delegate, and consensus_key)
592
540
  * @param options contains generic configuration for rpc calls to specified block (default to head)
593
- * @description Retrieves the delegates allowed to attest a block
541
+ * Retrieves the delegates allowed to attest a block
594
542
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
595
543
  */
596
- getAttestationRights() {
597
- return __awaiter(this, arguments, void 0, function* (args = {}, { block } = rpc_client_interface_1.defaultRPCOptions) {
598
- const response = yield this.httpBackend.createRequest({
599
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/attestation_rights`),
600
- method: 'GET',
601
- query: args,
602
- });
603
- return response;
544
+ async getAttestationRights(args = {}, { block } = rpc_client_interface_1.defaultRPCOptions) {
545
+ const response = await this.httpBackend.createRequest({
546
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/attestation_rights`),
547
+ method: 'GET',
548
+ query: args,
604
549
  });
550
+ return response;
605
551
  }
606
552
  /**
607
553
  * @param options contains generic configuration for rpc calls to specified block (default to head)
608
- * @description Ballots casted so far during a voting period
554
+ * Ballots casted so far during a voting period
609
555
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballot-list
610
556
  */
611
- getBallotList() {
612
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
613
- const response = yield this.httpBackend.createRequest({
614
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballot_list`),
615
- method: 'GET',
616
- });
617
- return response;
557
+ async getBallotList({ block } = rpc_client_interface_1.defaultRPCOptions) {
558
+ const response = await this.httpBackend.createRequest({
559
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballot_list`),
560
+ method: 'GET',
618
561
  });
562
+ return response;
619
563
  }
620
564
  /**
621
565
  * @param options contains generic configuration for rpc calls to specified block (default to head)
622
- * @description Sum of ballots casted so far during a voting period
566
+ * Sum of ballots casted so far during a voting period
623
567
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-ballots
624
568
  */
625
- getBallots() {
626
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
627
- const response = yield this.httpBackend.createRequest({
628
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballots`),
629
- method: 'GET',
630
- });
631
- const casted = (0, utils_1.castToBigNumber)(response, ['yay', 'nay', 'pass']);
632
- return casted;
569
+ async getBallots({ block } = rpc_client_interface_1.defaultRPCOptions) {
570
+ const response = await this.httpBackend.createRequest({
571
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/ballots`),
572
+ method: 'GET',
633
573
  });
574
+ const casted = (0, utils_1.castToBigNumber)(response, ['yay', 'nay', 'pass']);
575
+ return casted;
634
576
  }
635
577
  /**
636
578
  * @param options contains generic configuration for rpc calls to specified block (default to head)
637
- * @description Current proposal under evaluation.
579
+ * Current proposal under evaluation.
638
580
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-proposal
639
581
  */
640
- getCurrentProposal() {
641
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_1.defaultRPCOptions) {
642
- const response = yield this.httpBackend.createRequest({
643
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_proposal`),
644
- method: 'GET',
645
- });
646
- return response;
582
+ async getCurrentProposal({ block, } = rpc_client_interface_1.defaultRPCOptions) {
583
+ const response = await this.httpBackend.createRequest({
584
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_proposal`),
585
+ method: 'GET',
647
586
  });
587
+ return response;
648
588
  }
649
589
  /**
650
590
  * @param options contains generic configuration for rpc calls to specified block (default to head)
651
- * @description Current expected quorum.
591
+ * Current expected quorum.
652
592
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-quorum
653
593
  */
654
- getCurrentQuorum() {
655
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_1.defaultRPCOptions) {
656
- const response = yield this.httpBackend.createRequest({
657
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_quorum`),
658
- method: 'GET',
659
- });
660
- return response;
594
+ async getCurrentQuorum({ block, } = rpc_client_interface_1.defaultRPCOptions) {
595
+ const response = await this.httpBackend.createRequest({
596
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_quorum`),
597
+ method: 'GET',
661
598
  });
599
+ return response;
662
600
  }
663
601
  /**
664
602
  * @param options contains generic configuration for rpc calls to specified block (default to head)
665
- * @description List of delegates with their voting power
603
+ * List of delegates with their voting power
666
604
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-listings
667
605
  */
668
- getVotesListings() {
669
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_1.defaultRPCOptions) {
670
- const response = yield this.httpBackend.createRequest({
671
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/listings`),
672
- method: 'GET',
673
- });
674
- response.map((item) => {
675
- if (item.voting_power) {
676
- item.voting_power = new bignumber_js_1.default(item.voting_power);
677
- }
678
- return item;
679
- });
680
- return response;
606
+ async getVotesListings({ block, } = rpc_client_interface_1.defaultRPCOptions) {
607
+ const response = await this.httpBackend.createRequest({
608
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/listings`),
609
+ method: 'GET',
610
+ });
611
+ response.map((item) => {
612
+ if (item.voting_power) {
613
+ item.voting_power = new bignumber_js_1.default(item.voting_power);
614
+ }
615
+ return item;
681
616
  });
617
+ return response;
682
618
  }
683
619
  /**
684
620
  * @param options contains generic configuration for rpc calls to specified block (default to head)
685
- * @description List of proposals with number of supporters
621
+ * List of proposals with number of supporters
686
622
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-proposals
687
623
  */
688
- getProposals() {
689
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
690
- const response = yield this.httpBackend.createRequest({
691
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/proposals`),
692
- method: 'GET',
693
- });
694
- response.map((item) => {
695
- return (item[1] = new bignumber_js_1.default(item[1]));
696
- });
697
- return response;
624
+ async getProposals({ block } = rpc_client_interface_1.defaultRPCOptions) {
625
+ const response = await this.httpBackend.createRequest({
626
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/proposals`),
627
+ method: 'GET',
628
+ });
629
+ response.map((item) => {
630
+ return (item[1] = new bignumber_js_1.default(item[1]));
698
631
  });
632
+ return response;
699
633
  }
700
634
  /**
701
635
  * @param data operation contents to forge
702
636
  * @param options contains generic configuration for rpc calls to specified block (default to head)
703
- * @description Forge an operation returning the unsigned bytes
637
+ * Forge an operation returning the unsigned bytes
704
638
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
705
639
  */
706
- forgeOperations(data_1) {
707
- return __awaiter(this, arguments, void 0, function* (data, { block } = rpc_client_interface_1.defaultRPCOptions) {
708
- return this.httpBackend.createRequest({
709
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/forge/operations`),
710
- method: 'POST',
711
- }, data);
712
- });
640
+ async forgeOperations(data, { block } = rpc_client_interface_1.defaultRPCOptions) {
641
+ return this.httpBackend.createRequest({
642
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/forge/operations`),
643
+ method: 'POST',
644
+ }, data);
713
645
  }
714
646
  /**
715
647
  * @param signedOpBytes signed bytes to inject
716
- * @description Inject an operation in node and broadcast it and return the ID of the operation
648
+ * Inject an operation in node and broadcast it and return the ID of the operation
717
649
  * @see https://tezos.gitlab.io/shell/rpc.html#post-injection-operation
718
650
  */
719
- injectOperation(signedOpBytes) {
720
- return __awaiter(this, void 0, void 0, function* () {
721
- return this.httpBackend.createRequest({
722
- url: this.createURL(`/injection/operation`),
723
- method: 'POST',
724
- }, signedOpBytes);
725
- });
651
+ async injectOperation(signedOpBytes) {
652
+ return this.httpBackend.createRequest({
653
+ url: this.createURL(`/injection/operation`),
654
+ method: 'POST',
655
+ }, signedOpBytes);
726
656
  }
727
657
  /**
728
658
  * @param ops Operations to apply
729
659
  * @param options contains generic configuration for rpc calls to specified block and version
730
- * @description Simulate the application of the operations with the context of the given block and return the result of each operation application
660
+ * Simulate the application of the operations with the context of the given block and return the result of each operation application
731
661
  * @see https://tezos.gitlab.io/active/rpc.html#post-block-id-helpers-preapply-operations
732
662
  */
733
- preapplyOperations(ops_1) {
734
- return __awaiter(this, arguments, void 0, function* (ops, { block, version } = rpc_client_interface_1.defaultRPCOptions) {
735
- const requestOptions = {
736
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/preapply/operations`),
737
- method: 'POST',
738
- };
739
- if (version !== undefined) {
740
- requestOptions.query = { version };
741
- }
742
- return yield this.httpBackend.createRequest(requestOptions, ops);
743
- });
663
+ async preapplyOperations(ops, { block, version } = rpc_client_interface_1.defaultRPCOptions) {
664
+ const requestOptions = {
665
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/preapply/operations`),
666
+ method: 'POST',
667
+ };
668
+ if (version !== undefined) {
669
+ requestOptions.query = { version };
670
+ }
671
+ return await this.httpBackend.createRequest(requestOptions, ops);
744
672
  }
745
673
  /**
746
674
  * @param contract address of the contract we want to get the entrypoints of
747
675
  * @param options contains generic configuration for rpc calls to specified block (default to head)
748
- * @description Return the list of entrypoints of the contract
676
+ * Return the list of entrypoints of the contract
749
677
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-entrypoints
750
- * @version 005_PsBABY5H
678
+ * @remarks version 005_PsBABY5H
751
679
  */
752
- getEntrypoints(contract_1) {
753
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
754
- this.validateContract(contract);
755
- const contractResponse = yield this.httpBackend.createRequest({
756
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/entrypoints`),
757
- method: 'GET',
758
- });
759
- return contractResponse;
680
+ async getEntrypoints(contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
681
+ this.validateContract(contract);
682
+ const contractResponse = await this.httpBackend.createRequest({
683
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/entrypoints`),
684
+ method: 'GET',
760
685
  });
686
+ return contractResponse;
761
687
  }
762
688
  /**
763
689
  * @param op Operation to simulate
764
690
  * @param options contains generic configuration for rpc calls to specified block and version
765
- * @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.
691
+ * 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.
766
692
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
767
693
  */
768
- simulateOperation(op_1) {
769
- return __awaiter(this, arguments, void 0, function* (op, { block, version } = rpc_client_interface_1.defaultRPCOptions) {
770
- const requestOptions = {
771
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/simulate_operation`),
772
- method: 'POST',
773
- };
774
- if (version !== undefined) {
775
- requestOptions.query = { version };
776
- }
777
- return yield this.httpBackend.createRequest(requestOptions, op);
778
- });
694
+ async simulateOperation(op, { block, version } = rpc_client_interface_1.defaultRPCOptions) {
695
+ const requestOptions = {
696
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/simulate_operation`),
697
+ method: 'POST',
698
+ };
699
+ if (version !== undefined) {
700
+ requestOptions.query = { version };
701
+ }
702
+ return await this.httpBackend.createRequest(requestOptions, op);
779
703
  }
780
704
  /**
781
705
  * @param code Code to run
782
706
  * @param options contains generic configuration for rpc calls to specified block (default to head)
783
- * @description Run a Michelson script in the current context
707
+ * Run a Michelson script in the current context
784
708
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
785
709
  */
786
- runCode(code_1) {
787
- return __awaiter(this, arguments, void 0, function* (code, { block } = rpc_client_interface_1.defaultRPCOptions) {
788
- const response = yield this.httpBackend.createRequest({
789
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_code`),
790
- method: 'POST',
791
- }, code);
792
- return response;
793
- });
710
+ async runCode(code, { block } = rpc_client_interface_1.defaultRPCOptions) {
711
+ const response = await this.httpBackend.createRequest({
712
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_code`),
713
+ method: 'POST',
714
+ }, code);
715
+ return response;
794
716
  }
795
717
  /**
796
718
  * @param viewScriptParams Parameters of the script view to run
797
719
  * @param options contains generic configuration for rpc calls to specified block (default to head)
798
- * @description Simulate a call to a michelson view
720
+ * Simulate a call to a michelson view
799
721
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
800
722
  */
801
- runScriptView(_a, _b) {
802
- return __awaiter(this, void 0, void 0, function* () {
803
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
804
- var _c = _b === void 0 ? rpc_client_interface_1.defaultRPCOptions : _b, block = _c.block;
805
- return this.httpBackend.createRequest({
806
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_script_view`),
807
- method: 'POST',
808
- }, Object.assign({ unparsing_mode }, rest));
723
+ async runScriptView({ unparsing_mode = 'Readable', ...rest }, { block } = rpc_client_interface_1.defaultRPCOptions) {
724
+ return this.httpBackend.createRequest({
725
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_script_view`),
726
+ method: 'POST',
727
+ }, {
728
+ unparsing_mode,
729
+ ...rest,
809
730
  });
810
731
  }
811
732
  /**
812
733
  * @param viewParams Parameters of the view to run
813
734
  * @param options contains generic configuration for rpc calls to specified block (default to head)
814
- * @description Simulate a call to a view following the TZIP-4 standard.
735
+ * Simulate a call to a view following the TZIP-4 standard.
815
736
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
816
737
  */
817
- runView(_a, _b) {
818
- return __awaiter(this, void 0, void 0, function* () {
819
- var { unparsing_mode = 'Readable' } = _a, rest = __rest(_a, ["unparsing_mode"]);
820
- var _c = _b === void 0 ? rpc_client_interface_1.defaultRPCOptions : _b, block = _c.block;
821
- return this.httpBackend.createRequest({
822
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_view`),
823
- method: 'POST',
824
- }, Object.assign({ unparsing_mode }, rest));
738
+ async runView({ unparsing_mode = 'Readable', ...rest }, { block } = rpc_client_interface_1.defaultRPCOptions) {
739
+ return this.httpBackend.createRequest({
740
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/run_view`),
741
+ method: 'POST',
742
+ }, {
743
+ unparsing_mode,
744
+ ...rest,
825
745
  });
826
746
  }
827
- getChainId() {
828
- return __awaiter(this, void 0, void 0, function* () {
829
- return this.httpBackend.createRequest({
830
- url: this.createURL(`/chains/${this.chain}/chain_id`),
831
- method: 'GET',
832
- });
747
+ async getChainId() {
748
+ return this.httpBackend.createRequest({
749
+ url: this.createURL(`/chains/${this.chain}/chain_id`),
750
+ method: 'GET',
833
751
  });
834
752
  }
835
753
  /**
836
754
  * @param data Data to pack
837
755
  * @param options contains generic configuration for rpc calls to specified block (default to head)
838
- * @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
756
+ * Computes the serialized version of a data expression using the same algorithm as script instruction PACK
839
757
  * Note: You should always verify the packed bytes before signing or requesting that they be signed when using the RPC to pack.
840
758
  * This precaution helps protect you and your applications users from RPC nodes that have been compromised.
841
759
  * 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.
@@ -843,242 +761,226 @@ class RpcClient {
843
761
  * @example packData({ data: { string: "test" }, type: { prim: "string" } })
844
762
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
845
763
  */
846
- packData(data_1) {
847
- return __awaiter(this, arguments, void 0, function* (data, { block } = rpc_client_interface_1.defaultRPCOptions) {
848
- const _a = yield this.httpBackend.createRequest({
849
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/pack_data`),
850
- method: 'POST',
851
- }, data), { gas } = _a, rest = __rest(_a, ["gas"]);
852
- let formattedGas = gas;
853
- const tryBigNumber = new bignumber_js_1.default(gas || '');
854
- if (!tryBigNumber.isNaN()) {
855
- formattedGas = tryBigNumber;
856
- }
857
- return Object.assign({ gas: formattedGas }, rest);
858
- });
764
+ async packData(data, { block } = rpc_client_interface_1.defaultRPCOptions) {
765
+ const { gas, ...rest } = await this.httpBackend.createRequest({
766
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/helpers/scripts/pack_data`),
767
+ method: 'POST',
768
+ }, data);
769
+ let formattedGas = gas;
770
+ const tryBigNumber = new bignumber_js_1.default(gas || '');
771
+ if (!tryBigNumber.isNaN()) {
772
+ formattedGas = tryBigNumber;
773
+ }
774
+ return { gas: formattedGas, ...rest };
859
775
  }
860
776
  /**
861
777
  *
862
- * @description Return rpc root url
778
+ * Return rpc root url
863
779
  */
864
780
  getRpcUrl() {
865
781
  return this.url;
866
782
  }
867
783
  /**
868
784
  * @param options contains generic configuration for rpc calls to specified block (default to head)
869
- * @description Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
785
+ * Returns the voting period (index, kind, starting position) and related information (position, remaining) of the interrogated block
870
786
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-current-period
871
787
  */
872
- getCurrentPeriod() {
873
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_1.defaultRPCOptions) {
874
- const response = yield this.httpBackend.createRequest({
875
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_period`),
876
- method: 'GET',
877
- });
878
- return response;
788
+ async getCurrentPeriod({ block, } = rpc_client_interface_1.defaultRPCOptions) {
789
+ const response = await this.httpBackend.createRequest({
790
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/current_period`),
791
+ method: 'GET',
879
792
  });
793
+ return response;
880
794
  }
881
795
  /**
882
796
  * @param options contains generic configuration for rpc calls to specified block (default to head)
883
- * @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
797
+ * 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
884
798
  * @example getSuccessorPeriod() will default to successor voting period for /main/chains/block/head.
885
799
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-votes-successor-period
886
800
  */
887
- getSuccessorPeriod() {
888
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_1.defaultRPCOptions) {
889
- const response = yield this.httpBackend.createRequest({
890
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/successor_period`),
891
- method: 'GET',
892
- });
893
- return response;
801
+ async getSuccessorPeriod({ block, } = rpc_client_interface_1.defaultRPCOptions) {
802
+ const response = await this.httpBackend.createRequest({
803
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/votes/successor_period`),
804
+ method: 'GET',
894
805
  });
806
+ return response;
895
807
  }
896
808
  /**
897
809
  * @param id Sapling state ID
898
810
  * @param options contains generic configuration for rpc calls to specified block (default to head)
899
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
811
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
900
812
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-sapling-sapling-state-id-get-diff
901
813
  */
902
- getSaplingDiffById(id_1) {
903
- return __awaiter(this, arguments, void 0, function* (id, { block } = rpc_client_interface_1.defaultRPCOptions) {
904
- return this.httpBackend.createRequest({
905
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/sapling/${id}/get_diff`),
906
- method: 'GET',
907
- });
814
+ async getSaplingDiffById(id, { block } = rpc_client_interface_1.defaultRPCOptions) {
815
+ return this.httpBackend.createRequest({
816
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/sapling/${id}/get_diff`),
817
+ method: 'GET',
908
818
  });
909
819
  }
910
820
  /**
911
821
  * @param contract address of the contract we want to get the sapling diff
912
822
  * @param options contains generic configuration for rpc calls to specified block (default to head)
913
- * @description Returns the root and a diff of a state starting from an optional offset which is zero by default
823
+ * Returns the root and a diff of a state starting from an optional offset which is zero by default
914
824
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-contracts-contract-id-single-sapling-get-diff
915
825
  */
916
- getSaplingDiffByContract(contract_1) {
917
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
918
- return this.httpBackend.createRequest({
919
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/single_sapling_get_diff`),
920
- method: 'GET',
921
- });
826
+ async getSaplingDiffByContract(contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
827
+ return this.httpBackend.createRequest({
828
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/single_sapling_get_diff`),
829
+ method: 'GET',
922
830
  });
923
831
  }
924
832
  /**
925
833
  * @param options contains generic configuration for rpc calls to specified block (default to head)
926
- * @description get current and next protocol
834
+ * get current and next protocol
927
835
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
928
836
  */
929
- getProtocols() {
930
- return __awaiter(this, arguments, void 0, function* ({ block } = rpc_client_interface_1.defaultRPCOptions) {
931
- return this.httpBackend.createRequest({
932
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/protocols`),
933
- method: 'GET',
934
- });
837
+ async getProtocols({ block } = rpc_client_interface_1.defaultRPCOptions) {
838
+ return this.httpBackend.createRequest({
839
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/protocols`),
840
+ method: 'GET',
935
841
  });
936
842
  }
937
843
  /**
938
- * @param options contains generic configuration for rpc calls to specified block (default to head)
939
- * @description get current and next protocol
844
+ * @param protocol the protocol hash to look up (default to empty string)
845
+ * get current and next protocol
940
846
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-protocols
941
847
  */
942
- getProtocolActivations() {
943
- return __awaiter(this, arguments, void 0, function* (protocol = '') {
944
- if (protocol) {
945
- const protocolValidation = (0, utils_2.validateProtocol)(protocol);
946
- if (protocolValidation !== utils_2.ValidationResult.VALID) {
947
- throw new utils_2.InvalidProtocolHashError(protocol, protocolValidation);
948
- }
848
+ async getProtocolActivations(protocol = '') {
849
+ if (protocol) {
850
+ const protocolValidation = (0, utils_2.validateProtocol)(protocol);
851
+ if (protocolValidation !== utils_2.ValidationResult.VALID) {
852
+ throw new utils_2.InvalidProtocolHashError(protocol, protocolValidation);
949
853
  }
950
- return this.httpBackend.createRequest({
951
- url: this.createURL(`/chains/${this.chain}/protocols/${protocol}`),
952
- method: 'GET',
953
- });
854
+ }
855
+ return this.httpBackend.createRequest({
856
+ url: this.createURL(`/chains/${this.chain}/protocols/${protocol}`),
857
+ method: 'GET',
954
858
  });
955
859
  }
956
860
  /**
957
861
  * @param contract address of the contract we want to retrieve storage information of
958
862
  * @param options contains generic configuration for rpc calls to specified block (default to head)
959
- * @description Access the used storage space of the contract
863
+ * Access the used storage space of the contract
960
864
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
961
865
  */
962
- getStorageUsedSpace(contract_1) {
963
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
964
- return this.httpBackend.createRequest({
965
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/used_space`),
966
- method: 'GET',
967
- });
866
+ async getStorageUsedSpace(contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
867
+ return this.httpBackend.createRequest({
868
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/used_space`),
869
+ method: 'GET',
968
870
  });
969
871
  }
970
872
  /**
971
873
  * @param contract address of the contract we want to retrieve storage information of
972
874
  * @param options contains generic configuration for rpc calls to specified block (default to head)
973
- * @description Access the paid storage space of the contract
875
+ * Access the paid storage space of the contract
974
876
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/alpha-openapi.json
975
877
  */
976
- getStoragePaidSpace(contract_1) {
977
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
978
- return this.httpBackend.createRequest({
979
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/paid_space`),
980
- method: 'GET',
981
- });
878
+ async getStoragePaidSpace(contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
879
+ return this.httpBackend.createRequest({
880
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/storage/paid_space`),
881
+ method: 'GET',
982
882
  });
983
883
  }
984
884
  /**
985
885
  * @param contract implicit or originated address we want to retrieve ticket balance of
986
886
  * @param ticket object to specify a ticket by ticketer, content type and content
987
887
  * @param options contains generic configuration for rpc calls to specified block (default to head)
988
- * @description Access the contract's balance of ticket with specified ticketer, content type, and content.
888
+ * Access the contract's balance of ticket with specified ticketer, content type, and content.
989
889
  * @example ticket { ticketer: 'address', content_type: { prim: "string" }, content: { string: 'ticket1' } }
990
890
  * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes
991
891
  */
992
- getTicketBalance(contract_1, ticket_1) {
993
- return __awaiter(this, arguments, void 0, function* (contract, ticket, { block } = rpc_client_interface_1.defaultRPCOptions) {
994
- return this.httpBackend.createRequest({
995
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/ticket_balance`),
996
- method: 'POST',
997
- }, ticket);
998
- });
892
+ async getTicketBalance(contract, ticket, { block } = rpc_client_interface_1.defaultRPCOptions) {
893
+ return this.httpBackend.createRequest({
894
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/ticket_balance`),
895
+ method: 'POST',
896
+ }, ticket);
999
897
  }
1000
898
  /**
1001
899
  * @param contract originated address we want to retrieve ticket balances of
1002
900
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1003
- * @description Access the complete list of tickets owned by the given contract by scanning the contract's storage.
901
+ * Access the complete list of tickets owned by the given contract by scanning the contract's storage.
1004
902
  * @see https://tezos.gitlab.io/protocols/016_mumbai.html#rpc-changes
1005
903
  */
1006
- getAllTicketBalances(contract_1) {
1007
- return __awaiter(this, arguments, void 0, function* (contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
1008
- return this.httpBackend.createRequest({
1009
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/all_ticket_balances`),
1010
- method: 'GET',
1011
- });
904
+ async getAllTicketBalances(contract, { block } = rpc_client_interface_1.defaultRPCOptions) {
905
+ return this.httpBackend.createRequest({
906
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/contracts/${contract}/all_ticket_balances`),
907
+ method: 'GET',
1012
908
  });
1013
909
  }
1014
910
  /**
1015
- * @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.
911
+ * 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
912
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1017
913
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-adaptive-issuance-launch-cycle
1018
914
  */
1019
- getAdaptiveIssuanceLaunchCycle() {
1020
- return __awaiter(this, arguments, void 0, function* ({ block, } = rpc_client_interface_1.defaultRPCOptions) {
1021
- return this.httpBackend.createRequest({
1022
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/adaptive_issuance_launch_cycle`),
1023
- method: 'GET',
1024
- });
915
+ async getAdaptiveIssuanceLaunchCycle({ block, } = rpc_client_interface_1.defaultRPCOptions) {
916
+ return this.httpBackend.createRequest({
917
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/adaptive_issuance_launch_cycle`),
918
+ method: 'GET',
1025
919
  });
1026
920
  }
1027
921
  /**
1028
- * @description List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
922
+ * List the prevalidated operations in mempool (accessibility of mempool depends on each rpc endpoint)
1029
923
  * @param args has 5 optional properties
1030
924
  * @default args { version: '2', validated: true, refused: true, outdated, true, branchRefused: true, branchDelayed: true, validationPass: undefined, source: undefined, operationHash: undefined }
1031
925
  * @see https://gitlab.com/tezos/tezos/-/blob/master/docs/api/tallinn-mempool-openapi-rc.json
1032
926
  */
1033
- getPendingOperations() {
1034
- return __awaiter(this, arguments, void 0, function* (args = {}) {
1035
- return this.httpBackend.createRequest({
1036
- url: this.createURL(`/chains/${this.chain}/mempool/pending_operations`),
1037
- method: 'GET',
1038
- query: args,
1039
- });
927
+ async getPendingOperations(args = {}) {
928
+ return this.httpBackend.createRequest({
929
+ url: this.createURL(`/chains/${this.chain}/mempool/pending_operations`),
930
+ method: 'GET',
931
+ query: args,
932
+ });
933
+ }
934
+ /**
935
+ * Returns the current mempool fee filter configuration.
936
+ *
937
+ * On Tezos L1 these values commonly resemble the historical fee defaults used by clients.
938
+ * On Tezos X / Tezlink, the same fields are used for estimation but may differ materially,
939
+ * especially the byte fee and the gas-price component.
940
+ *
941
+ * @param args optional query arguments for the mempool/filter endpoint
942
+ */
943
+ async getMempoolFilter(args = {}) {
944
+ return this.httpBackend.createRequest({
945
+ url: this.createURL(`/chains/${this.chain}/mempool/filter`),
946
+ method: 'GET',
947
+ query: args,
1040
948
  });
1041
949
  }
1042
950
  /**
1043
951
  * @param delegate delegate address which we want to retrieve active staking parameters
1044
952
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1045
- * @description Returns the currently active staking parameters for the given delegate
953
+ * Returns the currently active staking parameters for the given delegate
1046
954
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-active-staking-parameters
1047
955
  */
1048
- getActiveStakingParameters(delegate_1) {
1049
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = rpc_client_interface_1.defaultRPCOptions) {
1050
- return yield this.httpBackend.createRequest({
1051
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/active_staking_parameters`),
1052
- method: 'GET',
1053
- });
956
+ async getActiveStakingParameters(delegate, { block } = rpc_client_interface_1.defaultRPCOptions) {
957
+ return await this.httpBackend.createRequest({
958
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/active_staking_parameters`),
959
+ method: 'GET',
1054
960
  });
1055
961
  }
1056
962
  /**
1057
963
  * @param delegate delegate address which we want to retrieve pending staking parameters
1058
964
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1059
- * @description Returns the pending values for the given delegate's staking parameters
965
+ * Returns the pending values for the given delegate's staking parameters
1060
966
  * @see https://tezos.gitlab.io/active/rpc.html#get-block-id-context-delegates-pkh-pending-staking-parameters
1061
967
  */
1062
- getPendingStakingParameters(delegate_1) {
1063
- return __awaiter(this, arguments, void 0, function* (delegate, { block } = rpc_client_interface_1.defaultRPCOptions) {
1064
- return yield this.httpBackend.createRequest({
1065
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/pending_staking_parameters`),
1066
- method: 'GET',
1067
- });
968
+ async getPendingStakingParameters(delegate, { block } = rpc_client_interface_1.defaultRPCOptions) {
969
+ return await this.httpBackend.createRequest({
970
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/delegates/${delegate}/pending_staking_parameters`),
971
+ method: 'GET',
1068
972
  });
1069
973
  }
1070
974
  /**
1071
975
  * @param destination address to retrieve the index for
1072
976
  * @param options contains generic configuration for rpc calls to specified block (default to head)
1073
- * @description Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
977
+ * Returns the index assigned to the address if it was indexed by the opcode INDEX_ADDRESS, otherwise returns null
1074
978
  * @see https://octez.tezos.com/docs/alpha/rpc.html#get-block-id-context-destination-destination-id-index
1075
979
  */
1076
- getDestinationIndex(destination_1) {
1077
- return __awaiter(this, arguments, void 0, function* (destination, { block } = rpc_client_interface_1.defaultRPCOptions) {
1078
- return yield this.httpBackend.createRequest({
1079
- url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/destination/${destination}/index`),
1080
- method: 'GET',
1081
- });
980
+ async getDestinationIndex(destination, { block } = rpc_client_interface_1.defaultRPCOptions) {
981
+ return await this.httpBackend.createRequest({
982
+ url: this.createURL(`/chains/${this.chain}/blocks/${block}/context/destination/${destination}/index`),
983
+ method: 'GET',
1082
984
  });
1083
985
  }
1084
986
  }