starknet 11.5.1 → 11.6.1

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
  }
@@ -23794,18 +23802,92 @@ ${indent}}` : "}";
23794
23802
  }
23795
23803
  return { cairo: "0", compiler: "0" };
23796
23804
  }
23805
+ /**
23806
+ * Estimates the fee for a given INVOKE transaction
23807
+ *
23808
+ * @param invocation the invocation object containing:
23809
+ * - contractAddress - the address of the contract
23810
+ * - entrypoint - (optional) the entrypoint of the contract
23811
+ * - calldata - (optional, defaults to []) the calldata
23812
+ * - signature - (optional, defaults to []) the signature
23813
+ * @param details - optional details containing:
23814
+ * - nonce - optional nonce
23815
+ * - version - optional version
23816
+ * @param blockIdentifier - (optional) block identifier
23817
+ * @param skipValidate - (optional) skip cairo __validate__ method
23818
+ * @returns the estimated fee
23819
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
23820
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
23821
+ * This method will be removed in a future major version, not before v13.
23822
+ * @example
23823
+ * ```typescript
23824
+ * const feeEstimate = await provider.getInvokeEstimateFee(invocation, details);
23825
+ * // Equivalent to:
23826
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.INVOKE, ...invocation, ...details }]);
23827
+ * ```
23828
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
23829
+ */
23797
23830
  async getInvokeEstimateFee(invocation, details, blockIdentifier, skipValidate) {
23798
23831
  return (await this.getEstimateFeeBulk(
23799
23832
  [{ type: ETransactionType2.INVOKE, ...invocation, ...details }],
23800
23833
  { blockIdentifier, skipValidate }
23801
23834
  ))[0];
23802
23835
  }
23836
+ /**
23837
+ * Estimates the fee for a given DECLARE transaction
23838
+ *
23839
+ * @param invocation transaction payload to be declared containing:
23840
+ * - compiled contract code
23841
+ * - sender address
23842
+ * - signature - (defaults to []) the signature
23843
+ * @param details - optional details containing:
23844
+ * - nonce
23845
+ * - version - optional version
23846
+ * @param blockIdentifier - (optional) block identifier
23847
+ * @param skipValidate - (optional) skip cairo __validate__ method
23848
+ * @returns the estimated fee
23849
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
23850
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
23851
+ * This method will be removed in a future major version, not before v13.
23852
+ * @example
23853
+ * ```typescript
23854
+ * const feeEstimate = await provider.getDeclareEstimateFee(transaction, details);
23855
+ * // Equivalent to:
23856
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.DECLARE, ...transaction, ...details }]);
23857
+ * ```
23858
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
23859
+ */
23803
23860
  async getDeclareEstimateFee(invocation, details, blockIdentifier, skipValidate) {
23804
23861
  return (await this.getEstimateFeeBulk(
23805
23862
  [{ type: ETransactionType2.DECLARE, ...invocation, ...details }],
23806
23863
  { blockIdentifier, skipValidate }
23807
23864
  ))[0];
23808
23865
  }
23866
+ /**
23867
+ * Estimates the fee for a given DEPLOY_ACCOUNT transaction
23868
+ *
23869
+ * @param invocation transaction payload to be deployed containing:
23870
+ * - classHash
23871
+ * - constructorCalldata
23872
+ * - addressSalt
23873
+ * - signature - (defaults to []) the signature
23874
+ * @param details - optional details containing:
23875
+ * - nonce
23876
+ * - version - optional version
23877
+ * @param blockIdentifier - (optional) block identifier
23878
+ * @param skipValidate - (optional) skip cairo __validate__ method
23879
+ * @returns the estimated fee
23880
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
23881
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
23882
+ * This method will be removed in a future major version, not before v13.
23883
+ * @example
23884
+ * ```typescript
23885
+ * const feeEstimate = await provider.getDeployAccountEstimateFee(transaction, details);
23886
+ * // Equivalent to:
23887
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }]);
23888
+ * ```
23889
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
23890
+ */
23809
23891
  async getDeployAccountEstimateFee(invocation, details, blockIdentifier, skipValidate) {
23810
23892
  return (await this.getEstimateFeeBulk(
23811
23893
  [{ type: ETransactionType2.DEPLOY_ACCOUNT, ...invocation, ...details }],