starknet 5.1.1 → 5.2.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,11 @@
1
+ # [5.2.0](https://github.com/0xs34n/starknet.js/compare/v5.1.1...v5.2.0) (2023-03-14)
2
+
3
+ ### Features
4
+
5
+ - compiledClassHash implementation working without cleanup ([485793c](https://github.com/0xs34n/starknet.js/commit/485793ce6fd0763e3da56d0d11a50bffc9bab984))
6
+ - comput chassHash for cairo 1 contract - computeSieraContractClassHash ([e20c1c5](https://github.com/0xs34n/starknet.js/commit/e20c1c5d01ce1d8abe2de527233a8396f7b9316d))
7
+ - unify classHash for siera and legacy ([fac2bfe](https://github.com/0xs34n/starknet.js/commit/fac2bfe92e074207132296a0d3f73dae2ddaf735))
8
+
1
9
  ## [5.1.1](https://github.com/0xs34n/starknet.js/compare/v5.1.0...v5.1.1) (2023-03-07)
2
10
 
3
11
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _noble_curves_abstract_weierstrass from '@noble/curves/abstract/weierstrass';
2
2
  import * as poseidon from '@noble/curves/abstract/poseidon';
3
- import * as stark$1 from '@noble/curves/stark';
3
+ import * as microStarknet from 'micro-starknet';
4
4
  import { CustomError } from 'ts-custom-error';
5
5
 
6
6
  declare namespace ec {
7
7
  export {
8
- stark$1 as starkCurve,
8
+ microStarknet as starkCurve,
9
9
  _noble_curves_abstract_weierstrass as weierstrass,
10
10
  };
11
11
  }
@@ -830,15 +830,26 @@ declare type StructAbi = {
830
830
  };
831
831
  declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
832
832
  declare type EventAbi = any;
833
+ declare type Builtins = string[];
834
+ declare type SieraContractEntryPointFields = {
835
+ selector: string;
836
+ function_idx: number;
837
+ };
833
838
  declare type ContractEntryPointFields = {
834
839
  selector: string;
835
840
  offset: string;
841
+ builtins?: Builtins;
836
842
  };
837
843
  declare type EntryPointsByType = {
838
844
  CONSTRUCTOR: ContractEntryPointFields[];
839
845
  EXTERNAL: ContractEntryPointFields[];
840
846
  L1_HANDLER: ContractEntryPointFields[];
841
847
  };
848
+ declare type SieraEntryPointsByType = {
849
+ CONSTRUCTOR: SieraContractEntryPointFields[];
850
+ EXTERNAL: SieraContractEntryPointFields[];
851
+ L1_HANDLER: SieraContractEntryPointFields[];
852
+ };
842
853
  interface Program extends Record<string, any> {
843
854
  builtins: string[];
844
855
  data: string[];
@@ -853,6 +864,21 @@ declare type CompiledContract = {
853
864
  declare type CompressedCompiledContract = Omit<CompiledContract, 'program'> & {
854
865
  program: CompressedProgram;
855
866
  };
867
+ declare type Hints = [number, string[]][];
868
+ declare type CompiledSieraCasm = {
869
+ prime: string;
870
+ compiler_version: string;
871
+ bytecode: string[];
872
+ hints: Hints;
873
+ entry_points_by_type: EntryPointsByType;
874
+ };
875
+ declare type CompiledSiera = {
876
+ sierra_program: string[];
877
+ sierra_program_debug_info: any;
878
+ contract_class_version: string;
879
+ entry_points_by_type: SieraEntryPointsByType;
880
+ abi: Abi;
881
+ };
856
882
  declare type Struct = {
857
883
  type: 'struct';
858
884
  [k: string]: BigNumberish;
@@ -2656,7 +2682,15 @@ declare function calculateDeployAccountTransactionHash(contractAddress: BigNumbe
2656
2682
  declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2657
2683
  declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, deployerAddress: BigNumberish): string;
2658
2684
  declare function computeHintedClassHash(compiledContract: CompiledContract): string;
2659
- declare function computeContractClassHash(contract: CompiledContract | string): string;
2685
+ declare function computeLegacyContractClassHash(contract: CompiledContract | string): string;
2686
+ declare function computeCompiledClassHash(casm: CompiledSieraCasm): string;
2687
+ declare function computeSieraContractClassHash(siera: CompiledSiera): string;
2688
+ /**
2689
+ * Compute ClassHash (siera or legacy) based on provided contract
2690
+ * @param contract CompiledContract | CompiledSiera | string
2691
+ * @returns HexString ClassHash
2692
+ */
2693
+ declare function computeContractClassHash(contract: CompiledContract | CompiledSiera | string): string;
2660
2694
 
2661
2695
  declare const hash_transactionVersion: typeof transactionVersion;
2662
2696
  declare const hash_feeTransactionVersion: typeof feeTransactionVersion;
@@ -2671,6 +2705,9 @@ declare const hash_calculateDeclareTransactionHash: typeof calculateDeclareTrans
2671
2705
  declare const hash_calculateDeployAccountTransactionHash: typeof calculateDeployAccountTransactionHash;
2672
2706
  declare const hash_calculateTransactionHash: typeof calculateTransactionHash;
2673
2707
  declare const hash_calculateContractAddressFromHash: typeof calculateContractAddressFromHash;
2708
+ declare const hash_computeLegacyContractClassHash: typeof computeLegacyContractClassHash;
2709
+ declare const hash_computeCompiledClassHash: typeof computeCompiledClassHash;
2710
+ declare const hash_computeSieraContractClassHash: typeof computeSieraContractClassHash;
2674
2711
  declare const hash_computeContractClassHash: typeof computeContractClassHash;
2675
2712
  declare const hash_poseidon: typeof poseidon;
2676
2713
  declare namespace hash {
@@ -2689,6 +2726,9 @@ declare namespace hash {
2689
2726
  hash_calculateDeployAccountTransactionHash as calculateDeployAccountTransactionHash,
2690
2727
  hash_calculateTransactionHash as calculateTransactionHash,
2691
2728
  hash_calculateContractAddressFromHash as calculateContractAddressFromHash,
2729
+ hash_computeLegacyContractClassHash as computeLegacyContractClassHash,
2730
+ hash_computeCompiledClassHash as computeCompiledClassHash,
2731
+ hash_computeSieraContractClassHash as computeSieraContractClassHash,
2692
2732
  hash_computeContractClassHash as computeContractClassHash,
2693
2733
  hash_poseidon as poseidon,
2694
2734
  };
@@ -2928,4 +2968,4 @@ declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: stri
2928
2968
  /** @deprecated prefer the 'num' naming */
2929
2969
  declare const number: typeof num;
2930
2970
 
2931
- export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, 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, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonces, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, Signature, Signer, SignerInterface, StateDiffItem, StateUpdateResponse, Status, StorageDiffItem, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, abiStructs, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
2971
+ export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Builtins, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSiera, CompiledSieraCasm, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, Hints, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonces, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SieraContractEntryPointFields, SieraEntryPointsByType, Signature, Signer, SignerInterface, StateDiffItem, StateUpdateResponse, Status, StorageDiffItem, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, abiStructs, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };