starknet 4.18.0 → 5.0.0-beta.1
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 +29 -0
- package/dist/index.d.ts +75 -101
- package/dist/index.global.js +3483 -12098
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +411 -442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +410 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# [5.0.0-beta.1](https://github.com/0xs34n/starknet.js/compare/v4.18.0...v5.0.0-beta.1) (2023-01-07)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- better ([cda4931](https://github.com/0xs34n/starknet.js/commit/cda49313b17d715463f915f9ec8f1bf7c4de93f2))
|
|
6
|
+
- imports ([a151afc](https://github.com/0xs34n/starknet.js/commit/a151afce77eb175e39982fbf8bfcbe25001ee6db))
|
|
7
|
+
- imports ([43f0e25](https://github.com/0xs34n/starknet.js/commit/43f0e25f22106da510a0152c65084b1ee677cc6f))
|
|
8
|
+
- sequencer fetchEndpoint ([7206d77](https://github.com/0xs34n/starknet.js/commit/7206d776a497cab833f5bf2e00b9f2eb695e3c71))
|
|
9
|
+
- **tests:** signature in account tests ([c8bc860](https://github.com/0xs34n/starknet.js/commit/c8bc8604d74d0e0556468afa3475150fe3579e7a))
|
|
10
|
+
- trying fixing tests for sequencer ([480e20d](https://github.com/0xs34n/starknet.js/commit/480e20de6b8d3f8eb3048a84430380d73fe46dcc))
|
|
11
|
+
- update lockfile ([ecf9ead](https://github.com/0xs34n/starknet.js/commit/ecf9ead06d137bd2b43816a75f66dca0626e9ecd))
|
|
12
|
+
- use hex array for RPC signatures ([aa73351](https://github.com/0xs34n/starknet.js/commit/aa73351b024daf75af2bc997b78cbde56de567e9))
|
|
13
|
+
|
|
14
|
+
- chore!: account and signer updates ([be0cbe8](https://github.com/0xs34n/starknet.js/commit/be0cbe88b409fa9db20de8125319e10d1e29677e))
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- add computeClassHash functionality ([3f6d88e](https://github.com/0xs34n/starknet.js/commit/3f6d88e00d9620bf2044ecccea6369067f2192d0))
|
|
19
|
+
- compute class hash tests ([31a52a2](https://github.com/0xs34n/starknet.js/commit/31a52a28994abb0081fb27a0a7801cf160bcd2ad))
|
|
20
|
+
- initial commit to ue faster hashing ([722717d](https://github.com/0xs34n/starknet.js/commit/722717dcf23f6b62a528e58e9483f868f658ebf3))
|
|
21
|
+
- initial poc ([eb26fbd](https://github.com/0xs34n/starknet.js/commit/eb26fbddc02d54bb1f9ecf12192f484122ab5df4))
|
|
22
|
+
- make class hash optional for Declare Txn ([624ca8b](https://github.com/0xs34n/starknet.js/commit/624ca8b8d1885d9b9a405a31f05d869fdfc03c9c))
|
|
23
|
+
- update declareAndDeploy method ([a47fbd5](https://github.com/0xs34n/starknet.js/commit/a47fbd5f523a375b988f912a5631c181e3a7159b))
|
|
24
|
+
- use yarn ([ec1101e](https://github.com/0xs34n/starknet.js/commit/ec1101e6edaf53446e76181fa0cf4530befb9463))
|
|
25
|
+
|
|
26
|
+
### BREAKING CHANGES
|
|
27
|
+
|
|
28
|
+
- uses BigInt and Faster Hashing
|
|
29
|
+
|
|
1
30
|
# [4.18.0](https://github.com/0xs34n/starknet.js/compare/v4.17.1...v4.18.0) (2022-12-23)
|
|
2
31
|
|
|
3
32
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import BN__default from 'bn.js';
|
|
1
|
+
import * as _noble_curves_abstract_weierstrass from '@noble/curves/abstract/weierstrass';
|
|
2
|
+
import { SignatureType } from '@noble/curves/abstract/weierstrass';
|
|
4
3
|
import { CustomError } from 'ts-custom-error';
|
|
5
4
|
|
|
6
|
-
declare type BigNumberish = string | number |
|
|
5
|
+
declare type BigNumberish = string | number | bigint;
|
|
7
6
|
declare function isHex(hex: string): boolean;
|
|
8
|
-
declare function
|
|
9
|
-
declare function
|
|
7
|
+
declare function toBigInt(value: BigNumberish): bigint;
|
|
8
|
+
declare function isBigInt(value: any): value is bigint;
|
|
9
|
+
declare function toHex(number: BigNumberish): string;
|
|
10
10
|
declare function hexToDecimalString(hex: string): string;
|
|
11
11
|
declare function toFelt(num: BigNumberish): string;
|
|
12
12
|
/**
|
|
@@ -26,7 +26,8 @@ declare const toCairoBool: (value: boolean) => string;
|
|
|
26
26
|
|
|
27
27
|
type number_BigNumberish = BigNumberish;
|
|
28
28
|
declare const number_isHex: typeof isHex;
|
|
29
|
-
declare const
|
|
29
|
+
declare const number_toBigInt: typeof toBigInt;
|
|
30
|
+
declare const number_isBigInt: typeof isBigInt;
|
|
30
31
|
declare const number_toHex: typeof toHex;
|
|
31
32
|
declare const number_hexToDecimalString: typeof hexToDecimalString;
|
|
32
33
|
declare const number_toFelt: typeof toFelt;
|
|
@@ -44,7 +45,8 @@ declare namespace number {
|
|
|
44
45
|
export {
|
|
45
46
|
number_BigNumberish as BigNumberish,
|
|
46
47
|
number_isHex as isHex,
|
|
47
|
-
|
|
48
|
+
number_toBigInt as toBigInt,
|
|
49
|
+
number_isBigInt as isBigInt,
|
|
48
50
|
number_toHex as toHex,
|
|
49
51
|
number_hexToDecimalString as hexToDecimalString,
|
|
50
52
|
number_toFelt as toFelt,
|
|
@@ -678,8 +680,7 @@ declare namespace RPC {
|
|
|
678
680
|
type Methods = OPENRPC.Methods;
|
|
679
681
|
}
|
|
680
682
|
|
|
681
|
-
declare type
|
|
682
|
-
declare type Signature = string[];
|
|
683
|
+
declare type Signature = SignatureType;
|
|
683
684
|
declare type RawCalldata = BigNumberish[];
|
|
684
685
|
declare type AllowArray<T> = T | T[];
|
|
685
686
|
declare type RawArgs = {
|
|
@@ -705,7 +706,7 @@ declare type DeployContractPayload = {
|
|
|
705
706
|
addressSalt?: string;
|
|
706
707
|
};
|
|
707
708
|
declare type DeployAccountContractPayload = {
|
|
708
|
-
classHash:
|
|
709
|
+
classHash: string;
|
|
709
710
|
constructorCalldata?: RawCalldata;
|
|
710
711
|
addressSalt?: BigNumberish;
|
|
711
712
|
contractAddress?: string;
|
|
@@ -715,9 +716,9 @@ declare type DeployAccountContractTransaction = Omit<DeployAccountContractPayloa
|
|
|
715
716
|
};
|
|
716
717
|
declare type DeclareContractPayload = {
|
|
717
718
|
contract: CompiledContract | string;
|
|
718
|
-
classHash
|
|
719
|
+
classHash?: string;
|
|
719
720
|
};
|
|
720
|
-
declare type
|
|
721
|
+
declare type DeclareAndDeployContractPayload = Omit<UniversalDeployerContractPayload, 'classHash'> & DeclareContractPayload;
|
|
721
722
|
declare type DeclareContractTransaction = {
|
|
722
723
|
contractDefinition: ContractClass;
|
|
723
724
|
senderAddress: string;
|
|
@@ -772,8 +773,19 @@ declare type StructAbi = {
|
|
|
772
773
|
};
|
|
773
774
|
declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
|
|
774
775
|
declare type EventAbi = any;
|
|
775
|
-
declare type
|
|
776
|
-
|
|
776
|
+
declare type ContractEntryPointFields = {
|
|
777
|
+
selector: string;
|
|
778
|
+
offset: string;
|
|
779
|
+
};
|
|
780
|
+
declare type EntryPointsByType = {
|
|
781
|
+
CONSTRUCTOR: ContractEntryPointFields[];
|
|
782
|
+
EXTERNAL: ContractEntryPointFields[];
|
|
783
|
+
L1_HANDLER: ContractEntryPointFields[];
|
|
784
|
+
};
|
|
785
|
+
interface Program extends Record<string, any> {
|
|
786
|
+
builtins: string[];
|
|
787
|
+
data: string[];
|
|
788
|
+
}
|
|
777
789
|
declare type BlockTag = 'pending' | 'latest';
|
|
778
790
|
declare type BlockNumber = BlockTag | null | number;
|
|
779
791
|
declare type CompiledContract = {
|
|
@@ -845,11 +857,10 @@ declare namespace encode {
|
|
|
845
857
|
};
|
|
846
858
|
}
|
|
847
859
|
|
|
848
|
-
declare const ZERO
|
|
849
|
-
declare const
|
|
850
|
-
declare const
|
|
851
|
-
declare const
|
|
852
|
-
declare const MASK_251: BN;
|
|
860
|
+
declare const ZERO = 0n;
|
|
861
|
+
declare const MASK_250: bigint;
|
|
862
|
+
declare const MASK_251: bigint;
|
|
863
|
+
declare const API_VERSION = 0n;
|
|
853
864
|
declare enum StarknetChainId {
|
|
854
865
|
MAINNET = "0x534e5f4d41494e",
|
|
855
866
|
TESTNET = "0x534e5f474f45524c49",
|
|
@@ -880,10 +891,9 @@ declare const MAX_ECDSA_VAL = "8000000000000000000000000000000000000000000000000
|
|
|
880
891
|
declare const CONSTANT_POINTS: string[][];
|
|
881
892
|
|
|
882
893
|
declare const constants_ZERO: typeof ZERO;
|
|
883
|
-
declare const constants_ONE: typeof ONE;
|
|
884
|
-
declare const constants_TWO: typeof TWO;
|
|
885
894
|
declare const constants_MASK_250: typeof MASK_250;
|
|
886
895
|
declare const constants_MASK_251: typeof MASK_251;
|
|
896
|
+
declare const constants_API_VERSION: typeof API_VERSION;
|
|
887
897
|
type constants_StarknetChainId = StarknetChainId;
|
|
888
898
|
declare const constants_StarknetChainId: typeof StarknetChainId;
|
|
889
899
|
type constants_TransactionHashPrefix = TransactionHashPrefix;
|
|
@@ -901,10 +911,9 @@ declare const constants_IS_BROWSER: typeof IS_BROWSER;
|
|
|
901
911
|
declare namespace constants {
|
|
902
912
|
export {
|
|
903
913
|
constants_ZERO as ZERO,
|
|
904
|
-
constants_ONE as ONE,
|
|
905
|
-
constants_TWO as TWO,
|
|
906
914
|
constants_MASK_250 as MASK_250,
|
|
907
915
|
constants_MASK_251 as MASK_251,
|
|
916
|
+
constants_API_VERSION as API_VERSION,
|
|
908
917
|
constants_StarknetChainId as StarknetChainId,
|
|
909
918
|
constants_TransactionHashPrefix as TransactionHashPrefix,
|
|
910
919
|
constants_UDC as UDC,
|
|
@@ -925,7 +934,7 @@ interface InvocationsSignerDetails extends Required<InvocationsDetails> {
|
|
|
925
934
|
chainId: StarknetChainId;
|
|
926
935
|
}
|
|
927
936
|
interface DeclareSignerDetails {
|
|
928
|
-
classHash:
|
|
937
|
+
classHash: string;
|
|
929
938
|
senderAddress: BigNumberish;
|
|
930
939
|
chainId: StarknetChainId;
|
|
931
940
|
maxFee: BigNumberish;
|
|
@@ -1015,9 +1024,9 @@ interface InvokeTransactionReceiptResponse extends CommonTransactionReceiptRespo
|
|
|
1015
1024
|
}
|
|
1016
1025
|
declare type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse;
|
|
1017
1026
|
interface EstimateFeeResponse {
|
|
1018
|
-
overall_fee:
|
|
1019
|
-
gas_consumed?:
|
|
1020
|
-
gas_price?:
|
|
1027
|
+
overall_fee: bigint;
|
|
1028
|
+
gas_consumed?: bigint;
|
|
1029
|
+
gas_price?: bigint;
|
|
1021
1030
|
}
|
|
1022
1031
|
interface InvokeFunctionResponse {
|
|
1023
1032
|
transaction_hash: string;
|
|
@@ -1044,7 +1053,7 @@ declare type EstimateFeeAction = {
|
|
|
1044
1053
|
};
|
|
1045
1054
|
|
|
1046
1055
|
interface EstimateFee extends EstimateFeeResponse {
|
|
1047
|
-
suggestedMaxFee:
|
|
1056
|
+
suggestedMaxFee: bigint;
|
|
1048
1057
|
}
|
|
1049
1058
|
interface EstimateFeeDetails {
|
|
1050
1059
|
nonce?: BigNumberish;
|
|
@@ -1118,7 +1127,7 @@ declare type TransactionTraceResponse = {
|
|
|
1118
1127
|
validate_invocation?: FunctionInvocation;
|
|
1119
1128
|
function_invocation?: FunctionInvocation;
|
|
1120
1129
|
fee_transfer_invocation?: FunctionInvocation;
|
|
1121
|
-
signature:
|
|
1130
|
+
signature: string[];
|
|
1122
1131
|
};
|
|
1123
1132
|
declare type CallL1Handler = {
|
|
1124
1133
|
from_address: string;
|
|
@@ -1131,7 +1140,7 @@ declare namespace Sequencer {
|
|
|
1131
1140
|
type: 'DECLARE';
|
|
1132
1141
|
sender_address: string;
|
|
1133
1142
|
contract_class: ContractClass;
|
|
1134
|
-
signature?:
|
|
1143
|
+
signature?: string[];
|
|
1135
1144
|
nonce: BigNumberish;
|
|
1136
1145
|
max_fee?: BigNumberish;
|
|
1137
1146
|
version?: BigNumberish;
|
|
@@ -1148,7 +1157,7 @@ declare namespace Sequencer {
|
|
|
1148
1157
|
class_hash: string;
|
|
1149
1158
|
contract_address_salt: BigNumberish;
|
|
1150
1159
|
constructor_calldata: string[];
|
|
1151
|
-
signature?:
|
|
1160
|
+
signature?: string[];
|
|
1152
1161
|
max_fee?: BigNumberish;
|
|
1153
1162
|
version?: BigNumberish;
|
|
1154
1163
|
nonce?: BigNumberish;
|
|
@@ -1156,7 +1165,7 @@ declare namespace Sequencer {
|
|
|
1156
1165
|
type InvokeFunctionTransaction = {
|
|
1157
1166
|
type: 'INVOKE_FUNCTION';
|
|
1158
1167
|
contract_address: string;
|
|
1159
|
-
signature?:
|
|
1168
|
+
signature?: string[];
|
|
1160
1169
|
entry_point_type?: EntryPointType;
|
|
1161
1170
|
calldata?: RawCalldata;
|
|
1162
1171
|
nonce: BigNumberish;
|
|
@@ -1267,7 +1276,7 @@ declare namespace Sequencer {
|
|
|
1267
1276
|
gas_usage: number;
|
|
1268
1277
|
uint: string;
|
|
1269
1278
|
} | {
|
|
1270
|
-
amount:
|
|
1279
|
+
amount: bigint;
|
|
1271
1280
|
unit: string;
|
|
1272
1281
|
};
|
|
1273
1282
|
type Endpoints = {
|
|
@@ -1976,13 +1985,13 @@ declare abstract class SignerInterface {
|
|
|
1976
1985
|
}
|
|
1977
1986
|
|
|
1978
1987
|
declare class Signer implements SignerInterface {
|
|
1979
|
-
protected
|
|
1980
|
-
constructor(
|
|
1988
|
+
protected pk: Uint8Array | string;
|
|
1989
|
+
constructor(pk?: Uint8Array | string);
|
|
1981
1990
|
getPubKey(): Promise<string>;
|
|
1982
1991
|
signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
|
|
1983
1992
|
signTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;
|
|
1984
|
-
signDeployAccountTransaction({ classHash, contractAddress, constructorCalldata, addressSalt, maxFee, version, chainId, nonce, }: DeployAccountSignerDetails): Promise<
|
|
1985
|
-
signDeclareTransaction({ classHash, senderAddress, chainId, maxFee, version, nonce }: DeclareSignerDetails): Promise<
|
|
1993
|
+
signDeployAccountTransaction({ classHash, contractAddress, constructorCalldata, addressSalt, maxFee, version, chainId, nonce, }: DeployAccountSignerDetails): Promise<_noble_curves_abstract_weierstrass.SignatureType>;
|
|
1994
|
+
signDeclareTransaction({ classHash, senderAddress, chainId, maxFee, version, nonce }: DeclareSignerDetails): Promise<_noble_curves_abstract_weierstrass.SignatureType>;
|
|
1986
1995
|
}
|
|
1987
1996
|
|
|
1988
1997
|
declare abstract class AccountInterface extends ProviderInterface {
|
|
@@ -2146,7 +2155,7 @@ declare abstract class AccountInterface extends ProviderInterface {
|
|
|
2146
2155
|
* - calldata
|
|
2147
2156
|
* - salt
|
|
2148
2157
|
*/
|
|
2149
|
-
abstract
|
|
2158
|
+
abstract declareAndDeploy(payload: DeclareAndDeployContractPayload, details?: InvocationsDetails | undefined): Promise<DeclareDeployUDCResponse>;
|
|
2150
2159
|
/**
|
|
2151
2160
|
* Deploy the account on Starknet
|
|
2152
2161
|
*
|
|
@@ -2219,20 +2228,20 @@ declare abstract class AccountInterface extends ProviderInterface {
|
|
|
2219
2228
|
declare class Account extends Provider implements AccountInterface {
|
|
2220
2229
|
signer: SignerInterface;
|
|
2221
2230
|
address: string;
|
|
2222
|
-
constructor(providerOrOptions: ProviderOptions | ProviderInterface, address: string,
|
|
2231
|
+
constructor(providerOrOptions: ProviderOptions | ProviderInterface, address: string, pkOrSigner: Uint8Array | string | SignerInterface);
|
|
2223
2232
|
getNonce(blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
|
|
2224
2233
|
getStarkName(StarknetIdContract?: string): Promise<string | Error>;
|
|
2225
2234
|
getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string | Error>;
|
|
2226
2235
|
estimateFee(calls: AllowArray<Call>, estimateFeeDetails?: EstimateFeeDetails | undefined): Promise<EstimateFee>;
|
|
2227
2236
|
estimateInvokeFee(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2228
|
-
estimateDeclareFee({
|
|
2237
|
+
estimateDeclareFee({ contract, classHash: providedClassHash }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2229
2238
|
estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
|
|
2230
2239
|
estimateDeployFee(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], transactionsDetail?: InvocationsDetails | undefined): Promise<EstimateFee>;
|
|
2231
2240
|
execute(calls: AllowArray<Call>, abis?: Abi[] | undefined, transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
|
|
2232
|
-
declare({
|
|
2241
|
+
declare({ contract, classHash: providedClassHash }: DeclareContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeclareContractResponse>;
|
|
2233
2242
|
deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], details?: InvocationsDetails | undefined): Promise<MultiDeployContractResponse>;
|
|
2234
2243
|
deployContract(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], details?: InvocationsDetails | undefined): Promise<DeployContractUDCResponse>;
|
|
2235
|
-
|
|
2244
|
+
declareAndDeploy(payload: DeclareAndDeployContractPayload, details?: InvocationsDetails | undefined): Promise<DeclareDeployUDCResponse>;
|
|
2236
2245
|
deployAccount({ classHash, constructorCalldata, addressSalt, contractAddress: providedContractAddress, }: DeployAccountContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeployContractResponse>;
|
|
2237
2246
|
signMessage(typedData: TypedData): Promise<Signature>;
|
|
2238
2247
|
hashMessage(typedData: TypedData): Promise<string>;
|
|
@@ -2413,8 +2422,8 @@ declare class ContractFactory {
|
|
|
2413
2422
|
attach(address: string): Contract;
|
|
2414
2423
|
}
|
|
2415
2424
|
|
|
2416
|
-
declare const transactionVersion =
|
|
2417
|
-
declare const feeTransactionVersion:
|
|
2425
|
+
declare const transactionVersion = 1n;
|
|
2426
|
+
declare const feeTransactionVersion: bigint;
|
|
2418
2427
|
declare function keccakBn(value: BigNumberish): string;
|
|
2419
2428
|
/**
|
|
2420
2429
|
* Function to get the starknet keccak hash from a string
|
|
@@ -2423,7 +2432,7 @@ declare function keccakBn(value: BigNumberish): string;
|
|
|
2423
2432
|
* @param value - string you want to get the starknetKeccak hash from
|
|
2424
2433
|
* @returns starknet keccak hash as BigNumber
|
|
2425
2434
|
*/
|
|
2426
|
-
declare function starknetKeccak(value: string):
|
|
2435
|
+
declare function starknetKeccak(value: string): bigint;
|
|
2427
2436
|
/**
|
|
2428
2437
|
* Function to get the hex selector from a given function name
|
|
2429
2438
|
*
|
|
@@ -2438,14 +2447,15 @@ declare function getSelectorFromName(funcName: string): string;
|
|
|
2438
2447
|
* @returns Hex selector
|
|
2439
2448
|
*/
|
|
2440
2449
|
declare function getSelector(value: string): string;
|
|
2441
|
-
declare function pedersen(input: [BigNumberish, BigNumberish]): string;
|
|
2442
2450
|
declare function computeHashOnElements(data: BigNumberish[]): string;
|
|
2443
2451
|
declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
|
|
2444
2452
|
declare function calculateDeployTransactionHash(contractAddress: BigNumberish, constructorCalldata: BigNumberish[], version: BigNumberish, chainId: StarknetChainId): string;
|
|
2445
|
-
declare function calculateDeclareTransactionHash(classHash:
|
|
2453
|
+
declare function calculateDeclareTransactionHash(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
|
|
2446
2454
|
declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: BigNumberish[], salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
|
|
2447
2455
|
declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
|
|
2448
2456
|
declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, deployerAddress: BigNumberish): string;
|
|
2457
|
+
declare function computeHintedClassHash(compiledContract: CompiledContract): string;
|
|
2458
|
+
declare function computeContractClassHash(contract: CompiledContract | string): string;
|
|
2449
2459
|
|
|
2450
2460
|
declare const hash_transactionVersion: typeof transactionVersion;
|
|
2451
2461
|
declare const hash_feeTransactionVersion: typeof feeTransactionVersion;
|
|
@@ -2453,7 +2463,6 @@ declare const hash_keccakBn: typeof keccakBn;
|
|
|
2453
2463
|
declare const hash_starknetKeccak: typeof starknetKeccak;
|
|
2454
2464
|
declare const hash_getSelectorFromName: typeof getSelectorFromName;
|
|
2455
2465
|
declare const hash_getSelector: typeof getSelector;
|
|
2456
|
-
declare const hash_pedersen: typeof pedersen;
|
|
2457
2466
|
declare const hash_computeHashOnElements: typeof computeHashOnElements;
|
|
2458
2467
|
declare const hash_calculateTransactionHashCommon: typeof calculateTransactionHashCommon;
|
|
2459
2468
|
declare const hash_calculateDeployTransactionHash: typeof calculateDeployTransactionHash;
|
|
@@ -2461,15 +2470,16 @@ declare const hash_calculateDeclareTransactionHash: typeof calculateDeclareTrans
|
|
|
2461
2470
|
declare const hash_calculateDeployAccountTransactionHash: typeof calculateDeployAccountTransactionHash;
|
|
2462
2471
|
declare const hash_calculateTransactionHash: typeof calculateTransactionHash;
|
|
2463
2472
|
declare const hash_calculateContractAddressFromHash: typeof calculateContractAddressFromHash;
|
|
2473
|
+
declare const hash_computeContractClassHash: typeof computeContractClassHash;
|
|
2464
2474
|
declare namespace hash {
|
|
2465
2475
|
export {
|
|
2476
|
+
computeHintedClassHash as default,
|
|
2466
2477
|
hash_transactionVersion as transactionVersion,
|
|
2467
2478
|
hash_feeTransactionVersion as feeTransactionVersion,
|
|
2468
2479
|
hash_keccakBn as keccakBn,
|
|
2469
2480
|
hash_starknetKeccak as starknetKeccak,
|
|
2470
2481
|
hash_getSelectorFromName as getSelectorFromName,
|
|
2471
2482
|
hash_getSelector as getSelector,
|
|
2472
|
-
hash_pedersen as pedersen,
|
|
2473
2483
|
hash_computeHashOnElements as computeHashOnElements,
|
|
2474
2484
|
hash_calculateTransactionHashCommon as calculateTransactionHashCommon,
|
|
2475
2485
|
hash_calculateDeployTransactionHash as calculateDeployTransactionHash,
|
|
@@ -2477,6 +2487,7 @@ declare namespace hash {
|
|
|
2477
2487
|
hash_calculateDeployAccountTransactionHash as calculateDeployAccountTransactionHash,
|
|
2478
2488
|
hash_calculateTransactionHash as calculateTransactionHash,
|
|
2479
2489
|
hash_calculateContractAddressFromHash as calculateContractAddressFromHash,
|
|
2490
|
+
hash_computeContractClassHash as computeContractClassHash,
|
|
2480
2491
|
};
|
|
2481
2492
|
}
|
|
2482
2493
|
|
|
@@ -2553,13 +2564,19 @@ declare function compressProgram(jsonProgram: Program | string): CompressedProgr
|
|
|
2553
2564
|
declare function randomAddress(): string;
|
|
2554
2565
|
declare function makeAddress(input: string): string;
|
|
2555
2566
|
declare function formatSignature(sig?: Signature): string[];
|
|
2567
|
+
declare function signatureToDecimalArray(sig?: Signature): string[];
|
|
2568
|
+
declare function signatureToHexArray(sig?: Signature): string[];
|
|
2569
|
+
declare function parseSignature(sig?: string[]): _noble_curves_abstract_weierstrass.SignatureType | undefined;
|
|
2556
2570
|
declare function compileCalldata(args: RawArgs): Calldata;
|
|
2557
|
-
declare function estimatedFeeToMaxFee(estimatedFee: BigNumberish, overhead?: number):
|
|
2571
|
+
declare function estimatedFeeToMaxFee(estimatedFee: BigNumberish, overhead?: number): bigint;
|
|
2558
2572
|
|
|
2559
2573
|
declare const stark_compressProgram: typeof compressProgram;
|
|
2560
2574
|
declare const stark_randomAddress: typeof randomAddress;
|
|
2561
2575
|
declare const stark_makeAddress: typeof makeAddress;
|
|
2562
2576
|
declare const stark_formatSignature: typeof formatSignature;
|
|
2577
|
+
declare const stark_signatureToDecimalArray: typeof signatureToDecimalArray;
|
|
2578
|
+
declare const stark_signatureToHexArray: typeof signatureToHexArray;
|
|
2579
|
+
declare const stark_parseSignature: typeof parseSignature;
|
|
2563
2580
|
declare const stark_compileCalldata: typeof compileCalldata;
|
|
2564
2581
|
declare const stark_estimatedFeeToMaxFee: typeof estimatedFeeToMaxFee;
|
|
2565
2582
|
declare namespace stark {
|
|
@@ -2568,6 +2585,9 @@ declare namespace stark {
|
|
|
2568
2585
|
stark_randomAddress as randomAddress,
|
|
2569
2586
|
stark_makeAddress as makeAddress,
|
|
2570
2587
|
stark_formatSignature as formatSignature,
|
|
2588
|
+
stark_signatureToDecimalArray as signatureToDecimalArray,
|
|
2589
|
+
stark_signatureToHexArray as signatureToHexArray,
|
|
2590
|
+
stark_parseSignature as parseSignature,
|
|
2571
2591
|
stark_compileCalldata as compileCalldata,
|
|
2572
2592
|
stark_estimatedFeeToMaxFee as estimatedFeeToMaxFee,
|
|
2573
2593
|
};
|
|
@@ -2594,59 +2614,13 @@ declare namespace merkle {
|
|
|
2594
2614
|
};
|
|
2595
2615
|
}
|
|
2596
2616
|
|
|
2597
|
-
declare const ec: elliptic.ec;
|
|
2598
|
-
declare const genKeyPair: (options?: elliptic.ec.GenKeyPairOptions | undefined) => elliptic.ec.KeyPair;
|
|
2599
|
-
declare function getKeyPair(pk: BigNumberish): KeyPair;
|
|
2600
|
-
declare function getStarkKey(keyPair: KeyPair): string;
|
|
2601
|
-
/**
|
|
2602
|
-
* Takes a public key and casts it into `elliptic` KeyPair format.
|
|
2603
|
-
*
|
|
2604
|
-
* @param publicKey - public key which should get casted to a KeyPair
|
|
2605
|
-
* @returns keyPair with public key only, which can be used to verify signatures, but cant sign anything
|
|
2606
|
-
*/
|
|
2607
|
-
declare function getKeyPairFromPublicKey(publicKey: BigNumberish): KeyPair;
|
|
2608
|
-
/**
|
|
2609
|
-
* Signs a message using the provided key.
|
|
2610
|
-
*
|
|
2611
|
-
* @param keyPair should be an KeyPair with a valid private key.
|
|
2612
|
-
* @returns an Signature.
|
|
2613
|
-
*/
|
|
2614
|
-
declare function sign(keyPair: KeyPair, msgHash: string): Signature;
|
|
2615
|
-
/**
|
|
2616
|
-
* Verifies a message using the provided key.
|
|
2617
|
-
*
|
|
2618
|
-
* @param keyPair should be an KeyPair with a valid public key.
|
|
2619
|
-
* @param sig should be an Signature.
|
|
2620
|
-
* @returns true if the verification succeeds.
|
|
2621
|
-
*/
|
|
2622
|
-
declare function verify(keyPair: KeyPair | KeyPair[], msgHash: string, sig: Signature): boolean;
|
|
2623
|
-
|
|
2624
|
-
declare const ellipticCurve_ec: typeof ec;
|
|
2625
|
-
declare const ellipticCurve_genKeyPair: typeof genKeyPair;
|
|
2626
|
-
declare const ellipticCurve_getKeyPair: typeof getKeyPair;
|
|
2627
|
-
declare const ellipticCurve_getStarkKey: typeof getStarkKey;
|
|
2628
|
-
declare const ellipticCurve_getKeyPairFromPublicKey: typeof getKeyPairFromPublicKey;
|
|
2629
|
-
declare const ellipticCurve_sign: typeof sign;
|
|
2630
|
-
declare const ellipticCurve_verify: typeof verify;
|
|
2631
|
-
declare namespace ellipticCurve {
|
|
2632
|
-
export {
|
|
2633
|
-
ellipticCurve_ec as ec,
|
|
2634
|
-
ellipticCurve_genKeyPair as genKeyPair,
|
|
2635
|
-
ellipticCurve_getKeyPair as getKeyPair,
|
|
2636
|
-
ellipticCurve_getStarkKey as getStarkKey,
|
|
2637
|
-
ellipticCurve_getKeyPairFromPublicKey as getKeyPairFromPublicKey,
|
|
2638
|
-
ellipticCurve_sign as sign,
|
|
2639
|
-
ellipticCurve_verify as verify,
|
|
2640
|
-
};
|
|
2641
|
-
}
|
|
2642
|
-
|
|
2643
2617
|
interface Uint256 {
|
|
2644
2618
|
low: BigNumberish;
|
|
2645
2619
|
high: BigNumberish;
|
|
2646
2620
|
}
|
|
2647
|
-
declare function uint256ToBN(uint256: Uint256):
|
|
2648
|
-
declare const UINT_128_MAX:
|
|
2649
|
-
declare const UINT_256_MAX:
|
|
2621
|
+
declare function uint256ToBN(uint256: Uint256): bigint;
|
|
2622
|
+
declare const UINT_128_MAX: bigint;
|
|
2623
|
+
declare const UINT_256_MAX: bigint;
|
|
2650
2624
|
declare function isUint256(bn: BigNumberish): boolean;
|
|
2651
2625
|
declare function bnToUint256(bignumber: BigNumberish): Uint256;
|
|
2652
2626
|
|
|
@@ -2698,4 +2672,4 @@ declare function validateChecksumAddress(address: string): boolean;
|
|
|
2698
2672
|
declare function isUrl(s?: string): boolean;
|
|
2699
2673
|
declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string): string;
|
|
2700
2674
|
|
|
2701
|
-
export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractFactory, ContractFunction, ContractInterface, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction,
|
|
2675
|
+
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, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeDetails, EstimateFeeResponse, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HttpError, Invocation, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, MessageToL1, MessageToL2, MultiDeployContractResponse, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerProvider, SequencerProviderOptions, Signature, Signer, SignerInterface, Status, Struct, StructAbi, TransactionStatus, TransactionTraceResponse, TransactionType, UniversalDeployerContractPayload, addAddressPadding, buildUrl, constants, defaultProvider, encode, getChecksumAddress, hash, isUrl, json, merkle, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress };
|