starknet 6.11.0 → 6.12.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
@@ -5,6 +5,7 @@ import * as weierstrass from '@noble/curves/abstract/weierstrass';
5
5
  import { RecoveredSignatureType } from '@noble/curves/abstract/weierstrass';
6
6
  import * as ts_mixer_dist_types_types from 'ts-mixer/dist/types/types';
7
7
  import { Abi as Abi$1, TypedContract } from 'abi-wan-kanabi';
8
+ import Transport from '@ledgerhq/hw-transport';
8
9
  import * as poseidon from '@noble/curves/abstract/poseidon';
9
10
  import * as json$1 from 'lossless-json';
10
11
  import * as starknet from '@scure/starknet';
@@ -1558,6 +1559,20 @@ declare function sanitizeHex(hex: string): string;
1558
1559
  * ```
1559
1560
  */
1560
1561
  declare const pascalToSnake: (text: string) => string;
1562
+ /**
1563
+ * Combine multiple Uint8Arrays into one.
1564
+ * Useful for wallet path creation.
1565
+ * @param {Uint8Array[]} uint8arrays An array of Uint8Array.
1566
+ * @returns {Uint8Array} all the Uint8Arrays joined.
1567
+ * @example
1568
+ * ```typescript
1569
+ * const path0buff = new Uint8Array([128, 0, 10, 85]);
1570
+ * const path1buff = new Uint8Array([71, 65, 233, 201]);
1571
+ * const result = encode.concatenateArrayBuffer([path0buff, path1buff]);
1572
+ * // result = Uint8Array(8) [128, 0, 10, 85, 71, 65, 233, 201]
1573
+ * ```
1574
+ */
1575
+ declare function concatenateArrayBuffer(uint8arrays: Uint8Array[]): Uint8Array;
1561
1576
 
1562
1577
  declare const encode_IS_BROWSER: typeof IS_BROWSER;
1563
1578
  declare const encode_addHexPrefix: typeof addHexPrefix;
@@ -1566,6 +1581,7 @@ declare const encode_atobUniversal: typeof atobUniversal;
1566
1581
  declare const encode_btoaUniversal: typeof btoaUniversal;
1567
1582
  declare const encode_buf2hex: typeof buf2hex;
1568
1583
  declare const encode_calcByteLength: typeof calcByteLength;
1584
+ declare const encode_concatenateArrayBuffer: typeof concatenateArrayBuffer;
1569
1585
  declare const encode_padLeft: typeof padLeft;
1570
1586
  declare const encode_pascalToSnake: typeof pascalToSnake;
1571
1587
  declare const encode_removeHexPrefix: typeof removeHexPrefix;
@@ -1574,7 +1590,7 @@ declare const encode_sanitizeHex: typeof sanitizeHex;
1574
1590
  declare const encode_stringToArrayBuffer: typeof stringToArrayBuffer;
1575
1591
  declare const encode_utf8ToArray: typeof utf8ToArray;
1576
1592
  declare namespace encode {
1577
- export { encode_IS_BROWSER as IS_BROWSER, encode_addHexPrefix as addHexPrefix, encode_arrayBufferToString as arrayBufferToString, encode_atobUniversal as atobUniversal, encode_btoaUniversal as btoaUniversal, encode_buf2hex as buf2hex, encode_calcByteLength as calcByteLength, encode_padLeft as padLeft, encode_pascalToSnake as pascalToSnake, encode_removeHexPrefix as removeHexPrefix, encode_sanitizeBytes as sanitizeBytes, encode_sanitizeHex as sanitizeHex, encode_stringToArrayBuffer as stringToArrayBuffer, encode_utf8ToArray as utf8ToArray };
1593
+ export { encode_IS_BROWSER as IS_BROWSER, encode_addHexPrefix as addHexPrefix, encode_arrayBufferToString as arrayBufferToString, encode_atobUniversal as atobUniversal, encode_btoaUniversal as btoaUniversal, encode_buf2hex as buf2hex, encode_calcByteLength as calcByteLength, encode_concatenateArrayBuffer as concatenateArrayBuffer, encode_padLeft as padLeft, encode_pascalToSnake as pascalToSnake, encode_removeHexPrefix as removeHexPrefix, encode_sanitizeBytes as sanitizeBytes, encode_sanitizeHex as sanitizeHex, encode_stringToArrayBuffer as stringToArrayBuffer, encode_utf8ToArray as utf8ToArray };
1578
1594
  }
1579
1595
 
1580
1596
  /**
@@ -1584,6 +1600,7 @@ declare const TEXT_TO_FELT_MAX_LEN = 31;
1584
1600
 
1585
1601
  declare const ZERO = 0n;
1586
1602
  declare const MASK_250: bigint;
1603
+ declare const MASK_31: bigint;
1587
1604
  declare const API_VERSION = 0n;
1588
1605
  declare const PRIME: bigint;
1589
1606
  declare const MAX_STORAGE_ITEM_SIZE = 256n;
@@ -1642,6 +1659,7 @@ type constants_FeeMarginPercentage = FeeMarginPercentage;
1642
1659
  declare const constants_FeeMarginPercentage: typeof FeeMarginPercentage;
1643
1660
  declare const constants_IS_BROWSER: typeof IS_BROWSER;
1644
1661
  declare const constants_MASK_250: typeof MASK_250;
1662
+ declare const constants_MASK_31: typeof MASK_31;
1645
1663
  declare const constants_MAX_STORAGE_ITEM_SIZE: typeof MAX_STORAGE_ITEM_SIZE;
1646
1664
  type constants_NetworkName = NetworkName;
1647
1665
  declare const constants_NetworkName: typeof NetworkName;
@@ -1659,7 +1677,7 @@ declare const constants_TransactionHashPrefix: typeof TransactionHashPrefix;
1659
1677
  declare const constants_UDC: typeof UDC;
1660
1678
  declare const constants_ZERO: typeof ZERO;
1661
1679
  declare namespace constants {
1662
- export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, constants_BaseUrl as BaseUrl, constants_FeeMarginPercentage as FeeMarginPercentage, constants_IS_BROWSER as IS_BROWSER, constants_MASK_250 as MASK_250, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, constants_NetworkName as NetworkName, constants_PRIME as PRIME, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_U128 as RANGE_U128, constants_RPC_DEFAULT_VERSION as RPC_DEFAULT_VERSION, constants_RPC_NODES as RPC_NODES, constants_StarknetChainId as StarknetChainId, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, ETransactionVersion$1 as TRANSACTION_VERSION, constants_TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
1680
+ export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, constants_BaseUrl as BaseUrl, constants_FeeMarginPercentage as FeeMarginPercentage, constants_IS_BROWSER as IS_BROWSER, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, constants_NetworkName as NetworkName, constants_PRIME as PRIME, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_U128 as RANGE_U128, constants_RPC_DEFAULT_VERSION as RPC_DEFAULT_VERSION, constants_RPC_NODES as RPC_NODES, constants_StarknetChainId as StarknetChainId, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, ETransactionVersion$1 as TRANSACTION_VERSION, constants_TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
1663
1681
  }
1664
1682
 
1665
1683
  declare const ec_weierstrass: typeof weierstrass;
@@ -2217,6 +2235,7 @@ type RpcProviderOptions = {
2217
2235
  l1BoundMaxPricePerUnit: number;
2218
2236
  maxFee: number;
2219
2237
  };
2238
+ batch?: false | number;
2220
2239
  };
2221
2240
 
2222
2241
  type Simplify<T> = {
@@ -2746,6 +2765,7 @@ declare class RpcChannel$1 {
2746
2765
  private chainId?;
2747
2766
  private specVersion?;
2748
2767
  readonly waitMode: Boolean;
2768
+ private batchClient?;
2749
2769
  constructor(optionsOrProvider?: RpcProviderOptions);
2750
2770
  setChainId(chainId: StarknetChainId): void;
2751
2771
  fetch(method: string, params?: object, id?: string | number): Promise<Response>;
@@ -2827,6 +2847,7 @@ declare class RpcChannel {
2827
2847
  private specVersion?;
2828
2848
  private transactionRetryIntervalFallback?;
2829
2849
  readonly waitMode: Boolean;
2850
+ private batchClient?;
2830
2851
  constructor(optionsOrProvider?: RpcProviderOptions);
2831
2852
  private get transactionRetryIntervalDefault();
2832
2853
  setChainId(chainId: StarknetChainId): void;
@@ -3249,7 +3270,7 @@ declare class RpcProvider$1 implements ProviderInterface {
3249
3270
  getBlockWithTxs(blockIdentifier?: BlockIdentifier): Promise<BlockWithTxs>;
3250
3271
  /**
3251
3272
  * Pause the execution of the script until a specified block is created.
3252
- * @param {BlockIdentifier} blockIdentifier bloc number (BigNumberisk) or 'pending' or 'latest'.
3273
+ * @param {BlockIdentifier} blockIdentifier bloc number (BigNumberish) or 'pending' or 'latest'.
3253
3274
  * Use of 'latest" or of a block already created will generate no pause.
3254
3275
  * @param {number} [retryInterval] number of milliseconds between 2 requests to the node
3255
3276
  * @example
@@ -3515,6 +3536,68 @@ declare class EthSigner implements SignerInterface {
3515
3536
  protected formatEthSignature(ethSignature: RecoveredSignatureType): ArraySignatureType;
3516
3537
  }
3517
3538
 
3539
+ /**
3540
+ * Signer for accounts using a Ledger Nano S+/X signature
3541
+ */
3542
+ declare class LedgerSigner implements SignerInterface {
3543
+ readonly transporter: Transport;
3544
+ readonly accountID: number;
3545
+ readonly eip2645applicationName: string;
3546
+ readonly pathBuffer: Uint8Array;
3547
+ private appVersion;
3548
+ protected pubKey: string;
3549
+ protected fullPubKey: string;
3550
+ /**
3551
+ * constructor of the LedgerSigner class.
3552
+ * @param {Transport} transport 5 transports are available to handle USB, bluetooth, Node, Web, Mobile.
3553
+ * See Guides for more details.
3554
+ * @param {number} accountID ID of Ledger Nano (can handle 2**31 accounts).
3555
+ * @param {string} [eip2645application='LedgerW'] A wallet is defined by an ERC2645 derivation path (6 items).
3556
+ * One item is the `application`. Default value is `LedgerW`.
3557
+ * @example
3558
+ * ```typescript
3559
+ * import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
3560
+ * const myNodeTransport = await TransportNodeHid.create();
3561
+ * const myLedgerSigner = new LedgerSigner(myNodeTransport, 0);
3562
+ * ```
3563
+ */
3564
+ constructor(transport: Transport, accountID: number, eip2645application?: string);
3565
+ /**
3566
+ * provides the Starknet public key
3567
+ * @returns an hex string : 64 characters are Point X coordinate.
3568
+ */
3569
+ getPubKey(): Promise<string>;
3570
+ /**
3571
+ * provides the full public key (with parity prefix)
3572
+ * @returns an hex string : 2 first characters are the parity, the 64 following characters are Point X coordinate. 64 last characters are Point Y coordinate.
3573
+ */
3574
+ getFullPubKey(): Promise<string>;
3575
+ /**
3576
+ * Returns the version of the Starknet APP implemented in the Ledger.
3577
+ * @returns {string} version.
3578
+ * @example
3579
+ * ```typescript
3580
+ * const result = await myLedgerSigner.getAppVersion();
3581
+ * // result= "1.1.1"
3582
+ * ```
3583
+ */
3584
+ getAppVersion(): Promise<string>;
3585
+ signMessage(typedDataToHash: TypedData, accountAddress: string): Promise<Signature>;
3586
+ signTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails): Promise<Signature>;
3587
+ signDeployAccountTransaction(details: DeployAccountSignerDetails): Promise<Signature>;
3588
+ signDeclareTransaction(details: DeclareSignerDetails): Promise<Signature>;
3589
+ private signRaw;
3590
+ private getPublicKeys;
3591
+ }
3592
+ /**
3593
+ * format the Ledger wallet path to an Uint8Array.
3594
+ * EIP2645 path = 2645'/starknet'/application'/0'/accountId'/0
3595
+ * @param {number} accountId Id of account. < 2**31.
3596
+ * @param {string} [applicationName='LedgerW'] utf8 string of application name.
3597
+ * @returns an Uint8array of 24 bytes.
3598
+ */
3599
+ declare function getLedgerPathBuffer(accountId: number, applicationName: string): Uint8Array;
3600
+
3518
3601
  declare abstract class AccountInterface extends ProviderInterface {
3519
3602
  abstract address: string;
3520
3603
  abstract signer: SignerInterface;
@@ -4123,7 +4206,7 @@ declare class ContractFactory {
4123
4206
  }
4124
4207
 
4125
4208
  /**
4126
- * Calculate the hex-string Keccak hash for a given BigNumberish
4209
+ * Calculate the hex-string Starknet Keccak hash for a given BigNumberish
4127
4210
  *
4128
4211
  * @param value value to hash
4129
4212
  * @returns hex-string Keccak hash
@@ -4161,9 +4244,9 @@ declare function starknetKeccak(str: string): bigint;
4161
4244
  */
4162
4245
  declare function getSelectorFromName(funcName: string): string;
4163
4246
  /**
4164
- * Calculate the hex-string selector from a given abi function name, decimal string or hex string
4247
+ * Calculate the hex-string selector from a given abi function name or of any representation of number.
4165
4248
  *
4166
- * @param value hex-string | dec-string | ascii-string
4249
+ * @param value ascii-string | hex-string | dec-string | number | BigInt
4167
4250
  * @returns hex-string selector
4168
4251
  * @example
4169
4252
  * ```typescript
