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.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
  }
@@ -18241,18 +18245,92 @@ var RpcProvider = class {
18241
18245
  }
18242
18246
  return { cairo: "0", compiler: "0" };
18243
18247
  }
18248
+ /**
18249
+ * Estimates the fee for a given INVOKE transaction
18250
+ *
18251
+ * @param invocation the invocation object containing:
18252
+ * - contractAddress - the address of the contract
18253
+ * - entrypoint - (optional) the entrypoint of the contract
18254
+ * - calldata - (optional, defaults to []) the calldata
18255
+ * - signature - (optional, defaults to []) the signature
18256
+ * @param details - optional details containing:
18257
+ * - nonce - optional nonce
18258
+ * - version - optional version
18259
+ * @param blockIdentifier - (optional) block identifier
18260
+ * @param skipValidate - (optional) skip cairo __validate__ method
18261
+ * @returns the estimated fee
18262
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
18263
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
18264
+ * This method will be removed in a future major version, not before v13.
18265
+ * @example
18266
+ * ```typescript
18267
+ * const feeEstimate = await provider.getInvokeEstimateFee(invocation, details);
18268
+ * // Equivalent to:
18269
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.INVOKE, ...invocation, ...details }]);
18270
+ * ```
18271
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
18272
+ */
18244
18273
  async getInvokeEstimateFee(invocation, details, blockIdentifier, skipValidate) {
18245
18274
  return (await this.getEstimateFeeBulk(
18246
18275
  [{ type: api_exports.ETransactionType.INVOKE, ...invocation, ...details }],
18247
18276
  { blockIdentifier, skipValidate }
18248
18277
  ))[0];
18249
18278
  }
18279
+ /**
18280
+ * Estimates the fee for a given DECLARE transaction
18281
+ *
18282
+ * @param invocation transaction payload to be declared containing:
18283
+ * - compiled contract code
18284
+ * - sender address
18285
+ * - signature - (defaults to []) the signature
18286
+ * @param details - optional details containing:
18287
+ * - nonce
18288
+ * - version - optional version
18289
+ * @param blockIdentifier - (optional) block identifier
18290
+ * @param skipValidate - (optional) skip cairo __validate__ method
18291
+ * @returns the estimated fee
18292
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
18293
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
18294
+ * This method will be removed in a future major version, not before v13.
18295
+ * @example
18296
+ * ```typescript
18297
+ * const feeEstimate = await provider.getDeclareEstimateFee(transaction, details);
18298
+ * // Equivalent to:
18299
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.DECLARE, ...transaction, ...details }]);
18300
+ * ```
18301
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
18302
+ */
18250
18303
  async getDeclareEstimateFee(invocation, details, blockIdentifier, skipValidate) {
18251
18304
  return (await this.getEstimateFeeBulk(
18252
18305
  [{ type: api_exports.ETransactionType.DECLARE, ...invocation, ...details }],
18253
18306
  { blockIdentifier, skipValidate }
18254
18307
  ))[0];
18255
18308
  }
18309
+ /**
18310
+ * Estimates the fee for a given DEPLOY_ACCOUNT transaction
18311
+ *
18312
+ * @param invocation transaction payload to be deployed containing:
18313
+ * - classHash
18314
+ * - constructorCalldata
18315
+ * - addressSalt
18316
+ * - signature - (defaults to []) the signature
18317
+ * @param details - optional details containing:
18318
+ * - nonce
18319
+ * - version - optional version
18320
+ * @param blockIdentifier - (optional) block identifier
18321
+ * @param skipValidate - (optional) skip cairo __validate__ method
18322
+ * @returns the estimated fee
18323
+ * @deprecated This method only calls `getEstimateFeeBulk` with one transaction. Use
18324
+ * {@link RpcProvider.getEstimateFeeBulk | getEstimateFeeBulk} instead (see the example).
18325
+ * This method will be removed in a future major version, not before v13.
18326
+ * @example
18327
+ * ```typescript
18328
+ * const feeEstimate = await provider.getDeployAccountEstimateFee(transaction, details);
18329
+ * // Equivalent to:
18330
+ * const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: TransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }]);
18331
+ * ```
18332
+ * @remarks This method is an alias that calls getEstimateFeeBulk with a single transaction
18333
+ */
18256
18334
  async getDeployAccountEstimateFee(invocation, details, blockIdentifier, skipValidate) {
18257
18335
  return (await this.getEstimateFeeBulk(
18258
18336
  [{ type: api_exports.ETransactionType.DEPLOY_ACCOUNT, ...invocation, ...details }],