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.js CHANGED
@@ -929,6 +929,11 @@ var CustomError = class extends Error {
929
929
  var LibraryError = class extends CustomError {
930
930
  };
931
931
  var RpcError = class extends LibraryError {
932
+ request;
933
+ // Declared after `request`, and not as a constructor parameter: fields are created in the
934
+ // order they are declared, so `JSON.stringify(error)` and `console.log(error)` list `request`
935
+ // first.
936
+ baseError;
932
937
  constructor(baseError, method, params) {
933
938
  super(`RPC: ${method} with params ${stringify2(params, null, 2)}
934
939
 
@@ -936,7 +941,6 @@ var RpcError = class extends LibraryError {
936
941
  this.baseError = baseError;
937
942
  this.request = { method, params };
938
943
  }
939
- request;
940
944
  get code() {
941
945
  return this.baseError.code;
942
946
  }
@@ -7580,15 +7584,6 @@ function parseResponseValue(responseIterator, element, parser, structs, enums) {
7580
7584
  return acc;
7581
7585
  }, {});
7582
7586
  }
7583
- if (isTypeArray(element.type)) {
7584
- const parsedDataArr = [];
7585
- const el = { name: "", type: getArrayType(element.type) };
7586
- const len = BigInt(responseIterator.next().value);
7587
- while (parsedDataArr.length < len) {
7588
- parsedDataArr.push(parseResponseValue(responseIterator, el, parser, structs, enums));
7589
- }
7590
- return parsedDataArr;
7591
- }
7592
7587
  return parseBaseTypes2(element.type, responseIterator, parser);
7593
7588
  }
7594
7589
  function responseParser({
@@ -11045,7 +11040,6 @@ function structStrategy(structs) {
11045
11040
 
11046
11041
  // src/utils/calldata/parser/parsingStrategy.ts
11047
11042
  var hdParsingStrategy = {
11048
- // TODO: provjeri svi request parseri stvaraju array, dali je to ok sa requstParserom
11049
11043
  request: {
11050
11044
  [CairoBytes31.abiSelector]: (val) => {
11051
11045
  return new CairoBytes31(val).toApiRequest();
@@ -14259,7 +14253,6 @@ var RpcChannel = class {
14259
14253
  }
14260
14254
  return this.specVersion;
14261
14255
  }
14262
- // TODO: New Method add test
14263
14256
  /**
14264
14257
  * 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
14265
14258
  */
@@ -14269,7 +14262,6 @@ var RpcChannel = class {
14269
14262
  transaction_hash
14270
14263
  });
14271
14264
  }
14272
- // TODO: New Method add test
14273
14265
  getStorageProof(classHashes = [], contractAddresses = [], contractsStorageKeys = [], blockIdentifier = this.blockIdentifier) {
14274
14266
  const block_id = new Block(blockIdentifier).identifier;
14275
14267
  const class_hashes = bigNumberishArrayToHexadecimalStringArray(classHashes);
@@ -14281,7 +14273,6 @@ var RpcChannel = class {
14281
14273
  contracts_storage_keys: contractsStorageKeys
14282
14274
  });
14283
14275
  }
14284
- // TODO: New Method add test
14285
14276
  getCompiledCasm(classHash) {
14286
14277
  const class_hash = toHex(classHash);
14287
14278
  return this.fetchEndpoint("starknet_getCompiledCasm", {
@@ -14394,7 +14385,8 @@ var RpcChannel = class {
14394
14385
  }
14395
14386
  async waitForTransaction(txHash, options) {
14396
14387
  const transactionHash = toHex(txHash);
14397
- let retries = options?.retries ?? this.retries;
14388
+ const maxRetries = options?.retries ?? this.retries;
14389
+ let retries = maxRetries;
14398
14390
  let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
14399
14391
  let onchain = false;
14400
14392
  let isErrorState = false;
@@ -14444,9 +14436,9 @@ var RpcChannel = class {
14444
14436
  }
14445
14437
  lifeCycleRetries -= 1;
14446
14438
  }
14447
- if (retries <= 0) {
14448
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
14449
- }
14439
+ }
14440
+ if (!onchain && retries <= 0) {
14441
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
14450
14442
  }
14451
14443
  retries -= 1;
14452
14444
  }
@@ -14456,7 +14448,7 @@ var RpcChannel = class {
14456
14448
  txReceipt = await this.getTransactionReceipt(transactionHash);
14457
14449
  } catch (error) {
14458
14450
  if (retries <= 0) {
14459
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
14451
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
14460
14452
  }
14461
14453
  retries -= 1;
14462
14454
  await wait(retryInterval);
@@ -15045,7 +15037,8 @@ var RpcChannel2 = class {
15045
15037
  }
15046
15038
  async waitForTransaction(txHash, options) {
15047
15039
  const transactionHash = toHex(txHash);
15048
- let retries = options?.retries ?? this.retries;
15040
+ const maxRetries = options?.retries ?? this.retries;
15041
+ let retries = maxRetries;
15049
15042
  let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
15050
15043
  let onchain = false;
15051
15044
  let isErrorState = false;
@@ -15095,9 +15088,9 @@ var RpcChannel2 = class {
15095
15088
  }
15096
15089
  lifeCycleRetries -= 1;
15097
15090
  }
15098
- if (retries <= 0) {
15099
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
15100
- }
15091
+ }
15092
+ if (!onchain && retries <= 0) {
15093
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
15101
15094
  }
15102
15095
  retries -= 1;
15103
15096
  }
@@ -15107,7 +15100,7 @@ var RpcChannel2 = class {
15107
15100
  txReceipt = await this.getTransactionReceipt(transactionHash);
15108
15101
  } catch (error) {
15109
15102
  if (retries <= 0) {
15110
- throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
15103
+ throw new Error(`waitForTransaction timed-out with retries ${maxRetries}`);
15111
15104
  }
15112
15105
  retries -= 1;
15113
15106
  await wait(retryInterval);
@@ -19821,7 +19814,6 @@ var Account = class {
19821
19814
  }
19822
19815
  return this.cairoVersion;
19823
19816
  }
19824
- // TODO: TT Cairo version is still needed for invoke on existing contracts
19825
19817
  async estimateInvokeFee(calls, details = {}) {
19826
19818
  const invocations = [{ type: api_exports.ETransactionType.INVOKE, payload: [calls].flat() }];
19827
19819
  const estimateBulk = await this.estimateFeeBulk(invocations, details);
@@ -20668,7 +20660,6 @@ var WalletAccount = class _WalletAccount extends Account {
20668
20660
  static async connectSilent(provider, walletProvider, cairoVersion, paymaster) {
20669
20661
  return _WalletAccount.connect(provider, walletProvider, cairoVersion, paymaster, true);
20670
20662
  }
20671
- // TODO: MISSING ESTIMATES
20672
20663
  };
20673
20664
 
20674
20665
  // src/wallet/connectV5.ts
@@ -21048,7 +21039,6 @@ var WalletAccountV5 = class _WalletAccountV5 extends Account {
21048
21039
  static async connectSilent(provider, walletProvider, cairoVersion, paymaster) {
21049
21040
  return _WalletAccountV5.connect(provider, walletProvider, cairoVersion, paymaster, true);
21050
21041
  }
21051
- // TODO: MISSING ESTIMATES
21052
21042
  };
21053
21043
 
21054
21044
  // src/wallet/adapterV6.ts