@@ -4175,16 +4258,125 @@ declare function getSelectorFromName(funcName: string): string;
4175
4258
  *
4176
4259
  * const selector3: string = getSelector("123456");
4177
4260
  * // selector3 = "0x1e240"
4261
+ *
4262
+ * const selector4: string = getSelector(123456n);
4263
+ * // selector4 = "0x1e240"
4264
+ * ```
4265
+ */
4266
+ declare function getSelector(value: string | BigNumberish): string;
4267
+ /**
4268
+ * Solidity hash of an array of uint256
4269
+ * @param {BigNumberish[]} params an array of uint256 numbers
4270
+ * @returns the hash of the array of Solidity uint256
4271
+ * @example
4272
+ * ```typescript
4273
+ * const result = hash.solidityUint256PackedKeccak256(['0x100', '200', 300, 400n]);
4274
+ * // result = '0xd1e6cb422b65269603c491b0c85463295edabebfb2a6844e4fdc389ff1dcdd97'
4275
+ * ```
4276
+ */
4277
+ declare function solidityUint256PackedKeccak256(params: BigNumberish[]): string;
4278
+ /**
4279
+ * Calculate the L2 message hash related by a message L1->L2
4280
+ * @param {BigNumberish} l1FromAddress L1 account address that paid the message.
4281
+ * @param {BigNumberish} l2ToAddress L2 contract address to execute.
4282
+ * @param {string | BigNumberish} l2Selector can be a function name ("bridge_withdraw") or a number (BigNumberish).
4283
+ * @param {RawCalldata} l2Calldata an array of BigNumberish of the raw parameters passed to the above function.
4284
+ * @param {BigNumberish} l1Nonce The nonce of the L1 account.
4285
+ * @returns {string} hex-string of the L2 transaction hash
4286
+ * @example
4287
+ * ```typescript
4288
+ * const l1FromAddress = "0x0000000000000000000000008453fc6cd1bcfe8d4dfc069c400b433054d47bdc";
4289
+ * const l2ToAddress = 2158142789748719025684046545159279785659305214176670733242887773692203401023n;
4290
+ * const l2Selector = 774397379524139446221206168840917193112228400237242521560346153613428128537n;
4291
+ * const payload = [
4292
+ * 4543560n,
4293
+ * 829565602143178078434185452406102222830667255948n,
4294
+ * 3461886633118033953192540141609307739580461579986333346825796013261542798665n,
4295
+ * 9000000000000000n,
4296
+ * 0n,
4297
+ * ];
4298
+ * const l1Nonce = 8288n;
4299
+ * const result = hash.getL2MessageHash(l1FromAddress, l2ToAddress, l2Selector, payload, l1Nonce);
4300
+ * // result = "0x2e350fa9d830482605cb68be4fdb9f0cb3e1f95a0c51623ac1a5d1bd997c2090"
4178
4301
  * ```
4179
4302
  */
4180
- declare function getSelector(value: string): string;
4303
+ declare function getL2MessageHash(l1FromAddress: BigNumberish, l2ToAddress: BigNumberish, l2Selector: string | BigNumberish, l2Calldata: BigNumberish[], l1Nonce: BigNumberish): string;
4181
4304
 
4305
+ declare const selector_getL2MessageHash: typeof getL2MessageHash;
4182
4306
  declare const selector_getSelector: typeof getSelector;
4183
4307
  declare const selector_getSelectorFromName: typeof getSelectorFromName;
4184
4308
  declare const selector_keccakBn: typeof keccakBn;
4309
+ declare const selector_solidityUint256PackedKeccak256: typeof solidityUint256PackedKeccak256;
4185
4310
  declare const selector_starknetKeccak: typeof starknetKeccak;
4186
4311
  declare namespace selector {
4187
- export { selector_getSelector as getSelector, selector_getSelectorFromName as getSelectorFromName, selector_keccakBn as keccakBn, selector_starknetKeccak as starknetKeccak };
4312
+ export { selector_getL2MessageHash as getL2MessageHash, selector_getSelector as getSelector, selector_getSelectorFromName as getSelectorFromName, selector_keccakBn as keccakBn, selector_solidityUint256PackedKeccak256 as solidityUint256PackedKeccak256, selector_starknetKeccak as starknetKeccak };
4313
+ }
4314
+
4315
+ /**
4316
+ * Calculate Hashes for v0 - v2 transactions
4317
+ */
4318
+
4319
+ /**
4320
+ * Compute pedersen hash from data
4321
+ * @returns format: hex-string - pedersen hash
4322
+ */
4323
+ declare function computeHashOnElements$1(data: BigNumberish[]): string;
4324
+ /**
4325
+ * Calculate transaction pedersen hash for common properties
4326
+ *
4327
+ * Following implementation is based on this python [implementation #](https://github.com/starkware-libs/cairo-lang/blob/b614d1867c64f3fb2cf4a4879348cfcf87c3a5a7/src/starkware/starknet/core/os/transaction_hash/transaction_hash.py)
4328
+ * @returns format: hex-string
4329
+ */
4330
+ declare function calculateTransactionHashCommon$1(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: RawCalldata, maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
4331
+ /**
4332
+ * Calculate declare transaction hash
4333
+ * @param classHash hex-string
4334
+ * @param compiledClassHash hex-string
4335
+ * @returns format: hex-string
4336
+ */
4337
+ declare function calculateDeclareTransactionHash$2(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, compiledClassHash?: string): string;
4338
+ /**
4339
+ * Calculate deploy_account transaction hash
4340
+ * @returns format: hex-string
4341
+ */
4342
+ declare function calculateDeployAccountTransactionHash$2(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
4343
+ /**
4344
+ * Calculate invoke transaction hash
4345
+ * @returns format: hex-string
4346
+ */
4347
+ declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: RawCalldata, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
4348
+ /**
4349
+ * Calculate the L2 transaction hash generated by a message L1->L2
4350
+ * @param {BigNumberish} l1FromAddress L1 account address that paid the message.
4351
+ * @param {BigNumberish} l2ToAddress L2 contract address to execute.
4352
+ * @param {string | BigNumberish} l2Selector can be a function name ("bridge_withdraw") or a number (BigNumberish).
4353
+ * @param {RawCalldata} l2Calldata an array of BigNumberish of the raw parameters passed to the above function.
4354
+ * @param {BigNumberish} l2ChainId L2 chain ID : from constants.StarknetChainId.xxx
4355
+ * @param {BigNumberish} l1Nonce The nonce of the L1 account.
4356
+ * @returns {string} hex-string of the L2 transaction hash
4357
+ * @example
4358
+ * ```typescript
4359
+ * const l1FromAddress = "0x0000000000000000000000008453fc6cd1bcfe8d4dfc069c400b433054d47bdc";
4360
+ * const l2ToAddress = 2158142789748719025684046545159279785659305214176670733242887773692203401023n;
4361
+ * const l2Selector = 774397379524139446221206168840917193112228400237242521560346153613428128537n;
4362
+ * const payload = [
4363
+ * 4543560n,
4364
+ * 829565602143178078434185452406102222830667255948n,
4365
+ * 3461886633118033953192540141609307739580461579986333346825796013261542798665n,
4366
+ * 9000000000000000n,
4367
+ * 0n,
4368
+ * ];
4369
+ * const l1Nonce = 8288n;
4370
+ * const result = hash.calculateL2MessageTxHash(l1FromAddress, l2ToAddress, l2Selector, payload, constants.StarknetChainId.SN_SEPOLIA, l1Nonce);
4371
+ * // result = "0x67d959200d65d4ad293aa4b0da21bb050a1f669bce37d215c6edbf041269c07"
4372
+ * ```
4373
+ */
4374
+ declare function calculateL2MessageTxHash(l1FromAddress: BigNumberish, l2ToAddress: BigNumberish, l2Selector: string | BigNumberish, l2Calldata: RawCalldata, l2ChainId: StarknetChainId, l1Nonce: BigNumberish): string;
4375
+
4376
+ declare const v2_calculateL2MessageTxHash: typeof calculateL2MessageTxHash;
4377
+ declare const v2_calculateTransactionHash: typeof calculateTransactionHash;
4378
+ declare namespace v2 {
4379
+ export { calculateDeclareTransactionHash$2 as calculateDeclareTransactionHash, calculateDeployAccountTransactionHash$2 as calculateDeployAccountTransactionHash, v2_calculateL2MessageTxHash as calculateL2MessageTxHash, v2_calculateTransactionHash as calculateTransactionHash, calculateTransactionHashCommon$1 as calculateTransactionHashCommon, computeHashOnElements$1 as computeHashOnElements };
4188
4380
  }
4189
4381
 
4190
4382
  /**
@@ -4238,7 +4430,7 @@ type CalcV3DeclareTxHashArgs = {
4238
4430
  paymasterData: BigNumberish[];
4239
4431
  };
4240
4432
  type CalcDeclareTxHashArgs = CalcV2DeclareTxHashArgs | CalcV3DeclareTxHashArgs;
4241
- declare function calculateDeclareTransactionHash$2(args: CalcDeclareTxHashArgs): string;
4433
+ declare function calculateDeclareTransactionHash$1(args: CalcDeclareTxHashArgs): string;
4242
4434
  type CalcV2DeployAccountTxHashArgs = {
4243
4435
  contractAddress: BigNumberish;
4244
4436
  classHash: BigNumberish;
@@ -4264,7 +4456,7 @@ type CalcV3DeployAccountTxHashArgs = {
4264
4456
  paymasterData: BigNumberish[];
4265
4457
  };
4266
4458
  type CalcDeployAccountTxHashArgs = CalcV2DeployAccountTxHashArgs | CalcV3DeployAccountTxHashArgs;
4267
- declare function calculateDeployAccountTransactionHash$2(args: CalcDeployAccountTxHashArgs): string;
4459
+ declare function calculateDeployAccountTransactionHash$1(args: CalcDeployAccountTxHashArgs): string;
4268
4460
 
4269
4461
  /**
4270
4462
  * Class Hash
@@ -4284,8 +4476,8 @@ declare function computePoseidonHash(a: BigNumberish, b: BigNumberish): string;
4284
4476
  * // result = 0x148141e8f7db29d005a0187669a56f0790d7e8c2c5b2d780e4d8b9e436a5521
4285
4477
  * ```
