starknet 10.0.0-beta.1 → 10.0.0-beta.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,9 @@
1
+ # [10.0.0-beta.2](https://github.com/starknet-io/starknet.js/compare/v10.0.0-beta.1...v10.0.0-beta.2) (2026-02-27)
2
+
3
+ ### Features
4
+
5
+ - remove default providers - resolve unintended side effect initializations ([ea581a8](https://github.com/starknet-io/starknet.js/commit/ea581a821a517362886e16075068b8ce4104e7a7))
6
+
1
7
  # [10.0.0-beta.1](https://github.com/starknet-io/starknet.js/compare/v9.5.0-beta.2...v10.0.0-beta.1) (2026-02-24)
2
8
 
3
9
  - feat!: refactor Account to use composition pattern, plugin system, docs\ \ BREAKING CHANGE: Account no longer extends Provider. Provider methods must now be accessed via account.provider property. \ Changes: - Account uses composition instead of inheritance - Add plugin system to replace ts-mixer - Update all tests to use account.provider.xyz() - Create migration guide and plugin documentation ([31d9458](https://github.com/starknet-io/starknet.js/commit/31d94587676a543c71dbd64b92d0e65d0ee3aa38))
package/dist/index.d.ts CHANGED
@@ -2327,8 +2327,6 @@ declare class PaymasterRpc implements PaymasterInterface {
2327
2327
  getSupportedTokens(): Promise<TokenData[]>;
2328
2328
  }
2329
2329
 
2330
- declare const defaultPaymaster: PaymasterRpc;
2331
-
2332
2330
  /**
2333
2331
  * Configuration options for creating an Account instance
2334
2332
  */
@@ -2973,7 +2971,6 @@ type RpcProviderOptions = {
2973
2971
  blockIdentifier?: BlockIdentifier;
2974
2972
  chainId?: _StarknetChainId;
2975
2973
  specVersion?: _SupportedRpcVersion;
2976
- default?: boolean;
2977
2974
  waitMode?: boolean;
2978
2975
  baseFetch?: WindowOrWorkerGlobalScope['fetch'];
2979
2976
  resourceBoundsOverhead?: ResourceBoundsOverhead | false;
@@ -3574,7 +3571,7 @@ type ContractOptions = {
3574
3571
  /**
3575
3572
  * Connect account to read and write methods
3576
3573
  * Connect provider to read methods
3577
- * @default defaultProvider
3574
+ * @default creates a new RpcProvider if not provided
3578
3575
  */
3579
3576
  providerOrAccount?: ProviderOrAccount;
3580
3577
  /**
@@ -5575,8 +5572,6 @@ declare function verifyMessageInStarknet(provider: ProviderInterface, message: B
5575
5572
 
5576
5573
  declare function getGasPrices(channel: RpcChannel$1 | RpcChannel, blockIdentifier?: BlockIdentifier): Promise<GasPrices>;
5577
5574
 
5578
- declare const defaultProvider: RpcProvider;
5579
-
5580
5575
  declare class Account implements AccountInterface {
5581
5576
  provider: RpcProvider;
5582
5577
  signer: SignerInterface;
@@ -5891,8 +5886,9 @@ declare abstract class ContractInterface {
5891
5886
  abstract address: string;
5892
5887
  /**
5893
5888
  * Provider for read operations or Account for write operations
5889
+ * Optional - a default RpcProvider will be created on first async operation if not provided
5894
5890
  */
5895
- abstract providerOrAccount: ProviderOrAccount;
5891
+ abstract providerOrAccount?: ProviderOrAccount;
5896
5892
  /**
5897
5893
  * Optional contract class hash for optimization
5898
5894
  */
@@ -6081,10 +6077,11 @@ type TypedContractV2<TAbi extends Abi$1> = TypedContract<TAbi> & Contract;
6081
6077
  declare class Contract implements ContractInterface {
6082
6078
  abi: Abi;
6083
6079
  address: string;
6084
- providerOrAccount: ProviderOrAccount;
6080
+ providerOrAccount?: ProviderOrAccount;
6085
6081
  classHash?: string;
6086
6082
  parseRequest: boolean;
6087
6083
  parseResponse: boolean;
6084
+ private defaultProvider?;
6088
6085
  private structs;
6089
6086
  private events;
6090
6087
  readonly functions: {
@@ -6108,11 +6105,16 @@ declare class Contract implements ContractInterface {
6108
6105
  * @private
6109
6106
  */
6110
6107
  private get provider();
6108
+ /**
6109
+ * Lazily initialize and cache the default provider with node version detection
6110
+ * @private
6111
+ */
6112
+ private ensureProvider;
6111
6113
  /**
6112
6114
  * @param options
6113
6115
  * - abi: Abi of the contract object (required)
6114
6116
  * - address: address to connect to (required)
6115
- * - providerOrAccount?: Provider or Account to attach to (fallback to defaultProvider)
6117
+ * - providerOrAccount?: Provider or Account to attach to (optional, creates default RpcProvider on first use with auto node detection)
6116
6118
  * - parseRequest?: compile and validate arguments (optional, default true)
6117
6119
  * - parseResponse?: Parse elements of the response array and structuring them into response object (optional, default true)
6118
6120
  * - parser?: Abi parser (optional, default createAbiParser(options.abi))
@@ -8461,16 +8463,15 @@ declare function extractAbi(contract: ContractClass): Abi;
8461
8463
  /**
8462
8464
  * Return randomly select available public node
8463
8465
  * @param {NetworkName} networkName NetworkName
8464
- * @param {boolean} mute mute public node warning
8465
8466
  * @returns {string} default node url
8466
8467
  * @example
8467
8468
  * ```typescript
8468
- * const result= provider.getDefaultNodeUrl(constants.NetworkName.SN_MAIN,false);
8469
+ * const result= provider.getDefaultNodeUrl(constants.NetworkName.SN_MAIN);
8469
8470
  * // console : "Using default public node url, please provide nodeUrl in provider options!"
8470
8471
  * // result = "https://starknet-mainnet.public.blastapi.io/rpc/v0_9"
8471
8472
  * ```
8472
8473
  */
8473
- declare const getDefaultNodeUrl: (networkName?: _NetworkName, mute?: boolean, rpcVersion?: _SupportedRpcVersion) => string;
8474
+ declare const getDefaultNodeUrl: (networkName?: _NetworkName, rpcVersion?: _SupportedRpcVersion) => string;
8474
8475
  /**
8475
8476
  * return Defaults RPC Nodes endpoints
8476
8477
  */
@@ -10184,4 +10185,4 @@ declare class Logger {
10184
10185
  */
10185
10186
  declare const logger: Logger;
10186
10187
 
10187
- 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 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_0 as RPC010, 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 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 Storage, 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, WebSocketChannel, type WebSocketModule, WebSocketNotConnectedError, type WebSocketOptions, type WeierstrassSignatureType, type WithOptions, addAddressPadding, brotherId, byteArray, cairo, compareVersions, config, constants, contractClassResponseToLegacyCompiledContract, contractLoader, createAbiParser, createTransactionReceipt, defaultDeployer, defaultPaymaster, defaultPlugins, defaultProvider, ec, encode, eth, index as events, extractContractHashes, type fastExecuteResponse, fastParsingStrategy, type fastWaitForTransactionOptions, 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, 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 };
10188
+ 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 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_0 as RPC010, 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 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 Storage, 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, 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, type fastExecuteResponse, fastParsingStrategy, type fastWaitForTransactionOptions, 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, 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 };
@@ -159,9 +159,7 @@ var starknet = (() => {
159
159
  createAbiParser: () => createAbiParser,
160
160
  createTransactionReceipt: () => createTransactionReceipt,
161
161
  defaultDeployer: () => defaultDeployer,
162
- defaultPaymaster: () => defaultPaymaster,
163
162
  defaultPlugins: () => defaultPlugins,
164
- defaultProvider: () => defaultProvider,
165
163
  ec: () => ec_exports,
166
164
  encode: () => encode_exports,
167
165
  eth: () => eth_exports,
@@ -10902,10 +10900,8 @@ ${indent}}` : "}";
10902
10900
  function extractAbi(contract) {
10903
10901
  return isString(contract.abi) ? parse2(contract.abi) : contract.abi;
10904
10902
  }
10905
- var getDefaultNodeUrl = (networkName, mute = false, rpcVersion) => {
10906
- if (!mute) {
10907
- logger.info("Using default public node url, please provide nodeUrl in provider options!");
10908
- }
10903
+ var getDefaultNodeUrl = (networkName, rpcVersion) => {
10904
+ logger.info("Using default public node url, please provide nodeUrl in provider options!");
10909
10905
  const rpcNodes = getDefaultNodes(rpcVersion ?? config.get("rpcVersion"));
10910
10906
  const nodes = rpcNodes[networkName ?? _NetworkName.SN_SEPOLIA];
10911
10907
  const randIdx = Math.floor(Math.random() * nodes.length);
@@ -11123,19 +11119,11 @@ ${indent}}` : "}";
11123
11119
  waitMode
11124
11120
  } = optionsOrProvider || {};
11125
11121
  if (Object.values(_NetworkName).includes(nodeUrl)) {
11126
- this.nodeUrl = getDefaultNodeUrl(
11127
- nodeUrl,
11128
- optionsOrProvider?.default,
11129
- this.channelSpecVersion
11130
- );
11122
+ this.nodeUrl = getDefaultNodeUrl(nodeUrl, this.channelSpecVersion);
11131
11123
  } else if (nodeUrl) {
11132
11124
  this.nodeUrl = nodeUrl;
11133
11125
  } else {
11134
- this.nodeUrl = getDefaultNodeUrl(
11135
- void 0,
11136
- optionsOrProvider?.default,
11137
- this.channelSpecVersion
11138
- );
11126
+ this.nodeUrl = getDefaultNodeUrl(void 0, this.channelSpecVersion);
11139
11127
  }
11140
11128
  const channelDefaults = config.get("channelDefaults");
11141
11129
  this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
@@ -11721,19 +11709,11 @@ ${indent}}` : "}";
11721
11709
  waitMode
11722
11710
  } = optionsOrProvider || {};
11723
11711
  if (Object.values(_NetworkName).includes(nodeUrl)) {
11724
- this.nodeUrl = getDefaultNodeUrl(
11725
- nodeUrl,
11726
- optionsOrProvider?.default,
11727
- this.channelSpecVersion
11728
- );
11712
+ this.nodeUrl = getDefaultNodeUrl(nodeUrl, this.channelSpecVersion);
11729
11713
  } else if (nodeUrl) {
11730
11714
  this.nodeUrl = nodeUrl;
11731
11715
  } else {
11732
- this.nodeUrl = getDefaultNodeUrl(
11733
- void 0,
11734
- optionsOrProvider?.default,
11735
- this.channelSpecVersion
11736
- );
11716
+ this.nodeUrl = getDefaultNodeUrl(void 0, this.channelSpecVersion);
11737
11717
  }
11738
11718
  const channelDefaults = config.get("channelDefaults");
11739
11719
  this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
@@ -14893,9 +14873,6 @@ ${indent}}` : "}";
14893
14873
  var ProviderInterface = class {
14894
14874
  };
14895
14875
 
14896
- // src/provider/index.ts
14897
- var defaultProvider = new RpcProvider({ default: true });
14898
-
14899
14876
  // src/signer/interface.ts
14900
14877
  var SignerInterface = class {
14901
14878
  };
@@ -16435,9 +16412,6 @@ ${indent}}` : "}";
16435
16412
  var PaymasterInterface = class {
16436
16413
  };
16437
16414
 
16438
- // src/paymaster/index.ts
16439
- var defaultPaymaster = new PaymasterRpc({ default: true });
16440
-
16441
16415
  // src/deployer/default.ts
16442
16416
  var Deployer = class {
16443
16417
  address;
@@ -16551,7 +16525,7 @@ ${indent}}` : "}";
16551
16525
  this.cairoVersion = cairoVersion.toString();
16552
16526
  }
16553
16527
  this.transactionVersion = transactionVersion ?? config.get("transactionVersion");
16554
- this.paymaster = paymaster ? new PaymasterRpc(paymaster) : defaultPaymaster;
16528
+ this.paymaster = paymaster ? new PaymasterRpc(paymaster) : new PaymasterRpc();
16555
16529
  this.deployer = options.deployer ?? defaultDeployer;
16556
16530
  this.defaultTipType = defaultTipType ?? config.get("defaultTipType");
16557
16531
  this.accountPluginManager = new PluginManager();
@@ -17876,6 +17850,7 @@ ${indent}}` : "}";
17876
17850
  classHash;
17877
17851
  parseRequest;
17878
17852
  parseResponse;
17853
+ defaultProvider;
17879
17854
  structs;
17880
17855
  events;
17881
17856
  functions;
@@ -17890,13 +17865,36 @@ ${indent}}` : "}";
17890
17865
  * @private
17891
17866
  */
17892
17867
  get provider() {
17868
+ if (!this.providerOrAccount) {
17869
+ throw new Error(
17870
+ "Contract is not connected to a provider or account. Provide one during construction or call an async method to auto-initialize."
17871
+ );
17872
+ }
17893
17873
  return isAccount(this.providerOrAccount) ? this.providerOrAccount.provider : this.providerOrAccount;
17894
17874
  }
17875
+ /**
17876
+ * Lazily initialize and cache the default provider with node version detection
17877
+ * @private
17878
+ */
17879
+ async ensureProvider() {
17880
+ if (this.defaultProvider) {
17881
+ return this.defaultProvider;
17882
+ }
17883
+ if (this.providerOrAccount) {
17884
+ if (isAccount(this.providerOrAccount)) {
17885
+ return this.providerOrAccount.provider;
17886
+ }
17887
+ return this.providerOrAccount;
17888
+ }
17889
+ this.defaultProvider = await RpcProvider.create();
17890
+ this.providerOrAccount = this.defaultProvider;
17891
+ return this.defaultProvider;
17892
+ }
17895
17893
  /**
17896
17894
  * @param options
17897
17895
  * - abi: Abi of the contract object (required)
17898
17896
  * - address: address to connect to (required)
17899
- * - providerOrAccount?: Provider or Account to attach to (fallback to defaultProvider)
17897
+ * - providerOrAccount?: Provider or Account to attach to (optional, creates default RpcProvider on first use with auto node detection)
17900
17898
  * - parseRequest?: compile and validate arguments (optional, default true)
17901
17899
  * - parseResponse?: Parse elements of the response array and structuring them into response object (optional, default true)
17902
17900
  * - parser?: Abi parser (optional, default createAbiParser(options.abi))
@@ -17906,7 +17904,7 @@ ${indent}}` : "}";
17906
17904
  const parser = createAbiParser(options.abi, options.parsingStrategy);
17907
17905
  this.abi = parser.getLegacyFormat();
17908
17906
  this.address = options.address && options.address.toLowerCase();
17909
- this.providerOrAccount = options.providerOrAccount ?? defaultProvider;
17907
+ this.providerOrAccount = options.providerOrAccount;
17910
17908
  this.parseRequest = options.parseRequest ?? true;
17911
17909
  this.parseResponse = options.parseResponse ?? true;
17912
17910
  this.classHash = options.classHash;
@@ -17971,7 +17969,8 @@ ${indent}}` : "}";
17971
17969
  }
17972
17970
  async isDeployed() {
17973
17971
  try {
17974
- await this.provider.getClassHashAt(this.address);
17972
+ const provider = await this.ensureProvider();
17973
+ await provider.getClassHashAt(this.address);
17975
17974
  } catch (error) {
17976
17975
  const errorMessage = error instanceof Error ? error.message : String(error);
17977
17976
  throw new Error(`Contract not deployed at address ${this.address}: ${errorMessage}`);
@@ -17993,7 +17992,8 @@ ${indent}}` : "}";
17993
17992
  logger.warn("Call skipped parsing but provided rawArgs, possible malfunction request");
17994
17993
  return args;
17995
17994
  });
17996
- return this.provider.callContract(
17995
+ const provider = await this.ensureProvider();
17996
+ return provider.callContract(
17997
17997
  {
17998
17998
  contractAddress: this.address,
17999
17999
  calldata,
@@ -18026,6 +18026,7 @@ ${indent}}` : "}";
18026
18026
  calldata,
18027
18027
  entrypoint: method
18028
18028
  };
18029
+ await this.ensureProvider();
18029
18030
  if (isAccount(this.providerOrAccount)) {
18030
18031
  if (restInvokeOptions.paymasterDetails) {
18031
18032
  const myCall = {
@@ -18043,7 +18044,8 @@ ${indent}}` : "}";
18043
18044
  ...restInvokeOptions
18044
18045
  });
18045
18046
  if (waitForTransaction) {
18046
- const result2 = await this.provider.waitForTransaction(
18047
+ const provider2 = await this.ensureProvider();
18048
+ const result2 = await provider2.waitForTransaction(
18047
18049
  result.transaction_hash
18048
18050
  );
18049
18051
  if (result2.isSuccess()) {
@@ -18056,7 +18058,8 @@ ${indent}}` : "}";
18056
18058
  if (!restInvokeOptions.nonce)
18057
18059
  throw new Error(`Manual nonce is required when invoking a function without an account`);
18058
18060
  logger.warn(`Invoking ${method} without an account.`);
18059
- return this.provider.invokeFunction(
18061
+ const provider = await this.ensureProvider();
18062
+ return provider.invokeFunction(
18060
18063
  {
18061
18064
  ...invocation,
18062
18065
  signature
@@ -18073,6 +18076,7 @@ ${indent}}` : "}";
18073
18076
  this.callData.validate(ValidateType.INVOKE, method, args);
18074
18077
  }
18075
18078
  const invocation = this.populate(method, args);
18079
+ await this.ensureProvider();
18076
18080
  if (isAccount(this.providerOrAccount)) {
18077
18081
  if (estimateDetails.paymasterDetails) {
18078
18082
  const myCall = {
@@ -18115,7 +18119,8 @@ ${indent}}` : "}";
18115
18119
  return cairo_exports.isCairo1Abi(this.abi);
18116
18120
  }
18117
18121
  async getVersion() {
18118
- return this.provider.getContractVersion(this.address);
18122
+ const provider = await this.ensureProvider();
18123
+ return provider.getContractVersion(this.address);
18119
18124
  }
18120
18125
  typedv2(tAbi) {
18121
18126
  return this;