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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +133 -96
- package/dist/index.global.js +42 -13
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -58,16 +58,22 @@ __export(api_exports, {
|
|
|
58
58
|
RPCSPEC09: () => RPCSPEC09
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
// src/types/api/jsonrpc
|
|
61
|
+
// src/types/api/jsonrpc.ts
|
|
62
62
|
var jsonrpc_exports = {};
|
|
63
63
|
|
|
64
64
|
// src/types/api/index.ts
|
|
65
|
-
__reExport(api_exports, starknet_types_09_star);
|
|
66
65
|
import * as RPCSPEC08 from "@starknet-io/starknet-types-08";
|
|
67
66
|
import * as RPCSPEC09 from "@starknet-io/starknet-types-09";
|
|
68
67
|
import { PAYMASTER_API } from "@starknet-io/starknet-types-08";
|
|
68
|
+
|
|
69
|
+
// src/types/api/rpc.ts
|
|
70
|
+
var rpc_exports = {};
|
|
71
|
+
__reExport(rpc_exports, starknet_types_09_star);
|
|
69
72
|
import * as starknet_types_09_star from "@starknet-io/starknet-types-09";
|
|
70
73
|
|
|
74
|
+
// src/types/api/index.ts
|
|
75
|
+
__reExport(api_exports, rpc_exports);
|
|
76
|
+
|
|
71
77
|
// src/utils/encode.ts
|
|
72
78
|
var encode_exports = {};
|
|
73
79
|
__export(encode_exports, {
|
|
@@ -3438,7 +3444,7 @@ __export(stark_exports, {
|
|
|
3438
3444
|
intDAM: () => intDAM,
|
|
3439
3445
|
randomAddress: () => randomAddress,
|
|
3440
3446
|
resourceBoundsToBigInt: () => resourceBoundsToBigInt,
|
|
3441
|
-
|
|
3447
|
+
resourceBoundsToEstimateFeeResponse: () => resourceBoundsToEstimateFeeResponse,
|
|
3442
3448
|
resourceBoundsToHexString: () => resourceBoundsToHexString,
|
|
3443
3449
|
signatureToDecimalArray: () => signatureToDecimalArray,
|
|
3444
3450
|
signatureToHexArray: () => signatureToHexArray,
|
|
@@ -3446,7 +3452,8 @@ __export(stark_exports, {
|
|
|
3446
3452
|
toOverheadOverallFee: () => toOverheadOverallFee,
|
|
3447
3453
|
toOverheadResourceBounds: () => toOverheadResourceBounds,
|
|
3448
3454
|
toTransactionVersion: () => toTransactionVersion,
|
|
3449
|
-
v3Details: () => v3Details
|
|
3455
|
+
v3Details: () => v3Details,
|
|
3456
|
+
zeroResourceBounds: () => zeroResourceBounds
|
|
3450
3457
|
});
|
|
3451
3458
|
import { getPublicKey, getStarkKey, utils } from "@scure/starknet";
|
|
3452
3459
|
import { gzip, ungzip } from "pako";
|
|
@@ -3482,26 +3489,44 @@ function signatureToDecimalArray(sig) {
|
|
|
3482
3489
|
function signatureToHexArray(sig) {
|
|
3483
3490
|
return bigNumberishArrayToHexadecimalStringArray(formatSignature(sig));
|
|
3484
3491
|
}
|
|
3492
|
+
function zeroResourceBounds() {
|
|
3493
|
+
return toOverheadResourceBounds(ZeroFeeEstimate(), false);
|
|
3494
|
+
}
|
|
3485
3495
|
function toOverheadResourceBounds(estimate, overhead = config.get("resourceBoundsOverhead")) {
|
|
3486
3496
|
return {
|
|
3487
3497
|
l2_gas: {
|
|
3488
|
-
max_amount: addPercent(
|
|
3489
|
-
|
|
3498
|
+
max_amount: addPercent(
|
|
3499
|
+
estimate.l2_gas_consumed,
|
|
3500
|
+
overhead !== false ? overhead.l2_gas.max_amount : 0
|
|
3501
|
+
),
|
|
3502
|
+
max_price_per_unit: addPercent(
|
|
3503
|
+
estimate.l2_gas_price,
|
|
3504
|
+
overhead !== false ? overhead.l2_gas.max_price_per_unit : 0
|
|
3505
|
+
)
|
|
3490
3506
|
},
|
|
3491
3507
|
l1_gas: {
|
|
3492
|
-
max_amount: addPercent(
|
|
3493
|
-
|
|
3508
|
+
max_amount: addPercent(
|
|
3509
|
+
estimate.l1_gas_consumed,
|
|
3510
|
+
overhead !== false ? overhead.l1_gas.max_amount : 0
|
|
3511
|
+
),
|
|
3512
|
+
max_price_per_unit: addPercent(
|
|
3513
|
+
estimate.l1_gas_price,
|
|
3514
|
+
overhead !== false ? overhead.l1_gas.max_price_per_unit : 0
|
|
3515
|
+
)
|
|
3494
3516
|
},
|
|
3495
3517
|
l1_data_gas: {
|
|
3496
|
-
max_amount: addPercent(
|
|
3518
|
+
max_amount: addPercent(
|
|
3519
|
+
estimate.l1_data_gas_consumed,
|
|
3520
|
+
overhead !== false ? overhead.l1_data_gas.max_amount : 0
|
|
3521
|
+
),
|
|
3497
3522
|
max_price_per_unit: addPercent(
|
|
3498
3523
|
estimate.l1_data_gas_price,
|
|
3499
|
-
overhead.l1_data_gas.max_price_per_unit
|
|
3524
|
+
overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
|
|
3500
3525
|
)
|
|
3501
3526
|
}
|
|
3502
3527
|
};
|
|
3503
3528
|
}
|
|
3504
|
-
function
|
|
3529
|
+
function resourceBoundsToEstimateFeeResponse(resourceBounds) {
|
|
3505
3530
|
return {
|
|
3506
3531
|
resourceBounds,
|
|
3507
3532
|
/**
|
|
@@ -3512,7 +3537,16 @@ function resourceBoundsToEstimateFee(resourceBounds) {
|
|
|
3512
3537
|
};
|
|
3513
3538
|
}
|
|
3514
3539
|
function toOverheadOverallFee(estimate, overhead = config.get("resourceBoundsOverhead")) {
|
|
3515
|
-
return addPercent(estimate.l1_gas_consumed, overhead
|
|
3540
|
+
return addPercent(estimate.l1_gas_consumed, overhead !== false ? overhead.l1_gas.max_amount : 0) * addPercent(
|
|
3541
|
+
estimate.l1_gas_price,
|
|
3542
|
+
overhead !== false ? overhead.l1_gas.max_price_per_unit : 0
|
|
3543
|
+
) + addPercent(
|
|
3544
|
+
estimate.l1_data_gas_consumed,
|
|
3545
|
+
overhead !== false ? overhead.l1_data_gas.max_amount : 0
|
|
3546
|
+
) * addPercent(
|
|
3547
|
+
estimate.l1_data_gas_price,
|
|
3548
|
+
overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
|
|
3549
|
+
) + 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);
|
|
3516
3550
|
}
|
|
3517
3551
|
function ZeroFeeEstimate() {
|
|
3518
3552
|
return {
|
|
@@ -3557,7 +3591,7 @@ function v3Details(details) {
|
|
|
3557
3591
|
accountDeploymentData: details.accountDeploymentData || [],
|
|
3558
3592
|
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode || EDataAvailabilityMode.L1,
|
|
3559
3593
|
feeDataAvailabilityMode: details.feeDataAvailabilityMode || EDataAvailabilityMode.L1,
|
|
3560
|
-
resourceBounds: details.resourceBounds ??
|
|
3594
|
+
resourceBounds: details.resourceBounds ?? zeroResourceBounds()
|
|
3561
3595
|
};
|
|
3562
3596
|
}
|
|
3563
3597
|
function getFullPublicKey(privateKey) {
|
|
@@ -9028,7 +9062,8 @@ var Account = class extends RpcProvider2 {
|
|
|
9028
9062
|
}
|
|
9029
9063
|
async estimateFeeBulk(invocations, details = {}) {
|
|
9030
9064
|
if (!invocations.length) throw TypeError("Invocations should be non-empty array");
|
|
9031
|
-
if (details.resourceBounds)
|
|
9065
|
+
if (details.resourceBounds)
|
|
9066
|
+
return [resourceBoundsToEstimateFeeResponse(details.resourceBounds)];
|
|
9032
9067
|
const { nonce, blockIdentifier, version, skipValidate } = details;
|
|
9033
9068
|
const detailsWithTip = await this.resolveDetailsWithTip(details);
|
|
9034
9069
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|