4286
4478
  */
4287
- declare function computeHashOnElements$1(data: BigNumberish[]): string;
4288
- declare const computePedersenHashOnElements: typeof computeHashOnElements$1;
4479
+ declare function computeHashOnElements(data: BigNumberish[]): string;
4480
+ declare const computePedersenHashOnElements: typeof computeHashOnElements;
4289
4481
  declare function computePoseidonHashOnElements(data: BigNumberish[]): string;
4290
4482
  /**
4291
4483
  * Calculate contract address from class hash
@@ -4392,8 +4584,10 @@ declare function computeContractClassHash(contract: CompiledContract | string):
4392
4584
  */
4393
4585
 
4394
4586
  declare const index$1_calculateContractAddressFromHash: typeof calculateContractAddressFromHash;
4587
+ declare const index$1_calculateL2MessageTxHash: typeof calculateL2MessageTxHash;
4395
4588
  declare const index$1_computeCompiledClassHash: typeof computeCompiledClassHash;
4396
4589
  declare const index$1_computeContractClassHash: typeof computeContractClassHash;
4590
+ declare const index$1_computeHashOnElements: typeof computeHashOnElements;
4397
4591
  declare const index$1_computeHintedClassHash: typeof computeHintedClassHash;
4398
4592
  declare const index$1_computeLegacyContractClassHash: typeof computeLegacyContractClassHash;
