starknet 5.3.0 → 5.4.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 +10 -0
- package/dist/index.d.ts +55 -33
- package/dist/index.global.js +835 -1980
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +88 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [5.4.0](https://github.com/0xs34n/starknet.js/compare/v5.3.0...v5.4.0) (2023-04-03)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- adjust suggested max fee response type ([78b1f81](https://github.com/0xs34n/starknet.js/commit/78b1f814f2a65fa0b28ed27912b69d3dfbc022ad))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- support cairo1 execute calldata ([1f7f001](https://github.com/0xs34n/starknet.js/commit/1f7f00155ae89ff871cdf987cd3b5238377d5450))
|
|
10
|
+
|
|
1
11
|
# [5.3.0](https://github.com/0xs34n/starknet.js/compare/v5.2.0...v5.3.0) (2023-03-29)
|
|
2
12
|
|
|
3
13
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _noble_curves_abstract_weierstrass from '@noble/curves/abstract/weierstrass';
|
|
2
2
|
import * as poseidon from '@noble/curves/abstract/poseidon';
|
|
3
3
|
import * as microStarknet from 'micro-starknet';
|
|
4
|
-
import { CustomError } from 'ts-custom-error';
|
|
4
|
+
import { CustomError } from 'ts-custom-error/dist/custom-error';
|
|
5
5
|
|
|
6
6
|
declare const IS_BROWSER: boolean;
|
|
7
7
|
declare function arrayBufferToString(array: ArrayBuffer): string;
|
|
@@ -368,10 +368,12 @@ declare type Invocation = CallDetails & {
|
|
|
368
368
|
declare type Call = CallDetails & {
|
|
369
369
|
entrypoint: string;
|
|
370
370
|
};
|
|
371
|
+
declare type CairoVersion = '0' | '1';
|
|
371
372
|
declare type InvocationsDetails = {
|
|
372
373
|
nonce?: BigNumberish;
|
|
373
374
|
maxFee?: BigNumberish;
|
|
374
375
|
version?: BigNumberish;
|
|
376
|
+
cairoVersion?: CairoVersion;
|
|
375
377
|
};
|
|
376
378
|
/**
|
|
377
379
|
* Contain all additional details params
|
|
@@ -446,6 +448,11 @@ declare type waitForTransactionOptions = {
|
|
|
446
448
|
retryInterval?: number;
|
|
447
449
|
successStates?: Array<TransactionStatus>;
|
|
448
450
|
};
|
|
451
|
+
interface CallStruct {
|
|
452
|
+
to: string;
|
|
453
|
+
selector: string;
|
|
454
|
+
calldata: string[];
|
|
455
|
+
}
|
|
449
456
|
|
|
450
457
|
declare type Calldata = string[];
|
|
451
458
|
declare type Overrides = {
|
|
@@ -461,14 +468,14 @@ interface InvocationsSignerDetails extends Required<InvocationsDetails> {
|
|
|
461
468
|
}
|
|
462
469
|
interface DeclareSignerDetails {
|
|
463
470
|
classHash: string;
|
|
464
|
-
senderAddress:
|
|
471
|
+
senderAddress: string;
|
|
465
472
|
chainId: StarknetChainId;
|
|
466
473
|
maxFee: BigNumberish;
|
|
467
474
|
version: BigNumberish;
|
|
468
475
|
nonce: BigNumberish;
|
|
469
476
|
compiledClassHash?: string;
|
|
470
477
|
}
|
|
471
|
-
declare type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
|
|
478
|
+
declare type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Omit<Required<InvocationsDetails>, 'cairoVersion'> & {
|
|
472
479
|
contractAddress: BigNumberish;
|
|
473
480
|
chainId: StarknetChainId;
|
|
474
481
|
};
|
|
@@ -1650,6 +1657,7 @@ interface EstimateFeeDetails {
|
|
|
1650
1657
|
nonce?: BigNumberish;
|
|
1651
1658
|
blockIdentifier?: BlockIdentifier;
|
|
1652
1659
|
skipValidate?: boolean;
|
|
1660
|
+
cairoVersion?: CairoVersion;
|
|
1653
1661
|
}
|
|
1654
1662
|
interface DeployContractResponse {
|
|
1655
1663
|
contract_address: string;
|
|
@@ -2546,7 +2554,7 @@ declare abstract class AccountInterface extends ProviderInterface {
|
|
|
2546
2554
|
* @param {BlockIdentifier} blockIdentifier - optional blockIdentifier. Defaults to 'pending'
|
|
2547
2555
|
* @returns nonce of the account
|
|
2548
2556
|
*/
|
|
2549
|
-
abstract getNonce(blockIdentifier?: BlockIdentifier): Promise<
|
|
2557
|
+
abstract getNonce(blockIdentifier?: BlockIdentifier): Promise<Nonce>;
|
|
2550
2558
|
/**
|
|
2551
2559
|
* Gets Suggested Max Fee based on the transaction type
|
|
2552
2560
|
*
|
|
@@ -2554,7 +2562,7 @@ declare abstract class AccountInterface extends ProviderInterface {
|
|
|
2554
2562
|
* @param {EstimateFeeDetails} details
|
|
2555
2563
|
* @returns suggestedMaxFee
|
|
2556
2564
|
*/
|
|
2557
|
-
abstract getSuggestedMaxFee(estimateFeeAction: EstimateFeeAction, details: EstimateFeeDetails): Promise<
|
|
2565
|
+
abstract getSuggestedMaxFee(estimateFeeAction: EstimateFeeAction, details: EstimateFeeDetails): Promise<bigint>;
|
|
2558
2566
|
/**
|
|
2559
2567
|
* Simulates the transaction and returns the transaction trace and estimated fee.
|
|
2560
2568
|
*
|
|
@@ -2572,13 +2580,13 @@ declare class Account extends Provider implements AccountInterface {
|
|
|
2572
2580
|
signer: SignerInterface;
|
|
2573
2581
|
address: string;
|
|
2574
2582
|
constructor(providerOrOptions: ProviderOptions | ProviderInterface, address: string, pkOrSigner: Uint8Array | string | SignerInterface);
|
|
2575
|
-
getNonce(blockIdentifier?: BlockIdentifier): Promise<
|
|
2583
|
+
getNonce(blockIdentifier?: BlockIdentifier): Promise<Nonce>;
|
|
2576
2584
|
estimateFee(calls: AllowArray<Call>, estimateFeeDetails?: EstimateFeeDetails | undefined): Promise<EstimateFee>;
|
|
2577
|
-
estimateInvokeFee(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier, skipValidate }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2578
|
-
estimateDeclareFee({ contract, classHash: providedClassHash, casm, compiledClassHash }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce, skipValidate }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2579
|
-
estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier, skipValidate }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2585
|
+
estimateInvokeFee(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier, skipValidate, cairoVersion }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2586
|
+
estimateDeclareFee({ contract, classHash: providedClassHash, casm, compiledClassHash }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce, skipValidate, cairoVersion }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2587
|
+
estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier, skipValidate, cairoVersion }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2580
2588
|
estimateDeployFee(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], transactionsDetail?: InvocationsDetails | undefined): Promise<EstimateFee>;
|
|
2581
|
-
estimateFeeBulk(transactions: TransactionBulk, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFeeBulk>;
|
|
2589
|
+
estimateFeeBulk(transactions: TransactionBulk, { nonce: providedNonce, blockIdentifier, cairoVersion }?: EstimateFeeDetails): Promise<EstimateFeeBulk>;
|
|
2582
2590
|
buildInvocation(call: Array<Call>, signerDetails: InvocationsSignerDetails): Promise<Invocation>;
|
|
2583
2591
|
execute(calls: AllowArray<Call>, abis?: Abi[] | undefined, transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
|
|
2584
2592
|
declare(payload: DeclareContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeclareContractResponse>;
|
|
@@ -2590,14 +2598,14 @@ declare class Account extends Provider implements AccountInterface {
|
|
|
2590
2598
|
hashMessage(typedData: TypedData): Promise<string>;
|
|
2591
2599
|
verifyMessageHash(hash: BigNumberish, signature: Signature): Promise<boolean>;
|
|
2592
2600
|
verifyMessage(typedData: TypedData, signature: Signature): Promise<boolean>;
|
|
2593
|
-
getSuggestedMaxFee({ type, payload }: EstimateFeeAction, details: EstimateFeeDetails): Promise<
|
|
2601
|
+
getSuggestedMaxFee({ type, payload }: EstimateFeeAction, details: EstimateFeeDetails): Promise<bigint>;
|
|
2594
2602
|
/**
|
|
2595
2603
|
* @deprecated will be renamed to buildDeclareContractTransaction
|
|
2596
2604
|
*/
|
|
2597
2605
|
buildDeclarePayload(payload: DeclareContractPayload, { nonce, chainId, version, walletAddress, maxFee }: InvocationsSignerDetails): Promise<DeclareContractTransaction>;
|
|
2598
2606
|
buildAccountDeployPayload({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { nonce, chainId, version, maxFee }: InvocationsSignerDetails): Promise<DeployAccountContractTransaction>;
|
|
2599
2607
|
buildUDCContractPayload(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Call[];
|
|
2600
|
-
simulateTransaction(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier, skipValidate }?: EstimateFeeDetails): Promise<TransactionSimulation>;
|
|
2608
|
+
simulateTransaction(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier, skipValidate, cairoVersion }?: EstimateFeeDetails): Promise<TransactionSimulation>;
|
|
2601
2609
|
getStarkName(address?: BigNumberish, // default to the wallet address
|
|
2602
2610
|
StarknetIdContract?: string): Promise<string>;
|
|
2603
2611
|
}
|
|
@@ -2844,34 +2852,21 @@ declare namespace hash {
|
|
|
2844
2852
|
};
|
|
2845
2853
|
}
|
|
2846
2854
|
|
|
2847
|
-
declare const parse: (
|
|
2848
|
-
declare const
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
declare const parseAlwaysAsBig: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
|
|
2853
|
-
declare const stringifyAlwaysAsBig: {
|
|
2854
|
-
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
2855
|
-
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
2856
|
-
};
|
|
2857
|
-
declare const _default: {
|
|
2858
|
-
parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
|
|
2859
|
-
stringify: {
|
|
2860
|
-
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
2861
|
-
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
2862
|
-
};
|
|
2863
|
-
};
|
|
2855
|
+
declare const parse: (x: string) => any;
|
|
2856
|
+
declare const parseAlwaysAsBig: (x: string) => any;
|
|
2857
|
+
declare const stringify: (value: JavaScriptValue, replacer?: any, space?: string | number | undefined, numberStringifiers?: NumberStringifier[] | undefined) => string;
|
|
2858
|
+
/** @deprecated */
|
|
2859
|
+
declare const stringifyAlwaysAsBig: (value: JavaScriptValue, replacer?: any, space?: string | number | undefined, numberStringifiers?: NumberStringifier[] | undefined) => string;
|
|
2864
2860
|
|
|
2865
2861
|
declare const json_parse: typeof parse;
|
|
2866
|
-
declare const json_stringify: typeof stringify;
|
|
2867
2862
|
declare const json_parseAlwaysAsBig: typeof parseAlwaysAsBig;
|
|
2863
|
+
declare const json_stringify: typeof stringify;
|
|
2868
2864
|
declare const json_stringifyAlwaysAsBig: typeof stringifyAlwaysAsBig;
|
|
2869
2865
|
declare namespace json {
|
|
2870
2866
|
export {
|
|
2871
|
-
_default as default,
|
|
2872
2867
|
json_parse as parse,
|
|
2873
|
-
json_stringify as stringify,
|
|
2874
2868
|
json_parseAlwaysAsBig as parseAlwaysAsBig,
|
|
2869
|
+
json_stringify as stringify,
|
|
2875
2870
|
json_stringifyAlwaysAsBig as stringifyAlwaysAsBig,
|
|
2876
2871
|
};
|
|
2877
2872
|
}
|
|
@@ -2894,15 +2889,42 @@ declare const transformCallsToMulticallArrays: (calls: Call[]) => {
|
|
|
2894
2889
|
*/
|
|
2895
2890
|
declare const fromCallsToExecuteCalldata: (calls: Call[]) => string[];
|
|
2896
2891
|
declare const fromCallsToExecuteCalldataWithNonce: (calls: Call[], nonce: BigNumberish) => string[];
|
|
2892
|
+
/**
|
|
2893
|
+
* Transforms a list of Calls, each with their own calldata, into
|
|
2894
|
+
* two arrays: one with the entrypoints, and one with the concatenated calldata.
|
|
2895
|
+
* @param calls
|
|
2896
|
+
* @returns
|
|
2897
|
+
*/
|
|
2898
|
+
declare const transformCallsToMulticallArrays_cairo1: (calls: Call[]) => CallStruct[];
|
|
2899
|
+
/**
|
|
2900
|
+
* Transforms a list of calls in the full flattened calldata expected
|
|
2901
|
+
* by the __execute__ protocol.
|
|
2902
|
+
* @param calls
|
|
2903
|
+
* @returns
|
|
2904
|
+
*/
|
|
2905
|
+
declare const fromCallsToExecuteCalldata_cairo1: (calls: Call[]) => string[];
|
|
2906
|
+
/**
|
|
2907
|
+
*
|
|
2908
|
+
* @param calls Call array
|
|
2909
|
+
* @param cairoVersion Defaults to 0
|
|
2910
|
+
* @returns string[] of calldata
|
|
2911
|
+
*/
|
|
2912
|
+
declare const getExecuteCalldata: (calls: Call[], cairoVersion?: CairoVersion) => string[];
|
|
2897
2913
|
|
|
2898
2914
|
declare const transaction_transformCallsToMulticallArrays: typeof transformCallsToMulticallArrays;
|
|
2899
2915
|
declare const transaction_fromCallsToExecuteCalldata: typeof fromCallsToExecuteCalldata;
|
|
2900
2916
|
declare const transaction_fromCallsToExecuteCalldataWithNonce: typeof fromCallsToExecuteCalldataWithNonce;
|
|
2917
|
+
declare const transaction_transformCallsToMulticallArrays_cairo1: typeof transformCallsToMulticallArrays_cairo1;
|
|
2918
|
+
declare const transaction_fromCallsToExecuteCalldata_cairo1: typeof fromCallsToExecuteCalldata_cairo1;
|
|
2919
|
+
declare const transaction_getExecuteCalldata: typeof getExecuteCalldata;
|
|
2901
2920
|
declare namespace transaction {
|
|
2902
2921
|
export {
|
|
2903
2922
|
transaction_transformCallsToMulticallArrays as transformCallsToMulticallArrays,
|
|
2904
2923
|
transaction_fromCallsToExecuteCalldata as fromCallsToExecuteCalldata,
|
|
2905
2924
|
transaction_fromCallsToExecuteCalldataWithNonce as fromCallsToExecuteCalldataWithNonce,
|
|
2925
|
+
transaction_transformCallsToMulticallArrays_cairo1 as transformCallsToMulticallArrays_cairo1,
|
|
2926
|
+
transaction_fromCallsToExecuteCalldata_cairo1 as fromCallsToExecuteCalldata_cairo1,
|
|
2927
|
+
transaction_getExecuteCalldata as getExecuteCalldata,
|
|
2906
2928
|
};
|
|
2907
2929
|
}
|
|
2908
2930
|
|
|
@@ -3123,4 +3145,4 @@ declare class CallData {
|
|
|
3123
3145
|
/** @deprecated prefer the 'num' naming */
|
|
3124
3146
|
declare const number: typeof num;
|
|
3125
3147
|
|
|
3126
|
-
export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, 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, Hints, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, 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, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
|
|
3148
|
+
export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, 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, 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, Hints, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, 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, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
|