starknet 10.7.0 → 10.7.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 CHANGED
@@ -1,3 +1,20 @@
1
+ ## [10.7.2](https://github.com/starknet-io/starknet.js/compare/v10.7.1...v10.7.2) (2026-09-08)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **paymaster:** accept a raw shortstring for the paymaster typed-data domain chainId ([4abd5ae](https://github.com/starknet-io/starknet.js/commit/4abd5aeec079e8ca14ce098d0ff8790a89aa1c62))
6
+ - **paymaster:** bind paymaster typed-data domain to the account's provider chain ([f194c61](https://github.com/starknet-io/starknet.js/commit/f194c612cd2fa2ecb6515e484f89d6f2bb72892a))
7
+ - **paymaster:** reject paymaster typed data declaring both "calls" and "Calls" ([e618f70](https://github.com/starknet-io/starknet.js/commit/e618f706fe543aa5dbce5b560098ad15d4ca341b))
8
+ - **paymaster:** validate selector and calldata shape of the appended gas-token call ([4b72d35](https://github.com/starknet-io/starknet.js/commit/4b72d35cfe19424fb707dbfdfd4e3877532f86b5))
9
+ - **paymaster:** validate the full u256 gas-token amount unconditionally ([3d1a1ec](https://github.com/starknet-io/starknet.js/commit/3d1a1ec420a769f31bb7fc94b2a68f36ae56630e))
10
+ - **paymaster:** verify calls equality for sponsored paymaster transactions too ([c403643](https://github.com/starknet-io/starknet.js/commit/c403643b580ab5953a2e737d1aa39e083d5f0262))
11
+
12
+ ## [10.7.1](https://github.com/starknet-io/starknet.js/compare/v10.7.0...v10.7.1) (2026-08-21)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **provider:** accept pre-release RPC spec versions ([436f433](https://github.com/starknet-io/starknet.js/commit/436f433e57039f3ae12c651c937d6b7e21592de1))
17
+
1
18
  # [10.7.0](https://github.com/starknet-io/starknet.js/compare/v10.6.8...v10.7.0) (2026-08-13)
2
19
 
3
20
  ### Features
package/dist/index.d.ts CHANGED
@@ -8936,10 +8936,38 @@ declare const getDefaultPaymasterNodeUrl: (networkName?: _NetworkName, mute?: bo
8936
8936
  * Asserts that the given calls are strictly equal, otherwise throws an error.
8937
8937
  * @param {Call[]} originalCalls - The original calls.
8938
8938
  * @param {Call[]} unsafeCalls - The unsafe calls.
8939
+ * @param {boolean} [isSponsored] - Whether the transaction is sponsored. A sponsored
8940
+ * transaction appends no gas-token fee-transfer call; a non-sponsored one appends exactly
8941
+ * one. Defaults to `false` for backward compatibility.
8939
8942
  * @throws {Error} Throws an error if the calls are not strictly equal.
8943
+ * @example
8944
+ * ```typescript
8945
+ * paymaster.assertCallsAreStrictlyEqual(originalCalls, unsafeCalls, true); // sponsored: no fee call
8946
+ * ```
8947
+ */
8948
+ declare function assertCallsAreStrictlyEqual(originalCalls: Call[], unsafeCalls: (OutsideCallV1 | OutsideCallV2)[], isSponsored?: boolean): void;
8949
+ /**
8950
+ * Asserts that a paymaster-prepared transaction is safe to sign: the typed-data domain is
8951
+ * bound to the account's own chain, and — for non-sponsored transactions — the calls and the
8952
+ * appended gas-token transfer match what the user actually requested.
8953
+ * @param {PreparedTransaction} preparedTransaction - The transaction returned by the paymaster.
8954
+ * @param {Call[]} calls - The calls originally requested by the user.
8955
+ * @param {PaymasterDetails} paymasterDetails - The fee mode and related paymaster details.
8956
+ * @param {StarknetChainId} chainId - The chain id of the account's own provider.
8957
+ * @param {BigNumberish} [maxFeeInGasToken] - Optional user-approved ceiling on the gas-token fee.
8958
+ * @throws {Error} Throws an error if any of the above safety properties do not hold.
8959
+ * @example
8960
+ * ```typescript
8961
+ * assertPaymasterTransactionSafety(
8962
+ * preparedTransaction,
8963
+ * calls,
8964
+ * { feeMode: { mode: 'default', gasToken: strkAddress } },
8965
+ * constants.StarknetChainId.SN_SEPOLIA
8966
+ * );
8967
+ * // does not throw if preparedTransaction is exactly what was requested
8968
+ * ```
8940
8969
  */
8941
- declare function assertCallsAreStrictlyEqual(originalCalls: Call[], unsafeCalls: (OutsideCallV1 | OutsideCallV2)[]): void;
8942
- declare const assertPaymasterTransactionSafety: (preparedTransaction: PreparedTransaction, calls: Call[], paymasterDetails: PaymasterDetails, maxFeeInGasToken?: BigNumberish) => void;
8970
+ declare const assertPaymasterTransactionSafety: (preparedTransaction: PreparedTransaction, calls: Call[], paymasterDetails: PaymasterDetails, chainId: _StarknetChainId, maxFeeInGasToken?: BigNumberish) => void;
8943
8971
 
8944
8972
  declare const paymaster_assertCallsAreStrictlyEqual: typeof assertCallsAreStrictlyEqual;
8945
8973
  declare const paymaster_assertPaymasterTransactionSafety: typeof assertPaymasterTransactionSafety;
@@ -9421,6 +9449,22 @@ declare function isSupportedSpecVersion(version: string, options?: {
9421
9449
  * ex. 0.8.1 -> 0.8.*
9422
9450
  */
9423
9451
  declare function toAnyPatchVersion(version: string): string;
9452
+ /**
9453
+ * Strip the semver pre-release and build metadata suffixes from a version.
9454
+ * A node can report a pre-release of a spec version (ex. Pathfinder reporting '0.10.3-rc.0');
9455
+ * the SDK handles it as the release it is a candidate for.
9456
+ * Input that is not a semver version is returned unchanged.
9457
+ * ex. '0.10.3-rc.0' -> '0.10.3', '0.10.3+build.1' -> '0.10.3', '0.10.2' -> '0.10.2'
9458
+ *
9459
+ * @param {string} version
9460
+ * @returns {string} the version without its pre-release and build metadata suffixes
9461
+ * @example
9462
+ * ```typescript
9463
+ * const result = toReleaseVersion('0.10.3-rc.0');
9464
+ * // result = '0.10.3'
9465
+ * ```
9466
+ */
9467
+ declare function toReleaseVersion(version: string): string;
9424
9468
  /**
9425
9469
  * Convert version to API format.
9426
9470
  * ex. '0.8.1' -> 'v0_8', '0.8' -> 'v0_8'
@@ -9432,6 +9476,8 @@ declare function toApiVersion(version: string): string;
9432
9476
  * Compare two semantic version strings segment by segment.
9433
9477
  * This function safely compares versions without collision risk between
9434
9478
  * versions like '0.0.1000' and '0.1.0'.
9479
+ * Pre-release and build metadata suffixes are ignored, so a version is compared as
9480
+ * the release it is a candidate for: '0.14.1-rc.0' compares equal to '0.14.1'.
9435
9481
  *
9436
9482
  * @param {string} a First version string (e.g., '0.0.9')
9437
9483
  * @param {string} b Second version string (e.g., '0.0.10')
@@ -10843,4 +10889,4 @@ declare class Logger {
10843
10889
  */
10844
10890
  declare const logger: Logger;
10845
10891
 
10846
- export { type Abi, type AbiEntry, type AbiEntryType, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, AbiParser1, AbiParser2, AbiParserInterface, type AbiStruct, type AbiStructs, Account, type AccountHooks, 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 BlockTransactionTrace, type BlockTransactionsTracesWithInitialReads, type BlockWithTxHashes, BrotherIdImpl, type BrotherIdProviderMethods, type BrotherProfile, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, CairoByteArray, CairoBytes31, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFelt, CairoFelt252, CairoFixedArray, CairoInt128, CairoInt16, CairoInt32, CairoInt64, CairoInt8, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint128, CairoUint16, CairoUint256, CairoUint32, CairoUint512, CairoUint64, CairoUint8, CairoUint96, 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, ESubscriptionTag, ETH_ADDRESS, ETraceFlag, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, ETxnResponseFlag, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type ErrorReceiptResponseHelper, 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 FastExecuteAccountMethods, type FastExecuteProviderMethods, type FastExecuteResponse, type FastWaitForTransactionOptions, type FeeEstimate, type FeeMode, type FormatResponse, type FunctionAbi, type GasPrices, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type Hint, type INITIAL_READS, Int, 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 LoadedContract, 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 PRE_CONFIRMED_STATE_UPDATE, type PRICE_UNIT, type ParsedEvent, type ParsedEvents, type ParsedStruct, type ParsingStrategy, type PaymasterDetails, type PaymasterFeeEstimate, PaymasterInterface, type PaymasterOptions, PaymasterRpc, type PaymasterRpcOptions, type PaymasterTimeBounds, type PluginConfig, PluginManager, type PreConfirmedBlock, type PreConfirmedStateUpdate, type PreparedDeployAndInvokeTransaction, type PreparedDeployTransaction, type PreparedInvokeTransaction, type PreparedTransaction, type Program, RpcProvider as Provider, type ProviderHooks, ProviderInterface, type ProviderOptions, type ProviderOrAccount, type PythonicHints, type RESOURCE_PRICE, index$4 as RPC, rpc_0_10_2 as RPC0102, rpc_0_10_3 as RPC0103, 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 ReconnectOptions, type RequiredKeysOf, type ResourceBounds, type ResourceBoundsBN, type ResourceBoundsOverhead, ResponseParser, type RevertedTransactionReceiptResponse, type RevertedTransactionReceiptResponseHelper, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type STATE_UPDATE, type STRK20_ACTION, type STRK20_CALL_AND_PROOF, type STRK20_SHADOW_ACCOUNT_INVOKE_ACTION, 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 StarknetIdAccountMethods, StarknetIdImpl, type StarknetIdProviderMethods, type StarknetPlugin, type StateUpdate, type StateUpdateResponse, type StorageResponse, type SubscribeEventsParams, type SubscribeNewHeadsParams, type SubscribeNewTransactionReceiptsParams, type SubscribeNewTransactionsParams, type SubscribeTransactionStatusParams, Subscription, type SubscriptionBlockIdentifier, type SubscriptionNewHeadsEvent, type SubscriptionNewTransactionEvent, type SubscriptionNewTransactionReceiptsEvent, type SubscriptionOptions, type SubscriptionStarknetEventsEvent, type SubscriptionTransactionStatusEvent, type SuccessfulTransactionReceiptResponse, type SuccessfulTransactionReceiptResponseHelper, type TXN_EXECUTION_STATUS, type 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, WalletAccountV5, WalletAccountV6, WebSocketChannel, type WebSocketModule, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, type WithOptions, addAddressPadding, brotherId, byteArray, cairo, compareVersions, config, constants, contractClassResponseToLegacyCompiledContract, contractLoader, createAbiParser, createTransactionReceipt, defaultDeployer, defaultPlugins, ec, encode, eth, index as events, extractContractHashes, fastExecute, fastParsingStrategy, getAbiVersion, type getBlockTransactionsTracesOptions, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getGasPrices, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, getTipStatsFromBlocks, index$3 as hash, hdParsingStrategy, isAccount, isFileSystemAvailable, isNoConstructorValid, isPreConfirmedBlock, isPreConfirmedStateUpdate, isPreConfirmedTransaction, 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, starknetId$1 as starknetIdPlugin, 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, connectV5 as walletV5, connectV6 as walletV6 };
10892
+ export { type Abi, type AbiEntry, type AbiEntryType, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, AbiParser1, AbiParser2, AbiParserInterface, type AbiStruct, type AbiStructs, Account, type AccountHooks, 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 BlockTransactionTrace, type BlockTransactionsTracesWithInitialReads, type BlockWithTxHashes, BrotherIdImpl, type BrotherIdProviderMethods, type BrotherProfile, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, CairoByteArray, CairoBytes31, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoFelt, CairoFelt252, CairoFixedArray, CairoInt128, CairoInt16, CairoInt32, CairoInt64, CairoInt8, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint128, CairoUint16, CairoUint256, CairoUint32, CairoUint512, CairoUint64, CairoUint8, CairoUint96, 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, ESubscriptionTag, ETH_ADDRESS, ETraceFlag, ETransactionExecutionStatus, ETransactionStatus, ETransactionVersion, ETransactionVersion2, ETransactionVersion3, ETxnResponseFlag, type EVENTS_CHUNK, type EmittedEvent, EntryPointType, type EntryPointsByType, type ErrorReceiptResponseHelper, 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 FastExecuteAccountMethods, type FastExecuteProviderMethods, type FastExecuteResponse, type FastWaitForTransactionOptions, type FeeEstimate, type FeeMode, type FormatResponse, type FunctionAbi, type GasPrices, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, type Hint, type INITIAL_READS, Int, 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 LoadedContract, 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 PRE_CONFIRMED_STATE_UPDATE, type PRICE_UNIT, type ParsedEvent, type ParsedEvents, type ParsedStruct, type ParsingStrategy, type PaymasterDetails, type PaymasterFeeEstimate, PaymasterInterface, type PaymasterOptions, PaymasterRpc, type PaymasterRpcOptions, type PaymasterTimeBounds, type PluginConfig, PluginManager, type PreConfirmedBlock, type PreConfirmedStateUpdate, type PreparedDeployAndInvokeTransaction, type PreparedDeployTransaction, type PreparedInvokeTransaction, type PreparedTransaction, type Program, RpcProvider as Provider, type ProviderHooks, ProviderInterface, type ProviderOptions, type ProviderOrAccount, type PythonicHints, type RESOURCE_PRICE, index$4 as RPC, rpc_0_10_2 as RPC0102, rpc_0_10_3 as RPC0103, 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 ReconnectOptions, type RequiredKeysOf, type ResourceBounds, type ResourceBoundsBN, type ResourceBoundsOverhead, ResponseParser, type RevertedTransactionReceiptResponse, type RevertedTransactionReceiptResponseHelper, RpcChannel, RpcError, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type STATE_UPDATE, type STRK20_ACTION, type STRK20_CALL_AND_PROOF, type STRK20_SHADOW_ACCOUNT_INVOKE_ACTION, 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 StarknetIdAccountMethods, StarknetIdImpl, type StarknetIdProviderMethods, type StarknetPlugin, type StateUpdate, type StateUpdateResponse, type StorageResponse, type SubscribeEventsParams, type SubscribeNewHeadsParams, type SubscribeNewTransactionReceiptsParams, type SubscribeNewTransactionsParams, type SubscribeTransactionStatusParams, Subscription, type SubscriptionBlockIdentifier, type SubscriptionNewHeadsEvent, type SubscriptionNewTransactionEvent, type SubscriptionNewTransactionReceiptsEvent, type SubscriptionOptions, type SubscriptionStarknetEventsEvent, type SubscriptionTransactionStatusEvent, type SuccessfulTransactionReceiptResponse, type SuccessfulTransactionReceiptResponseHelper, type TXN_EXECUTION_STATUS, type 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, WalletAccountV5, WalletAccountV6, WebSocketChannel, type WebSocketModule, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, type WithOptions, addAddressPadding, brotherId, byteArray, cairo, compareVersions, config, constants, contractClassResponseToLegacyCompiledContract, contractLoader, createAbiParser, createTransactionReceipt, defaultDeployer, defaultPlugins, ec, encode, eth, index as events, extractContractHashes, fastExecute, fastParsingStrategy, getAbiVersion, type getBlockTransactionsTracesOptions, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getGasPrices, getLedgerPathBuffer111 as getLedgerPathBuffer, getLedgerPathBuffer111, getLedgerPathBuffer221, type getSimulateTransactionOptions, getTipStatsFromBlocks, index$3 as hash, hdParsingStrategy, isAccount, isFileSystemAvailable, isNoConstructorValid, isPreConfirmedBlock, isPreConfirmedStateUpdate, isPreConfirmedTransaction, 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, starknetId$1 as starknetIdPlugin, toAnyPatchVersion, toApiVersion, toReleaseVersion, index$2 as transaction, typedData, uint256$1 as uint256, units, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, verifyMessageInStarknet, type waitForTransactionOptions, connect as wallet, connectV5 as walletV5, connectV6 as walletV6 };
@@ -207,6 +207,7 @@ var starknet = (() => {
207
207
  starknetIdPlugin: () => starknetId,
208
208
  toAnyPatchVersion: () => toAnyPatchVersion,
209
209
  toApiVersion: () => toApiVersion,
210
+ toReleaseVersion: () => toReleaseVersion,
210
211
  transaction: () => transaction_exports,
211
212
  typedData: () => typedData_exports,
212
213
  uint256: () => uint256_exports,
@@ -10134,13 +10135,16 @@ ${indent}}` : "}";
10134
10135
  }
10135
10136
  return `${parts[0]}.${parts[1]}.*`;
10136
10137
  }
10138
+ function toReleaseVersion(version) {
10139
+ return version.split(/[-+]/)[0];
10140
+ }
10137
10141
  function toApiVersion(version) {
10138
10142
  const [major, minor] = version.replace(/^v/, "").split(".");
10139
10143
  return `v${major}_${minor}`;
10140
10144
  }
10141
10145
  function compareVersions(a, b) {
10142
- const aParts = a.split(".").map(Number);
10143
- const bParts = b.split(".").map(Number);
10146
+ const aParts = toReleaseVersion(a).split(".").map(Number);
10147
+ const bParts = toReleaseVersion(b).split(".").map(Number);
10144
10148
  const maxLen = Math.max(aParts.length, bParts.length);
10145
10149
  for (let i = 0; i < maxLen; i += 1) {
10146
10150
  const aNum = aParts[i] || 0;
@@ -11230,7 +11234,7 @@ ${indent}}` : "}";
11230
11234
  this.chainId = chainId;
11231
11235
  this.headers = { ...channelDefaults.options.headers, ...headers };
11232
11236
  this.retries = retries ?? channelDefaults.options.retries;
11233
- this.specVersion = specVersion;
11237
+ this.specVersion = specVersion ? toReleaseVersion(specVersion) : void 0;
11234
11238
  this.transactionRetryIntervalFallback = transactionRetryIntervalFallback ?? channelDefaults.options.transactionRetryIntervalFallback;
11235
11239
  this.waitMode = waitMode ?? false;
11236
11240
  this.requestId = 0;
@@ -11318,18 +11322,19 @@ ${indent}}` : "}";
11318
11322
  */
11319
11323
  async setUpSpecVersion() {
11320
11324
  if (!this.specVersion) {
11321
- const unknownSpecVersion = await this.fetchEndpoint("starknet_specVersion");
11322
- if (!isVersion(this.channelSpecVersion, unknownSpecVersion)) {
11325
+ const nodeSpecVersion = await this.fetchEndpoint("starknet_specVersion");
11326
+ const specVersion = toReleaseVersion(nodeSpecVersion);
11327
+ if (!isVersion(this.channelSpecVersion, specVersion)) {
11323
11328
  logger.error(SYSTEM_MESSAGES.channelVersionMismatch, {
11324
11329
  channelId: this.id,
11325
11330
  channelSpecVersion: this.channelSpecVersion,
11326
- nodeSpecVersion: this.specVersion
11331
+ nodeSpecVersion
11327
11332
  });
11328
11333
  }
11329
- if (!isSupportedSpecVersion(unknownSpecVersion)) {
11334
+ if (!isSupportedSpecVersion(specVersion)) {
11330
11335
  throw new LibraryError(`${SYSTEM_MESSAGES.unsupportedSpecVersion}, channelId: ${this.id}`);
11331
11336
  }
11332
- this.specVersion = unknownSpecVersion;
11337
+ this.specVersion = specVersion;
11333
11338
  }
11334
11339
  return this.specVersion;
11335
11340
  }
@@ -11875,7 +11880,7 @@ ${indent}}` : "}";
11875
11880
  this.chainId = chainId;
11876
11881
  this.headers = { ...channelDefaults.options.headers, ...headers };
11877
11882
  this.retries = retries ?? channelDefaults.options.retries;
11878
- this.specVersion = specVersion;
11883
+ this.specVersion = specVersion ? toReleaseVersion(specVersion) : void 0;
11879
11884
  this.transactionRetryIntervalFallback = transactionRetryIntervalFallback ?? channelDefaults.options.transactionRetryIntervalFallback;
11880
11885
  this.waitMode = waitMode ?? false;
11881
11886
  this.requestId = 0;
@@ -11963,18 +11968,19 @@ ${indent}}` : "}";
11963
11968
  */
11964
11969
  async setUpSpecVersion() {
11965
11970
  if (!this.specVersion) {
11966
- const unknownSpecVersion = await this.fetchEndpoint("starknet_specVersion");
11967
- if (!isVersion("0.10", unknownSpecVersion)) {
11971
+ const nodeSpecVersion = await this.fetchEndpoint("starknet_specVersion");
11972
+ const specVersion = toReleaseVersion(nodeSpecVersion);
11973
+ if (!isVersion("0.10", specVersion)) {
11968
11974
  logger.error(SYSTEM_MESSAGES.channelVersionMismatch, {
11969
11975
  channelId: this.id,
11970
11976
  channelSpecVersion: this.channelSpecVersion,
11971
- nodeSpecVersion: this.specVersion
11977
+ nodeSpecVersion
11972
11978
  });
11973
11979
  }
11974
- if (!isSupportedSpecVersion(unknownSpecVersion)) {
11980
+ if (!isSupportedSpecVersion(specVersion)) {
11975
11981
  throw new LibraryError(`${SYSTEM_MESSAGES.unsupportedSpecVersion}, channelId: ${this.id}`);
11976
11982
  }
11977
- this.specVersion = unknownSpecVersion;
11983
+ this.specVersion = specVersion;
11978
11984
  }
11979
11985
  return this.specVersion;
11980
11986
  }
@@ -14928,16 +14934,17 @@ ${indent}}` : "}";
14928
14934
  static async create(optionsOrProvider) {
14929
14935
  const channel = new rpc_0_9_0_exports.RpcChannel({ ...optionsOrProvider });
14930
14936
  const spec = await channel.getSpecVersion();
14931
- if (!isSupportedSpecVersion(spec)) {
14937
+ const specVersion = toReleaseVersion(spec);
14938
+ if (!isSupportedSpecVersion(specVersion)) {
14932
14939
  logger.warn(`Using incompatible node spec version ${spec}`);
14933
14940
  }
14934
- if (isVersion("0.9", spec)) {
14941
+ if (isVersion("0.9", specVersion)) {
14935
14942
  return new this({
14936
14943
  ...optionsOrProvider,
14937
14944
  specVersion: _SupportedRpcVersion.v0_9_0
14938
14945
  });
14939
14946
  }
14940
- if (isVersion("0.10", spec)) {
14947
+ if (isVersion("0.10", specVersion)) {
14941
14948
  return new this({
14942
14949
  ...optionsOrProvider,
14943
14950
  specVersion: _SupportedRpcVersion.v0_10_3
@@ -16546,9 +16553,12 @@ ${indent}}` : "}";
16546
16553
  var assertGasFeeFromUnsafeCalls = (unsafeCalls, fees) => {
16547
16554
  const unsafeCall = toOutsideCallV2(unsafeCalls[unsafeCalls.length - 1]);
16548
16555
  const unsafeGasTokenCalldata = CallData.toCalldata(unsafeCall.Calldata);
16549
- const unsafeGasTokenValue = unsafeGasTokenCalldata[1];
16556
+ const unsafeGasTokenValue = uint256ToBN({
16557
+ low: unsafeGasTokenCalldata[1],
16558
+ high: unsafeGasTokenCalldata[2]
16559
+ });
16550
16560
  assert(
16551
- BigInt(unsafeGasTokenValue) === BigInt(fees),
16561
+ unsafeGasTokenValue === BigInt(fees),
16552
16562
  "Gas token value is not equal to the provided gas fees"
16553
16563
  );
16554
16564
  };
@@ -16558,12 +16568,21 @@ ${indent}}` : "}";
16558
16568
  BigInt(unsafeCall.To) === BigInt(gasToken),
16559
16569
  "Gas token address is not equal to the provided gas token"
16560
16570
  );
16571
+ assert(
16572
+ unsafeCall.Selector === getSelectorFromName("transfer"),
16573
+ "Gas token call selector is not a transfer"
16574
+ );
16575
+ assert(
16576
+ CallData.toCalldata(unsafeCall.Calldata).length === 3,
16577
+ "Gas token transfer calldata does not match the expected recipient/amount shape"
16578
+ );
16561
16579
  };
16562
- function assertCallsAreStrictlyEqual(originalCalls, unsafeCalls) {
16580
+ function assertCallsAreStrictlyEqual(originalCalls, unsafeCalls, isSponsored = false) {
16563
16581
  const baseError = "Provided calls are not strictly equal to the returned calls";
16582
+ const expectedExtraCalls = isSponsored ? 0 : 1;
16564
16583
  assert(
16565
- unsafeCalls.length - 1 === originalCalls.length,
16566
- `${baseError}: Expected ${originalCalls.length + 1} calls, got ${unsafeCalls.length}`
16584
+ unsafeCalls.length - expectedExtraCalls === originalCalls.length,
16585
+ `${baseError}: Expected ${originalCalls.length + expectedExtraCalls} calls, got ${unsafeCalls.length}`
16567
16586
  );
16568
16587
  for (let callIndex = 0; callIndex < originalCalls.length; callIndex += 1) {
16569
16588
  const originalCall = originalCalls[callIndex];
@@ -16597,21 +16616,42 @@ ${indent}}` : "}";
16597
16616
  }
16598
16617
  }
16599
16618
  }
16600
- var assertPaymasterTransactionSafety = (preparedTransaction, calls, paymasterDetails, maxFeeInGasToken) => {
16601
- if (paymasterDetails.feeMode.mode !== "sponsored") {
16602
- if (preparedTransaction.type === "invoke" || preparedTransaction.type === "deploy_and_invoke") {
16603
- const unsafeCalls = "calls" in preparedTransaction.typed_data.message ? preparedTransaction.typed_data.message.calls : preparedTransaction.typed_data.message.Calls;
16604
- assertCallsAreStrictlyEqual(calls, unsafeCalls);
16619
+ var domainFieldToFelt = (value) => {
16620
+ try {
16621
+ return toBigInt(value);
16622
+ } catch {
16623
+ return toBigInt(encodeShortString(String(value)));
16624
+ }
16625
+ };
16626
+ var assertChainIdFromTypedData = (typedData, chainId) => {
16627
+ assert(
16628
+ typedData.domain.chainId !== void 0 && domainFieldToFelt(typedData.domain.chainId) === BigInt(chainId),
16629
+ "Paymaster typed data domain chainId does not match the account's provider chain"
16630
+ );
16631
+ };
16632
+ var assertPaymasterTransactionSafety = (preparedTransaction, calls, paymasterDetails, chainId, maxFeeInGasToken) => {
16633
+ if (preparedTransaction.type === "invoke" || preparedTransaction.type === "deploy_and_invoke") {
16634
+ assertChainIdFromTypedData(preparedTransaction.typed_data, chainId);
16635
+ const { message } = preparedTransaction.typed_data;
16636
+ const hasV1Calls = "calls" in message;
16637
+ const hasV2Calls = "Calls" in message;
16638
+ assert(
16639
+ hasV1Calls !== hasV2Calls,
16640
+ 'Paymaster typed data must declare exactly one of "calls" (SNIP-9 V1) or "Calls" (SNIP-9 V2)'
16641
+ );
16642
+ const unsafeCalls = hasV1Calls ? message.calls : message.Calls;
16643
+ assertCallsAreStrictlyEqual(calls, unsafeCalls, paymasterDetails.feeMode.mode === "sponsored");
16644
+ if (paymasterDetails.feeMode.mode !== "sponsored") {
16605
16645
  assertGasTokenFromUnsafeCalls(unsafeCalls, paymasterDetails.feeMode.gasToken);
16646
+ assertGasFeeFromUnsafeCalls(
16647
+ unsafeCalls,
16648
+ preparedTransaction.fee.suggested_max_fee_in_gas_token
16649
+ );
16606
16650
  if (maxFeeInGasToken) {
16607
16651
  assert(
16608
16652
  preparedTransaction.fee.suggested_max_fee_in_gas_token <= maxFeeInGasToken,
16609
16653
  "Gas token price is too high"
16610
16654
  );
16611
- assertGasFeeFromUnsafeCalls(
16612
- unsafeCalls,
16613
- preparedTransaction.fee.suggested_max_fee_in_gas_token
16614
- );
16615
16655
  }
16616
16656
  }
16617
16657
  }
@@ -17736,6 +17776,7 @@ ${indent}}` : "}";
17736
17776
  preparedTransaction,
17737
17777
  calls,
17738
17778
  paymasterDetails,
17779
+ await this.provider.getChainId(),
17739
17780
  maxFeeInGasToken
17740
17781
  );
17741
17782
  const transaction = await this.preparePaymasterTransaction(preparedTransaction);