4399
4593
  declare const index$1_computePedersenHash: typeof computePedersenHash;
@@ -4402,14 +4596,16 @@ declare const index$1_computePoseidonHash: typeof computePoseidonHash;
4402
4596
  declare const index$1_computePoseidonHashOnElements: typeof computePoseidonHashOnElements;
4403
4597
  declare const index$1_computeSierraContractClassHash: typeof computeSierraContractClassHash;
4404
4598
  declare const index$1_formatSpaces: typeof formatSpaces;
4599
+ declare const index$1_getL2MessageHash: typeof getL2MessageHash;
4405
4600
  declare const index$1_getSelector: typeof getSelector;
4406
4601
  declare const index$1_getSelectorFromName: typeof getSelectorFromName;
4407
4602
  declare const index$1_hashByteCodeSegments: typeof hashByteCodeSegments;
4408
4603
  declare const index$1_keccakBn: typeof keccakBn;
4409
4604
  declare const index$1_poseidon: typeof poseidon;
4605
+ declare const index$1_solidityUint256PackedKeccak256: typeof solidityUint256PackedKeccak256;
4410
4606
  declare const index$1_starknetKeccak: typeof starknetKeccak;
4411
4607
  declare namespace index$1 {
4412
- export { index$1_calculateContractAddressFromHash as calculateContractAddressFromHash, calculateDeclareTransactionHash$2 as calculateDeclareTransactionHash, calculateDeployAccountTransactionHash$2 as calculateDeployAccountTransactionHash, calculateInvokeTransactionHash$1 as calculateInvokeTransactionHash, index$1_computeCompiledClassHash as computeCompiledClassHash, index$1_computeContractClassHash as computeContractClassHash, computeHashOnElements$1 as computeHashOnElements, index$1_computeHintedClassHash as computeHintedClassHash, index$1_computeLegacyContractClassHash as computeLegacyContractClassHash, index$1_computePedersenHash as computePedersenHash, index$1_computePedersenHashOnElements as computePedersenHashOnElements, index$1_computePoseidonHash as computePoseidonHash, index$1_computePoseidonHashOnElements as computePoseidonHashOnElements, index$1_computeSierraContractClassHash as computeSierraContractClassHash, index$1_formatSpaces as formatSpaces, index$1_getSelector as getSelector, index$1_getSelectorFromName as getSelectorFromName, index$1_hashByteCodeSegments as hashByteCodeSegments, index$1_keccakBn as keccakBn, index$1_poseidon as poseidon, index$1_starknetKeccak as starknetKeccak };
4608
+ export { index$1_calculateContractAddressFromHash as calculateContractAddressFromHash, calculateDeclareTransactionHash$1 as calculateDeclareTransactionHash, calculateDeployAccountTransactionHash$1 as calculateDeployAccountTransactionHash, calculateInvokeTransactionHash$1 as calculateInvokeTransactionHash, index$1_calculateL2MessageTxHash as calculateL2MessageTxHash, index$1_computeCompiledClassHash as computeCompiledClassHash, index$1_computeContractClassHash as computeContractClassHash, index$1_computeHashOnElements as computeHashOnElements, index$1_computeHintedClassHash as computeHintedClassHash, index$1_computeLegacyContractClassHash as computeLegacyContractClassHash, index$1_computePedersenHash as computePedersenHash, index$1_computePedersenHashOnElements as computePedersenHashOnElements, index$1_computePoseidonHash as computePoseidonHash, index$1_computePoseidonHashOnElements as computePoseidonHashOnElements, index$1_computeSierraContractClassHash as computeSierraContractClassHash, index$1_formatSpaces as formatSpaces, index$1_getL2MessageHash as getL2MessageHash, index$1_getSelector as getSelector, index$1_getSelectorFromName as getSelectorFromName, index$1_hashByteCodeSegments as hashByteCodeSegments, index$1_keccakBn as keccakBn, index$1_poseidon as poseidon, index$1_solidityUint256PackedKeccak256 as solidityUint256PackedKeccak256, index$1_starknetKeccak as starknetKeccak };
4413
4609
  }
