starknet 8.1.0 → 8.1.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
@@ -208,14 +208,20 @@ __export(api_exports, {
208
208
  RPCSPEC09: () => RPCSPEC09
209
209
  });
210
210
 
211
- // src/types/api/jsonrpc/index.ts
211
+ // src/types/api/jsonrpc.ts
212
212
  var jsonrpc_exports = {};
213
213
 
214
214
  // src/types/api/index.ts
215
215
  var RPCSPEC08 = __toESM(require("@starknet-io/starknet-types-08"));
216
216
  var RPCSPEC09 = __toESM(require("@starknet-io/starknet-types-09"));
217
217
  var import_starknet_types_08 = require("@starknet-io/starknet-types-08");
218
- __reExport(api_exports, require("@starknet-io/starknet-types-09"));
218
+
219
+ // src/types/api/rpc.ts
220
+ var rpc_exports = {};
221
+ __reExport(rpc_exports, require("@starknet-io/starknet-types-09"));
222
+
223
+ // src/types/api/index.ts
224
+ __reExport(api_exports, rpc_exports);
219
225
 
220
226
  // src/utils/encode.ts
221
227
  var encode_exports = {};
@@ -3587,7 +3593,7 @@ __export(stark_exports, {
3587
3593
  intDAM: () => intDAM,
3588
3594
  randomAddress: () => randomAddress,
3589
3595
  resourceBoundsToBigInt: () => resourceBoundsToBigInt,
3590
- resourceBoundsToEstimateFee: () => resourceBoundsToEstimateFee,
3596
+ resourceBoundsToEstimateFeeResponse: () => resourceBoundsToEstimateFeeResponse,
3591
3597
  resourceBoundsToHexString: () => resourceBoundsToHexString,
3592
3598
  signatureToDecimalArray: () => signatureToDecimalArray,
3593
3599
  signatureToHexArray: () => signatureToHexArray,
@@ -3595,7 +3601,8 @@ __export(stark_exports, {
3595
3601
  toOverheadOverallFee: () => toOverheadOverallFee,
3596
3602
  toOverheadResourceBounds: () => toOverheadResourceBounds,
3597
3603
  toTransactionVersion: () => toTransactionVersion,
3598
- v3Details: () => v3Details
3604
+ v3Details: () => v3Details,
3605
+ zeroResourceBounds: () => zeroResourceBounds
3599
3606
  });
3600
3607
  var import_starknet4 = require("@scure/starknet");
3601
3608
  var import_pako = require("pako");
@@ -3631,26 +3638,44 @@ function signatureToDecimalArray(sig) {
3631
3638
  function signatureToHexArray(sig) {
3632
3639
  return bigNumberishArrayToHexadecimalStringArray(formatSignature(sig));
3633
3640
  }
3641
+ function zeroResourceBounds() {
3642
+ return toOverheadResourceBounds(ZeroFeeEstimate(), false);
3643
+ }
3634
3644
  function toOverheadResourceBounds(estimate, overhead = config.get("resourceBoundsOverhead")) {
3635
3645
  return {
3636
3646
  l2_gas: {
3637
- max_amount: addPercent(estimate.l2_gas_consumed, overhead.l2_gas.max_amount),
3638
- max_price_per_unit: addPercent(estimate.l2_gas_price, overhead.l2_gas.max_price_per_unit)
3647
+ max_amount: addPercent(
3648
+ estimate.l2_gas_consumed,
3649
+ overhead !== false ? overhead.l2_gas.max_amount : 0
3650
+ ),
3651
+ max_price_per_unit: addPercent(
3652
+ estimate.l2_gas_price,
3653
+ overhead !== false ? overhead.l2_gas.max_price_per_unit : 0
3654
+ )
3639
3655
  },
3640
3656
  l1_gas: {
3641
- max_amount: addPercent(estimate.l1_gas_consumed, overhead.l1_gas.max_amount),
3642
- max_price_per_unit: addPercent(estimate.l1_gas_price, overhead.l1_gas.max_price_per_unit)
3657
+ max_amount: addPercent(
3658
+ estimate.l1_gas_consumed,
3659
+ overhead !== false ? overhead.l1_gas.max_amount : 0
3660
+ ),
3661
+ max_price_per_unit: addPercent(
3662
+ estimate.l1_gas_price,
3663
+ overhead !== false ? overhead.l1_gas.max_price_per_unit : 0
3664
+ )
3643
3665
  },
3644
3666
  l1_data_gas: {
3645
- max_amount: addPercent(estimate.l1_data_gas_consumed, overhead.l1_data_gas.max_amount),
3667
+ max_amount: addPercent(
3668
+ estimate.l1_data_gas_consumed,
3669
+ overhead !== false ? overhead.l1_data_gas.max_amount : 0
3670
+ ),
3646
3671
  max_price_per_unit: addPercent(
3647
3672
  estimate.l1_data_gas_price,
3648
- overhead.l1_data_gas.max_price_per_unit
3673
+ overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
3649
3674
  )
3650
3675
  }
3651
3676
  };
3652
3677
  }
3653
- function resourceBoundsToEstimateFee(resourceBounds) {
3678
+ function resourceBoundsToEstimateFeeResponse(resourceBounds) {
3654
3679
  return {
3655
3680
  resourceBounds,
3656
3681
  /**
@@ -3661,7 +3686,16 @@ function resourceBoundsToEstimateFee(resourceBounds) {
3661
3686
  };
3662
3687
  }
3663
3688
  function toOverheadOverallFee(estimate, overhead = config.get("resourceBoundsOverhead")) {
3664
- return addPercent(estimate.l1_gas_consumed, overhead.l1_gas.max_amount) * addPercent(estimate.l1_gas_price, overhead.l1_gas.max_price_per_unit) + addPercent(estimate.l1_data_gas_consumed, overhead.l1_data_gas.max_amount) * addPercent(estimate.l1_data_gas_price, overhead.l1_data_gas.max_price_per_unit) + addPercent(estimate.l2_gas_consumed, overhead.l2_gas.max_amount) * addPercent(estimate.l2_gas_price, overhead.l2_gas.max_price_per_unit);
3689
+ return addPercent(estimate.l1_gas_consumed, overhead !== false ? overhead.l1_gas.max_amount : 0) * addPercent(
3690
+ estimate.l1_gas_price,
3691
+ overhead !== false ? overhead.l1_gas.max_price_per_unit : 0
3692
+ ) + addPercent(
3693
+ estimate.l1_data_gas_consumed,
3694
+ overhead !== false ? overhead.l1_data_gas.max_amount : 0
3695
+ ) * addPercent(
3696
+ estimate.l1_data_gas_price,
3697
+ overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
3698
+ ) + addPercent(estimate.l2_gas_consumed, overhead !== false ? overhead.l2_gas.max_amount : 0) * addPercent(estimate.l2_gas_price, overhead !== false ? overhead.l2_gas.max_price_per_unit : 0);
3665
3699
  }
3666
3700
  function ZeroFeeEstimate() {
3667
3701
  return {
@@ -3706,7 +3740,7 @@ function v3Details(details) {
3706
3740
  accountDeploymentData: details.accountDeploymentData || [],
3707
3741
  nonceDataAvailabilityMode: details.nonceDataAvailabilityMode || EDataAvailabilityMode.L1,
3708
3742
  feeDataAvailabilityMode: details.feeDataAvailabilityMode || EDataAvailabilityMode.L1,
3709
- resourceBounds: details.resourceBounds ?? toOverheadResourceBounds(ZeroFeeEstimate(), void 0)
3743
+ resourceBounds: details.resourceBounds ?? zeroResourceBounds()
3710
3744
  };
3711
3745
  }
3712
3746
  function getFullPublicKey(privateKey) {
@@ -9177,7 +9211,8 @@ var Account = class extends RpcProvider2 {
9177
9211
  }
9178
9212
  async estimateFeeBulk(invocations, details = {}) {
9179
9213
  if (!invocations.length) throw TypeError("Invocations should be non-empty array");
9180
- if (details.resourceBounds) return [resourceBoundsToEstimateFee(details.resourceBounds)];
9214
+ if (details.resourceBounds)
9215
+ return [resourceBoundsToEstimateFeeResponse(details.resourceBounds)];
9181
9216
  const { nonce, blockIdentifier, version, skipValidate } = details;
9182
9217
  const detailsWithTip = await this.resolveDetailsWithTip(details);
9183
9218
  const accountInvocations = await this.accountInvocationsFactory(invocations, {