starknet 5.8.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,10 @@
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
+
1
8
  # [5.8.0](https://github.com/0xs34n/starknet.js/compare/v5.7.0...v5.8.0) (2023-04-26)
2
9
 
3
10
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -341,7 +341,15 @@ declare enum EntryPointType {
341
341
  declare type WeierstrassSignatureType = _noble_curves_abstract_weierstrass.SignatureType;
342
342
  declare type ArraySignatureType = string[];
343
343
  declare type Signature = ArraySignatureType | WeierstrassSignatureType;
344
+ /**
345
+ * BigNumberish array
346
+ * use CallData.compile() to convert to Calldata
347
+ */
344
348
  declare type RawCalldata = BigNumberish[];
349
+ /**
350
+ * Hexadecimal-string array
351
+ */
352
+ declare type HexCalldata = string[];
345
353
  declare type AllowArray<T> = T | T[];
346
354
  declare type RawArgs = RawArgsObject | RawArgsArray;
347
355
  declare type RawArgsObject = {
@@ -509,6 +517,10 @@ declare type ContractFunction = (...args: ArgsOrCalldataWithOptions) => any;
509
517
  declare type Result = {
510
518
  [key: string]: any;
511
519
  } | Result[] | bigint | string | boolean;
520
+ /**
521
+ * Compiled calldata ready to be sent
522
+ * decimal-string array
523
+ */
512
524
  declare type Calldata = string[] & {
513
525
  readonly __compiled__?: boolean;
514
526
  };
@@ -2846,11 +2858,11 @@ declare function getSelectorFromName(funcName: string): string;
2846
2858
  */
2847
2859
  declare function getSelector(value: string): string;
2848
2860
  declare function computeHashOnElements(data: BigNumberish[]): string;
2849
- declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
2850
- 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;
2851
2863
  declare function calculateDeclareTransactionHash(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, compiledClassHash?: string): string;
2852
- declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: BigNumberish[], salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2853
- 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;
2854
2866
  declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, deployerAddress: BigNumberish): string;
2855
2867
  declare function formatSpaces(json: string): string;
2856
2868
  declare function computeHintedClassHash(compiledContract: LegacyCompiledContract): string;
@@ -2937,7 +2949,7 @@ declare namespace json {
2937
2949
  */
2938
2950
  declare const transformCallsToMulticallArrays: (calls: Call[]) => {
2939
2951
  callArray: ParsedStruct[];
2940
- calldata: string[];
2952
+ calldata: Calldata;
2941
2953
  };
2942
2954
  /**
2943
2955
  * Transforms a list of calls in the full flattened calldata expected
@@ -2945,29 +2957,28 @@ declare const transformCallsToMulticallArrays: (calls: Call[]) => {
2945
2957
  * @param calls
2946
2958
  * @returns
2947
2959
  */
2948
- declare const fromCallsToExecuteCalldata: (calls: Call[]) => string[];
2949
- declare const fromCallsToExecuteCalldataWithNonce: (calls: Call[], nonce: BigNumberish) => string[];
2960
+ declare const fromCallsToExecuteCalldata: (calls: Call[]) => Calldata;
2961
+ declare const fromCallsToExecuteCalldataWithNonce: (calls: Call[], nonce: BigNumberish) => Calldata;
2950
2962
  /**
2951
- * Transforms a list of Calls, each with their own calldata, into
2952
- * two arrays: one with the entrypoints, and one with the concatenated calldata.
2953
- * @param calls
2954
- * @returns
2963
+ * Format Data inside Calls
2964
+ * @param calls Call[]
2965
+ * @returns CallStruct
2955
2966
  */
2956
2967
  declare const transformCallsToMulticallArrays_cairo1: (calls: Call[]) => CallStruct[];
2957
2968
  /**
2958
2969
  * Transforms a list of calls in the full flattened calldata expected
2959
2970
  * by the __execute__ protocol.
2960
2971
  * @param calls
2961
- * @returns
2972
+ * @returns Calldata
2962
2973
  */
2963
- declare const fromCallsToExecuteCalldata_cairo1: (calls: Call[]) => string[];
2974
+ declare const fromCallsToExecuteCalldata_cairo1: (calls: Call[]) => Calldata;
2964
2975
  /**
2965
2976
  *
2966
2977
  * @param calls Call array
2967
2978
  * @param cairoVersion Defaults to 0
2968
2979
  * @returns string[] of calldata
2969
2980
  */
2970
- declare const getExecuteCalldata: (calls: Call[], cairoVersion?: CairoVersion) => string[];
2981
+ declare const getExecuteCalldata: (calls: Call[], cairoVersion?: CairoVersion) => Calldata;
2971
2982
 
2972
2983
  declare const transaction_transformCallsToMulticallArrays: typeof transformCallsToMulticallArrays;
2973
2984
  declare const transaction_fromCallsToExecuteCalldata: typeof fromCallsToExecuteCalldata;
@@ -3319,6 +3330,18 @@ declare class CallData {
3319
3330
  * @returns AbiStructs - structs from abi
3320
3331
  */
3321
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;
3322
3345
  }
3323
3346
 
3324
3347
  /**
@@ -3328,4 +3351,4 @@ declare class CallData {
3328
3351
  /** @deprecated prefer the 'num' naming */
3329
3352
  declare const number: typeof num;
3330
3353
 
3331
- 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, 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 };
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 };