starknet 9.1.1 → 9.2.0

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
+ # [9.2.0](https://github.com/starknet-io/starknet.js/compare/v9.1.1...v9.2.0) (2025-12-10)
2
+
3
+ ### Features
4
+
5
+ - default channel options, estimate and simulate flags defaults n… ([#1546](https://github.com/starknet-io/starknet.js/issues/1546)) ([d1d3cef](https://github.com/starknet-io/starknet.js/commit/d1d3cef8220c9b99c28b2bdfaf3b14db91ee09e9))
6
+
1
7
  ## [9.1.1](https://github.com/starknet-io/starknet.js/compare/v9.1.0...v9.1.1) (2025-12-09)
2
8
 
3
9
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -875,6 +875,17 @@ type ContractVersion = {
875
875
  compiler: CompilerVersion;
876
876
  };
877
877
 
878
+ declare const LogLevelIndex: {
879
+ DEBUG: number;
880
+ INFO: number;
881
+ WARN: number;
882
+ ERROR: number;
883
+ FATAL: number;
884
+ OFF: number;
885
+ };
886
+ type LogLevelIndex = ValuesType<typeof LogLevelIndex>;
887
+ type LogLevel = keyof typeof LogLevelIndex;
888
+
878
889
  interface ProviderOptions extends RpcProviderOptions {
879
890
  }
880
891
  type RpcProviderOptions = {
@@ -1752,127 +1763,6 @@ declare class PaymasterRpc implements PaymasterInterface {
1752
1763
 
1753
1764
  declare const defaultPaymaster: PaymasterRpc;
1754
1765
 
1755
- /**
1756
- * Result of provider.getTipStatsFromBlocks().
1757
- * @param {bigint} minTip - minimum tip encountered in the analyzed blocks.
1758
- * @param {bigint} maxTip - maximum tip encountered in the analyzed blocks.
1759
- * @param {bigint} averageTip - average tip encountered in the analyzed blocks.
1760
- * @param {bigint} medianTip - median (middle value) tip encountered in the analyzed blocks.
1761
- * @param {bigint} modeTip - mode (most frequent) tip encountered in the analyzed blocks.
1762
- * @param {bigint} recommendedTip - suggested tip amount (median tip) for optimal inclusion probability.
1763
- * @param {bigint} p90Tip - 90th percentile tip (90% of tips are below this value).
1764
- * @param {bigint} p95Tip - 95th percentile tip (95% of tips are below this value).
1765
- * @param {object} metrics - Optional performance metrics for the analysis.
1766
- */
1767
- type TipEstimate = {
1768
- minTip: bigint;
1769
- maxTip: bigint;
1770
- averageTip: bigint;
1771
- medianTip: bigint;
1772
- modeTip: bigint;
1773
- recommendedTip: bigint;
1774
- p90Tip: bigint;
1775
- p95Tip: bigint;
1776
- metrics?: {
1777
- blocksAnalyzed: number;
1778
- transactionsTipsFound: bigint[];
1779
- };
1780
- };
1781
- type TipType = Exclude<keyof TipEstimate, 'metrics'>;
1782
- /**
1783
- * Options for customizing tip analysis behavior.
1784
- */
1785
- type TipAnalysisOptions = {
1786
- /**
1787
- * Maximum number of blocks to analyze going backwards from the starting block.
1788
- * @default 3
1789
- */
1790
- maxBlocks?: number;
1791
- /**
1792
- * Minimum number of transactions required to generate reliable statistics.
1793
- * @default 10
1794
- */
1795
- minTxsNecessary?: number;
1796
- /**
1797
- * Whether to include transactions with zero tips in the analysis.
1798
- * @default true
1799
- */
1800
- includeZeroTips?: boolean;
1801
- };
1802
- /**
1803
- * Analyzes tip statistics from recent blocks to help determine optimal tip amounts.
1804
- *
1805
- * This function examines V3 invoke transactions across multiple recent blocks to calculate
1806
- * minimum, maximum, and average tip amounts. This data can be used to determine an
1807
- * appropriate tip for new transactions.
1808
- *
1809
- * **Performance Notes:**
1810
- * - Automatically detects if your provider has batching enabled
1811
- * - When batching is enabled, all block requests are made in parallel and automatically
1812
- * batched into a single HTTP request for maximum efficiency
1813
- * - When batching is not enabled, requests are made sequentially with early exit capability
1814
- *
1815
- * @param provider - RPC provider for blockchain communication
1816
- * @param blockIdentifier - Starting block for analysis (goes backwards from this block)
1817
- * @param options - Configuration options for the analysis
1818
- * @returns Promise resolving to TipEstimate object
1819
- *
1820
- * @throws {Error} When invalid parameters are provided
1821
- * @throws {LibraryError} When RPC calls fail, data is invalid, or insufficient transaction data is found
1822
- *
1823
- * @example
1824
- * ```typescript
1825
- * import { RpcProvider } from 'starknet';
1826
- *
1827
- * // Create provider with batching for optimal performance
1828
- * const provider = new RpcProvider({
1829
- * nodeUrl: 'your_node_url',
1830
- * batch: 50 // 50ms batch interval - automatically detected and used
1831
- * });
1832
- *
1833
- * // Basic usage - automatically uses best strategy
1834
- * const tipStats = await getTipStatsFromBlocks(provider, 'latest');
1835
- * console.log(`Recommended tip (median): ${tipStats.recommendedTip}`);
1836
- * console.log(`90th percentile tip: ${tipStats.p90Tip}`);
1837
- * console.log(`95th percentile tip: ${tipStats.p95Tip}`);
1838
- *
1839
- * // Advanced usage with custom options
1840
- * const tipStats = await getTipStatsFromBlocks(
1841
- * provider,
1842
- * 'latest',
1843
- * {
1844
- * maxBlocks: 10,
1845
- * minTxsNecessary: 5,
1846
- * includeZeroTips: true
1847
- * }
1848
- * );
1849
- *
1850
- * // Check if we have sufficient data
1851
- * if (tipStats.recommendedTip === 0n) {
1852
- * console.log('Insufficient transaction data for reliable tip estimation');
1853
- * } else {
1854
- * console.log(`Recommended tip: ${tipStats.recommendedTip}`);
1855
- * console.log(`Average tip: ${tipStats.averageTip}`);
1856
- * console.log(`Median tip: ${tipStats.medianTip}`);
1857
- * console.log(`Mode tip: ${tipStats.modeTip}`);
1858
- * console.log(`Min tip: ${tipStats.minTip}, Max tip: ${tipStats.maxTip}`);
1859
- * console.log(`P90 tip: ${tipStats.p90Tip} (90% of tips are below this)`);
1860
- * console.log(`P95 tip: ${tipStats.p95Tip} (95% of tips are below this)`);
1861
- *
1862
- * // Access performance metrics if available
1863
- * if (tipStats.metrics) {
1864
- * console.log(`Analyzed ${tipStats.metrics.transactionsFound} transactions`);
1865
- * console.log(`Across ${tipStats.metrics.blocksAnalyzed} blocks`);
1866
- * }
1867
- * }
1868
- *
1869
- * // Using specific block number
1870
- * const blockNumber = 650000;
1871
- * const historicalTips = await getTipStatsFromBlocks(provider, blockNumber);
1872
- * ```
1873
- */
1874
- declare function getTipStatsFromBlocks(provider: ProviderInterface, blockIdentifier?: BlockIdentifier, options?: TipAnalysisOptions): Promise<TipEstimate>;
1875
-
1876
1766
  type TransactionStatusReceiptSets = {
1877
1767
  SUCCEEDED: SuccessfulTransactionReceiptResponse;
1878
1768
  REVERTED: RevertedTransactionReceiptResponse;
@@ -3443,16 +3333,126 @@ declare global {
3443
3333
  }
3444
3334
  }
3445
3335
 
3446
- declare const LogLevelIndex: {
3447
- DEBUG: number;
3448
- INFO: number;
3449
- WARN: number;
3450
- ERROR: number;
3451
- FATAL: number;
3452
- OFF: number;
3336
+ /**
3337
+ * Result of provider.getTipStatsFromBlocks().
3338
+ * @param {bigint} minTip - minimum tip encountered in the analyzed blocks.
3339
+ * @param {bigint} maxTip - maximum tip encountered in the analyzed blocks.
3340
+ * @param {bigint} averageTip - average tip encountered in the analyzed blocks.
3341
+ * @param {bigint} medianTip - median (middle value) tip encountered in the analyzed blocks.
3342
+ * @param {bigint} modeTip - mode (most frequent) tip encountered in the analyzed blocks.
3343
+ * @param {bigint} recommendedTip - suggested tip amount (median tip) for optimal inclusion probability.
3344
+ * @param {bigint} p90Tip - 90th percentile tip (90% of tips are below this value).
3345
+ * @param {bigint} p95Tip - 95th percentile tip (95% of tips are below this value).
3346
+ * @param {object} metrics - Optional performance metrics for the analysis.
3347
+ */
3348
+ type TipEstimate = {
3349
+ minTip: bigint;
3350
+ maxTip: bigint;
3351
+ averageTip: bigint;
3352
+ medianTip: bigint;
3353
+ modeTip: bigint;
3354
+ recommendedTip: bigint;
3355
+ p90Tip: bigint;
3356
+ p95Tip: bigint;
3357
+ metrics?: {
3358
+ blocksAnalyzed: number;
3359
+ transactionsTipsFound: bigint[];
3360
+ };
3453
3361
  };
3454
- type LogLevelIndex = ValuesType<typeof LogLevelIndex>;
3455
- type LogLevel = keyof typeof LogLevelIndex;
3362
+ type TipType = Exclude<keyof TipEstimate, 'metrics'>;
3363
+ /**
3364
+ * Options for customizing tip analysis behavior.
3365
+ */
3366
+ type TipAnalysisOptions = {
3367
+ /**
3368
+ * Maximum number of blocks to analyze going backwards from the starting block.
3369
+ * @default 3
3370
+ */
3371
+ maxBlocks?: number;
3372
+ /**
3373
+ * Minimum number of transactions required to generate reliable statistics.
3374
+ * @default 10
3375
+ */
3376
+ minTxsNecessary?: number;
3377
+ /**
3378
+ * Whether to include transactions with zero tips in the analysis.
3379
+ * @default true
3380
+ */
3381
+ includeZeroTips?: boolean;
3382
+ };
3383
+ /**
3384
+ * Analyzes tip statistics from recent blocks to help determine optimal tip amounts.
3385
+ *
3386
+ * This function examines V3 invoke transactions across multiple recent blocks to calculate
3387
+ * minimum, maximum, and average tip amounts. This data can be used to determine an
3388
+ * appropriate tip for new transactions.
3389
+ *
3390
+ * **Performance Notes:**
3391
+ * - Automatically detects if your provider has batching enabled
3392
+ * - When batching is enabled, all block requests are made in parallel and automatically
3393
+ * batched into a single HTTP request for maximum efficiency
3394
+ * - When batching is not enabled, requests are made sequentially with early exit capability
3395
+ *
3396
+ * @param provider - RPC provider for blockchain communication
3397
+ * @param blockIdentifier - Starting block for analysis (goes backwards from this block)
3398
+ * @param options - Configuration options for the analysis
3399
+ * @returns Promise resolving to TipEstimate object
3400
+ *
3401
+ * @throws {Error} When invalid parameters are provided
3402
+ * @throws {LibraryError} When RPC calls fail, data is invalid, or insufficient transaction data is found
3403
+ *
3404
+ * @example
3405
+ * ```typescript
3406
+ * import { RpcProvider } from 'starknet';
3407
+ *
3408
+ * // Create provider with batching for optimal performance
3409
+ * const provider = new RpcProvider({
3410
+ * nodeUrl: 'your_node_url',
3411
+ * batch: 50 // 50ms batch interval - automatically detected and used
3412
+ * });
3413
+ *
3414
+ * // Basic usage - automatically uses best strategy
3415
+ * const tipStats = await getTipStatsFromBlocks(provider, 'latest');
3416
+ * console.log(`Recommended tip (median): ${tipStats.recommendedTip}`);
3417
+ * console.log(`90th percentile tip: ${tipStats.p90Tip}`);
3418
+ * console.log(`95th percentile tip: ${tipStats.p95Tip}`);
3419
+ *
3420
+ * // Advanced usage with custom options
3421
+ * const tipStats = await getTipStatsFromBlocks(
3422
+ * provider,
3423
+ * 'latest',
3424
+ * {
3425
+ * maxBlocks: 10,
3426
+ * minTxsNecessary: 5,
3427
+ * includeZeroTips: true
3428
+ * }
3429
+ * );
3430
+ *
3431
+ * // Check if we have sufficient data
3432
+ * if (tipStats.recommendedTip === 0n) {
3433
+ * console.log('Insufficient transaction data for reliable tip estimation');
3434
+ * } else {
3435
+ * console.log(`Recommended tip: ${tipStats.recommendedTip}`);
3436
+ * console.log(`Average tip: ${tipStats.averageTip}`);
3437
+ * console.log(`Median tip: ${tipStats.medianTip}`);
3438
+ * console.log(`Mode tip: ${tipStats.modeTip}`);
3439
+ * console.log(`Min tip: ${tipStats.minTip}, Max tip: ${tipStats.maxTip}`);
3440
+ * console.log(`P90 tip: ${tipStats.p90Tip} (90% of tips are below this)`);
3441
+ * console.log(`P95 tip: ${tipStats.p95Tip} (95% of tips are below this)`);
3442
+ *
3443
+ * // Access performance metrics if available
3444
+ * if (tipStats.metrics) {
3445
+ * console.log(`Analyzed ${tipStats.metrics.transactionsFound} transactions`);
3446
+ * console.log(`Across ${tipStats.metrics.blocksAnalyzed} blocks`);
3447
+ * }
3448
+ * }
3449
+ *
3450
+ * // Using specific block number
3451
+ * const blockNumber = 650000;
3452
+ * const historicalTips = await getTipStatsFromBlocks(provider, blockNumber);
3453
+ * ```
3454
+ */
3455
+ declare function getTipStatsFromBlocks(provider: ProviderInterface, blockIdentifier?: BlockIdentifier, options?: TipAnalysisOptions): Promise<TipEstimate>;
3456
3456
 
3457
3457
  declare const IS_BROWSER: boolean;
3458
3458
  /**
@@ -3887,12 +3887,35 @@ type _SupportedRpcVersion = ValuesType<typeof _SupportedRpcVersion>;
3887
3887
 
3888
3888
  type SupportedTransactionVersion = typeof ETransactionVersion$1.V3;
3889
3889
  type SupportedCairoVersion = '1';
3890
+ /**
3891
+ * Channel method-specific options
3892
+ */
3893
+ type ChannelMethodOptions = {
3894
+ simulateTransaction: Omit<getSimulateTransactionOptions, 'blockIdentifier'>;
3895
+ getEstimateFee: Omit<getEstimateFeeBulkOptions, 'blockIdentifier'>;
3896
+ };
3897
+ /**
3898
+ * Channel default options
3899
+ */
3900
+ type ChannelDefaultOptions = {
3901
+ headers: Record<string, string>;
3902
+ blockIdentifier: BlockTag;
3903
+ retries: number;
3904
+ };
3905
+ /**
3906
+ * Channel defaults configuration
3907
+ */
3908
+ type ChannelDefaults = {
3909
+ options: ChannelDefaultOptions;
3910
+ methods: ChannelMethodOptions;
3911
+ };
3890
3912
  declare const DEFAULT_GLOBAL_CONFIG: {
3891
3913
  logLevel: LogLevel;
3892
3914
  rpcVersion: _SupportedRpcVersion;
3893
3915
  transactionVersion: SupportedTransactionVersion;
3894
3916
  resourceBoundsOverhead: ResourceBoundsOverhead;
3895
3917
  defaultTipType: TipType;
3918
+ channelDefaults: ChannelDefaults;
3896
3919
  fetch: any;
3897
3920
  websocket: any;
3898
3921
  buffer: any;
@@ -3934,6 +3957,9 @@ declare const SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS: "0.14.1";
3934
3957
 
3935
3958
  declare const constants_ADDR_BOUND: typeof ADDR_BOUND;
3936
3959
  declare const constants_API_VERSION: typeof API_VERSION;
3960
+ type constants_ChannelDefaultOptions = ChannelDefaultOptions;
3961
+ type constants_ChannelDefaults = ChannelDefaults;
3962
+ type constants_ChannelMethodOptions = ChannelMethodOptions;
3937
3963
  declare const constants_DEFAULT_GLOBAL_CONFIG: typeof DEFAULT_GLOBAL_CONFIG;
3938
3964
  declare const constants_HARDENING_4BYTES: typeof HARDENING_4BYTES;
3939
3965
  declare const constants_HARDENING_BYTE: typeof HARDENING_BYTE;
@@ -3968,7 +3994,7 @@ declare const constants_TEXT_TO_FELT_MAX_LEN: typeof TEXT_TO_FELT_MAX_LEN;
3968
3994
  declare const constants_UDC: typeof UDC;
3969
3995
  declare const constants_ZERO: typeof ZERO;
3970
3996
  declare namespace constants {
3971
- export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, _BaseUrl as BaseUrl, constants_DEFAULT_GLOBAL_CONFIG as DEFAULT_GLOBAL_CONFIG, constants_HARDENING_4BYTES as HARDENING_4BYTES, constants_HARDENING_BYTE as HARDENING_BYTE, constants_IS_BROWSER as IS_BROWSER, constants_LegacyUDC as LegacyUDC, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, _NetworkName as NetworkName, constants_OutsideExecutionCallerAny as OutsideExecutionCallerAny, constants_PAYMASTER_RPC_NODES as PAYMASTER_RPC_NODES, constants_PRIME as PRIME, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_I16 as RANGE_I16, constants_RANGE_I32 as RANGE_I32, constants_RANGE_I64 as RANGE_I64, constants_RANGE_I8 as RANGE_I8, constants_RANGE_U128 as RANGE_U128, constants_RANGE_U16 as RANGE_U16, constants_RANGE_U32 as RANGE_U32, constants_RANGE_U64 as RANGE_U64, constants_RANGE_U8 as RANGE_U8, constants_RANGE_U96 as RANGE_U96, constants_RPC_DEFAULT_NODES as RPC_DEFAULT_NODES, constants_SNIP9_V1_INTERFACE_ID as SNIP9_V1_INTERFACE_ID, constants_SNIP9_V2_INTERFACE_ID as SNIP9_V2_INTERFACE_ID, constants_SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS as SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS, constants_SYSTEM_MESSAGES as SYSTEM_MESSAGES, _StarknetChainId as StarknetChainId, type constants_SupportedCairoVersion as SupportedCairoVersion, _SupportedRpcVersion as SupportedRpcVersion, type constants_SupportedTransactionVersion as SupportedTransactionVersion, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, _TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
3997
+ export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, _BaseUrl as BaseUrl, type constants_ChannelDefaultOptions as ChannelDefaultOptions, type constants_ChannelDefaults as ChannelDefaults, type constants_ChannelMethodOptions as ChannelMethodOptions, constants_DEFAULT_GLOBAL_CONFIG as DEFAULT_GLOBAL_CONFIG, constants_HARDENING_4BYTES as HARDENING_4BYTES, constants_HARDENING_BYTE as HARDENING_BYTE, constants_IS_BROWSER as IS_BROWSER, constants_LegacyUDC as LegacyUDC, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, _NetworkName as NetworkName, constants_OutsideExecutionCallerAny as OutsideExecutionCallerAny, constants_PAYMASTER_RPC_NODES as PAYMASTER_RPC_NODES, constants_PRIME as PRIME, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_I16 as RANGE_I16, constants_RANGE_I32 as RANGE_I32, constants_RANGE_I64 as RANGE_I64, constants_RANGE_I8 as RANGE_I8, constants_RANGE_U128 as RANGE_U128, constants_RANGE_U16 as RANGE_U16, constants_RANGE_U32 as RANGE_U32, constants_RANGE_U64 as RANGE_U64, constants_RANGE_U8 as RANGE_U8, constants_RANGE_U96 as RANGE_U96, constants_RPC_DEFAULT_NODES as RPC_DEFAULT_NODES, constants_SNIP9_V1_INTERFACE_ID as SNIP9_V1_INTERFACE_ID, constants_SNIP9_V2_INTERFACE_ID as SNIP9_V2_INTERFACE_ID, constants_SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS as SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS, constants_SYSTEM_MESSAGES as SYSTEM_MESSAGES, _StarknetChainId as StarknetChainId, type constants_SupportedCairoVersion as SupportedCairoVersion, _SupportedRpcVersion as SupportedRpcVersion, type constants_SupportedTransactionVersion as SupportedTransactionVersion, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, _TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
3972
3998
  }
3973
3999
 
3974
4000
  declare class RpcChannel$1 {
@@ -4073,7 +4099,7 @@ declare class RpcChannel$1 {
4073
4099
  * @param invocations AccountInvocations
4074
4100
  * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
4075
4101
  * - blockIdentifier<br/>
4076
- * - skipValidate (default false)<br/>
4102
+ * - skipValidate (default true)<br/>
4077
4103
  * - skipFeeCharge (default true)<br/>
4078
4104
  */
4079
4105
  simulateTransaction(invocations: AccountInvocations, simulateTransactionOptions?: getSimulateTransactionOptions): Promise<RPC$1.SimulateTransactionResponse>;
@@ -4093,7 +4119,7 @@ declare class RpcChannel$1 {
4093
4119
  sierra_program?: undefined;
4094
4120
  contract_class_version?: undefined;
4095
4121
  })>;
4096
- getEstimateFee(invocations: AccountInvocations, { blockIdentifier, skipValidate }?: getEstimateFeeBulkOptions): Promise<RPC$1.FEE_ESTIMATE[]>;
4122
+ getEstimateFee(invocations: AccountInvocations, options?: getEstimateFeeBulkOptions): Promise<RPC$1.FEE_ESTIMATE[]>;
4097
4123
  invoke(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<RPC$1.InvokedTransaction>;
4098
4124
  declare(declareTransaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<RPC$1.DeclaredTransaction | RPC$1.TXN_RECEIPT>;
4099
4125
  deployAccount(deployAccountTransaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<RPC$1.DeployedAccountTransaction | RPC$1.TXN_RECEIPT>;
@@ -4249,7 +4275,7 @@ declare class RpcChannel {
4249
4275
  * @param invocations AccountInvocations
4250
4276
  * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
4251
4277
  * - blockIdentifier<br/>
4252
- * - skipValidate (default false)<br/>
4278
+ * - skipValidate (default true)<br/>
4253
4279
  * - skipFeeCharge (default true)<br/>
4254
4280
  */
4255
4281
  simulateTransaction(invocations: AccountInvocations, simulateTransactionOptions?: getSimulateTransactionOptions): Promise<RPC.SimulateTransactionResponse>;
@@ -4269,7 +4295,7 @@ declare class RpcChannel {
4269
4295
  sierra_program?: undefined;
4270
4296
  contract_class_version?: undefined;
4271
4297
  })>;
4272
- getEstimateFee(invocations: AccountInvocations, { blockIdentifier, skipValidate }?: getEstimateFeeBulkOptions): Promise<RPC.FEE_ESTIMATE[]>;
4298
+ getEstimateFee(invocations: AccountInvocations, options?: getEstimateFeeBulkOptions): Promise<RPC.FEE_ESTIMATE[]>;
4273
4299
  invoke(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<RPC.InvokedTransaction>;
4274
4300
  declare(declareTransaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<RPC.DeclaredTransaction | RPC.TXN_RECEIPT>;
4275
4301
  deployAccount(deployAccountTransaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<RPC.DeployedAccountTransaction | RPC.TXN_RECEIPT>;
@@ -9599,6 +9625,20 @@ declare class Configuration {
9599
9625
  private constructor();
9600
9626
  private initialize;
9601
9627
  static getInstance(): Configuration;
9628
+ /**
9629
+ * Get a nested value from an object using a dot-notation path
9630
+ * @param obj - The object to traverse
9631
+ * @param path - The dot-notation path (e.g., 'a.b.c')
9632
+ * @returns The value at the path, or undefined if not found
9633
+ */
9634
+ private getNestedValue;
9635
+ /**
9636
+ * Set a nested value in an object using a dot-notation path
9637
+ * @param obj - The object to modify
9638
+ * @param path - The dot-notation path (e.g., 'a.b.c')
9639
+ * @param value - The value to set
9640
+ */
9641
+ private setNestedValue;
9602
9642
  get<K extends keyof DefaultConfig>(key: K): DefaultConfig[K];
9603
9643
  get(key: string, defaultValue?: any): any;
9604
9644
  set<K extends keyof DefaultConfig>(key: K, value: DefaultConfig[K]): void;
@@ -766,6 +766,26 @@ var starknet = (() => {
766
766
  LEGACY: "0"
767
767
  };
768
768
 
769
+ // src/provider/types/spec.type.ts
770
+ var { ETransactionVersion: ETransactionVersion5 } = esm_exports;
771
+ var { ETransactionVersion2: ETransactionVersion23 } = esm_exports;
772
+ var { ETransactionVersion3: ETransactionVersion33 } = esm_exports;
773
+ var { EDataAvailabilityMode: EDataAvailabilityMode3 } = esm_exports2;
774
+ var { EDAMode: EDAMode3 } = esm_exports2;
775
+ function isRPC08Plus_ResourceBounds(entry) {
776
+ return "l1_data_gas" in entry;
777
+ }
778
+ function isRPC08Plus_ResourceBoundsBN(entry) {
779
+ return "l1_data_gas" in entry;
780
+ }
781
+ var { ETransactionStatus: ETransactionStatus3 } = esm_exports2;
782
+ var { ETransactionExecutionStatus: ETransactionExecutionStatus3 } = esm_exports2;
783
+ var { ETransactionType: TransactionType } = esm_exports;
784
+ var { EBlockStatus: BlockStatus } = esm_exports;
785
+ var { ETransactionFinalityStatus: TransactionFinalityStatus } = esm_exports;
786
+ var { ETransactionExecutionStatus: TransactionExecutionStatus } = esm_exports;
787
+ var { EBlockTag: BlockTag } = esm_exports;
788
+
769
789
  // src/utils/encode.ts
770
790
  var encode_exports = {};
771
791
  __export(encode_exports, {
@@ -1198,6 +1218,22 @@ var starknet = (() => {
1198
1218
  }
1199
1219
  },
1200
1220
  defaultTipType: "recommendedTip",
1221
+ channelDefaults: {
1222
+ options: {
1223
+ headers: { "Content-Type": "application/json" },
1224
+ blockIdentifier: BlockTag.LATEST,
1225
+ retries: 200
1226
+ },
1227
+ methods: {
1228
+ simulateTransaction: {
1229
+ skipValidate: true,
1230
+ skipFeeCharge: true
1231
+ },
1232
+ getEstimateFee: {
1233
+ skipValidate: true
1234
+ }
1235
+ }
1236
+ },
1201
1237
  fetch: void 0,
1202
1238
  websocket: void 0,
1203
1239
  buffer: void 0,
@@ -1242,11 +1278,51 @@ var starknet = (() => {
1242
1278
  }
1243
1279
  return _Configuration.instance;
1244
1280
  }
1281
+ /**
1282
+ * Get a nested value from an object using a dot-notation path
1283
+ * @param obj - The object to traverse
1284
+ * @param path - The dot-notation path (e.g., 'a.b.c')
1285
+ * @returns The value at the path, or undefined if not found
1286
+ */
1287
+ getNestedValue(obj, path) {
1288
+ const keys = path.split(".");
1289
+ return keys.reduce((current, key) => {
1290
+ if (current === null || current === void 0) {
1291
+ return void 0;
1292
+ }
1293
+ return current[key];
1294
+ }, obj);
1295
+ }
1296
+ /**
1297
+ * Set a nested value in an object using a dot-notation path
1298
+ * @param obj - The object to modify
1299
+ * @param path - The dot-notation path (e.g., 'a.b.c')
1300
+ * @param value - The value to set
1301
+ */
1302
+ setNestedValue(obj, path, value) {
1303
+ const keys = path.split(".");
1304
+ const lastKey = keys.pop();
1305
+ const target = keys.reduce((current, key) => {
1306
+ if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
1307
+ current[key] = {};
1308
+ }
1309
+ return current[key];
1310
+ }, obj);
1311
+ target[lastKey] = value;
1312
+ }
1245
1313
  get(key, defaultValue) {
1314
+ if (key.includes(".")) {
1315
+ const value = this.getNestedValue(this.config, key);
1316
+ return value ?? defaultValue;
1317
+ }
1246
1318
  return this.config[key] ?? defaultValue;
1247
1319
  }
1248
1320
  set(key, value) {
1249
- this.config[key] = value;
1321
+ if (key.includes(".")) {
1322
+ this.setNestedValue(this.config, key, value);
1323
+ } else {
1324
+ this.config[key] = value;
1325
+ }
1250
1326
  }
1251
1327
  update(configData) {
1252
1328
  this.config = {
@@ -1415,26 +1491,6 @@ ${JSON.stringify(data, null, 2)}`;
1415
1491
  CONSTRUCTOR: "CONSTRUCTOR"
1416
1492
  };
1417
1493
 
1418
- // src/provider/types/spec.type.ts
1419
- var { ETransactionVersion: ETransactionVersion5 } = esm_exports;
1420
- var { ETransactionVersion2: ETransactionVersion23 } = esm_exports;
1421
- var { ETransactionVersion3: ETransactionVersion33 } = esm_exports;
1422
- var { EDataAvailabilityMode: EDataAvailabilityMode3 } = esm_exports2;
1423
- var { EDAMode: EDAMode3 } = esm_exports2;
1424
- function isRPC08Plus_ResourceBounds(entry) {
1425
- return "l1_data_gas" in entry;
1426
- }
1427
- function isRPC08Plus_ResourceBoundsBN(entry) {
1428
- return "l1_data_gas" in entry;
1429
- }
1430
- var { ETransactionStatus: ETransactionStatus3 } = esm_exports2;
1431
- var { ETransactionExecutionStatus: ETransactionExecutionStatus3 } = esm_exports2;
1432
- var { ETransactionType: TransactionType } = esm_exports;
1433
- var { EBlockStatus: BlockStatus } = esm_exports;
1434
- var { ETransactionFinalityStatus: TransactionFinalityStatus } = esm_exports;
1435
- var { ETransactionExecutionStatus: TransactionExecutionStatus } = esm_exports;
1436
- var { EBlockTag: BlockTag } = esm_exports;
1437
-
1438
1494
  // src/types/calldata.ts
1439
1495
  var ValidateType = {
1440
1496
  DEPLOY: "DEPLOY",
@@ -14956,11 +15012,6 @@ ${indent}}` : "}";
14956
15012
  }
14957
15013
 
14958
15014
  // src/channel/rpc_0_9_0.ts
14959
- var defaultOptions = {
14960
- headers: { "Content-Type": "application/json" },
14961
- blockIdentifier: BlockTag.LATEST,
14962
- retries: 200
14963
- };
14964
15015
  var RpcChannel = class {
14965
15016
  id = "RPC090";
14966
15017
  /**
@@ -15010,11 +15061,12 @@ ${indent}}` : "}";
15010
15061
  this.channelSpecVersion
15011
15062
  );
15012
15063
  }
15064
+ const channelDefaults = config.get("channelDefaults");
15013
15065
  this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
15014
- this.blockIdentifier = blockIdentifier ?? defaultOptions.blockIdentifier;
15066
+ this.blockIdentifier = blockIdentifier ?? channelDefaults.options.blockIdentifier;
15015
15067
  this.chainId = chainId;
15016
- this.headers = { ...defaultOptions.headers, ...headers };
15017
- this.retries = retries ?? defaultOptions.retries;
15068
+ this.headers = { ...channelDefaults.options.headers, ...headers };
15069
+ this.retries = retries ?? channelDefaults.options.retries;
15018
15070
  this.specVersion = specVersion;
15019
15071
  this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
15020
15072
  this.waitMode = waitMode ?? false;
@@ -15228,14 +15280,16 @@ ${indent}}` : "}";
15228
15280
  * @param invocations AccountInvocations
15229
15281
  * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
15230
15282
  * - blockIdentifier<br/>
15231
- * - skipValidate (default false)<br/>
15283
+ * - skipValidate (default true)<br/>
15232
15284
  * - skipFeeCharge (default true)<br/>
15233
15285
  */
15234
15286
  simulateTransaction(invocations, simulateTransactionOptions = {}) {
15287
+ const channelDefaults = config.get("channelDefaults");
15288
+ const methodDefaults = channelDefaults.methods.simulateTransaction || {};
15235
15289
  const {
15236
15290
  blockIdentifier = this.blockIdentifier,
15237
- skipValidate = true,
15238
- skipFeeCharge = true
15291
+ skipValidate = methodDefaults.skipValidate,
15292
+ skipFeeCharge = methodDefaults.skipFeeCharge
15239
15293
  } = simulateTransactionOptions;
15240
15294
  const block_id = new Block(blockIdentifier).identifier;
15241
15295
  const simulationFlags = [];
@@ -15395,7 +15449,10 @@ ${indent}}` : "}";
15395
15449
  contract_address
15396
15450
  });
15397
15451
  }
15398
- async getEstimateFee(invocations, { blockIdentifier = this.blockIdentifier, skipValidate = true } = {}) {
15452
+ async getEstimateFee(invocations, options = {}) {
15453
+ const channelDefaults = config.get("channelDefaults");
15454
+ const methodDefaults = channelDefaults.methods.getEstimateFee || {};
15455
+ const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
15399
15456
  const block_id = new Block(blockIdentifier).identifier;
15400
15457
  const flags = {
15401
15458
  simulation_flags: skipValidate ? [esm_exports.ESimulationFlag.SKIP_VALIDATE] : []
@@ -15553,11 +15610,6 @@ ${indent}}` : "}";
15553
15610
  __export(rpc_0_10_0_exports, {
15554
15611
  RpcChannel: () => RpcChannel2
15555
15612
  });
15556
- var defaultOptions2 = {
15557
- headers: { "Content-Type": "application/json" },
15558
- blockIdentifier: BlockTag.LATEST,
15559
- retries: 200
15560
- };
15561
15613
  var RpcChannel2 = class {
15562
15614
  id = "RPC0.10.0";
15563
15615
  /**
@@ -15607,11 +15659,12 @@ ${indent}}` : "}";
15607
15659
  this.channelSpecVersion
15608
15660
  );
15609
15661
  }
15662
+ const channelDefaults = config.get("channelDefaults");
15610
15663
  this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
15611
- this.blockIdentifier = blockIdentifier ?? defaultOptions2.blockIdentifier;
15664
+ this.blockIdentifier = blockIdentifier ?? channelDefaults.options.blockIdentifier;
15612
15665
  this.chainId = chainId;
15613
- this.headers = { ...defaultOptions2.headers, ...headers };
15614
- this.retries = retries ?? defaultOptions2.retries;
15666
+ this.headers = { ...channelDefaults.options.headers, ...headers };
15667
+ this.retries = retries ?? channelDefaults.options.retries;
15615
15668
  this.specVersion = specVersion;
15616
15669
  this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
15617
15670
  this.waitMode = waitMode ?? false;
@@ -15825,14 +15878,16 @@ ${indent}}` : "}";
15825
15878
  * @param invocations AccountInvocations
15826
15879
  * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
15827
15880
  * - blockIdentifier<br/>
15828
- * - skipValidate (default false)<br/>
15881
+ * - skipValidate (default true)<br/>
15829
15882
  * - skipFeeCharge (default true)<br/>
15830
15883
  */
15831
15884
  simulateTransaction(invocations, simulateTransactionOptions = {}) {
15885
+ const channelDefaults = config.get("channelDefaults");
15886
+ const methodDefaults = channelDefaults.methods.simulateTransaction || {};
15832
15887
  const {
15833
15888
  blockIdentifier = this.blockIdentifier,
15834
- skipValidate = true,
15835
- skipFeeCharge = true
15889
+ skipValidate = methodDefaults.skipValidate,
15890
+ skipFeeCharge = methodDefaults.skipFeeCharge
15836
15891
  } = simulateTransactionOptions;
15837
15892
  const block_id = new Block(blockIdentifier).identifier;
15838
15893
  const simulationFlags = [];
@@ -15992,7 +16047,10 @@ ${indent}}` : "}";
15992
16047
  contract_address
15993
16048
  });
15994
16049
  }
15995
- async getEstimateFee(invocations, { blockIdentifier = this.blockIdentifier, skipValidate = true } = {}) {
16050
+ async getEstimateFee(invocations, options = {}) {
16051
+ const channelDefaults = config.get("channelDefaults");
16052
+ const methodDefaults = channelDefaults.methods.getEstimateFee || {};
16053
+ const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
15996
16054
  const block_id = new Block(blockIdentifier).identifier;
15997
16055
  const flags = {
15998
16056
  simulation_flags: skipValidate ? [esm_exports2.ESimulationFlag.SKIP_VALIDATE] : []
@@ -20166,7 +20224,7 @@ ${indent}}` : "}";
20166
20224
  feeMode: convertFEE_MODE(parameters.fee_mode),
20167
20225
  timeBounds: convertTIME_BOUNDS(parameters.time_bounds)
20168
20226
  });
20169
- var defaultOptions3 = {
20227
+ var defaultOptions = {
20170
20228
  headers: { "Content-Type": "application/json" }
20171
20229
  };
20172
20230
  var PaymasterRpc = class _PaymasterRpc {
@@ -20177,14 +20235,14 @@ ${indent}}` : "}";
20177
20235
  constructor(options) {
20178
20236
  if (options instanceof _PaymasterRpc) {
20179
20237
  this.nodeUrl = options.nodeUrl;
20180
- this.headers = { ...defaultOptions3.headers, ...options.headers };
20238
+ this.headers = { ...defaultOptions.headers, ...options.headers };
20181
20239
  this.baseFetch = options.baseFetch;
20182
20240
  this.requestId = options.requestId;
20183
20241
  return;
20184
20242
  }
20185
20243
  if (options && "nodeUrl" in options && "headers" in options && "baseFetch" in options) {
20186
20244
  this.nodeUrl = options.nodeUrl ?? getDefaultPaymasterNodeUrl(void 0);
20187
- this.headers = { ...defaultOptions3.headers, ...options.headers };
20245
+ this.headers = { ...defaultOptions.headers, ...options.headers };
20188
20246
  this.baseFetch = options.baseFetch ?? fetch_default;
20189
20247
  this.requestId = 0;
20190
20248
  return;
@@ -20198,7 +20256,7 @@ ${indent}}` : "}";
20198
20256
  this.nodeUrl = getDefaultPaymasterNodeUrl(void 0, options?.default);
20199
20257
  }
20200
20258
  this.baseFetch = baseFetch ?? fetch_default;
20201
- this.headers = { ...defaultOptions3.headers, ...headers };
20259
+ this.headers = { ...defaultOptions.headers, ...headers };
20202
20260
  this.requestId = 0;
20203
20261
  }
20204
20262
  fetch(method, params, id = 0) {