4414
4610
 
4415
4611
  /**
@@ -4418,71 +4614,31 @@ declare namespace index$1 {
4418
4614
 
4419
4615
  declare function hashDAMode(nonceDAMode: BigNumberish, feeDAMode: BigNumberish): bigint;
4420
4616
  declare function hashFeeField(tip: BigNumberish, bounds: ResourceBounds$2): bigint;
4421
- declare function calculateTransactionHashCommon$1(txHashPrefix: TransactionHashPrefix, version: BigNumberish, senderAddress: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, tip: BigNumberish, paymasterData: BigNumberish[], nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, additionalData?: BigNumberish[]): string;
4617
+ declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, senderAddress: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, tip: BigNumberish, paymasterData: BigNumberish[], nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, additionalData?: BigNumberish[]): string;
4422
4618
  /**
4423
4619
  * Calculate v3 deploy_account transaction hash
4424
4620
  * @returns format: hex-string
4425
4621
  */
4426
- declare function calculateDeployAccountTransactionHash$1(contractAddress: BigNumberish, classHash: BigNumberish, compiledConstructorCalldata: Calldata, salt: BigNumberish, version: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, tip: BigNumberish, paymasterData: BigNumberish[]): string;
4622
+ declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, compiledConstructorCalldata: Calldata, salt: BigNumberish, version: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, tip: BigNumberish, paymasterData: BigNumberish[]): string;
4427
4623
  /**
4428
4624
  * Calculate v3 declare transaction hash
4429
4625
  * @returns format: hex-string
4430
4626
  */
4431
- declare function calculateDeclareTransactionHash$1(classHash: string, compiledClassHash: string, senderAddress: BigNumberish, version: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, accountDeploymentData: BigNumberish[], nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, tip: BigNumberish, paymasterData: BigNumberish[]): string;
4627
+ declare function calculateDeclareTransactionHash(classHash: string, compiledClassHash: string, senderAddress: BigNumberish, version: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, accountDeploymentData: BigNumberish[], nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, tip: BigNumberish, paymasterData: BigNumberish[]): string;
4432
4628
  /**
4433
4629
  * Calculate v3 invoke transaction hash
4434
4630
  * @returns format: hex-string
4435
4631
  */
4436
4632
  declare function calculateInvokeTransactionHash(senderAddress: BigNumberish, version: BigNumberish, compiledCalldata: Calldata, chainId: StarknetChainId, nonce: BigNumberish, accountDeploymentData: BigNumberish[], nonceDataAvailabilityMode: EDAMode$1, feeDataAvailabilityMode: EDAMode$1, resourceBounds: ResourceBounds$2, tip: BigNumberish, paymasterData: BigNumberish[]): string;
4437
4633
 
4634
+ declare const v3_calculateDeclareTransactionHash: typeof calculateDeclareTransactionHash;
4635
+ declare const v3_calculateDeployAccountTransactionHash: typeof calculateDeployAccountTransactionHash;
4438
4636
  declare const v3_calculateInvokeTransactionHash: typeof calculateInvokeTransactionHash;
4637
+ declare const v3_calculateTransactionHashCommon: typeof calculateTransactionHashCommon;
4439
4638
  declare const v3_hashDAMode: typeof hashDAMode;
4440
4639
  declare const v3_hashFeeField: typeof hashFeeField;
