starknet 11.6.0 → 11.6.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.
@@ -11,7 +11,11 @@ var starknet = (() => {
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
13
  var __commonJS = (cb, mod2) => function __require2() {
14
- return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
14
+ try {
15
+ return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
16
+ } catch (e) {
17
+ throw mod2 = 0, e;
18
+ }
15
19
  };
16
20
  var __export = (target, all) => {
17
21
  for (var name in all)
@@ -2274,6 +2278,11 @@ ${indent}}` : "}";
2274
2278
  var LibraryError = class extends CustomError {
2275
2279
  };
2276
2280
  var RpcError = class extends LibraryError {
2281
+ request;
2282
+ // Declared after `request`, and not as a constructor parameter: fields are created in the
2283
+ // order they are declared, so `JSON.stringify(error)` and `console.log(error)` list `request`
2284
+ // first.
2285
+ baseError;
2277
2286
  constructor(baseError, method, params) {
2278
2287
  super(`RPC: ${method} with params ${stringify2(params, null, 2)}
2279
2288
 
@@ -2281,7 +2290,6 @@ ${indent}}` : "}";
2281
2290
  this.baseError = baseError;
2282
2291
  this.request = { method, params };
2283
2292
  }
2284
- request;
2285
2293
  get code() {
2286
2294
  return this.baseError.code;
2287
2295
  }
@@ -13005,15 +13013,6 @@ ${indent}}` : "}";
13005
13013
  return acc;
13006
13014
  }, {});
13007
13015
  }
13008
- if (isTypeArray(element.type)) {
13009
- const parsedDataArr = [];
13010
- const el = { name: "", type: getArrayType(element.type) };
13011
- const len = BigInt(responseIterator.next().value);
13012
- while (parsedDataArr.length < len) {
13013
- parsedDataArr.push(parseResponseValue(responseIterator, el, parser, structs, enums));
13014
- }
13015
- return parsedDataArr;
13016
- }
13017
13016
  return parseBaseTypes2(element.type, responseIterator, parser);
13018
13017
  }
13019
13018
  function responseParser({
@@ -16470,7 +16469,6 @@ ${indent}}` : "}";
16470
16469
 
16471
16470
  // src/utils/calldata/parser/parsingStrategy.ts
16472
16471
  var hdParsingStrategy = {
16473
- // TODO: provjeri svi request parseri stvaraju array, dali je to ok sa requstParserom
16474
16472
  request: {
16475
16473
  [CairoBytes31.abiSelector]: (val) => {
16476
16474
  return new CairoBytes31(val).toApiRequest();
@@ -19730,7 +19728,6 @@ ${indent}}` : "}";
19730
19728
  }
19731
19729
  return this.specVersion;
19732
19730
  }
19733
- // TODO: New Method add test
19734
19731
  /**
19735
19732
  * Given an l1 tx hash, returns the associated l1_handler tx hashes and statuses for all L1 -> L2 messages sent by the l1 transaction, ordered by the l1 tx sending order
19736
19733
  */
@@ -19740,7 +19737,6 @@ ${indent}}` : "}";
19740
19737
  transaction_hash
19741
19738
  });
19742
19739
  }
19743
- // TODO: New Method add test
19744
19740
  getStorageProof(classHashes = [], contractAddresses = [], contractsStorageKeys = [], blockIdentifier = this.blockIdentifier) {
19745
19741
  const block_id = new Block(blockIdentifier).identifier;
19746
19742
  const class_hashes = bigNumberishArrayToHexadecimalStringArray(classHashes);
@@ -19752,7 +19748,6 @@ ${indent}}` : "}";
19752
19748
  contracts_storage_keys: contractsStorageKeys
19753
19749
  });
19754
19750
  }
