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.
package/dist/index.mjs CHANGED
@@ -721,6 +721,11 @@ var CustomError = class extends Error {
721
721
  var LibraryError = class extends CustomError {
722
722
  };
723
723
  var RpcError = class extends LibraryError {
724
+ request;
725
+ // Declared after `request`, and not as a constructor parameter: fields are created in the
726
+ // order they are declared, so `JSON.stringify(error)` and `console.log(error)` list `request`
727
+ // first.
728
+ baseError;
724
729
  constructor(baseError, method, params) {
725
730
  super(`RPC: ${method} with params ${stringify2(params, null, 2)}
726
731
 
@@ -728,7 +733,6 @@ var RpcError = class extends LibraryError {
728
733
  this.baseError = baseError;
729
734
  this.request = { method, params };
730
735
  }
731
- request;
732
736
  get code() {
733
737
  return this.baseError.code;
734
738
  }
@@ -7372,15 +7376,6 @@ function parseResponseValue(responseIterator, element, parser, structs, enums) {
7372
7376
  return acc;
7373
7377
  }, {});
7374
7378
  }
7375
- if (isTypeArray(element.type)) {
7376
- const parsedDataArr = [];
7377
- const el = { name: "", type: getArrayType(element.type) };
7378
- const len = BigInt(responseIterator.next().value);
7379
- while (parsedDataArr.length < len) {
7380
- parsedDataArr.push(parseResponseValue(responseIterator, el, parser, structs, enums));
7381
- }
7382
- return parsedDataArr;
7383
- }
7384
7379
  return parseBaseTypes2(element.type, responseIterator, parser);
7385
7380
  }
7386
7381
  function responseParser({
@@ -10837,7 +10832,6 @@ function structStrategy(structs) {
10837
10832
 
10838
10833
  // src/utils/calldata/parser/parsingStrategy.ts
10839
10834
  var hdParsingStrategy = {
10840
- // TODO: provjeri svi request parseri stvaraju array, dali je to ok sa requstParserom
10841
10835
  request: {
10842
10836
  [CairoBytes31.abiSelector]: (val) => {
10843
10837
  return new CairoBytes31(val).toApiRequest();
@@ -14051,7 +14045,6 @@ var RpcChannel = class {
14051
14045
  }
14052
14046
  return this.specVersion;
14053
14047
  }
14054
- // TODO: New Method add test
14055
14048
  /**
14056
14049
  * 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
14057
14050
  */
@@ -14061,7 +14054,6 @@ var RpcChannel = class {
14061
14054
  transaction_hash
14062
14055
  });
14063
14056
  }
14064
- // TODO: New Method add test
14065
14057
  getStorageProof(classHashes = [], contractAddresses = [], contractsStorageKeys = [], blockIdentifier = this.blockIdentifier) {
14066
14058
  const block_id = new Block(blockIdentifier).identifier;
14067
14059
  const class_hashes = bigNumberishArrayToHexadecimalStringArray(classHashes);
@@ -14073,7 +14065,6 @@ var RpcChannel = class {
14073
14065
  contracts_storage_keys: contractsStorageKeys
14074
14066
  });
14075
14067
  }
14076
- // TODO: New Method add test
14077
14068
  getCompiledCasm(classHash) {
14078
14069
  const class_hash = toHex(classHash);
14079
14070
  return this.fetchEndpoint("starknet_getCompiledCasm", {
@@ -14186,7 +14177,8 @@ var RpcChannel = class {
14186
14177
  }
14187
14178
  async waitForTransaction(txHash, options) {
14188
14179
  const transactionHash = toHex(txHash);
14189
- let retries = options?.retries ?? this.retries;
14180
+ const maxRetries = options?.retries ?? this.retries;
14181
+ let retries = maxRetries;
14190
14182
  let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
14191
14183
  let onchain = false;
14192
14184
  let isErrorState = false;
@@ -14236,9 +14228,9 @@ var RpcChannel = class {
14236
14228
  }
14237
14229
  lifeCycleRetries -= 1;
14238
14230
  }
14239
- if (retries <= 0) {
14240
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
14241
- }
14231
+ }
14232
+ if (!onchain && retries <= 0) {
14233
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
14242
14234
  }
14243
14235
  retries -= 1;
14244
14236
  }
@@ -14248,7 +14240,7 @@ var RpcChannel = class {
14248
14240
  txReceipt = await this.getTransactionReceipt(transactionHash);
14249
14241
  } catch (error) {
14250
14242
  if (retries <= 0) {
14251
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
14243
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
14252
14244
  }
14253
14245
  retries -= 1;
14254
14246
  await wait(retryInterval);
@@ -14837,7 +14829,8 @@ var RpcChannel2 = class {
14837
14829
  }
14838
14830
  async waitForTransaction(txHash, options) {
14839
14831
  const transactionHash = toHex(txHash);
14840
- let retries = options?.retries ?? this.retries;
14832
+ const maxRetries = options?.retries ?? this.retries;
14833
+ let retries = maxRetries;
14841
14834
  let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
14842
14835
  let onchain = false;
14843
14836
  let isErrorState = false;
@@ -14887,9 +14880,9 @@ var RpcChannel2 = class {
14887
14880
  }
14888
14881
  lifeCycleRetries -= 1;
14889
14882
  }
14890
- if (retries <= 0) {
14891
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
14892
- }
14883
+ }
14884
+ if (!onchain && retries <= 0) {
14885
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
14893
14886
  }
14894
14887
  retries -= 1;
14895
14888
  }
@@ -14899,7 +14892,7 @@ var RpcChannel2 = class {
14899
14892
  txReceipt = await this.getTransactionReceipt(transactionHash);
14900
14893
  } catch (error) {
14901
14894
  if (retries <= 0) {
14902
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
14895
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
14903
14896
  }
14904
14897
  retries -= 1;
14905
14898
  await wait(retryInterval);
@@ -19613,7 +19606,6 @@ var Account = class {
19613
19606
  }
19614
19607
  return this.cairoVersion;
19615
19608
  }
19616
- // TODO: TT Cairo version is still needed for invoke on existing contracts
19617
19609
  async estimateInvokeFee(calls, details = {}) {
19618
19610
  const invocations = [{ type: api_exports.ETransactionType.INVOKE, payload: [calls].flat() }];
19619
19611
  const estimateBulk = await this.estimateFeeBulk(invocations, details);
@@ -20460,7 +20452,6 @@ var WalletAccount = class _WalletAccount extends Account {
20460
20452
  static async connectSilent(provider, walletProvider, cairoVersion, paymaster) {
20461
20453
  return _WalletAccount.connect(provider, walletProvider, cairoVersion, paymaster, true);
20462
20454
  }
20463
- // TODO: MISSING ESTIMATES
20464
20455
  };
20465
20456
 
20466
20457
  // src/wallet/connectV5.ts
@@ -20840,7 +20831,6 @@ var WalletAccountV5 = class _WalletAccountV5 extends Account {
20840
20831
  static async connectSilent(provider, walletProvider, cairoVersion, paymaster) {
20841
20832
  return _WalletAccountV5.connect(provider, walletProvider, cairoVersion, paymaster, true);
20842
20833
  }
20843
- // TODO: MISSING ESTIMATES
20844
20834
  };
20845
20835
 
20846
20836
  // src/wallet/adapterV6.ts