starknet 8.1.1 → 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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +114 -54
- package/dist/index.global.js +41 -12
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +41 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3593,7 +3593,7 @@ __export(stark_exports, {
|
|
|
3593
3593
|
intDAM: () => intDAM,
|
|
3594
3594
|
randomAddress: () => randomAddress,
|
|
3595
3595
|
resourceBoundsToBigInt: () => resourceBoundsToBigInt,
|
|
3596
|
-
|
|
3596
|
+
resourceBoundsToEstimateFeeResponse: () => resourceBoundsToEstimateFeeResponse,
|
|
3597
3597
|
resourceBoundsToHexString: () => resourceBoundsToHexString,
|
|
3598
3598
|
signatureToDecimalArray: () => signatureToDecimalArray,
|
|
3599
3599
|
signatureToHexArray: () => signatureToHexArray,
|
|
@@ -3601,7 +3601,8 @@ __export(stark_exports, {
|
|
|
3601
3601
|
toOverheadOverallFee: () => toOverheadOverallFee,
|
|
3602
3602
|
toOverheadResourceBounds: () => toOverheadResourceBounds,
|
|
3603
3603
|
toTransactionVersion: () => toTransactionVersion,
|
|
3604
|
-
v3Details: () => v3Details
|
|
3604
|
+
v3Details: () => v3Details,
|
|
3605
|
+
zeroResourceBounds: () => zeroResourceBounds
|
|
3605
3606
|
});
|
|
3606
3607
|
var import_starknet4 = require("@scure/starknet");
|
|
3607
3608
|
var import_pako = require("pako");
|
|
@@ -3637,26 +3638,44 @@ function signatureToDecimalArray(sig) {
|
|
|
3637
3638
|
function signatureToHexArray(sig) {
|
|
3638
3639
|
return bigNumberishArrayToHexadecimalStringArray(formatSignature(sig));
|
|
3639
3640
|
}
|
|
3641
|
+
function zeroResourceBounds() {
|
|
3642
|
+
return toOverheadResourceBounds(ZeroFeeEstimate(), false);
|
|
3643
|
+
}
|
|
3640
3644
|
function toOverheadResourceBounds(estimate, overhead = config.get("resourceBoundsOverhead")) {
|
|
3641
3645
|
return {
|
|
3642
3646
|
l2_gas: {
|
|
3643
|
-
max_amount: addPercent(
|
|
3644
|
-
|
|
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
|
+
)
|
|
3645
3655
|
},
|
|
3646
3656
|
l1_gas: {
|
|
3647
|
-
max_amount: addPercent(
|
|
3648
|
-
|
|
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
|
+
)
|
|
3649
3665
|
},
|
|
3650
3666
|
l1_data_gas: {
|
|
3651
|
-
max_amount: addPercent(
|
|
3667
|
+
max_amount: addPercent(
|
|
3668
|
+
estimate.l1_data_gas_consumed,
|
|
3669
|
+
overhead !== false ? overhead.l1_data_gas.max_amount : 0
|
|
3670
|
+
),
|
|
3652
3671
|
max_price_per_unit: addPercent(
|
|
3653
3672
|
estimate.l1_data_gas_price,
|
|
3654
|
-
overhead.l1_data_gas.max_price_per_unit
|
|
3673
|
+
overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
|
|
3655
3674
|
)
|
|
3656
3675
|
}
|
|
3657
3676
|
};
|
|
3658
3677
|
}
|
|
3659
|
-
function
|
|
3678
|
+
function resourceBoundsToEstimateFeeResponse(resourceBounds) {
|
|
3660
3679
|
return {
|
|
3661
3680
|
resourceBounds,
|
|
3662
3681
|
/**
|
|
@@ -3667,7 +3686,16 @@ function resourceBoundsToEstimateFee(resourceBounds) {
|
|
|
3667
3686
|
};
|
|
3668
3687
|
}
|
|
3669
3688
|
function toOverheadOverallFee(estimate, overhead = config.get("resourceBoundsOverhead")) {
|
|
3670
|
-
return addPercent(estimate.l1_gas_consumed, overhead
|
|
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);
|
|
3671
3699
|
}
|
|
3672
3700
|
function ZeroFeeEstimate() {
|
|
3673
3701
|
return {
|
|
@@ -3712,7 +3740,7 @@ function v3Details(details) {
|
|
|
3712
3740
|
accountDeploymentData: details.accountDeploymentData || [],
|
|
3713
3741
|
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode || EDataAvailabilityMode.L1,
|
|
3714
3742
|
feeDataAvailabilityMode: details.feeDataAvailabilityMode || EDataAvailabilityMode.L1,
|
|
3715
|
-
resourceBounds: details.resourceBounds ??
|
|
3743
|
+
resourceBounds: details.resourceBounds ?? zeroResourceBounds()
|
|
3716
3744
|
};
|
|
3717
3745
|
}
|
|
3718
3746
|
function getFullPublicKey(privateKey) {
|
|
@@ -9183,7 +9211,8 @@ var Account = class extends RpcProvider2 {
|
|
|
9183
9211
|
}
|
|
9184
9212
|
async estimateFeeBulk(invocations, details = {}) {
|
|
9185
9213
|
if (!invocations.length) throw TypeError("Invocations should be non-empty array");
|
|
9186
|
-
if (details.resourceBounds)
|
|
9214
|
+
if (details.resourceBounds)
|
|
9215
|
+
return [resourceBoundsToEstimateFeeResponse(details.resourceBounds)];
|
|
9187
9216
|
const { nonce, blockIdentifier, version, skipValidate } = details;
|
|
9188
9217
|
const detailsWithTip = await this.resolveDetailsWithTip(details);
|
|
9189
9218
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|