starknet 2.5.0 → 2.7.2

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,5 +1,6 @@
1
1
  import {
2
2
  AddTransactionResponse,
3
+ BlockNumber,
3
4
  CallContractResponse,
4
5
  CallContractTransaction,
5
6
  CompiledContract,
@@ -13,7 +14,7 @@ import {
13
14
  } from '../types';
14
15
  import { BigNumberish } from '../utils/number';
15
16
  import { ProviderInterface } from './interface';
16
- declare type NetworkName = 'mainnet-alpha' | 'georli-alpha';
17
+ declare type NetworkName = 'mainnet-alpha' | 'goerli-alpha';
17
18
  declare type ProviderOptions =
18
19
  | {
19
20
  network: NetworkName;
@@ -39,53 +40,67 @@ export declare class Provider implements ProviderInterface {
39
40
  /**
40
41
  * Calls a function on the StarkNet contract.
41
42
  *
42
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L17-L25)
43
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L25-L39)
43
44
  *
44
45
  * @param invokeTransaction - transaction to be invoked
45
- * @param blockId
46
+ * @param blockHash
47
+ * @param blockNumber
46
48
  * @returns the result of the function on the smart contract.
47
49
  */
48
50
  callContract(
49
51
  invokeTransaction: CallContractTransaction,
50
- blockId?: number
52
+ blockHash?: BigNumberish,
53
+ blockNumber?: BlockNumber
51
54
  ): Promise<CallContractResponse>;
52
55
  /**
53
- * Gets the block information from a block ID.
56
+ * Gets the block information
54
57
  *
55
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L27-L31)
58
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L41-L53)
56
59
  *
57
- * @param blockId
58
- * @returns the block object { block_id, previous_block_id, state_root, status, timestamp, transaction_receipts, transactions }
60
+ * @param blockHash
61
+ * @param blockNumber
62
+ * @returns the block object { block_number, previous_block_number, state_root, status, timestamp, transaction_receipts, transactions }
59
63
  */
60
- getBlock(blockId?: number): Promise<GetBlockResponse>;
64
+ getBlock(blockHash?: BigNumberish, blockNumber?: BlockNumber): Promise<GetBlockResponse>;
61
65
  /**
62
66
  * Gets the code of the deployed contract.
63
67
  *
64
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L33-L36)
68
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L55-L68)
65
69
  *
66
70
  * @param contractAddress
67
- * @param blockId
71
+ * @param blockHash
72
+ * @param blockNumber
68
73
  * @returns Bytecode and ABI of compiled contract
69
74
  */
70
- getCode(contractAddress: string, blockId?: number): Promise<GetCodeResponse>;
75
+ getCode(
76
+ contractAddress: string,
77
+ blockHash?: BigNumberish,
78
+ blockNumber?: BlockNumber
79
+ ): Promise<GetCodeResponse>;
71
80
  /**
72
81
  * Gets the contract's storage variable at a specific key.
73
82
  *
74
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L38-L46)
83
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L70-L85)
75
84
  *
76
85
  * @param contractAddress
77
86
  * @param key - from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
78
- * @param blockId
87
+ * @param blockHash
88
+ * @param blockNumber
79
89
  * @returns the value of the storage variable
80
90
  */
81
- getStorageAt(contractAddress: string, key: number, blockId?: number): Promise<object>;
91
+ getStorageAt(
92
+ contractAddress: string,
93
+ key: number,
94
+ blockHash?: BigNumberish,
95
+ blockNumber?: BlockNumber
96
+ ): Promise<object>;
82
97
  /**
83
98
  * Gets the status of a transaction.
84
99
  *
85
100
  * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L48-L52)
86
101
  *
87
102
  * @param txHash
88
- * @returns the transaction status object { block_id, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
103
+ * @returns the transaction status object { block_number, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
89
104
  */
90
105
  getTransactionStatus(txHash: BigNumberish): Promise<GetTransactionStatusResponse>;
91
106
  /**
@@ -94,7 +109,7 @@ export declare class Provider implements ProviderInterface {
94
109
  * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L54-L58)
95
110
  *
96
111
  * @param txHash
97
- * @returns the transacton object { transaction_id, status, transaction, block_id?, block_number?, transaction_index?, transaction_failure_reason? }
112
+ * @returns the transacton object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
98
113
  */
99
114
  getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
100
115
  /**
@@ -156,6 +156,7 @@ var url_join_1 = __importDefault(require('url-join'));
156
156
  var json_1 = require('../utils/json');
157
157
  var number_1 = require('../utils/number');
158
158
  var stark_1 = require('../utils/stark');
159
+ var utils_1 = require('./utils');
159
160
  function wait(delay) {
160
161
  return new Promise(function (res) {
161
162
  return setTimeout(res, delay);
@@ -164,7 +165,7 @@ function wait(delay) {
164
165
  var Provider = /** @class */ (function () {
165
166
  function Provider(optionsOrProvider) {
166
167
  if (optionsOrProvider === void 0) {
167
- optionsOrProvider = { network: 'georli-alpha' };
168
+ optionsOrProvider = { network: 'goerli-alpha' };
168
169
  }
169
170
  if (optionsOrProvider instanceof Provider) {
170
171
  this.baseUrl = optionsOrProvider.baseUrl;
@@ -184,7 +185,7 @@ var Provider = /** @class */ (function () {
184
185
  switch (name) {
185
186
  case 'mainnet-alpha':
186
187
  return 'https://alpha-mainnet.starknet.io';
187
- case 'georli-alpha':
188
+ case 'goerli-alpha':
188
189
  default:
189
190
  return 'https://alpha4.starknet.io';
190
191
  }
@@ -217,25 +218,33 @@ var Provider = /** @class */ (function () {
217
218
  /**
218
219
  * Calls a function on the StarkNet contract.
219
220
  *
220
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L17-L25)
221
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L25-L39)
221
222
  *
222
223
  * @param invokeTransaction - transaction to be invoked
223
- * @param blockId
224
+ * @param blockHash
225
+ * @param blockNumber
224
226
  * @returns the result of the function on the smart contract.
225
227
  */
226
- Provider.prototype.callContract = function (invokeTransaction, blockId) {
228
+ Provider.prototype.callContract = function (invokeTransaction, blockHash, blockNumber) {
229
+ if (blockNumber === void 0) {
230
+ blockNumber = null;
231
+ }
227
232
  return __awaiter(this, void 0, void 0, function () {
228
- var data;
233
+ var formattedBlockIdentifier, data;
229
234
  return __generator(this, function (_a) {
230
235
  switch (_a.label) {
231
236
  case 0:
237
+ formattedBlockIdentifier = (0, utils_1.getFormattedBlockIdentifier)(
238
+ blockHash,
239
+ blockNumber
240
+ );
232
241
  return [
233
242
  4 /*yield*/,
234
243
  axios_1.default.post(
235
244
  (0, url_join_1.default)(
236
245
  this.feederGatewayUrl,
237
246
  'call_contract',
238
- '?blockId=' + (blockId !== null && blockId !== void 0 ? blockId : 'null')
247
+ formattedBlockIdentifier
239
248
  ),
240
249
  __assign({ signature: [], calldata: [] }, invokeTransaction)
241
250
  ),
@@ -248,26 +257,34 @@ var Provider = /** @class */ (function () {
248
257
  });
249
258
  };
250
259
  /**
251
- * Gets the block information from a block ID.
260
+ * Gets the block information
252
261
  *
253
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L27-L31)
262
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L41-L53)
254
263
  *
255
- * @param blockId
256
- * @returns the block object { block_id, previous_block_id, state_root, status, timestamp, transaction_receipts, transactions }
264
+ * @param blockHash
265
+ * @param blockNumber
266
+ * @returns the block object { block_number, previous_block_number, state_root, status, timestamp, transaction_receipts, transactions }
257
267
  */
258
- Provider.prototype.getBlock = function (blockId) {
268
+ Provider.prototype.getBlock = function (blockHash, blockNumber) {
269
+ if (blockNumber === void 0) {
270
+ blockNumber = null;
271
+ }
259
272
  return __awaiter(this, void 0, void 0, function () {
260
- var data;
273
+ var formattedBlockIdentifier, data;
261
274
  return __generator(this, function (_a) {
262
275
  switch (_a.label) {
263
276
  case 0:
277
+ formattedBlockIdentifier = (0, utils_1.getFormattedBlockIdentifier)(
278
+ blockHash,
279
+ blockNumber
280
+ );
264
281
  return [
265
282
  4 /*yield*/,
266
283
  axios_1.default.get(
267
284
  (0, url_join_1.default)(
268
285
  this.feederGatewayUrl,
269
286
  'get_block',
270
- '?blockId=' + (blockId !== null && blockId !== void 0 ? blockId : 'null')
287
+ formattedBlockIdentifier
271
288
  )
272
289
  ),
273
290
  ];
@@ -281,28 +298,33 @@ var Provider = /** @class */ (function () {
281
298
  /**
282
299
  * Gets the code of the deployed contract.
283
300
  *
284
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L33-L36)
301
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L55-L68)
285
302
  *
286
303
  * @param contractAddress
287
- * @param blockId
304
+ * @param blockHash
305
+ * @param blockNumber
288
306
  * @returns Bytecode and ABI of compiled contract
289
307
  */
290
- Provider.prototype.getCode = function (contractAddress, blockId) {
308
+ Provider.prototype.getCode = function (contractAddress, blockHash, blockNumber) {
309
+ if (blockNumber === void 0) {
310
+ blockNumber = null;
311
+ }
291
312
  return __awaiter(this, void 0, void 0, function () {
292
- var data;
313
+ var formattedBlockIdentifier, data;
293
314
  return __generator(this, function (_a) {
294
315
  switch (_a.label) {
295
316
  case 0:
317
+ formattedBlockIdentifier = (0, utils_1.getFormattedBlockIdentifier)(
318
+ blockHash,
319
+ blockNumber
320
+ );
296
321
  return [
297
322
  4 /*yield*/,
298
323
  axios_1.default.get(
299
324
  (0, url_join_1.default)(
300
325
  this.feederGatewayUrl,
301
326
  'get_code',
302
- '?contractAddress=' +
303
- contractAddress +
304
- '&blockId=' +
305
- (blockId !== null && blockId !== void 0 ? blockId : 'null')
327
+ '?contractAddress=' + contractAddress + '&' + formattedBlockIdentifier
306
328
  )
307
329
  ),
308
330
  ];
@@ -317,19 +339,27 @@ var Provider = /** @class */ (function () {
317
339
  /**
318
340
  * Gets the contract's storage variable at a specific key.
319
341
  *
320
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L38-L46)
342
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L70-L85)
321
343
  *
322
344
  * @param contractAddress
323
345
  * @param key - from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
324
- * @param blockId
346
+ * @param blockHash
347
+ * @param blockNumber
325
348
  * @returns the value of the storage variable
326
349
  */
327
- Provider.prototype.getStorageAt = function (contractAddress, key, blockId) {
350
+ Provider.prototype.getStorageAt = function (contractAddress, key, blockHash, blockNumber) {
351
+ if (blockNumber === void 0) {
352
+ blockNumber = null;
353
+ }
328
354
  return __awaiter(this, void 0, void 0, function () {
329
- var data;
355
+ var formattedBlockIdentifier, data;
330
356
  return __generator(this, function (_a) {
331
357
  switch (_a.label) {
332
358
  case 0:
359
+ formattedBlockIdentifier = (0, utils_1.getFormattedBlockIdentifier)(
360
+ blockHash,
361
+ blockNumber
362
+ );
333
363
  return [
334
364
  4 /*yield*/,
335
365
  axios_1.default.get(
@@ -340,8 +370,8 @@ var Provider = /** @class */ (function () {
340
370
  contractAddress +
341
371
  '&key=' +
342
372
  key +
343
- '&blockId=' +
344
- (blockId !== null && blockId !== void 0 ? blockId : 'null')
373
+ '&' +
374
+ formattedBlockIdentifier
345
375
  )
346
376
  ),
347
377
  ];
@@ -358,7 +388,7 @@ var Provider = /** @class */ (function () {
358
388
  * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L48-L52)
359
389
  *
360
390
  * @param txHash
361
- * @returns the transaction status object { block_id, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
391
+ * @returns the transaction status object { block_number, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
362
392
  */
363
393
  Provider.prototype.getTransactionStatus = function (txHash) {
364
394
  return __awaiter(this, void 0, void 0, function () {
@@ -390,7 +420,7 @@ var Provider = /** @class */ (function () {
390
420
  * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L54-L58)
391
421
  *
392
422
  * @param txHash
393
- * @returns the transacton object { transaction_id, status, transaction, block_id?, block_number?, transaction_index?, transaction_failure_reason? }
423
+ * @returns the transacton object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
394
424
  */
395
425
  Provider.prototype.getTransaction = function (txHash) {
396
426
  return __awaiter(this, void 0, void 0, function () {
@@ -512,7 +542,7 @@ var Provider = /** @class */ (function () {
512
542
  retryInterval = 8000;
513
543
  }
514
544
  return __awaiter(this, void 0, void 0, function () {
515
- var onchain, res;
545
+ var onchain, res, error;
516
546
  return __generator(this, function (_a) {
517
547
  switch (_a.label) {
518
548
  case 0:
@@ -533,10 +563,10 @@ var Provider = /** @class */ (function () {
533
563
  res = _a.sent();
534
564
  if (res.tx_status === 'ACCEPTED_ON_L1' || res.tx_status === 'ACCEPTED_ON_L2') {
535
565
  onchain = true;
536
- } else if (res.tx_status === 'REJECTED') {
537
- throw Error('REJECTED');
538
- } else if (res.tx_status === 'NOT_RECEIVED') {
539
- throw Error('NOT_RECEIVED');
566
+ } else if (res.tx_status === 'REJECTED' || res.tx_status === 'NOT_RECEIVED') {
567
+ error = Error(res.tx_status);
568
+ error.response = res;
569
+ throw error;
540
570
  }
541
571
  return [3 /*break*/, 2];
542
572
  case 5:
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  AddTransactionResponse,
3
+ BlockNumber,
3
4
  CallContractResponse,
4
5
  CallContractTransaction,
5
6
  CompiledContract,
@@ -26,53 +27,67 @@ export declare abstract class ProviderInterface {
26
27
  /**
27
28
  * Calls a function on the StarkNet contract.
28
29
  *
29
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L17-L25)
30
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L25-L39)
30
31
  *
31
32
  * @param invokeTransaction - transaction to be invoked
32
- * @param blockId
33
+ * @param blockHash
34
+ * @param blockNumber
33
35
  * @returns the result of the function on the smart contract.
34
36
  */
35
37
  abstract callContract(
36
38
  invokeTransaction: CallContractTransaction,
37
- blockId?: number
39
+ blockHash?: BigNumberish,
40
+ blockNumber?: BlockNumber
38
41
  ): Promise<CallContractResponse>;
39
42
  /**
40
- * Gets the block information from a block ID.
43
+ * Gets the block information
41
44
  *
42
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L27-L31)
45
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L41-L53)
43
46
  *
44
- * @param blockId
45
- * @returns the block object { block_id, previous_block_id, state_root, status, timestamp, transaction_receipts, transactions }
47
+ * @param blockHash
48
+ * @param blockNumber
49
+ * @returns the block object { block_number, previous_block_number, state_root, status, timestamp, transaction_receipts, transactions }
46
50
  */
47
- abstract getBlock(blockId?: number): Promise<GetBlockResponse>;
51
+ abstract getBlock(blockHash?: BigNumberish, blockNumber?: BlockNumber): Promise<GetBlockResponse>;
48
52
  /**
49
53
  * Gets the code of the deployed contract.
50
54
  *
51
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L33-L36)
55
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L55-L68)
52
56
  *
53
57
  * @param contractAddress
54
- * @param blockId
58
+ * @param blockHash
59
+ * @param blockNumber
55
60
  * @returns Bytecode and ABI of compiled contract
56
61
  */
57
- abstract getCode(contractAddress: string, blockId?: number): Promise<GetCodeResponse>;
62
+ abstract getCode(
63
+ contractAddress: string,
64
+ blockHash?: BigNumberish,
65
+ blockNumber?: BlockNumber
66
+ ): Promise<GetCodeResponse>;
58
67
  /**
59
68
  * Gets the contract's storage variable at a specific key.
60
69
  *
61
- * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L38-L46)
70
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L70-L85)
62
71
  *
63
72
  * @param contractAddress
64
73
  * @param key - from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
65
- * @param blockId
74
+ * @param blockHash
75
+ * @param blockNumber
66
76
  * @returns the value of the storage variable
67
77
  */
68
- abstract getStorageAt(contractAddress: string, key: number, blockId?: number): Promise<object>;
78
+ abstract getStorageAt(
79
+ contractAddress: string,
80
+ key: number,
81
+ blockHash?: BigNumberish,
82
+ blockNumber?: BlockNumber
83
+ ): Promise<object>;
69
84
  /**
70
85
  * Gets the status of a transaction.
71
86
  *
72
87
  * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L48-L52)
73
88
  *
74
89
  * @param txHash
75
- * @returns the transaction status object { block_id, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
90
+ * @returns the transaction status object { block_number, tx_status: NOT_RECEIVED | RECEIVED | PENDING | REJECTED | ACCEPTED_ONCHAIN }
76
91
  */
77
92
  abstract getTransactionStatus(txHash: BigNumberish): Promise<GetTransactionStatusResponse>;
78
93
  /**
@@ -81,7 +96,7 @@ export declare abstract class ProviderInterface {
81
96
  * [Reference](https://github.com/starkware-libs/cairo-lang/blob/f464ec4797361b6be8989e36e02ec690e74ef285/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L54-L58)
82
97
  *
83
98
  * @param txHash
84
- * @returns the transacton object { transaction_id, status, transaction, block_id?, block_number?, transaction_index?, transaction_failure_reason? }
99
+ * @returns the transacton object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
85
100
  */
86
101
  abstract getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
87
102
  /**
@@ -0,0 +1,30 @@
1
+ import type { BlockNumber } from '../types';
2
+ import { BigNumberish } from '../utils/number';
3
+ /**
4
+ * TODO
5
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L148-L153)
6
+ *
7
+ * @param hashValue
8
+ * @param hashField
9
+ */
10
+ export declare function formatHash(): void;
11
+ /**
12
+ * TODO
13
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L156-L161)
14
+ * @param txHash
15
+ * @param txId
16
+ */
17
+ export declare function txIdentifier(): void;
18
+ /**
19
+ * Gets the block identifier for API request
20
+ *
21
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L164-L173)
22
+ *
23
+ * @param blockNumber
24
+ * @param blockHash
25
+ * @returns block identifier for API request
26
+ */
27
+ export declare function getFormattedBlockIdentifier(
28
+ blockHash?: BigNumberish,
29
+ blockNumber?: BlockNumber
30
+ ): string;
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.getFormattedBlockIdentifier = exports.txIdentifier = exports.formatHash = void 0;
4
+ /**
5
+ * TODO
6
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L148-L153)
7
+ *
8
+ * @param hashValue
9
+ * @param hashField
10
+ */
11
+ function formatHash() {}
12
+ exports.formatHash = formatHash;
13
+ /**
14
+ * TODO
15
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L156-L161)
16
+ * @param txHash
17
+ * @param txId
18
+ */
19
+ function txIdentifier() {}
20
+ exports.txIdentifier = txIdentifier;
21
+ /**
22
+ * Gets the block identifier for API request
23
+ *
24
+ * [Reference](https://github.com/starkware-libs/cairo-lang/blob/fc97bdd8322a7df043c87c371634b26c15ed6cee/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L164-L173)
25
+ *
26
+ * @param blockNumber
27
+ * @param blockHash
28
+ * @returns block identifier for API request
29
+ */
30
+ function getFormattedBlockIdentifier(blockHash, blockNumber) {
31
+ if (blockNumber === void 0) {
32
+ blockNumber = null;
33
+ }
34
+ if (blockHash) {
35
+ return '?blockHash=' + blockHash;
36
+ }
37
+ return '?blockNumber=' + blockNumber;
38
+ }
39
+ exports.getFormattedBlockIdentifier = getFormattedBlockIdentifier;