starknet 11.0.2 → 11.1.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/dist/index.d.ts CHANGED
@@ -243,25 +243,43 @@ type LegacyEvent = {
243
243
  keys: CONTRACT.EVENT_FIELD[];
244
244
  };
245
245
 
246
- /** LEGACY CONTRACT */
246
+ /** Cairo Assembly .casm */
247
+ type CairoAssembly = {
248
+ prime: string;
249
+ compiler_version: string;
250
+ bytecode: ByteCode;
251
+ hints: any[];
252
+ pythonic_hints?: PythonicHints;
253
+ bytecode_segment_lengths?: number[];
254
+ entry_points_by_type: EntryPointsByType;
255
+ };
256
+ /** COMPILED CONTRACT */
247
257
  /**
248
- * format produced after compressing 'program' property
258
+ * format produced after starknet-compile .cairo to .json
259
+ *
260
+ * sierra_program is hex array
249
261
  */
250
- type LegacyContractClass = {
251
- program: CompressedProgram;
252
- entry_points_by_type: EntryPointsByType;
262
+ type CompiledSierra = {
263
+ sierra_program: ByteCode;
264
+ sierra_program_debug_info?: SierraProgramDebugInfo;
265
+ contract_class_version: string;
266
+ entry_points_by_type: SierraEntryPointsByType;
253
267
  abi: Abi;
254
268
  };
255
269
  /**
256
- * format produced after compiling .cairo to .json
270
+ * format produced after compressing 'sierra_program', stringifies 'abi' property and omit sierra_program_debug_info
271
+ *
272
+ * CompressedCompiledSierra
257
273
  */
258
- type LegacyCompiledContract = Omit<LegacyContractClass, 'program'> & {
259
- program: Program;
274
+ type SierraContractClass = Omit<CompiledSierra, 'abi' | 'sierra_program' | 'sierra_program_debug_info'> & {
275
+ sierra_program: string;
276
+ abi: string;
260
277
  };
278
+ type CompiledSierraCasm = CairoAssembly;
261
279
  /** SUBTYPES */
280
+ type ByteCode = string[];
281
+ type PythonicHints = [number, string[]][];
262
282
  type Builtins = string[];
263
- type CompressedProgram = string;
264
- type Hint = Record<string, unknown>;
265
283
  type EntryPointsByType = {
266
284
  CONSTRUCTOR: ContractEntryPointFields[];
267
285
  EXTERNAL: ContractEntryPointFields[];
@@ -272,6 +290,39 @@ type ContractEntryPointFields = {
272
290
  offset: string | number;
273
291
  builtins?: Builtins;
274
292
  };
293
+ type SierraProgramDebugInfo = {
294
+ type_names: [number, string][];
295
+ libfunc_names: [number, string][];
296
+ user_func_names: [number, string][];
297
+ };
298
+ type SierraEntryPointsByType = {
299
+ CONSTRUCTOR: SierraContractEntryPointFields[];
300
+ EXTERNAL: SierraContractEntryPointFields[];
301
+ L1_HANDLER: SierraContractEntryPointFields[];
302
+ };
303
+ type SierraContractEntryPointFields = {
304
+ selector: string;
305
+ function_idx: number;
306
+ };
307
+
308
+ /** LEGACY CONTRACT */
309
+ /**
310
+ * format produced after compressing 'program' property
311
+ */
312
+ type LegacyContractClass = {
313
+ program: CompressedProgram;
314
+ entry_points_by_type: EntryPointsByType;
315
+ abi: Abi;
316
+ };
317
+ /**
318
+ * format produced after compiling .cairo to .json
319
+ */
320
+ type LegacyCompiledContract = Omit<LegacyContractClass, 'program'> & {
321
+ program: Program;
322
+ };
323
+ /** SUBTYPES */
324
+ type CompressedProgram = string;
325
+ type Hint = Record<string, unknown>;
275
326
  interface Program {
276
327
  builtins: string[];
277
328
  data: string[];
@@ -363,57 +414,6 @@ interface Program {
363
414
  }>;
364
415
  }
365
416
 
366
- /** Cairo Assembly .casm */
367
- type CairoAssembly = {
368
- prime: string;
369
- compiler_version: string;
370
- bytecode: ByteCode;
371
- hints: any[];
372
- pythonic_hints?: PythonicHints;
373
- bytecode_segment_lengths?: number[];
374
- entry_points_by_type: EntryPointsByType;
375
- };
376
- /** COMPILED CONTRACT */
377
- /**
378
- * format produced after starknet-compile .cairo to .json
379
- *
380
- * sierra_program is hex array
381
- */
382
- type CompiledSierra = {
383
- sierra_program: ByteCode;
384
- sierra_program_debug_info?: SierraProgramDebugInfo;
385
- contract_class_version: string;
386
- entry_points_by_type: SierraEntryPointsByType;
387
- abi: Abi;
388
- };
389
- /**
390
- * format produced after compressing 'sierra_program', stringifies 'abi' property and omit sierra_program_debug_info
391
- *
392
- * CompressedCompiledSierra
393
- */
394
- type SierraContractClass = Omit<CompiledSierra, 'abi' | 'sierra_program' | 'sierra_program_debug_info'> & {
395
- sierra_program: string;
396
- abi: string;
397
- };
398
- type CompiledSierraCasm = CairoAssembly;
399
- /** SUBTYPES */
400
- type ByteCode = string[];
401
- type PythonicHints = [number, string[]][];
402
- type SierraProgramDebugInfo = {
403
- type_names: [number, string][];
404
- libfunc_names: [number, string][];
405
- user_func_names: [number, string][];
406
- };
407
- type SierraEntryPointsByType = {
408
- CONSTRUCTOR: SierraContractEntryPointFields[];
409
- EXTERNAL: SierraContractEntryPointFields[];
410
- L1_HANDLER: SierraContractEntryPointFields[];
411
- };
412
- type SierraContractEntryPointFields = {
413
- selector: string;
414
- function_idx: number;
415
- };
416
-
417
417
  /**
418
418
  * format produced after compressing compiled contract
419
419
  *
@@ -2697,7 +2697,6 @@ declare abstract class AccountInterface {
2697
2697
  /**
2698
2698
  * Declare a contract class on Starknet
2699
2699
  *
2700
- // eslint-disable-next-line prettier/prettier
2701
2700
  * @param contractPayload - Contract declaration payload
2702
2701
  * - .contract - Compiled Sierra contract
2703
2702
  * - .classHash - Pre-computed class hash (optional)
@@ -4148,10 +4147,6 @@ declare abstract class AbiParserInterface {
4148
4147
  * too — `1`, `0n`, `'1'`, `'0x0'` — because that is how a bool comes back from a node, as a felt
4149
4148
  * rather than as a JS value. Any other number is refused : a bool is not a felt narrowed to a
4150
4149
  * range, it is exactly two values.
4151
- *
4152
- * On the request side the library is stricter still : `CallData.compile` runs `validateFields`
4153
- * first, which requires a real boolean. So a `1` reaching a `core::bool` argument is refused there
4154
- * before this class ever sees it.
4155
4150
  * @example
4156
4151
  * ```typescript
4157
4152
  * // the same value, reached three ways
@@ -7174,10 +7169,10 @@ declare class AbiParser2 extends AbiParser1 {
7174
7169
  /**
7175
7170
  * The strategy the composite classes drive.
7176
7171
  *
7177
- * It carries the leaf types only for now : a composite adds itself to `dynamicSelectors` as it is
7178
- * written, because its abi type is a family rather than one string. Nothing in the library reads
7179
- * this map yet — the parsers still run on {@link hdParsingStrategy}, and moving them over is the
7180
- * next step, not this one.
7172
+ * It carries the leaf types, and the composites whose abi type is a family rather than one
7173
+ * string — tuple, array, Option, Result, NonZero, fixed array — each found through
7174
+ * `dynamicSelectors`. A contract's own structs and enums are added by the parser. This is the
7175
+ * default strategy of the Cairo 1 parsers, `AbiParser1` and `AbiParser2`.
7181
7176
  * @example
7182
7177
  * ```typescript
7183
7178
  * const felts = cairoTypeStrategy.constructors['core::integer::u8'](44, cairoTypeStrategy)
@@ -9744,25 +9739,75 @@ type WalletAccountV6Options = {
9744
9739
  paymaster?: PaymasterOptions | PaymasterInterface;
9745
9740
  };
9746
9741
 
9742
+ /**
9743
+ * @deprecated Use {@link WalletAccountV6} (get-starknet v6) instead. This class is kept only for
9744
+ * DAPPs that are still on get-starknet v4.
9745
+ *
9746
+ * @remarks
9747
+ * Account that lets a wallet sign and send the transactions, using get-starknet v4.
9748
+ * It represents the 'Selected Active' Account inside the Connected Wallet.
9749
+ *
9750
+ * The private key stays in the wallet. Reads go to the RPC node given at the instantiation,
9751
+ * writes go to the wallet. It works only in a DAPP, not in a Node.js script.
9752
+ *
9753
+ * The wallet is selected with the `get-starknet` v4 library. Its `connect()` function opens a
9754
+ * window with the list of wallets. It returns the `StarknetWindowObject` (SWO) of the wallet that
9755
+ * the user selected. With `get-starknet-core` v4 you can also build your own UI and logic. See
9756
+ * [this DAPP](https://github.com/PhilippeR26/Starknet-WalletAccount/blob/53514a5529c4aebe9e7c6331186e83b7a7310ce0/src/app/components/client/WalletHandle/SelectWallet.tsx)
9757
+ * for an example where only the wallets compatible with the Starknet Wallet API can be selected.
9758
+ *
9759
+ * The address and the chain ID follow the wallet automatically. This can lead to reads and
9760
+ * writes on different networks, so create a new instance each time the account or the network
9761
+ * changes.
9762
+ *
9763
+ * The wallet emits 2 events: `accountsChanged` and `networkChanged`.
9764
+ * A change of network emits both. A change of account emits only `accountsChanged`.
9765
+ * You can subscribe with the SWO (`on`) or with the `onAccountChange` and `onNetworkChanged`
9766
+ * methods of this class. To unsubscribe, call `off` on the SWO with the same function.
9767
+ *
9768
+ * Needs `@starknet-io/get-starknet` v4.0.3 min.
9769
+ *
9770
+ * @example
9771
+ * ```typescript
9772
+ * import { connect } from '@starknet-io/get-starknet';
9773
+ * import { WalletAccount, wallet } from 'starknet';
9774
+ * const selectedWalletSWO = await connect({ modalMode: 'alwaysAsk', modalTheme: 'light' });
9775
+ * const myWalletAccount = await WalletAccount.connect(
9776
+ * { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
9777
+ * selectedWalletSWO
9778
+ * );
9779
+ * // The wallet writes on this network:
9780
+ * const writeChainId = await wallet.requestChainId(myWalletAccount.walletProvider);
9781
+ * // writeChainId = '0x534e5f5345504f4c4941' (SN_SEPOLIA, if the wallet is on Sepolia)
9782
+ * // The provider reads on this network:
9783
+ * const readChainId = await myWalletAccount.provider.getChainId();
9784
+ * // readChainId = '0x534e5f5345504f4c4941'
9785
+ * ```
9786
+ * @example
9787
+ * ```typescript
9788
+ * // Subscribe with the wallet object (SWO). Unsubscribe with `.off` and the same function.
9789
+ * const handleAccount: AccountChangeEventHandler = (accounts: string[] | undefined) => {
9790
+ * if (accounts?.length) console.log('new address =', accounts[0]);
9791
+ * };
9792
+ * const handleNetwork: NetworkChangeEventHandler = (chainId?: string) => {
9793
+ * if (chainId) console.log('new chain =', chainId);
9794
+ * };
9795
+ * selectedWalletSWO.on('accountsChanged', handleAccount);
9796
+ * selectedWalletSWO.on('networkChanged', handleNetwork);
9797
+ * selectedWalletSWO.off('accountsChanged', handleAccount);
9798
+ * selectedWalletSWO.off('networkChanged', handleNetwork);
9799
+ * ```
9800
+ */
9747
9801
  declare class WalletAccount extends Account {
9748
9802
  walletProvider: StarknetWalletProvider;
9749
9803
  constructor(options: WalletAccountV4Options);
9750
- /**
9751
- * WALLET EVENTS
9752
- */
9753
9804
  onAccountChange(callback: AccountChangeEventHandler): void;
9754
9805
  onNetworkChanged(callback: NetworkChangeEventHandler): void;
9755
- /**
9756
- * WALLET SPECIFIC METHODS
9757
- */
9758
9806
  requestAccounts(silentMode?: boolean): Promise<string[]>;
9759
9807
  getPermissions(): Promise<"accounts"[]>;
9760
9808
  switchStarknetChain(chainId: _StarknetChainId): Promise<boolean>;
9761
9809
  watchAsset(asset: WatchAssetParameters): Promise<boolean>;
9762
9810
  addStarknetChain(chain: AddStarknetChainParameters): Promise<boolean>;
9763
- /**
9764
- * ACCOUNT METHODS
9765
- */
9766
9811
  execute(calls: AllowArray<Call>): Promise<RPCSPEC0104.AddInvokeTransactionResult>;
9767
9812
  declare(payload: DeclareContractPayload): Promise<RPCSPEC0104.AddDeclareTransactionResult>;
9768
9813
  deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Promise<MultiDeployContractResponse>;
@@ -9772,8 +9817,25 @@ declare class WalletAccount extends Account {
9772
9817
  }
9773
9818
 
9774
9819
  /**
9775
- * WalletAccountV5 class.
9776
- * This class is used to create a wallet account that can be used to interact with a Starknet wallet browser extension, using get-starknet v5.
9820
+ * Account that lets a browser wallet sign and send the transactions, using get-starknet v5.
9821
+ *
9822
+ * The private key stays in the wallet. Reads go to the RPC node of the provider, writes go to
9823
+ * the wallet. It works only in a DAPP, not in a Node.js script.
9824
+ * For a new DAPP, use {@link WalletAccountV6} (get-starknet v6) instead.
9825
+ *
9826
+ * Create it with {@link WalletAccountV5.connect}. The address and the chain ID follow the
9827
+ * wallet automatically when the user changes them.
9828
+ * @example
9829
+ * ```typescript
9830
+ * import { createStore } from '@starknet-io/get-starknet-discovery'; // v5.0.0 min
9831
+ * const [selectedWallet] = createStore().getWallets(); // let the user choose in your own UI
9832
+ * const myWalletAccount = await WalletAccountV5.connect(
9833
+ * { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
9834
+ * selectedWallet
9835
+ * );
9836
+ * const result = await myWalletAccount.execute(myCall);
9837
+ * // result = { transaction_hash: '0x...' }
9838
+ * ```
9777
9839
  */
9778
9840
  declare class WalletAccountV5 extends Account {
9779
9841
  walletProvider: WalletWithStarknetFeatures;
@@ -9787,37 +9849,203 @@ declare class WalletAccountV5 extends Account {
9787
9849
  * Released by {@link unsubscribeChange}.
9788
9850
  */
9789
9851
  private changeSubscriptions;
9790
- constructor(options: WalletAccountV5Options);
9791
9852
  /**
9792
- * WALLET EVENTS
9853
+ * Prefer {@link WalletAccountV5.connect}: it also asks the wallet for the address.
9854
+ * @param {WalletAccountV5Options} options - The provider, the wallet, the account address, and
9855
+ * optionally the Cairo version and the paymaster.
9856
+ * @example
9857
+ * ```typescript
9858
+ * const myWalletAccount = new WalletAccountV5({
9859
+ * provider: { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
9860
+ * walletProvider: selectedWallet,
9861
+ * address: '0x...', // an address that the user already allowed in the wallet
9862
+ * });
9863
+ * ```
9793
9864
  */
9865
+ constructor(options: WalletAccountV5Options);
9794
9866
  /**
9795
9867
  * Subscribe a callback to wallet account/network changes.
9796
9868
  * @param {(change: StandardEventsChangeProperties) => void} callback called on each change.
9797
9869
  * @returns {() => void} a function to unsubscribe this specific callback.
9870
+ * @example
9871
+ * ```typescript
9872
+ * const unsubscribe = myWalletAccount.onChange((change) => {
9873
+ * console.log('new address =', change.accounts?.[0]?.address);
9874
+ * });
9875
+ * // Later, to stop this callback only:
9876
+ * unsubscribe();
9877
+ * ```
9798
9878
  */
9799
9879
  onChange(callback: (change: StandardEventsChangeProperties) => void): () => void;
9800
9880
  /**
9801
9881
  * Unsubscribe from all wallet events, including the callbacks registered through {@link onChange}.
9802
9882
  * To call before the instance is deleted.
9883
+ * @example
9884
+ * ```typescript
9885
+ * // In the cleanup of a React effect, or before you stop using the instance:
9886
+ * myWalletAccount.unsubscribeChange();
9887
+ * ```
9803
9888
  */
9804
9889
  unsubscribeChange(): void;
9805
9890
  /**
9806
- * WALLET SPECIFIC METHODS
9891
+ * Ask the wallet for the addresses that the user allowed for this DAPP.
9892
+ * @param {boolean} [silentMode=false] - false: the wallet can ask the user. true: no window;
9893
+ * only the addresses already allowed are returned.
9894
+ * @returns {Promise<Address[]>} The allowed addresses.
9895
+ * @example
9896
+ * ```typescript
9897
+ * const addresses = await myWalletAccount.requestAccounts();
9898
+ * // addresses = ['0x...']
9899
+ * ```
9807
9900
  */
9808
9901
  requestAccounts(silentMode?: boolean): Promise<string[]>;
9902
+ /**
9903
+ * Ask the wallet if this DAPP is allowed.
9904
+ * @returns {Promise<Permission[]>} `['accounts']` when the DAPP is allowed.
9905
+ * @example
9906
+ * ```typescript
9907
+ * const permissions = await myWalletAccount.getPermissions();
9908
+ * // permissions = ['accounts']
9909
+ * ```
9910
+ */
9809
9911
  getPermissions(): Promise<"accounts"[]>;
9912
+ /**
9913
+ * Ask the wallet to change its current network.
9914
+ * @param {StarknetChainId} chainId - The network to use.
9915
+ * @returns {Promise<boolean>} true if the wallet changed the network.
9916
+ * @example
9917
+ * ```typescript
9918
+ * const changed = await myWalletAccount.switchStarknetChain(constants.StarknetChainId.SN_SEPOLIA);
9919
+ * // changed = true
9920
+ * ```
9921
+ */
9810
9922
  switchStarknetChain(chainId: _StarknetChainId): Promise<boolean>;
9923
+ /**
9924
+ * Ask the wallet to display a token in its list.
9925
+ * @param {WatchAssetParameters} asset - The token to display.
9926
+ * @returns {Promise<boolean>} true if the token was added.
9927
+ * @example
9928
+ * ```typescript
9929
+ * const added = await myWalletAccount.watchAsset({ type: 'ERC20', options: { address: tokenAddress } });
9930
+ * // added = true
9931
+ * ```
9932
+ */
9811
9933
  watchAsset(asset: WatchAssetParameters$1): Promise<boolean>;
9934
+ /**
9935
+ * Ask the wallet to add a custom Starknet network.
9936
+ * @param {AddStarknetChainParameters} chain - The network to add.
9937
+ * @returns {Promise<boolean>} true if the network was added.
9938
+ * @example
9939
+ * ```typescript
9940
+ * const added = await myWalletAccount.addStarknetChain({
9941
+ * id: 'my-devnet',
9942
+ * chain_id: '0x534e5f5345504f4c4941',
9943
+ * chain_name: 'My devnet',
9944
+ * rpc_urls: ['http://127.0.0.1:5050/rpc'],
9945
+ * });
9946
+ * // added = true
9947
+ * ```
9948
+ */
9812
9949
  addStarknetChain(chain: AddStarknetChainParameters$1): Promise<boolean>;
9813
9950
  /**
9814
- * ACCOUNT METHODS
9951
+ * Ask the wallet to sign and send an invoke transaction. The wallet shows the calls to the
9952
+ * user and chooses the fee itself.
9953
+ * @param {AllowArray<Call>} calls - The call(s) to execute.
9954
+ * @returns {Promise<AddInvokeTransactionResult>} The hash of the transaction.
9955
+ * @example
9956
+ * ```typescript
9957
+ * const result = await myWalletAccount.execute(myContract.populate('increase', [10]));
9958
+ * // result = { transaction_hash: '0x...' }
9959
+ * ```
9815
9960
  */
9816
9961
  execute(calls: AllowArray<Call>): Promise<RPC$1.AddInvokeTransactionResult>;
9962
+ /**
9963
+ * Ask the wallet to sign and send a declare transaction (Cairo 1 contract).
9964
+ * The compiled class hash is required: give `casm`, or `compiledClassHash`.
9965
+ * @param {DeclareContractPayload} payload - The contract to declare.
9966
+ * @returns {Promise<AddDeclareTransactionResult>} The hash of the transaction and the class hash.
9967
+ * @example
9968
+ * ```typescript
9969
+ * const result = await myWalletAccount.declare({ contract: compiledSierra, casm: compiledCasm });
9970
+ * // result = { transaction_hash: '0x...', class_hash: '0x...' }
9971
+ * ```
9972
+ */
9817
9973
  declare(payload: DeclareContractPayload): Promise<RPC$1.AddDeclareTransactionResult>;
9974
+ /**
9975
+ * Deploy contract(s) with the Universal Deployer Contract (UDC). The wallet signs and sends
9976
+ * one invoke transaction.
9977
+ * @param {UniversalDeployerContractPayload | UniversalDeployerContractPayload[]} payload - The
9978
+ * contract(s) to deploy.
9979
+ * @returns {Promise<MultiDeployContractResponse>} The hash of the transaction, and the addresses
9980
+ * of the new contracts.
9981
+ * @example
9982
+ * ```typescript
9983
+ * const result = await myWalletAccount.deploy({ classHash, constructorCalldata: [] });
9984
+ * // result = { transaction_hash: '0x...', contract_address: ['0x...'] }
9985
+ * ```
9986
+ */
9818
9987
  deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Promise<MultiDeployContractResponse>;
9988
+ /**
9989
+ * Ask the wallet to sign a SNIP-12 typed message.
9990
+ * @param {TypedData} typedData - The message to sign.
9991
+ * @returns {Promise<Signature>} The signature, as an array of strings.
9992
+ * @example
9993
+ * ```typescript
9994
+ * const signature = await myWalletAccount.signMessage(myTypedData);
9995
+ * // signature = ['0x...', '0x...']
9996
+ * ```
9997
+ */
9819
9998
  signMessage(typedData: TypedData): Promise<Signature$2>;
9999
+ /**
10000
+ * Connect to a wallet, and create the account of the address that the user selected in it.
10001
+ *
10002
+ * The wallet asks the user to allow this DAPP. If the user refuses, there is no error: the
10003
+ * account is created with an `undefined` address.
10004
+ * @param {ProviderOptions | ProviderInterface} provider - The provider used to read Starknet,
10005
+ * or its options (e.g. `{ nodeUrl }`).
10006
+ * @param {WalletWithStarknetFeatures} walletProvider - The wallet selected by the user
10007
+ * (get-starknet v5).
10008
+ * @param {CairoVersion} [cairoVersion] - Cairo version of the account. Optional: detected if
10009
+ * not provided.
10010
+ * @param {PaymasterOptions | PaymasterInterface} [paymaster] - The paymaster to use with this
10011
+ * account.
10012
+ * @param {boolean} [silentMode=false] - true: no window; it works only if the user already
10013
+ * allowed this DAPP.
10014
+ * @returns {Promise<WalletAccountV5>} The account.
10015
+ * @example
10016
+ * ```typescript
10017
+ * const myWalletAccount = await WalletAccountV5.connect(
10018
+ * { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
10019
+ * selectedWallet
10020
+ * );
10021
+ * // With a paymaster. The parameters are positional, so cairoVersion must be given:
10022
+ * const myPaymasterAccount = await WalletAccountV5.connect(
10023
+ * myProvider,
10024
+ * selectedWallet,
10025
+ * undefined, // cairoVersion: detected
10026
+ * myPaymasterRpc
10027
+ * );
10028
+ * ```
10029
+ */
9820
10030
  static connect(provider: ProviderOptions | ProviderInterface, walletProvider: WalletWithStarknetFeatures, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface, silentMode?: boolean): Promise<WalletAccountV5>;
10031
+ /**
10032
+ * Same as {@link WalletAccountV5.connect} with `silentMode` true: no window is shown, so it
10033
+ * works only if the user already allowed this DAPP (for example, to connect again after a
10034
+ * page reload). Otherwise, the account is created with an `undefined` address.
10035
+ * @param {ProviderOptions | ProviderInterface} provider - The provider used to read Starknet,
10036
+ * or its options.
10037
+ * @param {WalletWithStarknetFeatures} walletProvider - The wallet selected by the user.
10038
+ * @param {CairoVersion} [cairoVersion] - Cairo version of the account. Optional: detected if
10039
+ * not provided.
10040
+ * @param {PaymasterOptions | PaymasterInterface} [paymaster] - The paymaster to use with this
10041
+ * account.
10042
+ * @returns {Promise<WalletAccountV5>} The account.
10043
+ * @example
10044
+ * ```typescript
10045
+ * const myWalletAccount = await WalletAccountV5.connectSilent(myProvider, selectedWallet);
10046
+ * // myWalletAccount.address is undefined if this DAPP is not allowed yet
10047
+ * ```
10048
+ */
9821
10049
  static connectSilent(provider: ProviderOptions | ProviderInterface, walletProvider: WalletWithStarknetFeatures, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface): Promise<WalletAccountV5>;
9822
10050
  }
9823
10051
 
@@ -9892,12 +10120,57 @@ type STRK20_CALL_AND_PROOF = Omit<STRK20_CALL_AND_PROOF$1, 'call'> & {
9892
10120
  };
9893
10121
 
9894
10122
  /**
9895
- * WalletAccountV6 class.
9896
- * Extends WalletAccountV5 with get-starknet v6 types and STRK20 privacy protocol methods.
10123
+ * Account that lets a browser wallet sign and send the transactions, using get-starknet v6.
10124
+ * This is the recommended class for a new DAPP.
10125
+ *
10126
+ * It extends {@link WalletAccountV5}: same methods, plus the STRK20 privacy protocol
10127
+ * (`strk20Balances`, `strk20PrepareInvoke`, `strk20InvokeTransaction`,
10128
+ * `strk20ShadowAccountCommitment` and `executeWithProof`).
10129
+ * It needs `@starknet-io/get-starknet-discovery` and `@starknet-io/get-starknet-wallet-standard`
10130
+ * v6.0.6 min.
10131
+ *
10132
+ * The `walletProvider` property keeps the type of get-starknet v5. To call a `walletV6`
10133
+ * function, give it the wallet that you selected, not `walletProvider`.
10134
+ * @example
10135
+ * ```typescript
10136
+ * import { createStore } from '@starknet-io/get-starknet-discovery'; // v6.0.6 min
10137
+ * const [selectedWallet] = createStore().getWallets(); // let the user choose in your own UI
10138
+ * const myWalletAccount = await WalletAccountV6.connect(
10139
+ * { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
10140
+ * selectedWallet
10141
+ * );
10142
+ * const chainId = await walletV6.requestChainId(selectedWallet);
10143
+ * // chainId = '0x534e5f5345504f4c4941' (the wallet is on Sepolia)
10144
+ * ```
9897
10145
  */
9898
10146
  declare class WalletAccountV6 extends WalletAccountV5 {
10147
+ /**
10148
+ * Prefer {@link WalletAccountV6.connect}: it also asks the wallet for the address.
10149
+ * @param {WalletAccountV6Options} options - The provider, the wallet, the account address, and
10150
+ * optionally the Cairo version and the paymaster.
10151
+ * @example
10152
+ * ```typescript
10153
+ * const myWalletAccount = new WalletAccountV6({
10154
+ * provider: { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
10155
+ * walletProvider: selectedWallet,
10156
+ * address: '0x...', // an address that the user already allowed in the wallet
10157
+ * });
10158
+ * ```
10159
+ */
9899
10160
  constructor(options: WalletAccountV6Options);
9900
10161
  private get v6Provider();
10162
+ /**
10163
+ * Ask the wallet to change its current network.
10164
+ * @param {StarknetChainId} chainId - The network to use.
10165
+ * @param {boolean} [silent_mode=false] - Sent to the wallet as `silent_mode`: true asks the
10166
+ * wallet not to show its window.
10167
+ * @returns {Promise<boolean>} true if the wallet changed the network.
10168
+ * @example
10169
+ * ```typescript
10170
+ * const changed = await myWalletAccount.switchStarknetChain(constants.StarknetChainId.SN_SEPOLIA);
10171
+ * // changed = true
10172
+ * ```
10173
+ */
9901
10174
  switchStarknetChain(chainId: _StarknetChainId, silent_mode?: boolean): Promise<boolean>;
9902
10175
  /**
9903
10176
  * Execute call(s) with an optional STRK20 privacy proof attached. Same signature as
@@ -9917,7 +10190,7 @@ declare class WalletAccountV6 extends WalletAccountV5 {
9917
10190
  * Get the private balances held by the user inside the STRK20 privacy pool.
9918
10191
  *
9919
10192
  * Reading a shielded balance requires the user approval, and this approval is time
9920
- * limited : `validUntil` requests when it expires. When it is omitted, the wallet applies
10193
+ * limited: `validUntil` requests when it expires. When it is omitted, the wallet applies
9921
10194
  * its own default window.
9922
10195
  * @param {Address[]} tokens - The tokens to get the private balance of. An empty array returns every shielded token.
9923
10196
  * @param {number} [validUntil] - Requested expiry of the balance read authorization, as a Unix timestamp in seconds. Omit it to let the wallet apply its default window.
@@ -9927,7 +10200,7 @@ declare class WalletAccountV6 extends WalletAccountV5 {
9927
10200
  * const balances = await myWalletAccount.strk20Balances([strkAddress]);
9928
10201
  * // balances = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
9929
10202
  *
9930
- * // Asking for a 5 minutes authorization window :
10203
+ * // Asking for a 5-minute authorization window:
9931
10204
  * const expiry = Math.floor(Date.now() / 1000) + 300;
9932
10205
  * const fresh = await myWalletAccount.strk20Balances([strkAddress], expiry);
9933
10206
  * // fresh = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]
@@ -9936,11 +10209,11 @@ declare class WalletAccountV6 extends WalletAccountV5 {
9936
10209
  strk20Balances(tokens: Address[], validUntil?: number): Promise<STRK20_BALANCE_ENTRY[]>;
9937
10210
  /**
9938
10211
  * Build the Starknet call and the SNIP-36 zero-knowledge proof of a STRK20 transaction,
9939
- * without submitting it : the DAPP submits the returned call itself, and therefore pays
10212
+ * without submitting it: the DAPP submits the returned call itself, and therefore pays
9940
10213
  * the fee (the wallet adds no fee action in this mode).
9941
10214
  *
9942
10215
  * With `simulate` set to true, the wallet skips the expensive proof generation and
9943
- * returns an empty proof : the call is then NOT submittable on-chain, and is only useful
10216
+ * returns an empty proof: the call is then NOT submittable on-chain, and is only useful
9944
10217
  * for fee estimation or UI previews.
9945
10218
  * @param {STRK20_ACTION[]} actions - The STRK20 actions to perform atomically (min 1).
9946
10219
  * @param {boolean} [simulate] - True to skip the proof generation.
@@ -9973,15 +10246,15 @@ declare class WalletAccountV6 extends WalletAccountV5 {
9973
10246
  }>;
9974
10247
  /**
9975
10248
  * Compute the commitment of a DAPP STRK20 shadow account. The commitment is computed
9976
- * locally by the wallet from the user private state ; no transaction is sent.
10249
+ * locally by the wallet from the user private state; no transaction is sent.
9977
10250
  *
9978
10251
  * When `nonce` is given, the full commitment of this single shadow account is returned.
9979
10252
  * When `nonce` is omitted, the partial (nonce independent) commitment is returned
9980
- * instead : it is shared by every shadow account the user derives for this DAPP, so it
10253
+ * instead: it is shared by every shadow account the user derives for this DAPP, so it
9981
10254
  * can be published once to let a DAPP recognize all the shadow accounts of a user
9982
10255
  * without learning any individual nonce.
9983
10256
  * @param {STRK20_DAPP_NAME} dappName - The DAPP that scopes the shadow account(s).
9984
- * @param {FELT} [nonce] - The shadow account nonce ; each nonce selects a distinct shadow account for this user + DAPP. Omit it to get the partial commitment.
10257
+ * @param {FELT} [nonce] - The shadow account nonce; each nonce selects a distinct shadow account for this user + DAPP. Omit it to get the partial commitment.
9985
10258
  * @returns {Promise<FELT>} The shadow account commitment.
9986
10259
  * @example
9987
10260
  * ```typescript
@@ -9990,7 +10263,56 @@ declare class WalletAccountV6 extends WalletAccountV5 {
9990
10263
  * ```
9991
10264
  */
9992
10265
  strk20ShadowAccountCommitment(dappName: STRK20_DAPP_NAME, nonce?: FELT$1): Promise<FELT$1>;
10266
+ /**
10267
+ * Connect to a wallet, and create the account of the address that the user selected in it.
10268
+ *
10269
+ * The wallet asks the user to allow this DAPP. If the user refuses, there is no error: the
10270
+ * account is created with an `undefined` address.
10271
+ * @param {ProviderOptions | ProviderInterface} provider - The provider used to read Starknet,
10272
+ * or its options (e.g. `{ nodeUrl }`).
10273
+ * @param {WalletWithStarknetFeaturesV6} walletProvider - The wallet selected by the user
10274
+ * (get-starknet v6).
10275
+ * @param {CairoVersion} [cairoVersion] - Cairo version of the account. Optional: detected if
10276
+ * not provided.
10277
+ * @param {PaymasterOptions | PaymasterInterface} [paymaster] - The paymaster to use with this
10278
+ * account.
10279
+ * @param {boolean} [silentMode=false] - true: no window; it works only if the user already
10280
+ * allowed this DAPP.
10281
+ * @returns {Promise<WalletAccountV6>} The account.
10282
+ * @example
10283
+ * ```typescript
10284
+ * const myWalletAccount = await WalletAccountV6.connect(
10285
+ * { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
10286
+ * selectedWallet
10287
+ * );
10288
+ * // With a paymaster. The parameters are positional, so cairoVersion must be given:
10289
+ * const myPaymasterAccount = await WalletAccountV6.connect(
10290
+ * myProvider,
10291
+ * selectedWallet,
10292
+ * undefined, // cairoVersion: detected
10293
+ * myPaymasterRpc
10294
+ * );
10295
+ * ```
10296
+ */
9993
10297
  static connect(provider: ProviderOptions | ProviderInterface, walletProvider: WalletWithStarknetFeatures$1, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface, silentMode?: boolean): Promise<WalletAccountV6>;
10298
+ /**
10299
+ * Same as {@link WalletAccountV6.connect} with `silentMode` true: no window is shown, so it
10300
+ * works only if the user already allowed this DAPP (for example, to connect again after a
10301
+ * page reload). Otherwise, the account is created with an `undefined` address.
10302
+ * @param {ProviderOptions | ProviderInterface} provider - The provider used to read Starknet,
10303
+ * or its options.
10304
+ * @param {WalletWithStarknetFeaturesV6} walletProvider - The wallet selected by the user.
10305
+ * @param {CairoVersion} [cairoVersion] - Cairo version of the account. Optional: detected if
10306
+ * not provided.
10307
+ * @param {PaymasterOptions | PaymasterInterface} [paymaster] - The paymaster to use with this
10308
+ * account.
10309
+ * @returns {Promise<WalletAccountV6>} The account.
10310
+ * @example
10311
+ * ```typescript
10312
+ * const myWalletAccount = await WalletAccountV6.connectSilent(myProvider, selectedWallet);
10313
+ * // myWalletAccount.address is undefined if this DAPP is not allowed yet
10314
+ * ```
10315
+ */
9994
10316
  static connectSilent(provider: ProviderOptions | ProviderInterface, walletProvider: WalletWithStarknetFeatures$1, cairoVersion?: CairoVersion, paymaster?: PaymasterOptions | PaymasterInterface): Promise<WalletAccountV6>;
9995
10317
  }
9996
10318
 
@@ -11050,6 +11372,45 @@ type CalcV3DeployAccountTxHashArgs = {
11050
11372
  type CalcDeployAccountTxHashArgs = CalcV3DeployAccountTxHashArgs;
11051
11373
  declare function calculateDeployAccountTransactionHash$1(args: CalcDeployAccountTxHashArgs): string;
11052
11374
 
11375
+ /**
11376
+ * Cairo 0 class hash computation, using the Pedersen hash
11377
+ */
11378
+
11379
+ /**
11380
+ * JSON replacer function that skips null values and empty arrays for specific keys
11381
+ * Used in legacy contract class serialization
11382
+ * @example
11383
+ * ```typescript
11384
+ * const input = { a: null, attributes: [], debug_info: { x: 1 }, b: 2 };
11385
+ * const result = JSON.stringify(input, hash.nullSkipReplacer);
11386
+ * // result = '{"debug_info":null,"b":2}'
11387
+ * ```
11388
+ */
11389
+ declare function nullSkipReplacer(key: string, value: any): any;
11390
+ /**
11391
+ * Compute hinted class hash for legacy compiled contract (Cairo 0)
11392
+ * @param {LegacyCompiledContract} compiledContract
11393
+ * @returns {string} hex-string
11394
+ * @example
11395
+ * ```typescript
11396
+ * const compiledCairo0 = json.parse(fs.readFileSync("./cairo0contract.json").toString("ascii"));
11397
+ * const result=hash.computeHintedClassHash(compiledCairo0);
11398
+ * // result = "0x293eabb06955c0a1e55557014675aa4e7a1fd69896147382b29b2b6b166a2ac"
11399
+ * ``` */
11400
+ declare function computeHintedClassHash(compiledContract: LegacyCompiledContract): string;
11401
+ /**
11402
+ * Computes the class hash for legacy compiled contract (Cairo 0)
11403
+ * @param {LegacyCompiledContract | string} contract legacy compiled contract content
11404
+ * @returns {string} hex-string of class hash
11405
+ * @example
11406
+ * ```typescript
11407
+ * const compiledCairo0 = json.parse(fs.readFileSync("./cairo0contract.json").toString("ascii"));
11408
+ * const result=hash.computeLegacyContractClassHash(compiledCairo0);
11409
+ * // result = "0x4a5cae61fa8312b0a3d0c44658b403d3e4197be80027fd5020ffcdf0c803331"
11410
+ * ```
11411
+ */
11412
+ declare function computeLegacyContractClassHash(contract: LegacyCompiledContract | string): string;
11413
+
11053
11414
  /**
11054
11415
  * Pure Pedersen hash utilities — no calldata dependency
11055
11416
  */
@@ -11071,7 +11432,7 @@ declare function computeHashOnElements(data: BigNumberish[]): string;
11071
11432
  declare const computePedersenHashOnElements: typeof computeHashOnElements;
11072
11433
 
11073
11434
  /**
11074
- * Cairo 0 Class Hash computation using Pedersen hash
11435
+ * Contract address computation, and the Pedersen hash helpers
11075
11436
  */
11076
11437
 
11077
11438
  /**
@@ -11089,29 +11450,6 @@ declare const computePedersenHashOnElements: typeof computeHashOnElements;
11089
11450
  * ```
11090
11451
  */
11091
11452
  declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawArgs, deployerAddress: BigNumberish): string;
11092
- /**
11093
- * Compute hinted class hash for legacy compiled contract (Cairo 0)
11094
- * @param {LegacyCompiledContract} compiledContract
11095
- * @returns {string} hex-string
11096
- * @example
11097
- * ```typescript
11098
- * const compiledCairo0 = json.parse(fs.readFileSync("./cairo0contract.json").toString("ascii"));
11099
- * const result=hash.computeHintedClassHash(compiledCairo0);
11100
- * // result = "0x293eabb06955c0a1e55557014675aa4e7a1fd69896147382b29b2b6b166a2ac"
11101
- * ``` */
11102
- declare function computeHintedClassHash(compiledContract: LegacyCompiledContract): string;
11103
- /**
11104
- * Computes the class hash for legacy compiled contract (Cairo 0)
11105
- * @param {LegacyCompiledContract | string} contract legacy compiled contract content
11106
- * @returns {string} hex-string of class hash
11107
- * @example
11108
- * ```typescript
11109
- * const compiledCairo0 = json.parse(fs.readFileSync("./cairo0contract.json").toString("ascii"));
11110
- * const result=hash.computeLegacyContractClassHash(compiledCairo0);
11111
- * // result = "0x4a5cae61fa8312b0a3d0c44658b403d3e4197be80027fd5020ffcdf0c803331"
11112
- * ```
11113
- */
11114
- declare function computeLegacyContractClassHash(contract: LegacyCompiledContract | string): string;
11115
11453
 
11116
11454
  /**
11117
11455
  * Cairo 1 Class Hash computation using Poseidon hash
@@ -11214,11 +11552,6 @@ declare const COMPILED_CLASS_VERSION = "COMPILED_CLASS_V1";
11214
11552
  * ```
11215
11553
  */
11216
11554
  declare function formatSpaces(json: string): string;
11217
- /**
11218
- * JSON replacer function that skips null values and empty arrays for specific keys
11219
- * Used in legacy contract class serialization
11220
- */
11221
- declare function nullSkipReplacer(key: string, value: any): any;
11222
11555
  /**
11223
11556
  * Convert builtins array to encoded BigInt array
11224
11557
  * Common pattern used in both Poseidon and Blake2s hashing
@@ -11756,11 +12089,6 @@ declare namespace num {
11756
12089
  export { num_addPercent as addPercent, num_assertInRange as assertInRange, num_bigNumberishArrayToDecimalStringArray as bigNumberishArrayToDecimalStringArray, num_bigNumberishArrayToHexadecimalStringArray as bigNumberishArrayToHexadecimalStringArray, num_cleanHex as cleanHex, num_getDecimalString as getDecimalString, num_getHexString as getHexString, num_getHexStringArray as getHexStringArray, num_getNext as getNext, num_hexToBytes as hexToBytes, num_hexToDecimalString as hexToDecimalString, num_isBigNumberish as isBigNumberish, num_isEmptyHex as isEmptyHex, num_isHex as isHex, num_isHexString as isHexString, num_isStringWholeNumber as isStringWholeNumber, num_stringToSha256ToArrayBuff4 as stringToSha256ToArrayBuff4, num_toBigInt as toBigInt, num_toCairoBool as toCairoBool, num_toHex as toHex, num_toHex64 as toHex64, num_toHexString as toHexString, num_toStorageKey as toStorageKey, num_tryToBigInt as tryToBigInt };
11757
12090
  }
11758
12091
 
11759
- /**
11760
- * Extract compiled calldata from args or execute callback
11761
- */
11762
- declare function getCompiledCalldata(constructorArguments: RawArgs, callback: Function): Calldata;
11763
-
11764
12092
  /**
11765
12093
  * Transforms a list of Calls, each with their own calldata, into
11766
12094
  * two arrays: one with the entry points, and one with the concatenated calldata
@@ -11822,6 +12150,12 @@ declare const transformCallsToMulticallArrays: (calls: Call[]) => {
11822
12150
  * ```
11823
12151
  */
11824
12152
  declare const fromCallsToExecuteCalldata: (calls: Call[]) => Calldata;
12153
+
12154
+ /**
12155
+ * Extract compiled calldata from args or execute callback
12156
+ */
12157
+ declare function getCompiledCalldata(constructorArguments: RawArgs, callback: Function): Calldata;
12158
+
11825
12159
  /**
11826
12160
  * Transforms a list of calls into the Cairo 1 `__execute__` calldata.
11827
12161
  * @param {Call[]} calls the list of calls to transform.
@@ -16470,7 +16804,13 @@ declare class CairoTypeOption {
16470
16804
  * Build an option, from a value a caller passed or from the felts of a response.
16471
16805
  *
16472
16806
  * A {@link CairoOption} says its own branch, so `variant` is not given with one — nor with the
16473
- * response iterator, which reads the branch off the wire. Anywhere else it is required.
16807
+ * response iterator, which reads the branch off the wire, nor with a `CairoTypeOption`, which
16808
+ * is copied as it is. Anywhere else it is required.
16809
+ *
16810
+ * For the same reason, a `CairoOption` that holds a `CairoTypeOption` is refused: once it is
16811
+ * unwrapped, the variant comes with the `CairoTypeOption`. Accepted, it would lose one level:
16812
+ * `Some(Some(1))` would be sent as `Some(None)`. Write a nested value with `CairoOption`
16813
+ * only, or build one `CairoTypeOption` for the whole type.
16474
16814
  *
16475
16815
  * `subType` is what makes an option of options work. Handed a `CairoOption`, this constructor
16476
16816
  * unwraps it and calls itself with what was inside, which for a nested option is another
@@ -16481,11 +16821,11 @@ declare class CairoTypeOption {
16481
16821
  * @param {string} optionCairoType the abi type, `core::option::Option::<T>`
16482
16822
  * @param {AllowArray<CairoTypeStrategy>} parsingStrategy how to build the value
16483
16823
  * @param {CairoOptionVariant | number} [variant] which branch, when the content does not say.
16484
- * Must be omitted when `content` is the response iterator.
16824
+ * Must be omitted when `content` is the response iterator or a `CairoTypeOption`.
16485
16825
  * @param {boolean} [subType=false] true when called from the unwrapping of a nested
16486
16826
  * `CairoOption`, which is the only caller that should set it
16487
- * @throws {Error} when the type is not an option, when the variant is missing, absurd, or
16488
- * contradicts the content
16827
+ * @throws {Error} when the type is not an option, or when the variant is missing, absurd,
16828
+ * contradicts the content, or is given with a `CairoTypeOption`
16489
16829
  * @example
16490
16830
  * ```typescript
16491
16831
  * const type = 'core::option::Option::<core::integer::u8>';
@@ -17653,7 +17993,7 @@ declare function subscribeWalletEvent(walletWSF: WalletWithStarknetFeatures$1, c
17653
17993
  /**
17654
17994
  * Get the private balances held by the user inside the STRK20 privacy pool.
17655
17995
  *
17656
- * Reading a shielded balance requires the user approval, and this approval is time limited :
17996
+ * Reading a shielded balance requires the user approval, and this approval is time limited:
17657
17997
  * `valid_until` requests when it expires. When it is omitted, the wallet applies its own
17658
17998
  * default window.
17659
17999
  * @param {WalletWithStarknetFeaturesV6} walletWSF - The get-starknet V6 wallet object to use.
@@ -17673,16 +18013,16 @@ declare function strk20InvokeTransaction(walletWSF: WalletWithStarknetFeatures$1
17673
18013
  }>;
17674
18014
  /**
17675
18015
  * Compute the commitment of a DAPP STRK20 shadow account. The commitment is computed
17676
- * locally by the wallet from the user private state ; no transaction is sent.
18016
+ * locally by the wallet from the user private state; no transaction is sent.
17677
18017
  *
17678
18018
  * When `nonce` is given, the full commitment of this single shadow account is returned.
17679
- * When `nonce` is omitted, the partial (nonce independent) commitment is returned instead :
18019
+ * When `nonce` is omitted, the partial (nonce independent) commitment is returned instead:
17680
18020
  * it is shared by every shadow account the user derives for this DAPP, so it can be
17681
18021
  * published once to let a DAPP recognize all the shadow accounts of a user without learning
17682
18022
  * any individual nonce.
17683
18023
  * @param {WalletWithStarknetFeaturesV6} walletWSF - The get-starknet V6 wallet object to use.
17684
18024
  * @param {STRK20_DAPP_NAME} dapp_name - The DAPP that scopes the shadow account(s).
17685
- * @param {FELT} [nonce] - The shadow account nonce ; each nonce selects a distinct shadow account for this user + DAPP. Omit it to get the partial commitment.
18025
+ * @param {FELT} [nonce] - The shadow account nonce; each nonce selects a distinct shadow account for this user + DAPP. Omit it to get the partial commitment.
17686
18026
  * @returns {Promise<FELT>} The shadow account commitment.
17687
18027
  * @example
17688
18028
  * ```typescript