4441
4640
  declare namespace v3 {
4442
- export { calculateDeclareTransactionHash$1 as calculateDeclareTransactionHash, calculateDeployAccountTransactionHash$1 as calculateDeployAccountTransactionHash, v3_calculateInvokeTransactionHash as calculateInvokeTransactionHash, calculateTransactionHashCommon$1 as calculateTransactionHashCommon, v3_hashDAMode as hashDAMode, v3_hashFeeField as hashFeeField };
4443
- }
4444
-
4445
- /**
4446
- * Calculate Hashes for v0 - v2 transactions
4447
- */
4448
-
4449
- /**
4450
- * Compute pedersen hash from data
4451
- * @returns format: hex-string - pedersen hash
4452
- */
4453
- declare function computeHashOnElements(data: BigNumberish[]): string;
4454
- /**
4455
- * Calculate transaction pedersen hash for common properties
4456
- *
4457
- * Following implementation is based on this python [implementation #](https://github.com/starkware-libs/cairo-lang/blob/b614d1867c64f3fb2cf4a4879348cfcf87c3a5a7/src/starkware/starknet/core/os/transaction_hash/transaction_hash.py)
4458
- * @returns format: hex-string
4459
- */
4460
- declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: RawCalldata, maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
4461
- /**
4462
- * Calculate declare transaction hash
4463
- * @param classHash hex-string
4464
- * @param compiledClassHash hex-string
4465
- * @returns format: hex-string
4466
- */
4467
- declare function calculateDeclareTransactionHash(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, compiledClassHash?: string): string;
4468
- /**
4469
- * Calculate deploy_account transaction hash
4470
- * @returns format: hex-string
4471
- */
4472
- declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
4473
- /**
4474
- * Calculate invoke transaction hash
4475
- * @returns format: hex-string
4476
- */
4477
- declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: RawCalldata, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
4478
-
4479
- declare const v2_calculateDeclareTransactionHash: typeof calculateDeclareTransactionHash;
4480
- declare const v2_calculateDeployAccountTransactionHash: typeof calculateDeployAccountTransactionHash;
4481
- declare const v2_calculateTransactionHash: typeof calculateTransactionHash;
4482
- declare const v2_calculateTransactionHashCommon: typeof calculateTransactionHashCommon;
4483
- declare const v2_computeHashOnElements: typeof computeHashOnElements;
4484
- declare namespace v2 {
4485
- export { v2_calculateDeclareTransactionHash as calculateDeclareTransactionHash, v2_calculateDeployAccountTransactionHash as calculateDeployAccountTransactionHash, v2_calculateTransactionHash as calculateTransactionHash, v2_calculateTransactionHashCommon as calculateTransactionHashCommon, v2_computeHashOnElements as computeHashOnElements };
4641
+ export { v3_calculateDeclareTransactionHash as calculateDeclareTransactionHash, v3_calculateDeployAccountTransactionHash as calculateDeployAccountTransactionHash, v3_calculateInvokeTransactionHash as calculateInvokeTransactionHash, v3_calculateTransactionHashCommon as calculateTransactionHashCommon, v3_hashDAMode as hashDAMode, v3_hashFeeField as hashFeeField };
4486
4642
  }
4487
4643
 
4488
4644
  /**
@@ -4823,6 +4979,20 @@ declare function isNumber(value: unknown): value is number;
4823
4979
  * @return {boolean} - True if the value is of boolean type, false otherwise.
4824
4980
  */
4825
4981
  declare function isBoolean(value: unknown): value is boolean;
4982
+ /**
4983
+ * Calculate the sha256 hash of an utf8 string, then encode the
4984
+ * result in an uint8Array of 4 elements.
4985
+ * Useful in wallet path calculation.
4986
+ * @param {string} str utf8 string (hex string not handled).
4987
+ * @returns a uint8Array of 4 bytes.
4988
+ * @example
4989
+ * ```typescript
4990
+ * const ledgerPathApplicationName = 'LedgerW';
4991
+ * const path2Buffer = num.stringToSha256ToArrayBuff4(ledgerPathApplicationName);
4992
+ * // path2Buffer = Uint8Array(4) [43, 206, 231, 219]
4993
+ * ```
4994
+ */
4995
+ declare function stringToSha256ToArrayBuff4(str: string): Uint8Array;
4826
4996
 
4827
4997
  type num_BigNumberish = BigNumberish;
4828
4998
  declare const num_addPercent: typeof addPercent;
@@ -4840,13 +5010,14 @@ declare const num_isBoolean: typeof isBoolean;
4840
5010
  declare const num_isHex: typeof isHex;
4841
5011
  declare const num_isNumber: typeof isNumber;
4842
5012
  declare const num_isStringWholeNumber: typeof isStringWholeNumber;
5013
+ declare const num_stringToSha256ToArrayBuff4: typeof stringToSha256ToArrayBuff4;
4843
5014
  declare const num_toBigInt: typeof toBigInt;
4844
5015
  declare const num_toCairoBool: typeof toCairoBool;
4845
5016
  declare const num_toHex: typeof toHex;
4846
5017
  declare const num_toHexString: typeof toHexString;
4847
5018
  declare const num_toStorageKey: typeof toStorageKey;
4848
5019
  declare namespace num {
4849
- export { type num_BigNumberish as BigNumberish, 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_hexToBytes as hexToBytes, num_hexToDecimalString as hexToDecimalString, num_isBigInt as isBigInt, num_isBoolean as isBoolean, num_isHex as isHex, num_isNumber as isNumber, num_isStringWholeNumber as isStringWholeNumber, num_toBigInt as toBigInt, num_toCairoBool as toCairoBool, num_toHex as toHex, num_toHexString as toHexString, num_toStorageKey as toStorageKey };
5020
+ export { type num_BigNumberish as BigNumberish, 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_hexToBytes as hexToBytes, num_hexToDecimalString as hexToDecimalString, num_isBigInt as isBigInt, num_isBoolean as isBoolean, num_isHex as isHex, num_isNumber as isNumber, num_isStringWholeNumber as isStringWholeNumber, num_stringToSha256ToArrayBuff4 as stringToSha256ToArrayBuff4, num_toBigInt as toBigInt, num_toCairoBool as toCairoBool, num_toHex as toHex, num_toHexString as toHexString, num_toStorageKey as toStorageKey };
4850
5021
  }
4851
5022
 
4852
5023
  /**
@@ -5665,10 +5836,20 @@ interface Context {
5665
5836
  key?: string;
5666
5837
  }
5667
5838
  /**
5668
- * Prepares the selector for use.
5839
+ * Prepares the selector for later use, if it's not already in correct format.
5840
+ * The selector in correct format is the starknet_keccak hash of the function name, encoded in ASCII.
5669
5841
  *
5670
5842
  * @param {string} selector - The selector to be prepared.
5671
5843
  * @returns {string} The prepared selector.
5844
+ *
5845
+ * @example
5846
+ * ```typescript
5847
+ * const result1 = prepareSelector('0xc14cfe23f3fa7ce7b1f8db7d7682305b1692293f71a61cc06637f0d8d8b6c8');
5848
+ * // result1 = '0xc14cfe23f3fa7ce7b1f8db7d7682305b1692293f71a61cc06637f0d8d8b6c8'
5849
+ *
5850
+ * const result2 = prepareSelector('myFunction');
5851
+ * // result2 = '0xc14cfe23f3fa7ce7b1f8db7d7682305b1692293f71a61cc06637f0d8d8b6c8'
5852
+ * ```
5672
5853
  */
