starknet 5.11.1 → 5.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
@@ -141,99 +141,6 @@ declare namespace ec {
141
141
  };
142
142
  }
143
143
 
144
- type BigNumberish = string | number | bigint;
145
- declare function isHex(hex: string): boolean;
146
- declare function toBigInt(value: BigNumberish): bigint;
147
- declare function isBigInt(value: any): value is bigint;
148
- declare function toHex(number: BigNumberish): string;
149
- declare function hexToDecimalString(hex: string): string;
150
- /**
151
- * Remove hex string leading zero and lower case '0x01A'.. -> '0x1a..'
152
- * @param hex string
153
- */
154
- declare const cleanHex: (hex: string) => string;
155
- declare function assertInRange(input: BigNumberish, lowerBound: BigNumberish, upperBound: BigNumberish, inputName?: string): void;
156
- declare function bigNumberishArrayToDecimalStringArray(rawCalldata: BigNumberish[]): string[];
157
- declare function bigNumberishArrayToHexadecimalStringArray(rawCalldata: BigNumberish[]): string[];
158
- declare const isStringWholeNumber: (value: string) => boolean;
159
- declare const toHexString: (value: string) => string;
160
- declare function getDecimalString(value: string): string;
161
- declare function getHexString(value: string): string;
162
- declare function getHexStringArray(value: Array<string>): string[];
163
- declare const toCairoBool: (value: boolean) => string;
164
- /**
165
- * Convert a hex string to an array of Bytes (Uint8Array)
166
- * @param value hex string
167
- * @returns an array of Bytes
168
- */
169
- declare function hexToBytes(value: string): Uint8Array;
170
-
171
- type num_BigNumberish = BigNumberish;
172
- declare const num_assertInRange: typeof assertInRange;
173
- declare const num_bigNumberishArrayToDecimalStringArray: typeof bigNumberishArrayToDecimalStringArray;
174
- declare const num_bigNumberishArrayToHexadecimalStringArray: typeof bigNumberishArrayToHexadecimalStringArray;
175
- declare const num_cleanHex: typeof cleanHex;
176
- declare const num_getDecimalString: typeof getDecimalString;
177
- declare const num_getHexString: typeof getHexString;
178
- declare const num_getHexStringArray: typeof getHexStringArray;
179
- declare const num_hexToBytes: typeof hexToBytes;
180
- declare const num_hexToDecimalString: typeof hexToDecimalString;
181
- declare const num_isBigInt: typeof isBigInt;
182
- declare const num_isHex: typeof isHex;
183
- declare const num_isStringWholeNumber: typeof isStringWholeNumber;
184
- declare const num_toBigInt: typeof toBigInt;
185
- declare const num_toCairoBool: typeof toCairoBool;
186
- declare const num_toHex: typeof toHex;
187
- declare const num_toHexString: typeof toHexString;
188
- declare namespace num {
189
- export {
190
- num_BigNumberish as BigNumberish,
191
- num_assertInRange as assertInRange,
192
- num_bigNumberishArrayToDecimalStringArray as bigNumberishArrayToDecimalStringArray,
193
- num_bigNumberishArrayToHexadecimalStringArray as bigNumberishArrayToHexadecimalStringArray,
194
- num_cleanHex as cleanHex,
195
- num_getDecimalString as getDecimalString,
196
- num_getHexString as getHexString,
197
- num_getHexStringArray as getHexStringArray,
198
- num_hexToBytes as hexToBytes,
199
- num_hexToDecimalString as hexToDecimalString,
200
- num_isBigInt as isBigInt,
201
- num_isHex as isHex,
202
- num_isStringWholeNumber as isStringWholeNumber,
203
- num_toBigInt as toBigInt,
204
- num_toCairoBool as toCairoBool,
205
- num_toHex as toHex,
206
- num_toHexString as toHexString,
207
- };
208
- }
209
-
210
- interface Uint256 {
211
- low: BigNumberish;
212
- high: BigNumberish;
213
- }
214
- declare function uint256ToBN(uint256: Uint256): bigint;
215
- declare const UINT_128_MAX: bigint;
216
- declare const UINT_256_MAX: bigint;
217
- declare function isUint256(bn: BigNumberish): boolean;
218
- declare function bnToUint256(bignumber: BigNumberish): Uint256;
219
-
220
- declare const uint256$1_UINT_128_MAX: typeof UINT_128_MAX;
221
- declare const uint256$1_UINT_256_MAX: typeof UINT_256_MAX;
222
- type uint256$1_Uint256 = Uint256;
223
- declare const uint256$1_bnToUint256: typeof bnToUint256;
224
- declare const uint256$1_isUint256: typeof isUint256;
225
- declare const uint256$1_uint256ToBN: typeof uint256ToBN;
226
- declare namespace uint256$1 {
227
- export {
228
- uint256$1_UINT_128_MAX as UINT_128_MAX,
229
- uint256$1_UINT_256_MAX as UINT_256_MAX,
230
- uint256$1_Uint256 as Uint256,
231
- uint256$1_bnToUint256 as bnToUint256,
232
- uint256$1_isUint256 as isUint256,
233
- uint256$1_uint256ToBN as uint256ToBN,
234
- };
235
- }
236
-
237
144
  /** ABI */
238
145
  type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
