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.
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
  }
@@ -18033,18 +18037,92 @@ var RpcProvider = class {
18033
18037
  }
18034
18038
  return { cairo: "0", compiler: "0" };
18035
18039
  }
18040
+ /**
18041
+ * Estimates the fee for a given INVOKE transaction
18042
+ *
18043
+ * @param invocation the invocation object containing:
18044
+ * - contractAddress - the address of the contract
18045
+ * - entrypoint - (optional) the entrypoint of the contract
18046
+ * - calldata - (optional, defaults to []) the calldata
18047
+ * - signature - (optional, defaults to []) the signature
18048
+ * @param details - optional details containing:
18049
+ * - nonce - optional nonce
18050
+ * - version - optional version
18051
+ * @param blockIdentifier - (optional) block identifier
18052
+ * @param skipValidate - (optional) skip cairo __validate__ method
18053
+ * @returns the estimated fee
18054
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
18055
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
18056
+ * This method will be removed in a future major version, not before v13.
18057
+ * @example
18058
+ * ```typescript
18059
+ * const feeEstimate = await provider.getInvokeEstimateFee(invocation, details);
18060
+ * // Equivalent to:
18061
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.INVOKE, ...invocation, ...details }]);
18062
+ * ```
18063
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
18064
+ */
18036
18065
  async getInvokeEstimateFee(invocation, details, blockIdentifier, skipValidate) {
18037
18066
  return (await this.getEstimateFeeBulk(
18038
18067
  [{ type: api_exports.ETransactionType.INVOKE, ...invocation, ...details }],
18039
18068
  { blockIdentifier, skipValidate }
18040
18069
  ))[0];
18041
18070
  }
18071
+ /**
18072
+ * Estimates the fee for a given DECLARE transaction
18073
+ *
18074
+ * @param invocation transaction payload to be declared containing:
18075
+ * - compiled contract code
18076
+ * - sender address
18077
+ * - signature - (defaults to []) the signature
18078
+ * @param details - optional details containing:
18079
+ * - nonce
18080
+ * - version - optional version
18081
+ * @param blockIdentifier - (optional) block identifier
18082
+ * @param skipValidate - (optional) skip cairo __validate__ method
18083
+ * @returns the estimated fee
18084
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
18085
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
18086
+ * This method will be removed in a future major version, not before v13.
18087
+ * @example
18088
+ * ```typescript
18089
+ * const feeEstimate = await provider.getDeclareEstimateFee(transaction, details);
18090
+ * // Equivalent to:
18091
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.DECLARE, ...transaction, ...details }]);
18092
+ * ```
18093
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
18094
+ */
18042
18095
  async getDeclareEstimateFee(invocation, details, blockIdentifier, skipValidate) {
18043
18096
  return (await this.getEstimateFeeBulk(
18044
18097
  [{ type: api_exports.ETransactionType.DECLARE, ...invocation, ...details }],
18045
18098
  { blockIdentifier, skipValidate }
18046
18099
  ))[0];
18047
18100
  }
18101
+ /**
18102
+ * Estimates the fee for a given DEPLOY_ACCOUNT transaction
18103
+ *
18104
+ * @param invocation transaction payload to be deployed containing:
18105
+ * - classHash
18106
+ * - constructorCalldata
18107
+ * - addressSalt
18108
+ * - signature - (defaults to []) the signature
18109
+ * @param details - optional details containing:
18110
+ * - nonce
18111
+ * - version - optional version
18112
+ * @param blockIdentifier - (optional) block identifier
18113
+ * @param skipValidate - (optional) skip cairo __validate__ method
18114
+ * @returns the estimated fee
18115
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
18116
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
18117
+ * This method will be removed in a future major version, not before v13.
18118
+ * @example
18119
+ * ```typescript
18120
+ * const feeEstimate = await provider.getDeployAccountEstimateFee(transaction, details);
18121
+ * // Equivalent to:
18122
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }]);
18123
+ * ```
18124
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
18125
+ */
18048
18126
  async getDeployAccountEstimateFee(invocation, details, blockIdentifier, skipValidate) {
18049
18127
  return (await this.getEstimateFeeBulk(
18050
18128
  [{ type: api_exports.ETransactionType.DEPLOY_ACCOUNT, ...invocation, ...details }],