5673
5854
  declare function prepareSelector(selector: string): string;
5674
5855
  /**
@@ -5677,38 +5858,186 @@ declare function prepareSelector(selector: string): string;
5677
5858
  * @param {StarknetType} type - The StarkNet type to check.
5678
5859
  *
5679
5860
  * @returns {boolean} - True if the type is a Merkle tree type, false otherwise.
5861
+ *
5862
+ * @example
5863
+ * ```typescript
5864
+ * const type = { name: 'test', type: 'merkletree',};
5865
+ * const result1 = isMerkleTreeType(type);
5866
+ * // result1 = true
5867
+ *
5868
+ * const type2 = {name: 'test', type: 'non-merkletree',};
5869
+ * const result2 = isMerkleTreeType(type2);
5870
+ * // result2 = false
5871
+ * ```
5680
5872
  */
5681
5873
  declare function isMerkleTreeType(type: StarknetType): type is StarknetMerkleType;
5682
5874
  /**
5683
5875
  * Get the dependencies of a struct type. If a struct has the same dependency multiple times, it's only included once
5684
5876
  * in the resulting array.
5877
+ *
5878
+ * @param {TypedData['types']} types - The types object containing all defined types.
5879
+ * @param {string} type - The name of the type to get dependencies for.
5880
+ * @param {string[]} [dependencies=[]] - The array to store dependencies.
5881
+ * @param {string} [contains=''] - The type contained within the struct.
5882
+ * @param {Revision} [revision=Revision.Legacy] - The revision of the TypedData.
5883
+ *
5884
+ * @returns {string[]} The array of dependencies.
5685
5885
  */
5686
5886
  declare function getDependencies(types: TypedData['types'], type: string, dependencies?: string[], contains?: string, revision?: TypedDataRevision): string[];
5687
5887
  /**
5688
5888
  * Encode a type to a string. All dependent types are alphabetically sorted.
5889
+ *
5890
+ * @param {TypedData['types']} types - The types object containing all defined types.
5891
+ * @param {string} type - The name of the type to encode.
5892
+ * @param {Revision} [revision=Revision.Legacy] - The revision of the TypedData.
5893
+ *
5894
+ * @returns {string} The encoded string.
5895
+ *
5896
+ * @example
5897
+ * ```typescript
5898
+ * import typedDataExample from '../../__mocks__/typedData/baseExample.json';
5899
+ *
5900
+ * const result = encodeType(typedDataExample.types, 'Mail');
5901
+ * // result = "Mail(from:Person,to:Person,contents:felt)Person(name:felt,wallet:felt)";
5902
+ * ```
5689
5903
  */
5690
5904
  declare function encodeType(types: TypedData['types'], type: string, revision?: TypedDataRevision): string;
5691
5905
  /**
5692
5906
  * Get a type string as hash.
5907
+ *
5908
+ * @param {TypedData['types']} types - The types object containing all defined types.
5909
+ * @param {string} type - The name of the type to hash.
5910
+ * @param {Revision} [revision=Revision.Legacy] - The revision of the TypedData.
5911
+ *
5912
+ * @returns {string} The hash.
5913
+ *
5914
+ * @example
5915
+ * ```typescript
5916
+ * import typedDataExample from '../../__mocks__/typedData/baseExample.json';
5917
+ *
5918
+ * const result = getTypeHash(typedDataExample.types, 'StarkNetDomain');
5919
+ * // result = "0x1bfc207425a47a5dfa1a50a4f5241203f50624ca5fdf5e18755765416b8e288";
5920
+ * ```
5693
5921
  */
5694
5922
  declare function getTypeHash(types: TypedData['types'], type: string, revision?: TypedDataRevision): string;
5695
5923
  /**
5696
- * Encodes a single value to an ABI serialisable string, number or Buffer. Returns the data as tuple, which consists of
5924
+ * Encodes a single value to an ABI serialisable string, number or Buffer. Returns the data as a tuple, which consists of
5697
5925
  * an array of ABI compatible types, and an array of corresponding values.
5926
+ *
5927
+ * @param {TypedData['types']} types - The types object containing all defined types.
5928
+ * @param {string} type - The name of the type to encode.
5929
+ * @param {unknown} data - The data to encode.
5930
+ * @param {Context} [ctx={}] - The context of the encoding process.
5931
+ * @param {Revision} [revision=Revision.Legacy] - The revision of the TypedData.
5932
+ *
5933
+ * @returns {[string, string]} The ABI compatible type and corresponding value.
5934
+ *
5935
+ * @example
5936
+ * ```typescript
5937
+ * import { getSelectorFromName } from '../../src/utils/hash';
5938
+ *
5939
+ * const selector = 'transfer';
5940
+ * const selectorHash = getSelectorFromName(selector);
5941
+ * const result1 = encodeValue({}, 'felt', selectorHash);
5942
+ *
5943
+ * // result1 = ['felt', '0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e']
5944
+ * ```
5698
5945
  */
5699
5946
  declare function encodeValue(types: TypedData['types'], type: string, data: unknown, ctx?: Context, revision?: TypedDataRevision): [string, string];
5700
5947
  /**
5701
5948
  * Encode the data to an ABI encoded Buffer. The data should be a key -> value object with all the required values.
5702
5949
  * All dependent types are automatically encoded.
5950
+ *
5951
+ * @param {TypedData['types']} types - The types object containing all defined types.
5952
+ * @param {string} type - The name of the type to encode.
5953
+ * @param {TypedData['message']} data - The data to encode.
5954
+ * @param {Revision} [revision=Revision.Legacy] - The revision of the TypedData.
5955
+ *
5956
+ * @returns {[string[], string[]]} The ABI compatible types and corresponding values.
5703
5957
  */
5704
5958
  declare function encodeData<T extends TypedData>(types: T['types'], type: string, data: T['message'], revision?: TypedDataRevision): string[][];