239
146
  type AbiEntry = {
@@ -342,6 +249,14 @@ declare enum EntryPointType {
342
249
  type WeierstrassSignatureType = weierstrass.SignatureType;
343
250
  type ArraySignatureType = string[];
344
251
  type Signature = ArraySignatureType | WeierstrassSignatureType;
252
+ type BigNumberish = string | number | bigint;
253
+ /**
254
+ * Represents an integer in the range [0, 2^256)
255
+ */
256
+ interface Uint256 {
257
+ low: BigNumberish;
258
+ high: BigNumberish;
259
+ }
345
260
  /**
346
261
  * BigNumberish array
347
262
  * use CallData.compile() to convert to Calldata
@@ -475,6 +390,7 @@ type Tupled = {
475
390
  };
476
391
  type BlockTag = 'pending' | 'latest';
477
392
  type BlockNumber = BlockTag | null | number;
393
+ type BlockIdentifier = BlockNumber | BigNumberish;
478
394
  type Struct = {
479
395
  type: 'struct';
480
396
  [k: string]: BigNumberish;
@@ -495,55 +411,29 @@ interface CallStruct {
495
411
  calldata: string[];
496
412
  }
497
413
 
498
- interface InvocationsSignerDetails extends Required<InvocationsDetails> {
499
- walletAddress: string;
500
- chainId: StarknetChainId;
501
- cairoVersion: CairoVersion;
502
- }
503
- interface DeclareSignerDetails {
504
- classHash: string;
505
- senderAddress: string;
506
- chainId: StarknetChainId;
507
- maxFee: BigNumberish;
508
- version: BigNumberish;
509
- nonce: BigNumberish;
510
- compiledClassHash?: string;
414
+ interface ProviderOptions {
415
+ sequencer?: SequencerProviderOptions;
416
+ rpc?: RpcProviderOptions;
511
417
  }
512
- type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
513
- contractAddress: BigNumberish;
514
- chainId: StarknetChainId;
515
- };
516
-
517
- type BlockIdentifier = BlockNumber | BigNumberish;
518
-
519
- type AsyncContractFunction<T = any> = (...args: ArgsOrCalldataWithOptions) => Promise<T>;
520
- type ContractFunction = (...args: ArgsOrCalldataWithOptions) => any;
521
- type Result = {
522
- [key: string]: any;
523
- } | Result[] | bigint | string | boolean;
524
- /**
525
- * Compiled calldata ready to be sent
526
- * decimal-string array
527
- */
528
- type Calldata = string[] & {
529
- readonly __compiled__?: boolean;
530
- };
531
- type ArgsOrCalldata = RawArgsArray | [Calldata] | Calldata;
532
- type ArgsOrCalldataWithOptions = ArgsOrCalldata & ContractOptions;
533
- type ContractOptions = {
418
+ type RpcProviderOptions = {
419
+ nodeUrl: string;
420
+ retries?: number;
421
+ headers?: object;
534
422
  blockIdentifier?: BlockIdentifier;
535
- parseRequest?: boolean;
536
- parseResponse?: boolean;
537
- formatResponse?: {
538
- [key: string]: any;
539
- };
540
- maxFee?: BigNumberish;
541
- nonce?: BigNumberish;
542
- signature?: Signature;
543
- addressSalt?: string;
423
+ chainId?: StarknetChainId;
544
424
  };
545
- type CallOptions = Pick<ContractOptions, 'blockIdentifier' | 'parseRequest' | 'parseResponse' | 'formatResponse'>;
546
- type InvokeOptions = Pick<ContractOptions, 'maxFee' | 'nonce' | 'signature' | 'parseRequest'>;
425
+ type SequencerHttpMethod = 'POST' | 'GET';
426
+ type SequencerProviderOptions = {
427
+ headers?: Record<string, string>;
428
+ blockIdentifier?: BlockIdentifier;
429
+ chainId?: StarknetChainId;
430
+ } & ({
431
+ network: NetworkName | StarknetChainId;
432
+ } | {
433
+ baseUrl: string;
434
+ feederGatewayUrl?: string;
435
+ gatewayUrl?: string;
436
+ });
547
437
 
548
438
  /**
549
439
  * Starknet RPC version 0.2.1
@@ -1748,95 +1638,440 @@ interface TransactionSimulation extends TransactionSimulationResponse {
1748
1638
  fee_estimation: EstimateFee;
1749
1639
  }
1750
1640
 
1751
- declare abstract class ProviderInterface {
1752
- /**
1753
- * Gets the Starknet chain Id
1754
- *
1755
- * @returns the chain Id
1756
- */
1757
- abstract getChainId(): Promise<StarknetChainId>;
1758
- /**
1759
- * Calls a function on the Starknet contract.
1760
- *
1761
- * @param call transaction to be called
1762
- * @param blockIdentifier block identifier
1763
- * @returns the result of the function on the smart contract.
1764
- */
1765
- abstract callContract(call: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
1766
- /**
1767
- * Gets the block information
1768
- *
1769
- * @param blockIdentifier block identifier
1770
- * @returns the block object
1771
- */
1772
- abstract getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
1773
- /**
1774
- * @deprecated The method should not be used
1775
- */
1776
- abstract getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
1777
- /**
1778
- * Gets the contract class of the deployed contract.
1779
- *
1780
- * @param contractAddress - contract address
1781
- * @param blockIdentifier - block identifier
1782
- * @returns Contract class of compiled contract
1783
- */
1784
- abstract getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass | RPC.ContractClass>;
1785
- /**
1786
- * Returns the class hash deployed under the given address.
1787
- *
1788
- * @param contractAddress - contract address
1789
- * @param blockIdentifier - block identifier
1790
- * @returns Class hash
1791
- */
1792
- abstract getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
1793
- /**
1794
- * Returns the contract class deployed under the given class hash.
1795
- *
1796
- * @param classHash - class hash
1797
- * @returns Contract class of compiled contract
1798
- */
1799
- abstract getClassByHash(classHash: string): Promise<ContractClass | RPC.ContractClass>;
1800
- /**
1801
- * Gets the nonce of a contract with respect to a specific block
1802
- *
1803
- * @param contractAddress - contract address
1804
- * @returns the hex nonce
1805
- */
1806
- abstract getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Nonce>;
1807
- /**
1808
- * Gets the contract's storage variable at a specific key.
1809
- *
1810
- * @param contractAddress
1811
- * @param key - from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
1812
- * @param blockIdentifier - block identifier
1813
- * @returns the value of the storage variable
1814
- */
1815
- abstract getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Storage>;
1816
- /**
1817
- * Gets the transaction information from a tx id.
1818
- *
1819
- * @param txHash
1820
- * @returns the transaction object \{ transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? \}
1821
- */
1822
- abstract getTransaction(transactionHash: BigNumberish): Promise<GetTransactionResponse>;
1823
- /**
1824
- * Gets the transaction receipt from a tx hash.
1825
- *
1826
- * @param txHash
1827
- * @returns the transaction receipt object
1828
- */
1829
- abstract getTransactionReceipt(transactionHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
1830
- /**
1831
- * Deploys a given compiled Account contract (json) to starknet
1832
- *
1833
- * @param payload payload to be deployed containing:
1834
- * - compiled contract code
1835
- * - constructor calldata
1836
- * - address salt
1837
- * @returns a confirmation of sending a transaction on the starknet contract
1838
- */
1839
- abstract deployAccountContract(payload: DeployAccountContractPayload, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
1641
+ type AsyncContractFunction<T = any> = (...args: ArgsOrCalldataWithOptions) => Promise<T>;
1642
+ type ContractFunction = (...args: ArgsOrCalldataWithOptions) => any;
1643
+ type Result = {
1644
+ [key: string]: any;
1645
+ } | Result[] | bigint | string | boolean;
1646
+ /**
1647
+ * Compiled calldata ready to be sent
1648
+ * decimal-string array
1649
+ */
1650
+ type Calldata = string[] & {
1651
+ readonly __compiled__?: boolean;
1652
+ };
1653
+ type ArgsOrCalldata = RawArgsArray | [Calldata] | Calldata;
1654
+ type ArgsOrCalldataWithOptions = ArgsOrCalldata & ContractOptions;
1655
+ type ContractOptions = {
1656
+ blockIdentifier?: BlockIdentifier;
1657
+ parseRequest?: boolean;
1658
+ parseResponse?: boolean;
1659
+ formatResponse?: {
1660
+ [key: string]: any;
1661
+ };
1662
+ maxFee?: BigNumberish;
1663
+ nonce?: BigNumberish;
1664
+ signature?: Signature;
1665
+ addressSalt?: string;
1666
+ };
1667
+ type CallOptions = Pick<ContractOptions, 'blockIdentifier' | 'parseRequest' | 'parseResponse' | 'formatResponse'>;
1668
+ type InvokeOptions = Pick<ContractOptions, 'maxFee' | 'nonce' | 'signature' | 'parseRequest'>;
1669
+
1670
+ interface InvocationsSignerDetails extends Required<InvocationsDetails> {
1671
+ walletAddress: string;
1672
+ chainId: StarknetChainId;
1673
+ cairoVersion: CairoVersion;
1674
+ }
1675
+ interface DeclareSignerDetails {
1676
+ classHash: string;
1677
+ senderAddress: string;
1678
+ chainId: StarknetChainId;
1679
+ maxFee: BigNumberish;
1680
+ version: BigNumberish;
1681
+ nonce: BigNumberish;
1682
+ compiledClassHash?: string;
1683
+ }
1684
+ type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
1685
+ contractAddress: BigNumberish;
1686
+ chainId: StarknetChainId;
1687
+ };
1688
+
1689
+ type StarkNetMerkleType = {
1690
+ name: string;
1691
+ type: 'merkletree';
1692
+ contains: string;
1693
+ };
1694
+ /**
1695
+ * A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
1696
+ *
1697
+ * Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
1698
+ * standard.
1699
+ */
1700
+ type StarkNetType = {
1701
+ name: string;
1702
+ type: string;
1703
+ } | StarkNetMerkleType;
1704
+ /**
1705
+ * The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
1706
+ */
1707
+ interface StarkNetDomain extends Record<string, unknown> {
1708
+ name?: string;
1709
+ version?: string;
1710
+ chainId?: string | number;
1711
+ }
1712
+ /**
1713
+ * The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
1714
+ */
1715
+ interface TypedData {
1716
+ types: Record<string, StarkNetType[]>;
1717
+ primaryType: string;
1718
+ domain: StarkNetDomain;
1719
+ message: Record<string, unknown>;
1720
+ }
1721
+
1722
+ type index_Abi = Abi;
1723
+ type index_AbiEntry = AbiEntry;
1724
+ type index_AbiStructs = AbiStructs;
1725
+ type index_AllowArray<T> = AllowArray<T>;
1726
+ type index_Args = Args;
1727
+ type index_ArgsOrCalldata = ArgsOrCalldata;
1728
+ type index_ArgsOrCalldataWithOptions = ArgsOrCalldataWithOptions;
1729
+ type index_ArraySignatureType = ArraySignatureType;
1730
+ type index_AsyncContractFunction<T = any> = AsyncContractFunction<T>;
1731
+ type index_BigNumberish = BigNumberish;
1732
+ type index_BlockIdentifier = BlockIdentifier;
1733
+ type index_BlockNumber = BlockNumber;
1734
+ type index_BlockTag = BlockTag;
1735
+ type index_Builtins = Builtins;
1736
+ type index_ByteCode = ByteCode;
1737
+ type index_CairoAssembly = CairoAssembly;
1738
+ type index_CairoContract = CairoContract;
1739
+ type index_CairoVersion = CairoVersion;
1740
+ type index_Call = Call;
1741
+ type index_CallContractResponse = CallContractResponse;
1742
+ type index_CallDetails = CallDetails;
1743
+ type index_CallL1Handler = CallL1Handler;
1744
+ type index_CallOptions = CallOptions;
1745
+ type index_CallStruct = CallStruct;
1746
+ type index_Calldata = Calldata;
1747
+ type index_CommonTransactionReceiptResponse = CommonTransactionReceiptResponse;
1748
+ type index_CommonTransactionResponse = CommonTransactionResponse;
1749
+ type index_CompiledContract = CompiledContract;
1750
+ type index_CompiledSierra = CompiledSierra;
1751
+ type index_CompiledSierraCasm = CompiledSierraCasm;
1752
+ type index_CompleteDeclareContractPayload = CompleteDeclareContractPayload;
1753
+ type index_CompressedProgram = CompressedProgram;
1754
+ type index_ContractClass = ContractClass;
1755
+ type index_ContractEntryPoint = ContractEntryPoint;
1756
+ type index_ContractEntryPointFields = ContractEntryPointFields;
1757
+ type index_ContractFunction = ContractFunction;
1758
+ type index_ContractOptions = ContractOptions;
1759
+ type index_DeclareAndDeployContractPayload = DeclareAndDeployContractPayload;
1760
+ type index_DeclareContractPayload = DeclareContractPayload;
1761
+ type index_DeclareContractResponse = DeclareContractResponse;
1762
+ type index_DeclareContractTransaction = DeclareContractTransaction;
1763
+ type index_DeclareDeployUDCResponse = DeclareDeployUDCResponse;
1764
+ type index_DeclareSignerDetails = DeclareSignerDetails;
1765
+ type index_DeclareTransactionReceiptResponse = DeclareTransactionReceiptResponse;
1766
+ type index_DeclareTransactionResponse = DeclareTransactionResponse;
1767
+ type index_DeployAccountContractPayload = DeployAccountContractPayload;
1768
+ type index_DeployAccountContractTransaction = DeployAccountContractTransaction;
1769
+ type index_DeployAccountSignerDetails = DeployAccountSignerDetails;
1770
+ type index_DeployContractPayload = DeployContractPayload;
1771
+ type index_DeployContractResponse = DeployContractResponse;
1772
+ type index_DeployContractUDCResponse = DeployContractUDCResponse;
1773
+ type index_DeployedContractItem = DeployedContractItem;
1774
+ type index_Details = Details;
1775
+ type index_EntryPointType = EntryPointType;
1776
+ declare const index_EntryPointType: typeof EntryPointType;
1777
+ type index_EntryPointsByType = EntryPointsByType;
1778
+ type index_EstimateFee = EstimateFee;
1779
+ type index_EstimateFeeAction = EstimateFeeAction;
1780
+ type index_EstimateFeeBulk = EstimateFeeBulk;
1781
+ type index_EstimateFeeDetails = EstimateFeeDetails;
1782
+ type index_EstimateFeeResponse = EstimateFeeResponse;
1783
+ type index_EstimateFeeResponseBulk = EstimateFeeResponseBulk;
1784
+ type index_Event = Event;
1785
+ type index_ExecutionResources = ExecutionResources;
1786
+ type index_FunctionAbi = FunctionAbi;
1787
+ type index_FunctionInvocation = FunctionInvocation;
1788
+ type index_GetBlockResponse = GetBlockResponse;
1789
+ type index_GetCodeResponse = GetCodeResponse;
1790
+ type index_GetContractAddressesResponse = GetContractAddressesResponse;
1791
+ type index_GetTransactionReceiptResponse = GetTransactionReceiptResponse;
1792
+ type index_GetTransactionResponse = GetTransactionResponse;
1793
+ type index_GetTransactionStatusResponse = GetTransactionStatusResponse;
1794
+ type index_HexCalldata = HexCalldata;
1795
+ type index_Invocation = Invocation;
1796
+ type index_InvocationBulk = InvocationBulk;
1797
+ type index_InvocationsDetails = InvocationsDetails;
1798
+ type index_InvocationsDetailsWithNonce = InvocationsDetailsWithNonce;
1799
+ type index_InvocationsSignerDetails = InvocationsSignerDetails;
1800
+ type index_InvokeFunctionResponse = InvokeFunctionResponse;
1801
+ type index_InvokeOptions = InvokeOptions;
1802
+ type index_InvokeTransactionReceiptResponse = InvokeTransactionReceiptResponse;
1803
+ type index_InvokeTransactionResponse = InvokeTransactionResponse;
1804
+ type index_LegacyCompiledContract = LegacyCompiledContract;
1805
+ type index_LegacyContractClass = LegacyContractClass;
1806
+ type index_MessageToL1 = MessageToL1;
1807
+ type index_MessageToL2 = MessageToL2;
1808
+ type index_MultiDeployContractResponse = MultiDeployContractResponse;
1809
+ type index_MultiType = MultiType;
1810
+ type index_Nonce = Nonce;
1811
+ type index_ParsedStruct = ParsedStruct;
1812
+ type index_Program = Program;
1813
+ type index_ProviderOptions = ProviderOptions;
1814
+ type index_PythonicHints = PythonicHints;
1815
+ declare const index_RPC: typeof RPC;
1816
+ type index_RawArgs = RawArgs;
1817
+ type index_RawArgsArray = RawArgsArray;
1818
+ type index_RawArgsObject = RawArgsObject;
1819
+ type index_RawCalldata = RawCalldata;
1820
+ type index_Result = Result;
1821
+ type index_RpcProviderOptions = RpcProviderOptions;
1822
+ declare const index_Sequencer: typeof Sequencer;
1823
+ type index_SequencerHttpMethod = SequencerHttpMethod;
1824
+ type index_SequencerIdentifier = SequencerIdentifier;
1825
+ type index_SequencerProviderOptions = SequencerProviderOptions;
1826
+ type index_SierraContractClass = SierraContractClass;
1827
+ type index_SierraContractEntryPointFields = SierraContractEntryPointFields;
1828
+ type index_SierraEntryPointsByType = SierraEntryPointsByType;
1829
+ type index_SierraProgramDebugInfo = SierraProgramDebugInfo;
1830
+ type index_Signature = Signature;
1831
+ type index_StarkNetDomain = StarkNetDomain;
1832
+ type index_StarkNetMerkleType = StarkNetMerkleType;
1833
+ type index_StarkNetType = StarkNetType;
1834
+ type index_StateUpdateResponse = StateUpdateResponse;
1835
+ type index_Status = Status;
1836
+ type index_Storage = Storage;
1837
+ type index_Struct = Struct;
1838
+ type index_StructAbi = StructAbi;
1839
+ type index_TransactionBulk = TransactionBulk;
1840
+ type index_TransactionSimulation = TransactionSimulation;
1841
+ type index_TransactionSimulationResponse = TransactionSimulationResponse;
1842
+ type index_TransactionStatus = TransactionStatus;
1843
+ declare const index_TransactionStatus: typeof TransactionStatus;
1844
+ type index_TransactionTraceResponse = TransactionTraceResponse;
1845
+ type index_TransactionType = TransactionType;
1846
+ declare const index_TransactionType: typeof TransactionType;
1847
+ type index_Tupled = Tupled;
1848
+ type index_TypedData = TypedData;
1849
+ type index_Uint256 = Uint256;
1850
+ type index_UniversalDeployerContractPayload = UniversalDeployerContractPayload;
1851
+ type index_WeierstrassSignatureType = WeierstrassSignatureType;
1852
+ type index_waitForTransactionOptions = waitForTransactionOptions;
1853
+ declare namespace index {
1854
+ export {
1855
+ index_Abi as Abi,
1856
+ index_AbiEntry as AbiEntry,
1857
+ index_AbiStructs as AbiStructs,
1858
+ index_AllowArray as AllowArray,
1859
+ index_Args as Args,
1860
+ index_ArgsOrCalldata as ArgsOrCalldata,
1861
+ index_ArgsOrCalldataWithOptions as ArgsOrCalldataWithOptions,
1862
+ index_ArraySignatureType as ArraySignatureType,
1863
+ index_AsyncContractFunction as AsyncContractFunction,
1864
+ index_BigNumberish as BigNumberish,
1865
+ index_BlockIdentifier as BlockIdentifier,
1866
+ index_BlockNumber as BlockNumber,
1867
+ index_BlockTag as BlockTag,
1868
+ index_Builtins as Builtins,
1869
+ index_ByteCode as ByteCode,
1870
+ index_CairoAssembly as CairoAssembly,
1871
+ index_CairoContract as CairoContract,
1872
+ index_CairoVersion as CairoVersion,
1873
+ index_Call as Call,
1874
+ index_CallContractResponse as CallContractResponse,
1875
+ index_CallDetails as CallDetails,
1876
+ index_CallL1Handler as CallL1Handler,
1877
+ index_CallOptions as CallOptions,
1878
+ index_CallStruct as CallStruct,
1879
+ index_Calldata as Calldata,
1880
+ index_CommonTransactionReceiptResponse as CommonTransactionReceiptResponse,
1881
+ index_CommonTransactionResponse as CommonTransactionResponse,
1882
+ index_CompiledContract as CompiledContract,
1883
+ index_CompiledSierra as CompiledSierra,
1884
+ index_CompiledSierraCasm as CompiledSierraCasm,
1885
+ index_CompleteDeclareContractPayload as CompleteDeclareContractPayload,
1886
+ index_CompressedProgram as CompressedProgram,
1887
+ index_ContractClass as ContractClass,
1888
+ index_ContractEntryPoint as ContractEntryPoint,
1889
+ index_ContractEntryPointFields as ContractEntryPointFields,
1890
+ index_ContractFunction as ContractFunction,
1891
+ index_ContractOptions as ContractOptions,
1892
+ index_DeclareAndDeployContractPayload as DeclareAndDeployContractPayload,
1893
+ index_DeclareContractPayload as DeclareContractPayload,
1894
+ index_DeclareContractResponse as DeclareContractResponse,
1895
+ index_DeclareContractTransaction as DeclareContractTransaction,
1896
+ index_DeclareDeployUDCResponse as DeclareDeployUDCResponse,
1897
+ index_DeclareSignerDetails as DeclareSignerDetails,
1898
+ index_DeclareTransactionReceiptResponse as DeclareTransactionReceiptResponse,
1899
+ index_DeclareTransactionResponse as DeclareTransactionResponse,
1900
+ index_DeployAccountContractPayload as DeployAccountContractPayload,
1901
+ index_DeployAccountContractTransaction as DeployAccountContractTransaction,
1902
+ index_DeployAccountSignerDetails as DeployAccountSignerDetails,
1903
+ index_DeployContractPayload as DeployContractPayload,
1904
+ index_DeployContractResponse as DeployContractResponse,
1905
+ index_DeployContractUDCResponse as DeployContractUDCResponse,
1906
+ index_DeployedContractItem as DeployedContractItem,
1907
+ index_Details as Details,
1908
+ index_EntryPointType as EntryPointType,
1909
+ index_EntryPointsByType as EntryPointsByType,
1910
+ index_EstimateFee as EstimateFee,
1911
+ index_EstimateFeeAction as EstimateFeeAction,
1912
+ index_EstimateFeeBulk as EstimateFeeBulk,
1913
+ index_EstimateFeeDetails as EstimateFeeDetails,
1914
+ index_EstimateFeeResponse as EstimateFeeResponse,
1915
+ index_EstimateFeeResponseBulk as EstimateFeeResponseBulk,
1916
+ index_Event as Event,
1917
+ index_ExecutionResources as ExecutionResources,
1918
+ index_FunctionAbi as FunctionAbi,
1919
+ index_FunctionInvocation as FunctionInvocation,
1920
+ index_GetBlockResponse as GetBlockResponse,
1921
+ index_GetCodeResponse as GetCodeResponse,
1922
+ index_GetContractAddressesResponse as GetContractAddressesResponse,
1923
+ index_GetTransactionReceiptResponse as GetTransactionReceiptResponse,
1924
+ index_GetTransactionResponse as GetTransactionResponse,
1925
+ index_GetTransactionStatusResponse as GetTransactionStatusResponse,
1926
+ index_HexCalldata as HexCalldata,
1927
+ index_Invocation as Invocation,
1928
+ index_InvocationBulk as InvocationBulk,
1929
+ index_InvocationsDetails as InvocationsDetails,
1930
+ index_InvocationsDetailsWithNonce as InvocationsDetailsWithNonce,
1931
+ index_InvocationsSignerDetails as InvocationsSignerDetails,
1932
+ index_InvokeFunctionResponse as InvokeFunctionResponse,
1933
+ index_InvokeOptions as InvokeOptions,
1934
+ index_InvokeTransactionReceiptResponse as InvokeTransactionReceiptResponse,
1935
+ index_InvokeTransactionResponse as InvokeTransactionResponse,
1936
+ index_LegacyCompiledContract as LegacyCompiledContract,
1937
+ index_LegacyContractClass as LegacyContractClass,
1938
+ index_MessageToL1 as MessageToL1,
1939
+ index_MessageToL2 as MessageToL2,
1940
+ index_MultiDeployContractResponse as MultiDeployContractResponse,
1941
+ index_MultiType as MultiType,
1942
+ index_Nonce as Nonce,
1943
+ index_ParsedStruct as ParsedStruct,
1944
+ index_Program as Program,
1945
+ index_ProviderOptions as ProviderOptions,
1946
+ index_PythonicHints as PythonicHints,
1947
+ index_RPC as RPC,
1948
+ index_RawArgs as RawArgs,
1949
+ index_RawArgsArray as RawArgsArray,
1950
+ index_RawArgsObject as RawArgsObject,
1951
+ index_RawCalldata as RawCalldata,
1952
+ index_Result as Result,
1953
+ index_RpcProviderOptions as RpcProviderOptions,
1954
+ index_Sequencer as Sequencer,
1955
+ index_SequencerHttpMethod as SequencerHttpMethod,
1956
+ index_SequencerIdentifier as SequencerIdentifier,
1957
+ index_SequencerProviderOptions as SequencerProviderOptions,
1958
+ index_SierraContractClass as SierraContractClass,
1959
+ index_SierraContractEntryPointFields as SierraContractEntryPointFields,
1960
+ index_SierraEntryPointsByType as SierraEntryPointsByType,
1961
+ index_SierraProgramDebugInfo as SierraProgramDebugInfo,
1962
+ index_Signature as Signature,
1963
+ index_StarkNetDomain as StarkNetDomain,
1964
+ index_StarkNetMerkleType as StarkNetMerkleType,
1965
+ index_StarkNetType as StarkNetType,
1966
+ index_StateUpdateResponse as StateUpdateResponse,
1967
+ index_Status as Status,
1968
+ index_Storage as Storage,
1969
+ index_Struct as Struct,
1970
+ index_StructAbi as StructAbi,
1971
+ index_TransactionBulk as TransactionBulk,
1972
+ index_TransactionSimulation as TransactionSimulation,
1973
+ index_TransactionSimulationResponse as TransactionSimulationResponse,
1974
+ index_TransactionStatus as TransactionStatus,
1975
+ index_TransactionTraceResponse as TransactionTraceResponse,
1976
+ index_TransactionType as TransactionType,
1977
+ index_Tupled as Tupled,
1978
+ index_TypedData as TypedData,
1979
+ index_Uint256 as Uint256,
1980
+ index_UniversalDeployerContractPayload as UniversalDeployerContractPayload,
1981
+ index_WeierstrassSignatureType as WeierstrassSignatureType,
1982
+ index_waitForTransactionOptions as waitForTransactionOptions,
1983
+ };
1984
+ }
1985
+
1986
+ declare abstract class ProviderInterface {
1987
+ /**
1988
+ * Gets the Starknet chain Id
1989
+ *
1990
+ * @returns the chain Id
1991
+ */
1992
+ abstract getChainId(): Promise<StarknetChainId>;
1993
+ /**
1994
+ * Calls a function on the Starknet contract.
1995
+ *
1996
+ * @param call transaction to be called
1997
+ * @param blockIdentifier block identifier
1998
+ * @returns the result of the function on the smart contract.
1999
+ */
2000
+ abstract callContract(call: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
2001
+ /**
2002
+ * Gets the block information
2003
+ *
2004
+ * @param blockIdentifier block identifier
2005
+ * @returns the block object
2006
+ */
2007
+ abstract getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
2008
+ /**
2009
+ * @deprecated The method should not be used
2010
+ */
2011
+ abstract getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
2012
+ /**
2013
+ * Gets the contract class of the deployed contract.
2014
+ *
2015
+ * @param contractAddress - contract address
2016
+ * @param blockIdentifier - block identifier
2017
+ * @returns Contract class of compiled contract
2018
+ */
2019
+ abstract getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass | RPC.ContractClass>;
2020
+ /**
2021
+ * Returns the class hash deployed under the given address.
2022
+ *
2023
+ * @param contractAddress - contract address
2024
+ * @param blockIdentifier - block identifier
2025
+ * @returns Class hash
2026
+ */
2027
+ abstract getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
2028
+ /**
2029
+ * Returns the contract class deployed under the given class hash.
2030
+ *
2031
+ * @param classHash - class hash
2032
+ * @returns Contract class of compiled contract
2033
+ */
2034
+ abstract getClassByHash(classHash: string): Promise<ContractClass | RPC.ContractClass>;
2035
+ /**
2036
+ * Gets the nonce of a contract with respect to a specific block
2037
+ *
2038
+ * @param contractAddress - contract address
2039
+ * @returns the hex nonce
2040
+ */
2041
+ abstract getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Nonce>;
2042
+ /**
2043
+ * Gets the contract's storage variable at a specific key.
2044
+ *
2045
+ * @param contractAddress
2046
+ * @param key - from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
2047
+ * @param blockIdentifier - block identifier
2048
+ * @returns the value of the storage variable
2049
+ */
2050
+ abstract getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Storage>;
2051
+ /**
2052
+ * Gets the transaction information from a tx id.
2053
+ *
2054
+ * @param txHash
2055
+ * @returns the transaction object \{ transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? \}
2056
+ */
2057
+ abstract getTransaction(transactionHash: BigNumberish): Promise<GetTransactionResponse>;
2058
+ /**
2059
+ * Gets the transaction receipt from a tx hash.
2060
+ *
2061
+ * @param txHash
2062
+ * @returns the transaction receipt object
2063
+ */
2064
+ abstract getTransactionReceipt(transactionHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
2065
+ /**
2066
+ * Deploys a given compiled Account contract (json) to starknet
2067
+ *
2068
+ * @param payload payload to be deployed containing:
2069
+ * - compiled contract code
2070
+ * - constructor calldata
2071
+ * - address salt
2072
+ * @returns a confirmation of sending a transaction on the starknet contract
2073
+ */
2074
+ abstract deployAccountContract(payload: DeployAccountContractPayload, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
1840
2075
  /**
1841
2076
  * Invokes a function on starknet
1842
2077
  * @deprecated This method wont be supported as soon as fees are mandatory. Should not be used outside of Account class
@@ -1979,102 +2214,52 @@ declare abstract class ProviderInterface {
1979
2214
  abstract getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
1980
2215
  }
1981
2216
 
1982
- type RpcProviderOptions = {
1983
- nodeUrl: string;
1984
- retries?: number;
1985
- headers?: object;
1986
- blockIdentifier?: BlockIdentifier;
1987
- chainId?: StarknetChainId;
1988
- };
1989
- declare class RpcProvider implements ProviderInterface {
1990
- nodeUrl: string;
1991
- headers: object;
1992
- private responseParser;
1993
- private retries;
1994
- private blockIdentifier;
1995
- private chainId?;
1996
- constructor(optionsOrProvider: RpcProviderOptions);
1997
- fetch(method: any, params: any): Promise<any>;
1998
- protected errorHandler(error: any): void;
1999
- protected fetchEndpoint<T extends keyof RPC.Methods>(method: T, params?: RPC.Methods[T]['params']): Promise<RPC.Methods[T]['result']>;
2217
+ declare class Provider implements ProviderInterface {
2218
+ private provider;
2219
+ constructor(providerOrOptions?: ProviderOptions | ProviderInterface);
2000
2220
  getChainId(): Promise<StarknetChainId>;
2001
- getBlock(blockIdentifier?: BlockIdentifier): Promise<GetBlockResponse>;
2002
- getBlockHashAndNumber(): Promise<RPC.BlockHashAndNumber>;
2003
- getBlockWithTxHashes(blockIdentifier?: BlockIdentifier): Promise<RPC.GetBlockWithTxHashesResponse>;
2004
- getBlockWithTxs(blockIdentifier?: BlockIdentifier): Promise<RPC.GetBlockWithTxs>;
2005
- getClassHashAt(contractAddress: RPC.ContractAddress, blockIdentifier?: BlockIdentifier): Promise<RPC.Felt>;
2006
- getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<RPC.Nonce>;
2007
- getPendingTransactions(): Promise<RPC.PendingTransactions>;
2008
- getProtocolVersion(): Promise<Error>;
2009
- getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<RPC.StateUpdate>;
2010
- getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<RPC.Storage>;
2011
- getTransaction(txHash: string): Promise<GetTransactionResponse>;
2012
- getTransactionByHash(txHash: string): Promise<RPC.GetTransactionByHashResponse>;
2013
- getTransactionByBlockIdAndIndex(blockIdentifier: BlockIdentifier, index: number): Promise<RPC.GetTransactionByBlockIdAndIndex>;
2014
- getTransactionReceipt(txHash: string): Promise<RPC.TransactionReceipt>;
2015
- getClassByHash(classHash: RPC.Felt): Promise<RPC.ContractClass>;
2016
- getClass(classHash: RPC.Felt, blockIdentifier?: BlockIdentifier): Promise<RPC.ContractClass>;
2017
- getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<RPC.ContractClass>;
2018
- getCode(_contractAddress: string, _blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
2019
- getEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2020
- getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2021
- getDeclareEstimateFee({ senderAddress, contractDefinition, signature }: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2022
- getDeployAccountEstimateFee({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2023
- getEstimateFeeBulk(_invocations: InvocationBulk, _blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
2024
- declareContract({ contractDefinition, signature, senderAddress }: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
2025
- deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
2221
+ getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
2222
+ getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass | RPC.ContractClass>;
2223
+ getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
2224
+ getClassByHash(classHash: string): Promise<ContractClass | RPC.ContractClass>;
2225
+ getEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier): Promise<EstimateFeeResponse>;
2226
+ getInvokeEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2227
+ getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
2228
+ getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Nonce>;
2229
+ getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Storage>;
2230
+ getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
2231
+ getTransactionReceipt(txHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
2232
+ callContract(request: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
2026
2233
  invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
2027
- callContract(call: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
2028
- traceTransaction(transactionHash: RPC.TransactionHash): Promise<RPC.Trace>;
2029
- traceBlockTransactions(blockHash: RPC.BlockHash): Promise<RPC.Traces>;
2030
- waitForTransaction(txHash: string, options?: waitForTransactionOptions): Promise<any>;
2031
- /**
2032
- * Gets the transaction count from a block.
2033
- *
2034
- *
2035
- * @param blockIdentifier
2036
- * @returns Number of transactions
2037
- */
2038
- getTransactionCount(blockIdentifier?: BlockIdentifier): Promise<RPC.GetTransactionCountResponse>;
2039
- /**
2040
- * Gets the latest block number
2041
- *
2042
- *
2043
- * @returns Number of the latest block
2044
- */
2045
- getBlockNumber(): Promise<RPC.GetBlockNumberResponse>;
2046
- /**
2047
- * Gets syncing status of the node
2048
- *
2049
- *
2050
- * @returns Object with the stats data
2051
- */
2052
- getSyncingStats(): Promise<RPC.GetSyncingStatsResponse>;
2053
- /**
2054
- * Gets all the events filtered
2055
- *
2056
- *
2057
- * @returns events and the pagination of the events
2058
- */
2059
- getEvents(eventFilter: RPC.EventFilter): Promise<RPC.GetEventsResponse>;
2060
- getSimulateTransaction(_invocation: Invocation, _invocationDetails: InvocationsDetailsWithNonce, _blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
2234
+ deployAccountContract(payload: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
2235
+ declareContract(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
2236
+ getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2237
+ getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2238
+ getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
2239
+ waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
2240
+ getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
2241
+ getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
2061
2242
  getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
2062
2243
  getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
2063
2244
  }
2064
2245
 
2065
- type SequencerHttpMethod = 'POST' | 'GET';
2066
- type SequencerProviderOptions = {
2067
- headers?: Record<string, string>;
2068
- blockIdentifier?: BlockIdentifier;
2069
- } & ({
2070
- network: NetworkName | StarknetChainId;
2071
- chainId?: StarknetChainId;
2072
- } | {
2073
- baseUrl: string;
2074
- feederGatewayUrl?: string;
2075
- gatewayUrl?: string;
2076
- chainId?: StarknetChainId;
2077
- });
2246
+ declare function fixStack(target: Error, fn?: Function): void;
2247
+ declare function fixProto(target: Error, prototype: {}): void;
2248
+ declare class CustomError extends Error {
2249
+ name: string;
2250
+ constructor(message?: string);
2251
+ }
2252
+ declare class LibraryError extends CustomError {
2253
+ }
2254
+ declare class GatewayError extends LibraryError {
2255
+ errorCode: string;
2256
+ constructor(message: string, errorCode: string);
2257
+ }
2258
+ declare class HttpError extends LibraryError {
2259
+ errorCode: number;
2260
+ constructor(message: string, errorCode: number);
2261
+ }
2262
+
2078
2263
  declare class SequencerProvider implements ProviderInterface {
2079
2264
  baseUrl: string;
2080
2265
  feederGatewayUrl: string;
@@ -2140,200 +2325,92 @@ declare class SequencerProvider implements ProviderInterface {
2140
2325
  * @returns the transaction trace
2141
2326
  */
2142
2327
  getTransactionTrace(txHash: BigNumberish): Promise<TransactionTraceResponse>;
2143
- estimateMessageFee({ from_address, to_address, entry_point_selector, payload }: CallL1Handler, blockIdentifier?: BlockIdentifier): Promise<Sequencer.EstimateFeeResponse>;
2144
- getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
2145
- getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
2146
- getBlockTraces(blockIdentifier?: BlockIdentifier): Promise<Sequencer.BlockTransactionTracesResponse>;
2147
- getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
2148
- getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
2149
- }
2150
-
2151
- interface ProviderOptions {
2152
- sequencer?: SequencerProviderOptions;
2153
- rpc?: RpcProviderOptions;
2154
- }
2155
- declare class Provider implements ProviderInterface {
2156
- private provider;
2157
- constructor(providerOrOptions?: ProviderOptions | ProviderInterface);
2158
- getChainId(): Promise<StarknetChainId>;
2159
- getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
2160
- getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass | RPC.ContractClass>;
2161
- getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
2162
- getClassByHash(classHash: string): Promise<ContractClass | RPC.ContractClass>;
2163
- getEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier): Promise<EstimateFeeResponse>;
2164
- getInvokeEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2165
- getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
2166
- getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Nonce>;
2167
- getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Storage>;
2168
- getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
2169
- getTransactionReceipt(txHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
2170
- callContract(request: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
2171
- invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
2172
- deployAccountContract(payload: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
2173
- declareContract(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
2174
- getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2175
- getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2176
- getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
2177
- waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
2178
- getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
2179
- getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
2180
- getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
2181
- getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
2182
- }
2183
-
2184
- declare function fixStack(target: Error, fn?: Function): void;
2185
- declare function fixProto(target: Error, prototype: {}): void;
2186
- declare class CustomError extends Error {
2187
- name: string;
2188
- constructor(message?: string);
2189
- }
2190
- declare class LibraryError extends CustomError {
2191
- }
2192
- declare class GatewayError extends LibraryError {
2193
- errorCode: string;
2194
- constructor(message: string, errorCode: string);
2195
- }
2196
- declare class HttpError extends LibraryError {
2197
- errorCode: number;
2198
- constructor(message: string, errorCode: number);
2199
- }
2200
-
2201
- declare const defaultProvider: Provider;
2202
-
2203
- type StarkNetMerkleType = {
2204
- name: string;
2205
- type: 'merkletree';
2206
- contains: string;
2207
- };
2208
- /**
2209
- * A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
2210
- *
2211
- * Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
2212
- * standard.
2213
- */
2214
- type StarkNetType = {
2215
- name: string;
2216
- type: string;
2217
- } | StarkNetMerkleType;
2218
- /**
2219
- * The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
2220
- */
2221
- interface StarkNetDomain extends Record<string, unknown> {
2222
- name?: string;
2223
- version?: string;
2224
- chainId?: string | number;
2225
- }
2226
- /**
2227
- * The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
2228
- */
2229
- interface TypedData {
2230
- types: Record<string, StarkNetType[]>;
2231
- primaryType: string;
2232
- domain: StarkNetDomain;
2233
- message: Record<string, unknown>;
2234
- }
2235
-
2236
- declare function prepareSelector(selector: string): string;
2237
- declare function isMerkleTreeType(type: StarkNetType): type is StarkNetMerkleType;
2238
- interface Context {
2239
- parent?: string;
2240
- key?: string;
2241
- }
2242
- /**
2243
- * Get the dependencies of a struct type. If a struct has the same dependency multiple times, it's only included once
2244
- * in the resulting array.
2245
- *
2246
- * @param {TypedData} typedData
2247
- * @param {string} type
2248
- * @param {string[]} [dependencies]
2249
- * @return {string[]}
2250
- */
2251
- declare const getDependencies: (types: TypedData['types'], type: string, dependencies?: string[]) => string[];
2252
- /**
2253
- * Encode a type to a string. All dependant types are alphabetically sorted.
2254
- *
2255
- * @param {TypedData} typedData
2256
- * @param {string} type
2257
- * @return {string}
2258
- */
2259
- declare const encodeType: (types: TypedData['types'], type: string) => string;
2260
- /**
2261
- * Get a type string as hash.
2262
- *
2263
- * @param {TypedData} typedData
2264
- * @param {string} type
2265
- * @return {string}
2266
- */
2267
- declare const getTypeHash: (types: TypedData['types'], type: string) => string;
2268
- /**
2269
- * Encodes a single value to an ABI serialisable string, number or Buffer. Returns the data as tuple, which consists of
2270
- * an array of ABI compatible types, and an array of corresponding values.
2271
- *
2272
- * @param {TypedData} typedData
2273
- * @param {string} type
2274
- * @param {any} data
2275
- * @returns {[string, string]}
2276
- */
2277
- declare const encodeValue: (types: TypedData['types'], type: string, data: unknown, ctx?: Context) => [string, string];
2278
- /**
2279
- * Encode the data to an ABI encoded Buffer. The data should be a key -> value object with all the required values. All
2280
- * dependant types are automatically encoded.
2281
- *
2282
- * @param {TypedData} typedData
2283
- * @param {string} type
2284
- * @param {Record<string, any>} data
2285
- */
2286
- declare const encodeData: <T extends TypedData>(types: T["types"], type: string, data: T["message"]) => string[][];
2287
- /**
2288
- * Get encoded data as a hash. The data should be a key -> value object with all the required values. All dependant
2289
- * types are automatically encoded.
2290
- *
2291
- * @param {TypedData} typedData
2292
- * @param {string} type
2293
- * @param {Record<string, any>} data
2294
- * @return {Buffer}
2295
- */
2296
- declare const getStructHash: <T extends TypedData>(types: T["types"], type: string, data: T["message"]) => string;
2297
- /**
2298
- * Get the EIP-191 encoded message to sign, from the typedData object.
2299
- *
2300
- * @param {TypedData} typedData
2301
- * @param {BigNumberish} account
2302
- * @return {string}
2303
- */
2304
- declare const getMessageHash: (typedData: TypedData, account: BigNumberish) => string;
2328
+ estimateMessageFee({ from_address, to_address, entry_point_selector, payload }: CallL1Handler, blockIdentifier?: BlockIdentifier): Promise<Sequencer.EstimateFeeResponse>;
2329
+ getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
2330
+ getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
2331
+ getBlockTraces(blockIdentifier?: BlockIdentifier): Promise<Sequencer.BlockTransactionTracesResponse>;
2332
+ getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
2333
+ getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
2334
+ }
2305
2335
 
2306
- type index_StarkNetDomain = StarkNetDomain;
2307
- type index_StarkNetMerkleType = StarkNetMerkleType;
2308
- type index_StarkNetType = StarkNetType;
2309
- type index_TypedData = TypedData;
2310
- declare const index_encodeData: typeof encodeData;
2311
- declare const index_encodeType: typeof encodeType;
2312
- declare const index_encodeValue: typeof encodeValue;
2313
- declare const index_getDependencies: typeof getDependencies;
2314
- declare const index_getMessageHash: typeof getMessageHash;
2315
- declare const index_getStructHash: typeof getStructHash;
2316
- declare const index_getTypeHash: typeof getTypeHash;
2317
- declare const index_isMerkleTreeType: typeof isMerkleTreeType;
2318
- declare const index_prepareSelector: typeof prepareSelector;
2319
- declare namespace index {
2320
- export {
2321
- index_StarkNetDomain as StarkNetDomain,
2322
- index_StarkNetMerkleType as StarkNetMerkleType,
2323
- index_StarkNetType as StarkNetType,
2324
- index_TypedData as TypedData,
2325
- index_encodeData as encodeData,
2326
- index_encodeType as encodeType,
2327
- index_encodeValue as encodeValue,
2328
- index_getDependencies as getDependencies,
2329
- index_getMessageHash as getMessageHash,
2330
- index_getStructHash as getStructHash,
2331
- index_getTypeHash as getTypeHash,
2332
- index_isMerkleTreeType as isMerkleTreeType,
2333
- index_prepareSelector as prepareSelector,
2334
- };
2336
+ declare class RpcProvider implements ProviderInterface {
2337
+ nodeUrl: string;
2338
+ headers: object;
2339
+ private responseParser;
2340
+ private retries;
2341
+ private blockIdentifier;
2342
+ private chainId?;
2343
+ constructor(optionsOrProvider: RpcProviderOptions);
2344
+ fetch(method: any, params: any): Promise<any>;
2345
+ protected errorHandler(error: any): void;
2346
+ protected fetchEndpoint<T extends keyof RPC.Methods>(method: T, params?: RPC.Methods[T]['params']): Promise<RPC.Methods[T]['result']>;
2347
+ getChainId(): Promise<StarknetChainId>;
2348
+ getBlock(blockIdentifier?: BlockIdentifier): Promise<GetBlockResponse>;
2349
+ getBlockHashAndNumber(): Promise<RPC.BlockHashAndNumber>;
2350
+ getBlockWithTxHashes(blockIdentifier?: BlockIdentifier): Promise<RPC.GetBlockWithTxHashesResponse>;
2351
+ getBlockWithTxs(blockIdentifier?: BlockIdentifier): Promise<RPC.GetBlockWithTxs>;
2352
+ getClassHashAt(contractAddress: RPC.ContractAddress, blockIdentifier?: BlockIdentifier): Promise<RPC.Felt>;
2353
+ getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<RPC.Nonce>;
2354
+ getPendingTransactions(): Promise<RPC.PendingTransactions>;
2355
+ getProtocolVersion(): Promise<Error>;
2356
+ getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<RPC.StateUpdate>;
2357
+ getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<RPC.Storage>;
2358
+ getTransaction(txHash: string): Promise<GetTransactionResponse>;
2359
+ getTransactionByHash(txHash: string): Promise<RPC.GetTransactionByHashResponse>;
2360
+ getTransactionByBlockIdAndIndex(blockIdentifier: BlockIdentifier, index: number): Promise<RPC.GetTransactionByBlockIdAndIndex>;
2361
+ getTransactionReceipt(txHash: string): Promise<RPC.TransactionReceipt>;
2362
+ getClassByHash(classHash: RPC.Felt): Promise<RPC.ContractClass>;
2363
+ getClass(classHash: RPC.Felt, blockIdentifier?: BlockIdentifier): Promise<RPC.ContractClass>;
2364
+ getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<RPC.ContractClass>;
2365
+ getCode(_contractAddress: string, _blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
2366
+ getEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2367
+ getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2368
+ getDeclareEstimateFee({ senderAddress, contractDefinition, signature }: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2369
+ getDeployAccountEstimateFee({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2370
+ getEstimateFeeBulk(_invocations: InvocationBulk, _blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
2371
+ declareContract({ contractDefinition, signature, senderAddress }: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
2372
+ deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
2373
+ invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
2374
+ callContract(call: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
2375
+ traceTransaction(transactionHash: RPC.TransactionHash): Promise<RPC.Trace>;
2376
+ traceBlockTransactions(blockHash: RPC.BlockHash): Promise<RPC.Traces>;
2377
+ waitForTransaction(txHash: string, options?: waitForTransactionOptions): Promise<any>;
2378
+ /**
2379
+ * Gets the transaction count from a block.
2380
+ *
2381
+ *
2382
+ * @param blockIdentifier
2383
+ * @returns Number of transactions
2384
+ */
2385
+ getTransactionCount(blockIdentifier?: BlockIdentifier): Promise<RPC.GetTransactionCountResponse>;
2386
+ /**
2387
+ * Gets the latest block number
2388
+ *
2389
+ *
2390
+ * @returns Number of the latest block
2391
+ */
2392
+ getBlockNumber(): Promise<RPC.GetBlockNumberResponse>;
2393
+ /**
2394
+ * Gets syncing status of the node
2395
+ *
2396
+ *
2397
+ * @returns Object with the stats data
2398
+ */
2399
+ getSyncingStats(): Promise<RPC.GetSyncingStatsResponse>;
2400
+ /**
2401
+ * Gets all the events filtered
2402
+ *
2403
+ *
2404
+ * @returns events and the pagination of the events
2405
+ */
2406
+ getEvents(eventFilter: RPC.EventFilter): Promise<RPC.GetEventsResponse>;
2407
+ getSimulateTransaction(_invocation: Invocation, _invocationDetails: InvocationsDetailsWithNonce, _blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
2408
+ getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
2409
+ getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
2335
2410
  }
2336
2411
 
2412
+ declare const defaultProvider: Provider;
2413
+
2337
2414
  declare abstract class SignerInterface {
2338
2415
  /**
2339
2416
  * Method to get the public key of the signer
@@ -2774,7 +2851,7 @@ declare const splitArgsAndOptions: (args: ArgsOrCalldataWithOptions) => {
2774
2851
  args: ArgsOrCalldata;
2775
2852
  options?: undefined;
2776
2853
  };
2777
- declare function getCalldata(args: ArgsOrCalldata, callback: Function): Calldata;
2854
+ declare function getCalldata(args: RawArgs, callback: Function): Calldata;
2778
2855
  /**
2779
2856
  * Not used at the moment
2780
2857
  */
@@ -2814,7 +2891,7 @@ declare class Contract implements ContractInterface {
2814
2891
  call(method: string, args?: ArgsOrCalldata, { parseRequest, parseResponse, formatResponse, blockIdentifier, }?: CallOptions): Promise<Result>;
2815
2892
  invoke(method: string, args?: ArgsOrCalldata, { parseRequest, maxFee, nonce, signature }?: InvokeOptions): Promise<InvokeFunctionResponse>;
2816
2893
  estimate(method: string, args?: ArgsOrCalldata): Promise<EstimateFeeResponse>;
2817
- populate(method: string, args?: ArgsOrCalldata): Call;
2894
+ populate(method: string, args?: RawArgs): Call;
2818
2895
  }
2819
2896
 
2820
2897
  declare class ContractFactory {
@@ -2948,7 +3025,7 @@ declare namespace hash {
2948
3025
  declare const parse: (x: string) => any;
2949
3026
  declare const parseAlwaysAsBig: (x: string) => any;
2950
3027
  declare const stringify: (value: JavaScriptValue, replacer?: any, space?: string | number | undefined, numberStringifiers?: NumberStringifier[] | undefined) => string;
2951
- /** @deprecated */
3028
+ /** @deprecated equivalent to 'stringify', alias will be removed */
2952
3029
  declare const stringifyAlwaysAsBig: (value: JavaScriptValue, replacer?: any, space?: string | number | undefined, numberStringifiers?: NumberStringifier[] | undefined) => string;
2953
3030
 
2954
3031
  declare const json_parse: typeof parse;
@@ -2964,6 +3041,71 @@ declare namespace json {
2964
3041
  };
2965
3042
  }
2966
3043
 
3044
+ declare function isHex(hex: string): boolean;
3045
+ declare function toBigInt(value: BigNumberish): bigint;
3046
+ declare function isBigInt(value: any): value is bigint;
3047
+ declare function toHex(number: BigNumberish): string;
3048
+ declare function hexToDecimalString(hex: string): string;
3049
+ /**
3050
+ * Remove hex string leading zero and lower case '0x01A'.. -> '0x1a..'
3051
+ * @param hex string
3052
+ */
3053
+ declare const cleanHex: (hex: string) => string;
3054
+ declare function assertInRange(input: BigNumberish, lowerBound: BigNumberish, upperBound: BigNumberish, inputName?: string): void;
3055
+ declare function bigNumberishArrayToDecimalStringArray(rawCalldata: BigNumberish[]): string[];
3056
+ declare function bigNumberishArrayToHexadecimalStringArray(rawCalldata: BigNumberish[]): string[];
3057
+ declare const isStringWholeNumber: (value: string) => boolean;
3058
+ declare const toHexString: (value: string) => string;
3059
+ declare function getDecimalString(value: string): string;
3060
+ declare function getHexString(value: string): string;
3061
+ declare function getHexStringArray(value: Array<string>): string[];
3062
+ declare const toCairoBool: (value: boolean) => string;
3063
+ /**
3064
+ * Convert a hex string to an array of Bytes (Uint8Array)
3065
+ * @param value hex string
3066
+ * @returns an array of Bytes
3067
+ */
3068
+ declare function hexToBytes(value: string): Uint8Array;
3069
+
3070
+ type num_BigNumberish = BigNumberish;
3071
+ declare const num_assertInRange: typeof assertInRange;
3072
+ declare const num_bigNumberishArrayToDecimalStringArray: typeof bigNumberishArrayToDecimalStringArray;
3073
+ declare const num_bigNumberishArrayToHexadecimalStringArray: typeof bigNumberishArrayToHexadecimalStringArray;
3074
+ declare const num_cleanHex: typeof cleanHex;
3075
+ declare const num_getDecimalString: typeof getDecimalString;
3076
+ declare const num_getHexString: typeof getHexString;
3077
+ declare const num_getHexStringArray: typeof getHexStringArray;
3078
+ declare const num_hexToBytes: typeof hexToBytes;
3079
+ declare const num_hexToDecimalString: typeof hexToDecimalString;
3080
+ declare const num_isBigInt: typeof isBigInt;
3081
+ declare const num_isHex: typeof isHex;
3082
+ declare const num_isStringWholeNumber: typeof isStringWholeNumber;
3083
+ declare const num_toBigInt: typeof toBigInt;
3084
+ declare const num_toCairoBool: typeof toCairoBool;
3085
+ declare const num_toHex: typeof toHex;
3086
+ declare const num_toHexString: typeof toHexString;
3087
+ declare namespace num {
3088
+ export {
3089
+ num_BigNumberish as BigNumberish,
3090
+ num_assertInRange as assertInRange,
3091
+ num_bigNumberishArrayToDecimalStringArray as bigNumberishArrayToDecimalStringArray,
3092
+ num_bigNumberishArrayToHexadecimalStringArray as bigNumberishArrayToHexadecimalStringArray,
3093
+ num_cleanHex as cleanHex,
3094
+ num_getDecimalString as getDecimalString,
3095
+ num_getHexString as getHexString,
3096
+ num_getHexStringArray as getHexStringArray,
3097
+ num_hexToBytes as hexToBytes,
3098
+ num_hexToDecimalString as hexToDecimalString,
3099
+ num_isBigInt as isBigInt,
3100
+ num_isHex as isHex,
3101
+ num_isStringWholeNumber as isStringWholeNumber,
3102
+ num_toBigInt as toBigInt,
3103
+ num_toCairoBool as toCairoBool,
3104
+ num_toHex as toHex,
3105
+ num_toHexString as toHexString,
3106
+ };
3107
+ }
3108
+
2967
3109
  /**
2968
3110
  * Transforms a list of Calls, each with their own calldata, into
2969
3111
  * two arrays: one with the entrypoints, and one with the concatenated calldata.
@@ -3075,6 +3217,29 @@ declare namespace merkle {
3075
3217
  };
3076
3218
  }
3077
3219
 
3220
+ declare function uint256ToBN(uint256: Uint256): bigint;
3221
+ declare const UINT_128_MAX: bigint;
3222
+ declare const UINT_256_MAX: bigint;
3223
+ declare function isUint256(bn: BigNumberish): boolean;
3224
+ declare function bnToUint256(bignumber: BigNumberish): Uint256;
3225
+
3226
+ declare const uint256$1_UINT_128_MAX: typeof UINT_128_MAX;
3227
+ declare const uint256$1_UINT_256_MAX: typeof UINT_256_MAX;
3228
+ type uint256$1_Uint256 = Uint256;
3229
+ declare const uint256$1_bnToUint256: typeof bnToUint256;
3230
+ declare const uint256$1_isUint256: typeof isUint256;
3231
+ declare const uint256$1_uint256ToBN: typeof uint256ToBN;
3232
+ declare namespace uint256$1 {
3233
+ export {
3234
+ uint256$1_UINT_128_MAX as UINT_128_MAX,
3235
+ uint256$1_UINT_256_MAX as UINT_256_MAX,
3236
+ uint256$1_Uint256 as Uint256,
3237
+ uint256$1_bnToUint256 as bnToUint256,
3238
+ uint256$1_isUint256 as isUint256,
3239
+ uint256$1_uint256ToBN as uint256ToBN,
3240
+ };
3241
+ }
3242
+
3078
3243
  declare function isASCII(str: string): boolean;
3079
3244
  declare function isShortString(str: string): boolean;
3080
3245
  declare function isDecimalString(decim: string): boolean;
@@ -3136,6 +3301,107 @@ declare namespace shortString {
3136
3301
  };
3137
3302
  }
3138
3303
 
3304
+ declare function prepareSelector(selector: string): string;
3305
+ declare function isMerkleTreeType(type: StarkNetType): type is StarkNetMerkleType;
3306
+ interface Context {
3307
+ parent?: string;
3308
+ key?: string;
3309
+ }
3310
+ /**
3311
+ * Get the dependencies of a struct type. If a struct has the same dependency multiple times, it's only included once
3312
+ * in the resulting array.
3313
+ *
3314
+ * @param {TypedData} typedData
3315
+ * @param {string} type
3316
+ * @param {string[]} [dependencies]
3317
+ * @return {string[]}
3318
+ */
3319
+ declare const getDependencies: (types: TypedData['types'], type: string, dependencies?: string[]) => string[];
3320
+ /**
3321
+ * Encode a type to a string. All dependant types are alphabetically sorted.
3322
+ *
3323
+ * @param {TypedData} typedData
3324
+ * @param {string} type
3325
+ * @return {string}
3326
+ */
3327
+ declare const encodeType: (types: TypedData['types'], type: string) => string;
3328
+ /**
3329
+ * Get a type string as hash.
3330
+ *
3331
+ * @param {TypedData} typedData
3332
+ * @param {string} type
3333
+ * @return {string}
3334
+ */
3335
+ declare const getTypeHash: (types: TypedData['types'], type: string) => string;
3336
+ /**
3337
+ * Encodes a single value to an ABI serialisable string, number or Buffer. Returns the data as tuple, which consists of
3338
+ * an array of ABI compatible types, and an array of corresponding values.
3339
+ *
3340
+ * @param {TypedData} typedData
3341
+ * @param {string} type
3342
+ * @param {any} data
3343
+ * @returns {[string, string]}
3344
+ */
3345
+ declare const encodeValue: (types: TypedData['types'], type: string, data: unknown, ctx?: Context) => [string, string];
3346
+ /**
3347
+ * Encode the data to an ABI encoded Buffer. The data should be a key -> value object with all the required values. All
3348
+ * dependant types are automatically encoded.
3349
+ *
3350
+ * @param {TypedData} typedData
3351
+ * @param {string} type
3352
+ * @param {Record<string, any>} data
3353
+ */
3354
+ declare const encodeData: <T extends TypedData>(types: T["types"], type: string, data: T["message"]) => string[][];
3355
+ /**
3356
+ * Get encoded data as a hash. The data should be a key -> value object with all the required values. All dependant
3357
+ * types are automatically encoded.
3358
+ *
3359
+ * @param {TypedData} typedData
3360
+ * @param {string} type
3361
+ * @param {Record<string, any>} data
3362
+ * @return {Buffer}
3363
+ */
3364
+ declare const getStructHash: <T extends TypedData>(types: T["types"], type: string, data: T["message"]) => string;
3365
+ /**
3366
+ * Get the EIP-191 encoded message to sign, from the typedData object.
3367
+ *
3368
+ * @param {TypedData} typedData
3369
+ * @param {BigNumberish} account
3370
+ * @return {string}
3371
+ */
3372
+ declare const getMessageHash: (typedData: TypedData, account: BigNumberish) => string;
3373
+
3374
+ type typedData_StarkNetDomain = StarkNetDomain;
3375
+ type typedData_StarkNetMerkleType = StarkNetMerkleType;
3376
+ type typedData_StarkNetType = StarkNetType;
3377
+ type typedData_TypedData = TypedData;
3378
+ declare const typedData_encodeData: typeof encodeData;
3379
+ declare const typedData_encodeType: typeof encodeType;
3380
+ declare const typedData_encodeValue: typeof encodeValue;
3381
+ declare const typedData_getDependencies: typeof getDependencies;
3382
+ declare const typedData_getMessageHash: typeof getMessageHash;
3383
+ declare const typedData_getStructHash: typeof getStructHash;
3384
+ declare const typedData_getTypeHash: typeof getTypeHash;
3385
+ declare const typedData_isMerkleTreeType: typeof isMerkleTreeType;
3386
+ declare const typedData_prepareSelector: typeof prepareSelector;
3387
+ declare namespace typedData {
3388
+ export {
3389
+ typedData_StarkNetDomain as StarkNetDomain,
3390
+ typedData_StarkNetMerkleType as StarkNetMerkleType,
3391
+ typedData_StarkNetType as StarkNetType,
3392
+ typedData_TypedData as TypedData,
3393
+ typedData_encodeData as encodeData,
3394
+ typedData_encodeType as encodeType,
3395
+ typedData_encodeValue as encodeValue,
3396
+ typedData_getDependencies as getDependencies,
3397
+ typedData_getMessageHash as getMessageHash,
3398
+ typedData_getStructHash as getStructHash,
3399
+ typedData_getTypeHash as getTypeHash,
3400
+ typedData_isMerkleTreeType as isMerkleTreeType,
3401
+ typedData_prepareSelector as prepareSelector,
3402
+ };
3403
+ }
3404
+
3139
3405
  declare function useDecoded(encoded: bigint[]): string;
3140
3406
  declare function useEncoded(decoded: string): bigint;
3141
3407
  declare const enum StarknetIdContract {
@@ -3327,4 +3593,4 @@ declare class CallData {
3327
3593
  /** @deprecated prefer the 'num' naming */
3328
3594
  declare const number: typeof num;
3329
3595
 
3330
- export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, ArgsOrCalldata, ArgsOrCalldataWithOptions, ArraySignatureType, AsyncContractFunction, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, ContractOptions, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HexCalldata, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeOptions, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, MultiType, Nonce, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, RPC, RawArgs, RawArgsArray, RawArgsObject, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, cairo, constants, defaultProvider, ec, encode, fixProto, fixStack, getCalldata, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, splitArgsAndOptions, stark, starknetId, transaction, index as typedData, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
3596
+ export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, ArgsOrCalldata, ArgsOrCalldataWithOptions, ArraySignatureType, AsyncContractFunction, BigNumberish, BlockIdentifier, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, ContractOptions, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HexCalldata, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeOptions, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, MultiType, Nonce, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, RPC, RawArgs, RawArgsArray, RawArgsObject, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, StarkNetDomain, StarkNetMerkleType, StarkNetType, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, TypedData, Uint256, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, cairo, constants, defaultProvider, ec, encode, fixProto, fixStack, getCalldata, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index as types, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };