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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [8.1.2](https://github.com/starknet-io/starknet.js/compare/v8.1.1...v8.1.2) (2025-08-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- migration docs update and fix overhead method to allow false overhead for no overhead ([3b74e62](https://github.com/starknet-io/starknet.js/commit/3b74e621b69447790a6bd1c4112b60e2b428c946))
|
|
6
|
+
|
|
1
7
|
## [8.1.1](https://github.com/starknet-io/starknet.js/compare/v8.1.0...v8.1.1) (2025-08-04)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -530,6 +530,7 @@ type ApiEstimateFeeResponse = FeeEstimate[];
|
|
|
530
530
|
declare function isRPC08Plus_ResourceBounds(entry: ResourceBounds): entry is RPCSPEC08.ResourceBounds;
|
|
531
531
|
declare function isRPC08Plus_ResourceBoundsBN(entry: ResourceBoundsBN): entry is ResourceBoundsBN;
|
|
532
532
|
type ResourceBounds = Merge<RPCSPEC08.ResourceBounds, RPC.ResourceBounds>;
|
|
533
|
+
type EventFilter = RPC.EventFilter;
|
|
533
534
|
/**
|
|
534
535
|
* Represents percentage overhead for each resource bound
|
|
535
536
|
* numerical 50 means 50% overhead
|
|
@@ -858,7 +859,7 @@ type RpcProviderOptions = {
|
|
|
858
859
|
default?: boolean;
|
|
859
860
|
waitMode?: boolean;
|
|
860
861
|
baseFetch?: WindowOrWorkerGlobalScope['fetch'];
|
|
861
|
-
resourceBoundsOverhead?: ResourceBoundsOverhead;
|
|
862
|
+
resourceBoundsOverhead?: ResourceBoundsOverhead | false;
|
|
862
863
|
batch?: false | number;
|
|
863
864
|
};
|
|
864
865
|
|
|
@@ -887,10 +888,6 @@ type EstimateFeeResponseOverhead = {
|
|
|
887
888
|
overall_fee: bigint;
|
|
888
889
|
unit: PRICE_UNIT;
|
|
889
890
|
};
|
|
890
|
-
/**
|
|
891
|
-
* same type as EstimateFeeResponseOverhead but without overhead
|
|
892
|
-
*/
|
|
893
|
-
type EstimateFeeResponse = EstimateFeeResponseOverhead;
|
|
894
891
|
type EstimateFeeResponseBulkOverhead = Array<EstimateFeeResponseOverhead>;
|
|
895
892
|
type InvokeFunctionResponse = InvokedTransaction;
|
|
896
893
|
type DeclareContractResponse = DeclaredTransaction;
|
|
@@ -1035,7 +1032,7 @@ declare abstract class SignerInterface {
|
|
|
1035
1032
|
/**
|
|
1036
1033
|
* Method to get the public key of the signer
|
|
1037
1034
|
*
|
|
1038
|
-
* @returns {string} hex-string
|
|
1035
|
+
* @returns {Promise<string>} hex-string public key
|
|
1039
1036
|
* @example
|
|
1040
1037
|
* ```typescript
|
|
1041
1038
|
* const mySigner = new Signer("0x123");
|
|
@@ -1048,49 +1045,67 @@ declare abstract class SignerInterface {
|
|
|
1048
1045
|
* Signs a JSON object for off-chain usage with the private key and returns the signature.
|
|
1049
1046
|
* This adds a message prefix so it can't be interchanged with transactions
|
|
1050
1047
|
*
|
|
1051
|
-
* @param {TypedData} typedData JSON object to be signed
|
|
1052
|
-
* @param {string} accountAddress Hex string of the account's address
|
|
1048
|
+
* @param {TypedData} typedData - JSON object to be signed
|
|
1049
|
+
* @param {string} accountAddress - Hex string of the account's address
|
|
1053
1050
|
* @returns {Promise<Signature>} the signature of the message
|
|
1054
1051
|
* @example
|
|
1055
1052
|
* ```typescript
|
|
1056
1053
|
* const mySigner = new Signer("0x123");
|
|
1057
|
-
*
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1054
|
+
* const myTypedData: TypedData = {
|
|
1055
|
+
* domain: {
|
|
1056
|
+
* name: "Example DApp",
|
|
1057
|
+
* chainId: constants.StarknetChainId.SN_SEPOLIA,
|
|
1058
|
+
* version: "0.0.3"
|
|
1059
|
+
* },
|
|
1060
|
+
* types: {
|
|
1061
|
+
* StarkNetDomain: [
|
|
1062
|
+
* { name: "name", type: "string" },
|
|
1063
|
+
* { name: "chainId", type: "felt" },
|
|
1064
|
+
* { name: "version", type: "string" }
|
|
1065
|
+
* ],
|
|
1066
|
+
* Message: [{ name: "message", type: "felt" }]
|
|
1067
|
+
* },
|
|
1068
|
+
* primaryType: "Message",
|
|
1069
|
+
* message: { message: "1234" }
|
|
1070
|
+
* };
|
|
1071
|
+
* const result = await mySigner.signMessage(myTypedData, "0x5d08a4e9188429da4e993c9bf25aafe5cd491ee2b501505d4d059f0c938f82d");
|
|
1068
1072
|
* // result = Signature {r: 684915484701699003335398790608214855489903651271362390249153620883122231253n,
|
|
1069
1073
|
* // s: 1399150959912500412309102776989465580949387575375484933432871778355496929189n, recovery: 1}
|
|
1070
1074
|
* ```
|
|
1071
|
-
|
|
1072
1075
|
*/
|
|
1073
1076
|
abstract signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
|
|
1074
1077
|
/**
|
|
1075
|
-
* Signs transactions with the private key and returns the signature
|
|
1078
|
+
* Signs INVOKE transactions with the private key and returns the signature
|
|
1076
1079
|
*
|
|
1077
|
-
* @param {Call[]} transactions
|
|
1078
|
-
* @param {InvocationsSignerDetails} transactionsDetail
|
|
1080
|
+
* @param {Call[]} transactions - Array of Call objects representing the transactions
|
|
1081
|
+
* @param {InvocationsSignerDetails} transactionsDetail - Transaction details including V3 fields
|
|
1079
1082
|
* @returns {Promise<Signature>} the signature of the transaction
|
|
1083
|
+
* @remarks Only supports V3 transactions. V0, V1, and V2 transactions will throw an error.
|
|
1080
1084
|
* @example
|
|
1081
1085
|
* ```typescript
|
|
1082
1086
|
* const mySigner = new Signer("0x123");
|
|
1083
1087
|
* const calls: Call[] = [{
|
|
1084
|
-
*
|
|
1085
|
-
*
|
|
1086
|
-
*
|
|
1088
|
+
* contractAddress: "0x1234567890123456789012345678901234567890",
|
|
1089
|
+
* entrypoint: "transfer",
|
|
1090
|
+
* calldata: ["0xRecipient", "1000", "0"]
|
|
1087
1091
|
* }];
|
|
1088
1092
|
* const transactionsDetail: InvocationsSignerDetails = {
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1093
|
+
* walletAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
|
|
1094
|
+
* chainId: constants.StarknetChainId.SN_MAIN,
|
|
1095
|
+
* cairoVersion: "1",
|
|
1096
|
+
* version: "0x3",
|
|
1097
|
+
* nonce: 1,
|
|
1098
|
+
* resourceBounds: {
|
|
1099
|
+
* l1_gas: { amount: "0x1000", price: "0x20" },
|
|
1100
|
+
* l2_gas: { amount: "0x200", price: "0x5" },
|
|
1101
|
+
* l1_data_gas: { amount: "0x500", price: "0x10" }
|
|
1102
|
+
* },
|
|
1103
|
+
* tip: 0,
|
|
1104
|
+
* paymasterData: [],
|
|
1105
|
+
* accountDeploymentData: [],
|
|
1106
|
+
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
1107
|
+
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
|
|
1108
|
+
* };
|
|
1094
1109
|
* const result = await mySigner.signTransaction(calls, transactionsDetail);
|
|
1095
1110
|
* // result = Signature {r: 304910226421970384958146916800275294114105560641204815169249090836676768876n,
|
|
1096
1111
|
* // s: 1072798866000813654190523783606274062837012608648308896325315895472901074693n, recovery: 0}
|
|
@@ -1100,21 +1115,31 @@ declare abstract class SignerInterface {
|
|
|
1100
1115
|
/**
|
|
1101
1116
|
* Signs a DEPLOY_ACCOUNT transaction with the private key and returns the signature
|
|
1102
1117
|
*
|
|
1103
|
-
* @param {DeployAccountSignerDetails} transaction to deploy an account contract
|
|
1118
|
+
* @param {DeployAccountSignerDetails} transaction - Transaction details to deploy an account contract
|
|
1104
1119
|
* @returns {Promise<Signature>} the signature of the transaction to deploy an account
|
|
1120
|
+
* @remarks Only supports V3 transactions. V0, V1, and V2 transactions will throw an error.
|
|
1105
1121
|
* @example
|
|
1106
1122
|
* ```typescript
|
|
1107
1123
|
* const mySigner = new Signer("0x123");
|
|
1108
1124
|
* const myDeployAcc: DeployAccountSignerDetails = {
|
|
1109
1125
|
* contractAddress: "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641",
|
|
1110
|
-
* version: "
|
|
1126
|
+
* version: "0x3",
|
|
1127
|
+
* chainId: constants.StarknetChainId.SN_SEPOLIA,
|
|
1111
1128
|
* classHash: "0x5f3614e8671257aff9ac38e929c74d65b02d460ae966cd826c9f04a7fa8e0d4",
|
|
1112
|
-
* constructorCalldata: [
|
|
1113
|
-
*
|
|
1129
|
+
* constructorCalldata: ["0x123", "0x456"],
|
|
1130
|
+
* addressSalt: "0x789",
|
|
1131
|
+
* nonce: 0,
|
|
1132
|
+
* resourceBounds: {
|
|
1133
|
+
* l1_gas: { amount: "0x1000", price: "0x20" },
|
|
1134
|
+
* l2_gas: { amount: "0x200", price: "0x5" },
|
|
1135
|
+
* l1_data_gas: { amount: "0x500", price: "0x10" }
|
|
1136
|
+
* },
|
|
1137
|
+
* tip: 0,
|
|
1138
|
+
* paymasterData: [],
|
|
1139
|
+
* accountDeploymentData: [],
|
|
1114
1140
|
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
1115
|
-
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
|
|
1116
|
-
*
|
|
1117
|
-
* }
|
|
1141
|
+
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
|
|
1142
|
+
* };
|
|
1118
1143
|
* const result = await mySigner.signDeployAccountTransaction(myDeployAcc);
|
|
1119
1144
|
* // result = Signature {r: 2871311234341436528393212130310036951068553852419934781736214693308640202748n,
|
|
1120
1145
|
* // s: 1746271646048888422437132495446973163454853863041370993384284773665861377605n, recovery: 1}
|
|
@@ -1124,20 +1149,30 @@ declare abstract class SignerInterface {
|
|
|
1124
1149
|
/**
|
|
1125
1150
|
* Signs a DECLARE transaction with the private key and returns the signature
|
|
1126
1151
|
*
|
|
1127
|
-
* @param {DeclareSignerDetails} transaction to declare a class
|
|
1152
|
+
* @param {DeclareSignerDetails} transaction - Transaction details to declare a contract class
|
|
1128
1153
|
* @returns {Promise<Signature>} the signature of the transaction to declare a class
|
|
1154
|
+
* @remarks Only supports V3 transactions. V0, V1, and V2 transactions will throw an error.
|
|
1129
1155
|
* @example
|
|
1130
1156
|
* ```typescript
|
|
1131
1157
|
* const mySigner = new Signer("0x123");
|
|
1132
1158
|
* const myDeclare: DeclareSignerDetails = {
|
|
1133
|
-
* version: "
|
|
1159
|
+
* version: "0x3",
|
|
1160
|
+
* chainId: constants.StarknetChainId.SN_SEPOLIA,
|
|
1134
1161
|
* senderAddress: "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641",
|
|
1135
1162
|
* classHash: "0x5f3614e8671257aff9ac38e929c74d65b02d460ae966cd826c9f04a7fa8e0d4",
|
|
1136
|
-
*
|
|
1163
|
+
* compiledClassHash: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
|
1164
|
+
* nonce: 45,
|
|
1165
|
+
* resourceBounds: {
|
|
1166
|
+
* l1_gas: { amount: "0x1000", price: "0x20" },
|
|
1167
|
+
* l2_gas: { amount: "0x200", price: "0x5" },
|
|
1168
|
+
* l1_data_gas: { amount: "0x500", price: "0x10" }
|
|
1169
|
+
* },
|
|
1170
|
+
* tip: 0,
|
|
1171
|
+
* paymasterData: [],
|
|
1172
|
+
* accountDeploymentData: [],
|
|
1137
1173
|
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
1138
|
-
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
|
|
1139
|
-
*
|
|
1140
|
-
}
|
|
1174
|
+
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1
|
|
1175
|
+
* };
|
|
1141
1176
|
* const result = await mySigner.signDeclareTransaction(myDeclare);
|
|
1142
1177
|
* // result = Signature {r: 2432056944313955951711774394836075930010416436707488863728289188289211995670n,
|
|
1143
1178
|
* // s: 3407649393310177489888603098175002856596469926897298636282244411990343146307n, recovery: 1}
|
|
@@ -6012,16 +6047,40 @@ declare function signatureToDecimalArray(sig?: Signature): ArraySignatureType;
|
|
|
6012
6047
|
* ```
|
|
6013
6048
|
*/
|
|
6014
6049
|
declare function signatureToHexArray(sig?: Signature): ArraySignatureType;
|
|
6050
|
+
/**
|
|
6051
|
+
* Returns a resource bounds with zero values and no overhead.
|
|
6052
|
+
* @returns {ResourceBoundsBN} A resource bounds with zero values and no overhead.
|
|
6053
|
+
*/
|
|
6054
|
+
declare function zeroResourceBounds(): ResourceBoundsBN;
|
|
6015
6055
|
/**
|
|
6016
6056
|
* Calculates the maximum resource bounds for fee estimation.
|
|
6017
6057
|
*
|
|
6018
|
-
* @param {FeeEstimate
|
|
6019
|
-
* @param {ResourceBoundsOverhead} [overhead] - The percentage overhead added to the max units and max price per unit.
|
|
6058
|
+
* @param {FeeEstimate} estimate The estimate for the fee.
|
|
6059
|
+
* @param {ResourceBoundsOverhead | false} [overhead] - The percentage overhead added to the max units and max price per unit. Pass `false` to disable overhead.
|
|
6020
6060
|
* @returns {ResourceBoundsBN} The resource bounds with overhead represented as BigInt.
|
|
6021
6061
|
* @throws {Error} If the estimate object is undefined or does not have the required properties.
|
|
6022
6062
|
*/
|
|
6023
|
-
declare function toOverheadResourceBounds(estimate: FeeEstimate, overhead?: ResourceBoundsOverhead): ResourceBoundsBN;
|
|
6024
|
-
|
|
6063
|
+
declare function toOverheadResourceBounds(estimate: FeeEstimate, overhead?: ResourceBoundsOverhead | false): ResourceBoundsBN;
|
|
6064
|
+
/**
|
|
6065
|
+
* Converts a resource bounds to an estimate fee response. No overhead is applied.
|
|
6066
|
+
* @param {ResourceBoundsBN} resourceBounds - The resource bounds to convert.
|
|
6067
|
+
* @returns {EstimateFeeResponseOverhead} The estimate fee response.
|
|
6068
|
+
* @example
|
|
6069
|
+
* ```typescript
|
|
6070
|
+
* const resourceBounds = {
|
|
6071
|
+
* l1_gas: { max_amount: 1000n, max_price_per_unit: 100n },
|
|
6072
|
+
* l2_gas: { max_amount: 2000n, max_price_per_unit: 200n },
|
|
6073
|
+
* l1_data_gas: { max_amount: 500n, max_price_per_unit: 50n }
|
|
6074
|
+
* };
|
|
6075
|
+
* const result = stark.resourceBoundsToEstimateFeeResponse(resourceBounds);
|
|
6076
|
+
* // result = {
|
|
6077
|
+
* // resourceBounds: resourceBounds,
|
|
6078
|
+
* // overall_fee: 129000n,
|
|
6079
|
+
* // unit: 'FRI'
|
|
6080
|
+
* // }
|
|
6081
|
+
* ```
|
|
6082
|
+
*/
|
|
6083
|
+
declare function resourceBoundsToEstimateFeeResponse(resourceBounds: ResourceBoundsBN): EstimateFeeResponseOverhead;
|
|
6025
6084
|
/**
|
|
6026
6085
|
* Calculates the overall fee for a transaction based on resource consumption and prices.
|
|
6027
6086
|
*
|
|
@@ -6029,7 +6088,7 @@ declare function resourceBoundsToEstimateFee(resourceBounds: ResourceBoundsBN):
|
|
|
6029
6088
|
* l1_gas_consumed*l1_gas_price + l1_data_gas_consumed*l1_data_gas_price + l2_gas_consumed*l2_gas_price
|
|
6030
6089
|
*
|
|
6031
6090
|
* @param {FeeEstimate} estimate - The fee estimate containing gas consumption and price data
|
|
6032
|
-
* @param {ResourceBoundsOverhead} overhead - The overhead percentage
|
|
6091
|
+
* @param {ResourceBoundsOverhead | false} overhead - The overhead percentage. Pass `false` to disable overhead.
|
|
6033
6092
|
* @returns {bigint} The calculated overall fee in wei or fri
|
|
6034
6093
|
* @example
|
|
6035
6094
|
* ```typescript
|
|
@@ -6045,9 +6104,9 @@ declare function resourceBoundsToEstimateFee(resourceBounds: ResourceBoundsBN):
|
|
|
6045
6104
|
* // result = 1000n * 100n + 500n * 50n + 200n * 20n = 129000n
|
|
6046
6105
|
* ```
|
|
6047
6106
|
*/
|
|
6048
|
-
declare function toOverheadOverallFee(estimate: FeeEstimate, overhead?: ResourceBoundsOverhead): bigint;
|
|
6107
|
+
declare function toOverheadOverallFee(estimate: FeeEstimate, overhead?: ResourceBoundsOverhead | false): bigint;
|
|
6049
6108
|
/**
|
|
6050
|
-
* Mock zero fee response
|
|
6109
|
+
* Mock zero fee API response
|
|
6051
6110
|
*/
|
|
6052
6111
|
declare function ZeroFeeEstimate(): FeeEstimate;
|
|
6053
6112
|
/**
|
|
@@ -6173,7 +6232,7 @@ declare const index$1_getFullPublicKey: typeof getFullPublicKey;
|
|
|
6173
6232
|
declare const index$1_intDAM: typeof intDAM;
|
|
6174
6233
|
declare const index$1_randomAddress: typeof randomAddress;
|
|
6175
6234
|
declare const index$1_resourceBoundsToBigInt: typeof resourceBoundsToBigInt;
|
|
6176
|
-
declare const index$
|
|
6235
|
+
declare const index$1_resourceBoundsToEstimateFeeResponse: typeof resourceBoundsToEstimateFeeResponse;
|
|
6177
6236
|
declare const index$1_resourceBoundsToHexString: typeof resourceBoundsToHexString;
|
|
6178
6237
|
declare const index$1_signatureToDecimalArray: typeof signatureToDecimalArray;
|
|
6179
6238
|
declare const index$1_signatureToHexArray: typeof signatureToHexArray;
|
|
@@ -6182,8 +6241,9 @@ declare const index$1_toOverheadOverallFee: typeof toOverheadOverallFee;
|
|
|
6182
6241
|
declare const index$1_toOverheadResourceBounds: typeof toOverheadResourceBounds;
|
|
6183
6242
|
declare const index$1_toTransactionVersion: typeof toTransactionVersion;
|
|
6184
6243
|
declare const index$1_v3Details: typeof v3Details;
|
|
6244
|
+
declare const index$1_zeroResourceBounds: typeof zeroResourceBounds;
|
|
6185
6245
|
declare namespace index$1 {
|
|
6186
|
-
export { index$1_ZeroFeeEstimate as ZeroFeeEstimate, index$1_compressProgram as compressProgram, index$1_decompressProgram as decompressProgram, index$1_formatSignature as formatSignature, index$1_getFullPublicKey as getFullPublicKey, index$1_intDAM as intDAM, index$1_randomAddress as randomAddress, index$1_resourceBoundsToBigInt as resourceBoundsToBigInt, index$
|
|
6246
|
+
export { index$1_ZeroFeeEstimate as ZeroFeeEstimate, index$1_compressProgram as compressProgram, index$1_decompressProgram as decompressProgram, index$1_formatSignature as formatSignature, index$1_getFullPublicKey as getFullPublicKey, index$1_intDAM as intDAM, index$1_randomAddress as randomAddress, index$1_resourceBoundsToBigInt as resourceBoundsToBigInt, index$1_resourceBoundsToEstimateFeeResponse as resourceBoundsToEstimateFeeResponse, index$1_resourceBoundsToHexString as resourceBoundsToHexString, index$1_signatureToDecimalArray as signatureToDecimalArray, index$1_signatureToHexArray as signatureToHexArray, index$1_toFeeVersion as toFeeVersion, index$1_toOverheadOverallFee as toOverheadOverallFee, index$1_toOverheadResourceBounds as toOverheadResourceBounds, index$1_toTransactionVersion as toTransactionVersion, index$1_v3Details as v3Details, index$1_zeroResourceBounds as zeroResourceBounds };
|
|
6187
6247
|
}
|
|
6188
6248
|
|
|
6189
6249
|
/**
|
|
@@ -8480,4 +8540,4 @@ declare class Logger {
|
|
|
8480
8540
|
*/
|
|
8481
8541
|
declare const logger: Logger;
|
|
8482
8542
|
|
|
8483
|
-
export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AccountOptions, type AllowArray, type ApiEstimateFeeResponse, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BLOCK_HASH, type BLOCK_NUMBER, BatchClient, type BatchClientOptions, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallResult, type Calldata, type CommonContractOptions, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeclaredTransaction, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployAndInvokeTransaction, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransaction, type DeployTransactionReceiptResponse, type DeployedAccountTransaction, Deployer, type DeployerCall, DeployerInterface, type Details, EDAMode, EDataAvailabilityMode, ETH_ADDRESS, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type EstimateFeeBulk, type
|
|
8543
|
+
export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AccountOptions, type AllowArray, type ApiEstimateFeeResponse, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BLOCK_HASH, type BLOCK_NUMBER, BatchClient, type BatchClientOptions, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFixedArray, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallResult, type Calldata, type CommonContractOptions, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassIdentifier, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeclaredTransaction, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployAndInvokeTransaction, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransaction, type DeployTransactionReceiptResponse, type DeployedAccountTransaction, Deployer, type DeployerCall, DeployerInterface, type Details, EDAMode, EDataAvailabilityMode, ETH_ADDRESS, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type EstimateFeeBulk, type EstimateFeeResponseBulkOverhead, type EstimateFeeResponseOverhead, EthSigner, type Event$1 as Event, type EventEntry, type EventFilter, type ExecutableDeployAndInvokeTransaction, type ExecutableDeployTransaction, type ExecutableInvokeTransaction, type ExecutableUserInvoke, type ExecutableUserTransaction, type ExecuteOptions, type ExecutionParameters, type FEE_ESTIMATE, type FELT, type FactoryParams, type FeeEstimate, type FeeMode, type FormatResponse, type FunctionAbi, type GasPrices, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type Hint, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeTransaction, type InvokeTransactionReceiptResponse, type InvokedTransaction, type L1HandlerTransactionReceiptResponse, type L1_HANDLER_TXN, type LedgerPathCalculation, LedgerSigner111 as LedgerSigner, LedgerSigner111, LedgerSigner221, LedgerSigner231, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type LogLevel, LogLevelIndex, type Methods, type MultiDeployContractResponse, type MultiType, NON_ZERO_PREFIX, type Nonce, type OptionalPayload, type OutsideCall, type OutsideExecution, type OutsideExecutionOptions, OutsideExecutionTypesV1, OutsideExecutionTypesV2, OutsideExecutionVersion, type OutsideTransaction, type PENDING_DECLARE_TXN_RECEIPT, type PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT, type PENDING_INVOKE_TXN_RECEIPT, type PENDING_L1_HANDLER_TXN_RECEIPT, type PENDING_STATE_UPDATE, type PRE_CONFIRMED_STATE_UPDATE, type PRICE_UNIT, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PaymasterDetails, type PaymasterFeeEstimate, PaymasterInterface, type PaymasterOptions, PaymasterRpc, type PaymasterRpcOptions, type PaymasterTimeBounds, type PendingBlock, type PendingReceipt, type PendingStateUpdate, type PreConfirmedStateUpdate, type PreparedDeployAndInvokeTransaction, type PreparedDeployTransaction, type PreparedInvokeTransaction, type PreparedTransaction, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type ProviderOrAccount, type PythonicHints, type RESOURCE_PRICE, index$4 as RPC, rpc_0_8_1 as RPC08, rpc_0_9_0 as RPC09, RPCResponseParser, type RPC_ERROR, type RPC_ERROR_SET, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, type Receipt, ReceiptTx, type RequiredKeysOf, type ResourceBounds, type ResourceBoundsBN, type ResourceBoundsOverhead, ResponseParser, type RevertedTransactionReceiptResponse, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type STATE_UPDATE, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type Simplify, type SimulateTransaction, type SimulateTransactionDetails, type SimulateTransactionOverhead, type SimulateTransactionOverheadResponse, type SimulateTransactionResponse, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, Subscription, type SubscriptionBlockIdentifier, type SuccessfulTransactionReceiptResponse, type TXN_EXECUTION_STATUS, type TXN_HASH$1 as TXN_HASH, type TXN_STATUS, TimeoutError, type TipAnalysisOptions, type TipEstimate, type TipType, type TokenData, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptValue, type TransactionStatus, type TransactionStatusReceiptSets, type TransactionTrace, TransactionType, type TransactionWithHash, type Tupled, type TypedContractV2, UINT_128_MAX, UINT_128_MIN, UINT_256_HIGH_MAX, UINT_256_HIGH_MIN, UINT_256_LOW_MAX, UINT_256_LOW_MIN, UINT_256_MAX, UINT_256_MIN, UINT_512_MAX, UINT_512_MIN, Uint, type Uint256, type Uint512, type UniversalDeployerContractPayload, type UniversalDetails, type UserInvoke, type UserTransaction, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, WebSocketChannel, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, type WithOptions, addAddressPadding, byteArray, cairo, config, constants, contractClassResponseToLegacyCompiledContract, defaultDeployer, defaultPaymaster, defaultProvider, ec, encode, eth, index as events, extractContractHashes, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getGasPrices, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, getTipStatsFromBlocks, index$3 as hash, isAccount, isPendingBlock, isPendingStateUpdate, isPendingTransaction, isRPC08Plus_ResourceBounds, isRPC08Plus_ResourceBoundsBN, isSierra, isSupportedSpecVersion, isV3Tx, isVersion, json, legacyDeployer, logger, merkle, num, outsideExecution, parseCalldataField, paymaster, provider, selector, shortString, src5, index$1 as stark, starknetId, toAnyPatchVersion, toApiVersion, index$2 as transaction, typedData, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, verifyMessageInStarknet, type waitForTransactionOptions, connect as wallet };
|
package/dist/index.global.js
CHANGED
|
@@ -7635,7 +7635,7 @@ ${indent}}` : "}";
|
|
|
7635
7635
|
intDAM: () => intDAM,
|
|
7636
7636
|
randomAddress: () => randomAddress,
|
|
7637
7637
|
resourceBoundsToBigInt: () => resourceBoundsToBigInt,
|
|
7638
|
-
|
|
7638
|
+
resourceBoundsToEstimateFeeResponse: () => resourceBoundsToEstimateFeeResponse,
|
|
7639
7639
|
resourceBoundsToHexString: () => resourceBoundsToHexString,
|
|
7640
7640
|
signatureToDecimalArray: () => signatureToDecimalArray,
|
|
7641
7641
|
signatureToHexArray: () => signatureToHexArray,
|
|
@@ -7643,7 +7643,8 @@ ${indent}}` : "}";
|
|
|
7643
7643
|
toOverheadOverallFee: () => toOverheadOverallFee,
|
|
7644
7644
|
toOverheadResourceBounds: () => toOverheadResourceBounds,
|
|
7645
7645
|
toTransactionVersion: () => toTransactionVersion,
|
|
7646
|
-
v3Details: () => v3Details
|
|
7646
|
+
v3Details: () => v3Details,
|
|
7647
|
+
zeroResourceBounds: () => zeroResourceBounds
|
|
7647
7648
|
});
|
|
7648
7649
|
|
|
7649
7650
|
// node_modules/pako/dist/pako.esm.mjs
|
|
@@ -11854,26 +11855,44 @@ ${indent}}` : "}";
|
|
|
11854
11855
|
function signatureToHexArray(sig) {
|
|
11855
11856
|
return bigNumberishArrayToHexadecimalStringArray(formatSignature(sig));
|
|
11856
11857
|
}
|
|
11858
|
+
function zeroResourceBounds() {
|
|
11859
|
+
return toOverheadResourceBounds(ZeroFeeEstimate(), false);
|
|
11860
|
+
}
|
|
11857
11861
|
function toOverheadResourceBounds(estimate, overhead = config.get("resourceBoundsOverhead")) {
|
|
11858
11862
|
return {
|
|
11859
11863
|
l2_gas: {
|
|
11860
|
-
max_amount: addPercent(
|
|
11861
|
-
|
|
11864
|
+
max_amount: addPercent(
|
|
11865
|
+
estimate.l2_gas_consumed,
|
|
11866
|
+
overhead !== false ? overhead.l2_gas.max_amount : 0
|
|
11867
|
+
),
|
|
11868
|
+
max_price_per_unit: addPercent(
|
|
11869
|
+
estimate.l2_gas_price,
|
|
11870
|
+
overhead !== false ? overhead.l2_gas.max_price_per_unit : 0
|
|
11871
|
+
)
|
|
11862
11872
|
},
|
|
11863
11873
|
l1_gas: {
|
|
11864
|
-
max_amount: addPercent(
|
|
11865
|
-
|
|
11874
|
+
max_amount: addPercent(
|
|
11875
|
+
estimate.l1_gas_consumed,
|
|
11876
|
+
overhead !== false ? overhead.l1_gas.max_amount : 0
|
|
11877
|
+
),
|
|
11878
|
+
max_price_per_unit: addPercent(
|
|
11879
|
+
estimate.l1_gas_price,
|
|
11880
|
+
overhead !== false ? overhead.l1_gas.max_price_per_unit : 0
|
|
11881
|
+
)
|
|
11866
11882
|
},
|
|
11867
11883
|
l1_data_gas: {
|
|
11868
|
-
max_amount: addPercent(
|
|
11884
|
+
max_amount: addPercent(
|
|
11885
|
+
estimate.l1_data_gas_consumed,
|
|
11886
|
+
overhead !== false ? overhead.l1_data_gas.max_amount : 0
|
|
11887
|
+
),
|
|
11869
11888
|
max_price_per_unit: addPercent(
|
|
11870
11889
|
estimate.l1_data_gas_price,
|
|
11871
|
-
overhead.l1_data_gas.max_price_per_unit
|
|
11890
|
+
overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
|
|
11872
11891
|
)
|
|
11873
11892
|
}
|
|
11874
11893
|
};
|
|
11875
11894
|
}
|
|
11876
|
-
function
|
|
11895
|
+
function resourceBoundsToEstimateFeeResponse(resourceBounds) {
|
|
11877
11896
|
return {
|
|
11878
11897
|
resourceBounds,
|
|
11879
11898
|
/**
|
|
@@ -11884,7 +11903,16 @@ ${indent}}` : "}";
|
|
|
11884
11903
|
};
|
|
11885
11904
|
}
|
|
11886
11905
|
function toOverheadOverallFee(estimate, overhead = config.get("resourceBoundsOverhead")) {
|
|
11887
|
-
return addPercent(estimate.l1_gas_consumed, overhead
|
|
11906
|
+
return addPercent(estimate.l1_gas_consumed, overhead !== false ? overhead.l1_gas.max_amount : 0) * addPercent(
|
|
11907
|
+
estimate.l1_gas_price,
|
|
11908
|
+
overhead !== false ? overhead.l1_gas.max_price_per_unit : 0
|
|
11909
|
+
) + addPercent(
|
|
11910
|
+
estimate.l1_data_gas_consumed,
|
|
11911
|
+
overhead !== false ? overhead.l1_data_gas.max_amount : 0
|
|
11912
|
+
) * addPercent(
|
|
11913
|
+
estimate.l1_data_gas_price,
|
|
11914
|
+
overhead !== false ? overhead.l1_data_gas.max_price_per_unit : 0
|
|
11915
|
+
) + 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);
|
|
11888
11916
|
}
|
|
11889
11917
|
function ZeroFeeEstimate() {
|
|
11890
11918
|
return {
|
|
@@ -11929,7 +11957,7 @@ ${indent}}` : "}";
|
|
|
11929
11957
|
accountDeploymentData: details.accountDeploymentData || [],
|
|
11930
11958
|
nonceDataAvailabilityMode: details.nonceDataAvailabilityMode || EDataAvailabilityMode3.L1,
|
|
11931
11959
|
feeDataAvailabilityMode: details.feeDataAvailabilityMode || EDataAvailabilityMode3.L1,
|
|
11932
|
-
resourceBounds: details.resourceBounds ??
|
|
11960
|
+
resourceBounds: details.resourceBounds ?? zeroResourceBounds()
|
|
11933
11961
|
};
|
|
11934
11962
|
}
|
|
11935
11963
|
function getFullPublicKey(privateKey) {
|
|
@@ -17698,7 +17726,8 @@ ${indent}}` : "}";
|
|
|
17698
17726
|
}
|
|
17699
17727
|
async estimateFeeBulk(invocations, details = {}) {
|
|
17700
17728
|
if (!invocations.length) throw TypeError("Invocations should be non-empty array");
|
|
17701
|
-
if (details.resourceBounds)
|
|
17729
|
+
if (details.resourceBounds)
|
|
17730
|
+
return [resourceBoundsToEstimateFeeResponse(details.resourceBounds)];
|
|
17702
17731
|
const { nonce, blockIdentifier, version, skipValidate } = details;
|
|
17703
17732
|
const detailsWithTip = await this.resolveDetailsWithTip(details);
|
|
17704
17733
|
const accountInvocations = await this.accountInvocationsFactory(invocations, {
|