19755
- // TODO: New Method add test
19756
19751
  getCompiledCasm(classHash) {
19757
19752
  const class_hash = toHex(classHash);
19758
19753
  return this.fetchEndpoint("starknet_getCompiledCasm", {
@@ -19865,7 +19860,8 @@ ${indent}}` : "}";
19865
19860
  }
19866
19861
  async waitForTransaction(txHash, options) {
19867
19862
  const transactionHash = toHex(txHash);
19868
- let retries = options?.retries ?? this.retries;
19863
+ const maxRetries = options?.retries ?? this.retries;
19864
+ let retries = maxRetries;
19869
19865
  let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
19870
19866
  let onchain = false;
19871
19867
  let isErrorState = false;
@@ -19915,9 +19911,9 @@ ${indent}}` : "}";
19915
19911
  }
19916
19912
  lifeCycleRetries -= 1;
19917
19913
  }
19918
- if (retries <= 0) {
19919
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
19920
- }
19914
+ }
19915
+ if (!onchain && retries <= 0) {
19916
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
19921
19917
  }
19922
19918
  retries -= 1;
19923
19919
  }
@@ -19927,7 +19923,7 @@ ${indent}}` : "}";
19927
19923
  txReceipt = await this.getTransactionReceipt(transactionHash);
19928
19924
  } catch (error) {
19929
19925
  if (retries <= 0) {
19930
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
19926
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
19931
19927
  }
19932
19928
  retries -= 1;
19933
19929
  await wait(retryInterval);
@@ -20598,7 +20594,8 @@ ${indent}}` : "}";
20598
20594
  }
20599
20595
  async waitForTransaction(txHash, options) {
20600
20596
  const transactionHash = toHex(txHash);
20601
- let retries = options?.retries ?? this.retries;
20597
+ const maxRetries = options?.retries ?? this.retries;
20598
+ let retries = maxRetries;
20602
20599
  let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
20603
20600
  let onchain = false;
20604
20601
  let isErrorState = false;
@@ -20648,9 +20645,9 @@ ${indent}}` : "}";
20648
20645
  }
20649
20646
  lifeCycleRetries -= 1;
20650
20647
  }
20651
- if (retries <= 0) {
20652
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
20653
- }
20648
+ }
20649
+ if (!onchain && retries <= 0) {
20650
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
20654
20651
  }
20655
20652
  retries -= 1;
20656
20653
  }
@@ -20660,7 +20657,7 @@ ${indent}}` : "}";
20660
20657
  txReceipt = await this.getTransactionReceipt(transactionHash);
20661
20658
  } catch (error) {
20662
20659
  if (retries <= 0) {
20663
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
20660
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
20664
20661
  }
20665
20662
  retries -= 1;
20666
20663
  await wait(retryInterval);
@@ -25372,7 +25369,6 @@ ${indent}}` : "}";
25372
25369
  }
25373
25370
  return this.cairoVersion;
25374
25371
  }
25375
- // TODO: TT Cairo version is still needed for invoke on existing contracts
25376
25372
  async estimateInvokeFee(calls, details = {}) {
25377
25373
  const invocations = [{ type: ETransactionType2.INVOKE, payload: [calls].flat() }];
25378
25374
  const estimateBulk = await this.estimateFeeBulk(invocations, details);
@@ -26219,7 +26215,6 @@ ${indent}}` : "}";
26219
26215
  static async connectSilent(provider, walletProvider, cairoVersion, paymaster) {
26220
26216
  return _WalletAccount.connect(provider, walletProvider, cairoVersion, paymaster, true);
26221
26217
  }
26222
- // TODO: MISSING ESTIMATES
26223
26218
  };
26224
26219
 
26225
26220
  // src/wallet/connectV5.ts
@@ -26599,7 +26594,6 @@ ${indent}}` : "}";
26599
26594
  static async connectSilent(provider, walletProvider, cairoVersion, paymaster) {
26600
26595
  return _WalletAccountV5.connect(provider, walletProvider, cairoVersion, paymaster, true);
26601
26596
  }
26602
- // TODO: MISSING ESTIMATES
26603
26597
  };
26604
26598
 
26605
26599
  // src/wallet/adapterV6.ts