starknet 5.7.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [5.9.0](https://github.com/0xs34n/starknet.js/compare/v5.8.0...v5.9.0) (2023-04-28)
2
+
3
+ ### Features
4
+
5
+ - complex c1 Struct with forced abi, complex ci arrays, refactor parser ([8f28462](https://github.com/0xs34n/starknet.js/commit/8f2846290a88c7b3b2985f32c61446a378566679))
6
+ - helpers toHex, Calldata, executeCallData, compile entrypoint, type improvements ([a452d64](https://github.com/0xs34n/starknet.js/commit/a452d64f1aa4e1005378bbba4d7748a054cae2be))
7
+
8
+ # [5.8.0](https://github.com/0xs34n/starknet.js/compare/v5.7.0...v5.8.0) (2023-04-26)
9
+
10
+ ### Bug Fixes
11
+
12
+ - contract types, interface, cleanup, extend tests ([02c6b72](https://github.com/0xs34n/starknet.js/commit/02c6b72ec41016fdd75537044889e7cffd624b27))
13
+ - contractfactory, contract, interface cleanup cleanup & ts ([b25047e](https://github.com/0xs34n/starknet.js/commit/b25047ece2eed313eaa776b2a132b9a04c3fbc2f))
14
+ - lapsus lingua, dangling, cleanup 🚀 ([a79d55c](https://github.com/0xs34n/starknet.js/commit/a79d55c2990e81bc6b0e58583142d3eb7bbddfa2))
15
+ - prevent missusage of cairoVersion on deploy ([d920dbe](https://github.com/0xs34n/starknet.js/commit/d920dbe6144006438c917727b153a043fec2531b))
16
+ - remove unused cairoVersion from Contract ([e4fcf24](https://github.com/0xs34n/starknet.js/commit/e4fcf244fa1dfd01301addfa7492bf90dac5a854))
17
+
18
+ ### Features
19
+
20
+ - boolean to felt - cairo 1, compile() ([ef34e0a](https://github.com/0xs34n/starknet.js/commit/ef34e0a25a52be7a6ac76714bda43233a2f1a6f1))
21
+ - remove deprecated compileCalldata ([e5adca4](https://github.com/0xs34n/starknet.js/commit/e5adca449a9d1142339d5e63adb857698c5913d6))
22
+
1
23
  # [5.7.0](https://github.com/0xs34n/starknet.js/compare/v5.6.1...v5.7.0) (2023-04-25)
2
24
 
3
25
  ### Features
package/dist/index.d.ts CHANGED
@@ -206,6 +206,33 @@ declare namespace num {
206
206
  };
207
207
  }
208
208
 
209
+ interface Uint256 {
210
+ low: BigNumberish;
211
+ high: BigNumberish;
212
+ }
213
+ declare function uint256ToBN(uint256: Uint256): bigint;
214
+ declare const UINT_128_MAX: bigint;
215
+ declare const UINT_256_MAX: bigint;
216
+ declare function isUint256(bn: BigNumberish): boolean;
217
+ declare function bnToUint256(bignumber: BigNumberish): Uint256;
218
+
219
+ type uint256$1_Uint256 = Uint256;
220
+ declare const uint256$1_uint256ToBN: typeof uint256ToBN;
221
+ declare const uint256$1_UINT_128_MAX: typeof UINT_128_MAX;
222
+ declare const uint256$1_UINT_256_MAX: typeof UINT_256_MAX;
223
+ declare const uint256$1_isUint256: typeof isUint256;
224
+ declare const uint256$1_bnToUint256: typeof bnToUint256;
225
+ declare namespace uint256$1 {
226
+ export {
227
+ uint256$1_Uint256 as Uint256,
228
+ uint256$1_uint256ToBN as uint256ToBN,
229
+ uint256$1_UINT_128_MAX as UINT_128_MAX,
230
+ uint256$1_UINT_256_MAX as UINT_256_MAX,
231
+ uint256$1_isUint256 as isUint256,
232
+ uint256$1_bnToUint256 as bnToUint256,
233
+ };
234
+ }
235
+
209
236
  /** ABI */
210
237
  declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
211
238
  declare type AbiEntry = {
@@ -314,14 +341,22 @@ declare enum EntryPointType {
314
341
  declare type WeierstrassSignatureType = _noble_curves_abstract_weierstrass.SignatureType;
315
342
  declare type ArraySignatureType = string[];
316
343
  declare type Signature = ArraySignatureType | WeierstrassSignatureType;
344
+ /**
345
+ * BigNumberish array
346
+ * use CallData.compile() to convert to Calldata
347
+ */
317
348
  declare type RawCalldata = BigNumberish[];
349
+ /**
350
+ * Hexadecimal-string array
351
+ */
352
+ declare type HexCalldata = string[];
318
353
  declare type AllowArray<T> = T | T[];
319
- declare type RawArgs = {
320
- [inputName: string]: BigNumberish | BigNumberish[] | {
321
- type: 'struct';
322
- [k: string]: BigNumberish;
323
- };
324
- } | BigNumberish[];
354
+ declare type RawArgs = RawArgsObject | RawArgsArray;
355
+ declare type RawArgsObject = {
356
+ [inputName: string]: MultiType | MultiType[] | RawArgs;
357
+ };
358
+ declare type RawArgsArray = Array<MultiType | MultiType[] | RawArgs>;
359
+ declare type MultiType = BigNumberish | Uint256 | object | boolean;
325
360
  declare type UniversalDeployerContractPayload = {
326
361
  classHash: BigNumberish;
327
362
  salt?: string;
@@ -457,14 +492,6 @@ interface CallStruct {
457
492
  calldata: string[];
458
493
  }
459
494
 
460
- declare type Calldata = string[];
461
- declare type Overrides = {
462
- maxFee?: BigNumberish;
463
- nonce?: BigNumberish;
464
- signature?: Signature;
465
- parseRequest?: Boolean;
466
- };
467
-
468
495
  interface InvocationsSignerDetails extends Required<InvocationsDetails> {
469
496
  walletAddress: string;
470
497
  chainId: StarknetChainId;
@@ -483,13 +510,36 @@ declare type DeployAccountSignerDetails = Required<DeployAccountContractPayload>
483
510
  chainId: StarknetChainId;
484
511
  };
485
512
 
486
- declare type AsyncContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
487
- declare type ContractFunction = (...args: Array<any>) => any;
513
+ declare type BlockIdentifier = BlockNumber | BigNumberish;
514
+
515
+ declare type AsyncContractFunction<T = any> = (...args: ArgsOrCalldataWithOptions) => Promise<T>;
516
+ declare type ContractFunction = (...args: ArgsOrCalldataWithOptions) => any;
488
517
  declare type Result = {
489
518
  [key: string]: any;
490
519
  } | Result[] | bigint | string | boolean;
491
-
492
- declare type BlockIdentifier = BlockNumber | BigNumberish;
520
+ /**
521
+ * Compiled calldata ready to be sent
522
+ * decimal-string array
523
+ */
524
+ declare type Calldata = string[] & {
525
+ readonly __compiled__?: boolean;
526
+ };
527
+ declare type ArgsOrCalldata = RawArgsArray | [Calldata] | Calldata;
528
+ declare type ArgsOrCalldataWithOptions = ArgsOrCalldata & ContractOptions;
529
+ declare type ContractOptions = {
530
+ blockIdentifier?: BlockIdentifier;
531
+ parseRequest?: boolean;
532
+ parseResponse?: boolean;
533
+ formatResponse?: {
534
+ [key: string]: any;
535
+ };
536
+ maxFee?: BigNumberish;
537
+ nonce?: BigNumberish;
538
+ signature?: Signature;
539
+ addressSalt?: string;
540
+ };
541
+ declare type CallOptions = Pick<ContractOptions, 'blockIdentifier' | 'parseRequest' | 'parseResponse' | 'formatResponse'>;
542
+ declare type InvokeOptions = Pick<ContractOptions, 'maxFee' | 'nonce' | 'signature' | 'parseRequest'>;
493
543
 
494
544
  /**
495
545
  * Starknet RPC version 0.2.1
@@ -1609,6 +1659,7 @@ interface EstimateFeeResponse {
1609
1659
  overall_fee: bigint;
1610
1660
  gas_consumed?: bigint;
1611
1661
  gas_price?: bigint;
1662
+ suggestedMaxFee?: bigint;
1612
1663
  }
1613
1664
  interface InvokeFunctionResponse {
1614
1665
  transaction_hash: string;
@@ -2624,12 +2675,6 @@ declare class Account extends Provider implements AccountInterface {
2624
2675
  StarknetIdContract?: string): Promise<string>;
2625
2676
  }
2626
2677
 
2627
- declare type CallOptions = {
2628
- blockIdentifier?: BlockIdentifier;
2629
- parseRequest: Boolean;
2630
- parseResponse: Boolean;
2631
- formatResponse?: object | null;
2632
- };
2633
2678
  declare abstract class ContractInterface {
2634
2679
  abstract abi: Abi;
2635
2680
  abstract address: string;
@@ -2675,36 +2720,47 @@ declare abstract class ContractInterface {
2675
2720
  * @param options optional blockIdentifier
2676
2721
  * @returns Result of the call as an array with key value pars
2677
2722
  */
2678
- abstract call(method: string, args?: Array<any>, options?: CallOptions): Promise<Object>;
2723
+ abstract call(method: string, args?: ArgsOrCalldata, options?: CallOptions): Promise<Result>;
2679
2724
  /**
2680
2725
  * Invokes a method on a contract
2681
2726
  *
2682
2727
  * @param method name of the method
2683
- * @param args Array of the arguments for the invoke
2728
+ * @param args Array of the arguments for the invoke or Calldata
2684
2729
  * @param options
2685
2730
  * @returns Add Transaction Response
2686
2731
  */
2687
- abstract invoke(method: string, args?: Array<any>, options?: Overrides): Promise<InvokeFunctionResponse>;
2732
+ abstract invoke(method: string, args?: ArgsOrCalldata, options?: InvokeOptions): Promise<InvokeFunctionResponse>;
2688
2733
  /**
2689
2734
  * Estimates a method on a contract
2690
2735
  *
2691
2736
  * @param method name of the method
2692
- * @param args Array of the arguments for the call
2737
+ * @param args Array of the arguments for the call or Calldata
2693
2738
  * @param options optional blockIdentifier
2694
2739
  */
2695
- abstract estimate(method: string, args?: Array<any>, options?: {
2740
+ abstract estimate(method: string, args?: ArgsOrCalldata, options?: {
2696
2741
  blockIdentifier?: BlockIdentifier;
2697
- }): Promise<any>;
2742
+ }): Promise<EstimateFeeResponse>;
2698
2743
  /**
2699
2744
  * Calls a method on a contract
2700
2745
  *
2701
2746
  * @param method name of the method
2702
- * @param args Array of the arguments for the call
2747
+ * @param args Array of the arguments for the call or Calldata
2703
2748
  * @returns Invocation object
2704
2749
  */
2705
- abstract populate(method: string, args?: Array<any>): Invocation;
2750
+ abstract populate(method: string, args?: ArgsOrCalldata): Invocation;
2706
2751
  }
2707
2752
 
2753
+ declare const splitArgsAndOptions: (args: ArgsOrCalldataWithOptions) => {
2754
+ args: ArgsOrCalldata;
2755
+ options: ContractOptions;
2756
+ } | {
2757
+ args: ArgsOrCalldata;
2758
+ options?: undefined;
2759
+ };
2760
+ declare function getCalldata(args: ArgsOrCalldata, callback: Function): Calldata;
2761
+ /**
2762
+ * Not used at the moment
2763
+ */
2708
2764
  declare class Contract implements ContractInterface {
2709
2765
  abi: Abi;
2710
2766
  address: string;
@@ -2727,23 +2783,21 @@ declare class Contract implements ContractInterface {
2727
2783
  };
2728
2784
  readonly [key: string]: AsyncContractFunction | any;
2729
2785
  private callData;
2730
- private version;
2731
2786
  /**
2732
2787
  * Contract class to handle contract methods
2733
2788
  *
2734
2789
  * @param abi - Abi of the contract object
2735
2790
  * @param address (optional) - address to connect to
2736
2791
  * @param providerOrAccount (optional) - Provider or Account to attach to
2737
- * @param cairoVersion (optional) - default '0', for Cairo 1 set '1'
2738
2792
  */
2739
- constructor(abi: Abi, address: string, providerOrAccount?: ProviderInterface | AccountInterface, cairoVersion?: string);
2793
+ constructor(abi: Abi, address: string, providerOrAccount?: ProviderInterface | AccountInterface);
2740
2794
  attach(address: string): void;
2741
2795
  connect(providerOrAccount: ProviderInterface | AccountInterface): void;
2742
2796
  deployed(): Promise<Contract>;
2743
- call(method: string, args?: Array<any>, options?: CallOptions): Promise<Result>;
2744
- invoke(method: string, args?: Array<any>, options?: Overrides): Promise<InvokeFunctionResponse>;
2745
- estimate(method: string, args?: Array<any>): Promise<EstimateFeeResponse>;
2746
- populate(method: string, args?: Array<any>): Call;
2797
+ call(method: string, args?: ArgsOrCalldata, { parseRequest, parseResponse, formatResponse, blockIdentifier, }?: CallOptions): Promise<Result>;
2798
+ invoke(method: string, args?: ArgsOrCalldata, { parseRequest, maxFee, nonce, signature }?: InvokeOptions): Promise<InvokeFunctionResponse>;
2799
+ estimate(method: string, args?: ArgsOrCalldata): Promise<EstimateFeeResponse>;
2800
+ populate(method: string, args?: ArgsOrCalldata): Call;
2747
2801
  }
2748
2802
 
2749
2803
  declare class ContractFactory {
@@ -2751,7 +2805,7 @@ declare class ContractFactory {
2751
2805
  compiledContract: CompiledContract;
2752
2806
  classHash: string;
2753
2807
  account: AccountInterface;
2754
- private callData;
2808
+ private CallData;
2755
2809
  constructor(compiledContract: CompiledContract, classHash: string, account: AccountInterface, abi?: Abi);
2756
2810
  /**
2757
2811
  * Deploys contract and returns new instance of the Contract
@@ -2760,16 +2814,16 @@ declare class ContractFactory {
2760
2814
  * @param options (optional) Object - parseRequest, parseResponse, addressSalt
2761
2815
  * @returns deployed Contract
2762
2816
  */
2763
- deploy(...args: Array<any>): Promise<Contract>;
2817
+ deploy(...args: ArgsOrCalldataWithOptions): Promise<Contract>;
2764
2818
  /**
2765
- * Attaches to new Provider or Account
2819
+ * Attaches to new Account
2766
2820
  *
2767
2821
  * @param account - new Provider or Account to attach to
2768
2822
  * @returns ContractFactory
2769
2823
  */
2770
2824
  connect(account: AccountInterface): ContractFactory;
2771
2825
  /**
2772
- * Attaches current abi and provider or account to the new address
2826
+ * Attaches current abi and account to the new address
2773
2827
  *
2774
2828
  * @param address - Contract address
2775
2829
  * @returns Contract
@@ -2804,11 +2858,11 @@ declare function getSelectorFromName(funcName: string): string;
2804
2858
  */
2805
2859
  declare function getSelector(value: string): string;
2806
2860
  declare function computeHashOnElements(data: BigNumberish[]): string;
2807
- declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
2808
- declare function calculateDeployTransactionHash(contractAddress: BigNumberish, constructorCalldata: BigNumberish[], version: BigNumberish, chainId: StarknetChainId): string;
2861
+ declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: RawCalldata, maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
2862
+ declare function calculateDeployTransactionHash(contractAddress: BigNumberish, constructorCalldata: RawCalldata, version: BigNumberish, chainId: StarknetChainId): string;
2809
2863
  declare function calculateDeclareTransactionHash(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, compiledClassHash?: string): string;
2810
- declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: BigNumberish[], salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2811
- declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2864
+ declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2865
+ declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: RawCalldata, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2812
2866
  declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, deployerAddress: BigNumberish): string;
2813
2867
  declare function formatSpaces(json: string): string;
2814
2868
  declare function computeHintedClassHash(compiledContract: LegacyCompiledContract): string;
@@ -2895,7 +2949,7 @@ declare namespace json {
2895
2949
  */
2896
2950
  declare const transformCallsToMulticallArrays: (calls: Call[]) => {
2897
2951
  callArray: ParsedStruct[];
2898
- calldata: string[];
2952
+ calldata: Calldata;
2899
2953
  };
2900
2954
  /**
2901
2955
  * Transforms a list of calls in the full flattened calldata expected
@@ -2903,29 +2957,28 @@ declare const transformCallsToMulticallArrays: (calls: Call[]) => {
2903
2957
  * @param calls
2904
2958
  * @returns
2905
2959
  */
2906
- declare const fromCallsToExecuteCalldata: (calls: Call[]) => string[];
2907
- declare const fromCallsToExecuteCalldataWithNonce: (calls: Call[], nonce: BigNumberish) => string[];
2960
+ declare const fromCallsToExecuteCalldata: (calls: Call[]) => Calldata;
2961
+ declare const fromCallsToExecuteCalldataWithNonce: (calls: Call[], nonce: BigNumberish) => Calldata;
2908
2962
  /**
2909
- * Transforms a list of Calls, each with their own calldata, into
2910
- * two arrays: one with the entrypoints, and one with the concatenated calldata.
2911
- * @param calls
2912
- * @returns
2963
+ * Format Data inside Calls
2964
+ * @param calls Call[]
2965
+ * @returns CallStruct
2913
2966
  */
2914
2967
  declare const transformCallsToMulticallArrays_cairo1: (calls: Call[]) => CallStruct[];
2915
2968
  /**
2916
2969
  * Transforms a list of calls in the full flattened calldata expected
2917
2970
  * by the __execute__ protocol.
2918
2971
  * @param calls
2919
- * @returns
2972
+ * @returns Calldata
2920
2973
  */
2921
- declare const fromCallsToExecuteCalldata_cairo1: (calls: Call[]) => string[];
2974
+ declare const fromCallsToExecuteCalldata_cairo1: (calls: Call[]) => Calldata;
2922
2975
  /**
2923
2976
  *
2924
2977
  * @param calls Call array
2925
2978
  * @param cairoVersion Defaults to 0
2926
2979
  * @returns string[] of calldata
2927
2980
  */
2928
- declare const getExecuteCalldata: (calls: Call[], cairoVersion?: CairoVersion) => string[];
2981
+ declare const getExecuteCalldata: (calls: Call[], cairoVersion?: CairoVersion) => Calldata;
2929
2982
 
2930
2983
  declare const transaction_transformCallsToMulticallArrays: typeof transformCallsToMulticallArrays;
2931
2984
  declare const transaction_fromCallsToExecuteCalldata: typeof fromCallsToExecuteCalldata;
@@ -2957,10 +3010,6 @@ declare function makeAddress(input: string): string;
2957
3010
  declare function formatSignature(sig?: Signature): ArraySignatureType;
2958
3011
  declare function signatureToDecimalArray(sig?: Signature): ArraySignatureType;
2959
3012
  declare function signatureToHexArray(sig?: Signature): ArraySignatureType;
2960
- /**
2961
- * @deprecated this function is deprecated use callData instead from calldata.ts
2962
- */
2963
- declare function compileCalldata(args: RawArgs): Calldata;
2964
3013
  declare function estimatedFeeToMaxFee(estimatedFee: BigNumberish, overhead?: number): bigint;
2965
3014
 
2966
3015
  declare const stark_compressProgram: typeof compressProgram;
@@ -2969,7 +3018,6 @@ declare const stark_makeAddress: typeof makeAddress;
2969
3018
  declare const stark_formatSignature: typeof formatSignature;
2970
3019
  declare const stark_signatureToDecimalArray: typeof signatureToDecimalArray;
2971
3020
  declare const stark_signatureToHexArray: typeof signatureToHexArray;
2972
- declare const stark_compileCalldata: typeof compileCalldata;
2973
3021
  declare const stark_estimatedFeeToMaxFee: typeof estimatedFeeToMaxFee;
2974
3022
  declare namespace stark {
2975
3023
  export {
@@ -2979,7 +3027,6 @@ declare namespace stark {
2979
3027
  stark_formatSignature as formatSignature,
2980
3028
  stark_signatureToDecimalArray as signatureToDecimalArray,
2981
3029
  stark_signatureToHexArray as signatureToHexArray,
2982
- stark_compileCalldata as compileCalldata,
2983
3030
  stark_estimatedFeeToMaxFee as estimatedFeeToMaxFee,
2984
3031
  };
2985
3032
  }
@@ -3005,33 +3052,6 @@ declare namespace merkle {
3005
3052
  };
3006
3053
  }
3007
3054
 
3008
- interface Uint256 {
3009
- low: BigNumberish;
3010
- high: BigNumberish;
3011
- }
3012
- declare function uint256ToBN(uint256: Uint256): bigint;
3013
- declare const UINT_128_MAX: bigint;
3014
- declare const UINT_256_MAX: bigint;
3015
- declare function isUint256(bn: BigNumberish): boolean;
3016
- declare function bnToUint256(bignumber: BigNumberish): Uint256;
3017
-
3018
- type uint256$1_Uint256 = Uint256;
3019
- declare const uint256$1_uint256ToBN: typeof uint256ToBN;
3020
- declare const uint256$1_UINT_128_MAX: typeof UINT_128_MAX;
3021
- declare const uint256$1_UINT_256_MAX: typeof UINT_256_MAX;
3022
- declare const uint256$1_isUint256: typeof isUint256;
3023
- declare const uint256$1_bnToUint256: typeof bnToUint256;
3024
- declare namespace uint256$1 {
3025
- export {
3026
- uint256$1_Uint256 as Uint256,
3027
- uint256$1_uint256ToBN as uint256ToBN,
3028
- uint256$1_UINT_128_MAX as UINT_128_MAX,
3029
- uint256$1_UINT_256_MAX as UINT_256_MAX,
3030
- uint256$1_isUint256 as isUint256,
3031
- uint256$1_bnToUint256 as bnToUint256,
3032
- };
3033
- }
3034
-
3035
3055
  declare function isASCII(str: string): boolean;
3036
3056
  declare function isShortString(str: string): boolean;
3037
3057
  declare function isDecimalString(decim: string): boolean;
@@ -3263,44 +3283,65 @@ declare class CallData {
3263
3283
  protected readonly structs: AbiStructs;
3264
3284
  constructor(abi: Abi);
3265
3285
  /**
3266
- * Validates if all arguments that are passed to the method are corresponding to the ones in the abi
3267
- *
3268
- * @param type - type of the method
3269
- * @param method - name of the method
3270
- * @param args - arguments that are passed to the method
3286
+ * Validate arguments passed to the method as corresponding to the ones in the abi
3287
+ * @param type string - type of the method
3288
+ * @param method string - name of the method
3289
+ * @param args ArgsOrCalldata - arguments that are passed to the method
3271
3290
  */
3272
- validate(type: 'INVOKE' | 'CALL' | 'DEPLOY', method: string, args?: Array<any>): void;
3291
+ validate(type: 'INVOKE' | 'CALL' | 'DEPLOY', method: string, args?: ArgsOrCalldata): void;
3273
3292
  /**
3293
+ * Compile contract callData with abi
3274
3294
  * Parse the calldata by using input fields from the abi for that method
3275
- *
3276
- * @param args - arguments passed the the method
3277
- * @param inputs - list of inputs(fields) that are in the abi
3278
- * @return {Calldata} - parsed arguments in format that contract is expecting
3295
+ * @param method string - method name
3296
+ * @param args ArgsOrCalldata - arguments passed to the method
3297
+ * @return Calldata - parsed arguments in format that contract is expecting
3279
3298
  */
3280
- compile(args: Array<any>, inputs: AbiEntry[]): Calldata;
3299
+ compile(method: string, args: ArgsOrCalldata): Calldata;
3281
3300
  /**
3282
3301
  * Compile contract callData without abi
3283
- * @param data Object representing cairo method arguments or string array of compiled data
3284
- * @returns string[]
3302
+ * @param rawArgs RawArgs representing cairo method arguments or string array of compiled data
3303
+ * @returns Calldata
3285
3304
  */
3286
- static compile(data: object | string[]): Calldata;
3305
+ static compile(rawArgs: RawArgs): Calldata;
3287
3306
  /**
3288
3307
  * Parse elements of the response array and structuring them into response object
3289
- * @param method - method name
3290
- * @param response - response from the method
3291
- * @return - parsed response corresponding to the abi
3308
+ * @param method string - method name
3309
+ * @param response string[] - response from the method
3310
+ * @return Result - parsed response corresponding to the abi
3292
3311
  */
3293
3312
  parse(method: string, response: string[]): Result;
3294
3313
  /**
3295
3314
  * Format cairo method response data to native js values based on provided format schema
3296
- * @param method - cairo method name
3297
- * @param response - cairo method response
3298
- * @param format - formatter object schema
3299
- * @returns parsed and formatted response object
3315
+ * @param method string - cairo method name
3316
+ * @param response string[] - cairo method response
3317
+ * @param format object - formatter object schema
3318
+ * @returns Result - parsed and formatted response object
3319
+ */
3320
+ format(method: string, response: string[], format: object): Result;
3321
+ /**
3322
+ * Helper to calculate inputs from abi
3323
+ * @param inputs AbiEntry
3324
+ * @returns number
3300
3325
  */
3301
- format(method: string, response: string[], format: object): object;
3302
3326
  static abiInputsLength(inputs: AbiEntry[]): number;
3303
- static getAbiStruct(abi: Abi): any;
3327
+ /**
3328
+ * Helper to extract structs from abi
3329
+ * @param abi Abi
3330
+ * @returns AbiStructs - structs from abi
3331
+ */
3332
+ static getAbiStruct(abi: Abi): AbiStructs;
3333
+ /**
3334
+ * Helper: Compile RawCalldata to Calldata
3335
+ * @param rawCalldata
3336
+ * @returns Calldata
3337
+ */
3338
+ static toCalldata(rawCalldata?: RawCalldata): Calldata;
3339
+ /**
3340
+ * Helper: Convert RawCalldata to HexCalldata
3341
+ * @param rawCalldata
3342
+ * @returns HexCalldata
3343
+ */
3344
+ static toHex(rawCalldata?: RawCalldata): HexCalldata;
3304
3345
  }
3305
3346
 
3306
3347
  /**
@@ -3310,4 +3351,4 @@ declare class CallData {
3310
3351
  /** @deprecated prefer the 'num' naming */
3311
3352
  declare const number: typeof num;
3312
3353
 
3313
- export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, 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, 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, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, RPC, RawArgs, 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, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, starknetId, transaction, index as typedData, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
3354
+ 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 };