5705
5959
  /**
5706
5960
  * Get encoded data as a hash. The data should be a key -> value object with all the required values.
5707
5961
  * All dependent types are automatically encoded.
5962
+ *
5963
+ * @param {TypedData['types']} types - The types object containing all defined types.
5964
+ * @param {string} type - The name of the type to hash.
5965
+ * @param {TypedData['message']} data - The data to hash.
5966
+ * @param {Revision} [revision=Revision.Legacy] - The revision of the TypedData.
5967
+ *
5968
+ * @returns {string} The hash of the encoded data.
5969
+ *
5970
+ * @example
5971
+ * ```typescript
5972
+ * import exampleBaseTypes from '../../__mocks__/typedData/example_baseTypes.json';
5973
+ *
5974
+ * const result = getStructHash(
5975
+ * exampleBaseTypes.types,
5976
+ * 'StarknetDomain',
5977
+ * exampleBaseTypes.domain as StarknetDomain,
5978
+ * TypedDataRevision.ACTIVE
5979
+ * );
5980
+ * // result = "0x555f72e550b308e50c1a4f8611483a174026c982a9893a05c185eeb85399657";
5981
+ * ```
5708
5982
  */
5709
5983
  declare function getStructHash<T extends TypedData>(types: T['types'], type: string, data: T['message'], revision?: TypedDataRevision): string;
5710
5984
  /**
5711
5985
  * Get the SNIP-12 encoded message to sign, from the typedData object.
5986
+ *
5987
+ * @param {TypedData} typedData - The TypedData object.
5988
+ * @param {BigNumberish} account - The account to sign the message.
5989
+ *
5990
+ * @returns {string} The hash of the message to sign.
5991
+ * @throws Will throw an error if the typedData does not match the JSON schema.
5992
+ *
5993
+ * @example
5994
+ * ```typescript
5995
+ * const exampleAddress = "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826";
5996
+ * const typedDataStringExample = {
5997
+ * types: {
5998
+ * StarkNetDomain: [
5999
+ * { name: 'name', type: 'felt' },
6000
+ * { name: 'version', type: 'felt' },
6001
+ * { name: 'chainId', type: 'felt' },
6002
+ * ],
6003
+ * Person: [
6004
+ * { name: 'name', type: 'felt' },
6005
+ * { name: 'wallet', type: 'felt' },
6006
+ * ],
6007
+ * String: [
6008
+ * { name: 'len', type: 'felt' },
6009
+ * { name: 'data', type: 'felt*' },
6010
+ * ],
6011
+ * Mail: [
6012
+ * { name: 'from', type: 'Person' },
6013
+ * { name: 'to', type: 'Person' },
6014
+ * { name: 'contents', type: 'String' },
6015
+ * ],
6016
+ * },
6017
+ * primaryType: 'Mail',
6018
+ * domain: {
6019
+ * name: 'StarkNet Mail',
6020
+ * version: '1',
6021
+ * chainId: 1,
6022
+ * },
6023
+ * message: {
6024
+ * from: {
6025
+ * name: 'Cow',
6026
+ * wallet: exampleAddress,
6027
+ * },
6028
+ * to: {
6029
+ * name: 'Bob',
6030
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
6031
+ * },
6032
+ * contents: stringToStringStruct(
6033
+ * 'this is way longer than just 32 characters, to test if that is possible within a typedData struct.'
6034
+ * ),
6035
+ * },
6036
+ * };
6037
+ *
6038
+ * const result = getMessageHash(typedDataStringExample, exampleAddress);
6039
+ * // result = "0x70338fb11b8f70b68b261de8a322bcb004bd85e88ac47d9147982c7f5ac66fd"
6040
+ * ```
5712
6041
  */
5713
6042
  declare function getMessageHash(typedData: TypedData, account: BigNumberish): string;
5714
6043
 
@@ -6946,4 +7275,4 @@ declare namespace connect {
6946
7275
  /** @deprecated prefer the 'num' naming */
6947
7276
  declare const number: typeof num;
6948
7277
 
6949
- export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallStruct, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, CustomError, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransactionReceiptResponse, type Details, EntryPointType, type EntryPointsByType, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type EventEntry, type FeeEstimate, type FunctionAbi, GatewayError, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, HttpError, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransactionReceiptResponse, type L1HandlerTransactionReceiptResponse, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type MessageToL1, type MultiDeployContractResponse, type MultiType, type Nonce, type OptionalPayload, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PendingBlock, type PendingStateUpdate, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, index$3 as RPC, rpc_0_6 as RPC06, rpc_0_7 as RPC07, RPCResponseParser, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, ReceiptTx, type RejectedTransactionReceiptResponse, ResponseParser, type Result, type RevertedTransactionReceiptResponse, RpcChannel, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type SuccessfulTransactionReceiptResponse, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptUtilityInterface, type TransactionReceiptValue, TransactionStatus, type TransactionStatusReceiptSets, TransactionType, 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 V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, type WeierstrassSignatureType, addAddressPadding, buildUrl, byteArray, cairo, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, eth, index as events, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, type getSimulateTransactionOptions, index$1 as hash, isSierra, isUrl, json, merkle, num, number, parseCalldataField, provider, selector, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index$2 as types, uint256$1 as uint256, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions, connect as wallet };
7278
+ export { type Abi, type AbiEntry, type AbiEnum, type AbiEnums, type AbiEvent, type AbiEvents, type AbiInterfaces, type AbiStruct, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, type CairoEvent, type CairoEventDefinition, type CairoEventVariant, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoUint256, CairoUint512, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallStruct, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, CustomError, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransactionReceiptResponse, type Details, EntryPointType, type EntryPointsByType, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type EventEntry, type FeeEstimate, type FunctionAbi, GatewayError, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type GetTxReceiptResponseWithoutHelper, type HexCalldata, HttpError, type InterfaceAbi, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransactionReceiptResponse, type L1HandlerTransactionReceiptResponse, LedgerSigner, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type MessageToL1, type MultiDeployContractResponse, type MultiType, type Nonce, type OptionalPayload, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PendingBlock, type PendingStateUpdate, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, index$3 as RPC, rpc_0_6 as RPC06, rpc_0_7 as RPC07, RPCResponseParser, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, ReceiptTx, type RejectedTransactionReceiptResponse, ResponseParser, type Result, type RevertedTransactionReceiptResponse, RpcChannel, RpcProvider, type RpcProviderOptions, type SIMULATION_FLAG, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type SuccessfulTransactionReceiptResponse, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, type TransactionReceiptCallbacks, type TransactionReceiptCallbacksDefault, type TransactionReceiptCallbacksDefined, type TransactionReceiptStatus, type TransactionReceiptUtilityInterface, type TransactionReceiptValue, TransactionStatus, type TransactionStatusReceiptSets, TransactionType, 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 V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, type WeierstrassSignatureType, addAddressPadding, buildUrl, byteArray, cairo, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, eth, index as events, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getLedgerPathBuffer, type getSimulateTransactionOptions, index$1 as hash, isSierra, isUrl, json, merkle, num, number, parseCalldataField, provider, selector, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index$2 as types, uint256$1 as uint256, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions, connect as wallet };