starknet 5.4.2 → 5.6.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 +23 -0
- package/dist/index.d.ts +156 -23
- package/dist/index.global.js +195 -23
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +196 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +195 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [5.6.0](https://github.com/0xs34n/starknet.js/compare/v5.5.0...v5.6.0) (2023-04-19)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- optional param in contract invoke ([da094e4](https://github.com/0xs34n/starknet.js/commit/da094e4172ed43ce93604e92adbba2a5ecb1498e))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- cairo 1 bool ([52fed30](https://github.com/0xs34n/starknet.js/commit/52fed30f04b70bcce80f829dba6975101f6f3644))
|
|
10
|
+
- cairo1 array, fix invoke response, hash separate test ([4637cd7](https://github.com/0xs34n/starknet.js/commit/4637cd74481ba85b3164ddb93c258b9ca8b9b949))
|
|
11
|
+
- felt252 implementation ([3d20ea4](https://github.com/0xs34n/starknet.js/commit/3d20ea44b49d1c7ba90d8a46a307f54e737c3285))
|
|
12
|
+
- uint validate and parsing supprot ([c1acd29](https://github.com/0xs34n/starknet.js/commit/c1acd298d63758ba27fc20bcb4b0c00cca82078f))
|
|
13
|
+
|
|
14
|
+
# [5.5.0](https://github.com/0xs34n/starknet.js/compare/v5.4.2...v5.5.0) (2023-04-10)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- update DeclareAndDeploy with cairo 1 declare ([71072cf](https://github.com/0xs34n/starknet.js/commit/71072cffadb8ac118780cec21cb8c4f83e74d7ae))
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- response parsing and types ([09a46af](https://github.com/0xs34n/starknet.js/commit/09a46af02e88376dc49e0aa39468fded99b94ee2))
|
|
23
|
+
|
|
1
24
|
## [5.4.2](https://github.com/0xs34n/starknet.js/compare/v5.4.1...v5.4.2) (2023-04-04)
|
|
2
25
|
|
|
3
26
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,7 @@ declare type FunctionAbi = {
|
|
|
222
222
|
name: string;
|
|
223
223
|
outputs: AbiEntry[];
|
|
224
224
|
stateMutability?: 'view';
|
|
225
|
+
state_mutability?: string;
|
|
225
226
|
type: FunctionAbiType;
|
|
226
227
|
};
|
|
227
228
|
declare type AbiStructs = {
|
|
@@ -269,7 +270,8 @@ declare type CairoAssembly = {
|
|
|
269
270
|
prime: string;
|
|
270
271
|
compiler_version: string;
|
|
271
272
|
bytecode: ByteCode;
|
|
272
|
-
hints:
|
|
273
|
+
hints: any[];
|
|
274
|
+
pythonic_hints: PythonicHints;
|
|
273
275
|
entry_points_by_type: EntryPointsByType;
|
|
274
276
|
};
|
|
275
277
|
declare type SierraContractClass = {
|
|
@@ -284,7 +286,7 @@ declare type CompiledSierra = SierraContractClass;
|
|
|
284
286
|
declare type CompiledSierraCasm = CairoAssembly;
|
|
285
287
|
/** SUBTYPES */
|
|
286
288
|
declare type ByteCode = string[];
|
|
287
|
-
declare type
|
|
289
|
+
declare type PythonicHints = [number, string[]][];
|
|
288
290
|
declare type SierraProgramDebugInfo = {
|
|
289
291
|
type_names: [number, string][];
|
|
290
292
|
libfunc_names: [number, string][];
|
|
@@ -460,7 +462,7 @@ declare type Overrides = {
|
|
|
460
462
|
maxFee?: BigNumberish;
|
|
461
463
|
nonce?: BigNumberish;
|
|
462
464
|
signature?: Signature;
|
|
463
|
-
parseRequest
|
|
465
|
+
parseRequest?: Boolean;
|
|
464
466
|
};
|
|
465
467
|
|
|
466
468
|
interface InvocationsSignerDetails extends Required<InvocationsDetails> {
|
|
@@ -485,7 +487,7 @@ declare type AsyncContractFunction<T = any> = (...args: Array<any>) => Promise<T
|
|
|
485
487
|
declare type ContractFunction = (...args: Array<any>) => any;
|
|
486
488
|
declare type Result = {
|
|
487
489
|
[key: string]: any;
|
|
488
|
-
};
|
|
490
|
+
} | Result[] | bigint | string | boolean;
|
|
489
491
|
|
|
490
492
|
declare type BlockIdentifier = BlockNumber | BigNumberish;
|
|
491
493
|
|
|
@@ -509,8 +511,8 @@ declare type TXN_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJ
|
|
|
509
511
|
declare type TXN_TYPE = 'DECLARE' | 'DEPLOY' | 'DEPLOY_ACCOUNT' | 'INVOKE' | 'L1_HANDLER';
|
|
510
512
|
declare type BLOCK_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
|
|
511
513
|
declare enum BLOCK_TAG {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
+
latest = "latest",
|
|
515
|
+
pending = "pending"
|
|
514
516
|
}
|
|
515
517
|
declare type BLOCK_ID = {
|
|
516
518
|
block_hash: BLOCK_HASH;
|
|
@@ -1892,7 +1894,9 @@ declare abstract class ProviderInterface {
|
|
|
1892
1894
|
/**
|
|
1893
1895
|
* Wait for the transaction to be accepted
|
|
1894
1896
|
* @param txHash - transaction hash
|
|
1895
|
-
* @param
|
|
1897
|
+
* @param options
|
|
1898
|
+
* - (optional) retryInterval: number | undefined;
|
|
1899
|
+
* - (optional) successStates: TransactionStatus[] | undefined;
|
|
1896
1900
|
* @return GetTransactionReceiptResponse
|
|
1897
1901
|
*/
|
|
1898
1902
|
abstract waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
|
|
@@ -2723,14 +2727,16 @@ declare class Contract implements ContractInterface {
|
|
|
2723
2727
|
};
|
|
2724
2728
|
readonly [key: string]: AsyncContractFunction | any;
|
|
2725
2729
|
private callData;
|
|
2730
|
+
private version;
|
|
2726
2731
|
/**
|
|
2727
2732
|
* Contract class to handle contract methods
|
|
2728
2733
|
*
|
|
2729
2734
|
* @param abi - Abi of the contract object
|
|
2730
2735
|
* @param address (optional) - address to connect to
|
|
2731
2736
|
* @param providerOrAccount (optional) - Provider or Account to attach to
|
|
2737
|
+
* @param cairoVersion (optional) - default '0', for Cairo 1 set '1'
|
|
2732
2738
|
*/
|
|
2733
|
-
constructor(abi: Abi, address: string, providerOrAccount?: ProviderInterface | AccountInterface);
|
|
2739
|
+
constructor(abi: Abi, address: string, providerOrAccount?: ProviderInterface | AccountInterface, cairoVersion?: string);
|
|
2734
2740
|
attach(address: string): void;
|
|
2735
2741
|
connect(providerOrAccount: ProviderInterface | AccountInterface): void;
|
|
2736
2742
|
deployed(): Promise<Contract>;
|
|
@@ -3009,20 +3015,20 @@ declare const UINT_256_MAX: bigint;
|
|
|
3009
3015
|
declare function isUint256(bn: BigNumberish): boolean;
|
|
3010
3016
|
declare function bnToUint256(bignumber: BigNumberish): Uint256;
|
|
3011
3017
|
|
|
3012
|
-
type
|
|
3013
|
-
declare const
|
|
3014
|
-
declare const
|
|
3015
|
-
declare const
|
|
3016
|
-
declare const
|
|
3017
|
-
declare const
|
|
3018
|
-
declare namespace uint256 {
|
|
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 {
|
|
3019
3025
|
export {
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
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,
|
|
3026
3032
|
};
|
|
3027
3033
|
}
|
|
3028
3034
|
|
|
@@ -3100,6 +3106,133 @@ declare function validateChecksumAddress(address: string): boolean;
|
|
|
3100
3106
|
declare function isUrl(s?: string): boolean;
|
|
3101
3107
|
declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string): string;
|
|
3102
3108
|
|
|
3109
|
+
declare enum Uint {
|
|
3110
|
+
u8 = "core::integer::u8",
|
|
3111
|
+
u16 = "core::integer::u16",
|
|
3112
|
+
u32 = "core::integer::u32",
|
|
3113
|
+
u64 = "core::integer::u64",
|
|
3114
|
+
u128 = "core::integer::u128",
|
|
3115
|
+
u256 = "core::integer::u256"
|
|
3116
|
+
}
|
|
3117
|
+
declare const isLen: (name: string) => boolean;
|
|
3118
|
+
declare const isTypeFelt: (type: string) => boolean;
|
|
3119
|
+
declare const isTypeArray: (type: string) => boolean;
|
|
3120
|
+
declare const isTypeTuple: (type: string) => boolean;
|
|
3121
|
+
declare const isTypeNamedTuple: (type: string) => boolean;
|
|
3122
|
+
declare const isTypeStruct: (type: string, structs: AbiStructs) => boolean;
|
|
3123
|
+
declare const isTypeUint: (type: string) => boolean;
|
|
3124
|
+
declare const isTypeBool: (type: string) => boolean;
|
|
3125
|
+
declare const isTypeContractAddress: (type: string) => boolean;
|
|
3126
|
+
declare const isCairo1Type: (type: string) => boolean;
|
|
3127
|
+
declare const getArrayType: (type: string) => string;
|
|
3128
|
+
/**
|
|
3129
|
+
* named tuple are described as js object {}
|
|
3130
|
+
* struct types are described as js object {}
|
|
3131
|
+
* array types are described as js array []
|
|
3132
|
+
*/
|
|
3133
|
+
/**
|
|
3134
|
+
* Uint256 cairo type (helper for common struct type)
|
|
3135
|
+
*/
|
|
3136
|
+
declare const uint256: (it: BigNumberish) => Uint256;
|
|
3137
|
+
/**
|
|
3138
|
+
* unnamed tuple cairo type (helper same as common struct type)
|
|
3139
|
+
*/
|
|
3140
|
+
declare const tuple: (...args: (BigNumberish | object)[]) => {
|
|
3141
|
+
[x: number]: object | BigNumberish;
|
|
3142
|
+
length: number;
|
|
3143
|
+
toString(): string;
|
|
3144
|
+
toLocaleString(): string;
|
|
3145
|
+
pop(): object | BigNumberish | undefined;
|
|
3146
|
+
push(...items: (object | BigNumberish)[]): number;
|
|
3147
|
+
concat(...items: ConcatArray<object | BigNumberish>[]): (object | BigNumberish)[];
|
|
3148
|
+
concat(...items: (object | BigNumberish | ConcatArray<object | BigNumberish>)[]): (object | BigNumberish)[];
|
|
3149
|
+
join(separator?: string | undefined): string;
|
|
3150
|
+
reverse(): (object | BigNumberish)[];
|
|
3151
|
+
shift(): object | BigNumberish | undefined;
|
|
3152
|
+
slice(start?: number | undefined, end?: number | undefined): (object | BigNumberish)[];
|
|
3153
|
+
sort(compareFn?: ((a: object | BigNumberish, b: object | BigNumberish) => number) | undefined): (object | BigNumberish)[];
|
|
3154
|
+
splice(start: number, deleteCount?: number | undefined): (object | BigNumberish)[];
|
|
3155
|
+
splice(start: number, deleteCount: number, ...items: (object | BigNumberish)[]): (object | BigNumberish)[];
|
|
3156
|
+
unshift(...items: (object | BigNumberish)[]): number;
|
|
3157
|
+
indexOf(searchElement: object | BigNumberish, fromIndex?: number | undefined): number;
|
|
3158
|
+
lastIndexOf(searchElement: object | BigNumberish, fromIndex?: number | undefined): number;
|
|
3159
|
+
every<S extends object | BigNumberish>(predicate: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => value is S, thisArg?: any): this is S[];
|
|
3160
|
+
every(predicate: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => unknown, thisArg?: any): boolean;
|
|
3161
|
+
some(predicate: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => unknown, thisArg?: any): boolean;
|
|
3162
|
+
forEach(callbackfn: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => void, thisArg?: any): void;
|
|
3163
|
+
map<U>(callbackfn: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => U, thisArg?: any): U[];
|
|
3164
|
+
filter<S_1 extends object | BigNumberish>(predicate: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => value is S_1, thisArg?: any): S_1[];
|
|
3165
|
+
filter(predicate: (value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => unknown, thisArg?: any): (object | BigNumberish)[];
|
|
3166
|
+
reduce(callbackfn: (previousValue: object | BigNumberish, currentValue: object | BigNumberish, currentIndex: number, array: (object | BigNumberish)[]) => object | BigNumberish): object | BigNumberish;
|
|
3167
|
+
reduce(callbackfn: (previousValue: object | BigNumberish, currentValue: object | BigNumberish, currentIndex: number, array: (object | BigNumberish)[]) => object | BigNumberish, initialValue: object | BigNumberish): object | BigNumberish;
|
|
3168
|
+
reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: object | BigNumberish, currentIndex: number, array: (object | BigNumberish)[]) => U_1, initialValue: U_1): U_1;
|
|
3169
|
+
reduceRight(callbackfn: (previousValue: object | BigNumberish, currentValue: object | BigNumberish, currentIndex: number, array: (object | BigNumberish)[]) => object | BigNumberish): object | BigNumberish;
|
|
3170
|
+
reduceRight(callbackfn: (previousValue: object | BigNumberish, currentValue: object | BigNumberish, currentIndex: number, array: (object | BigNumberish)[]) => object | BigNumberish, initialValue: object | BigNumberish): object | BigNumberish;
|
|
3171
|
+
reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: object | BigNumberish, currentIndex: number, array: (object | BigNumberish)[]) => U_2, initialValue: U_2): U_2;
|
|
3172
|
+
find<S_2 extends object | BigNumberish>(predicate: (this: void, value: object | BigNumberish, index: number, obj: (object | BigNumberish)[]) => value is S_2, thisArg?: any): S_2 | undefined;
|
|
3173
|
+
find(predicate: (value: object | BigNumberish, index: number, obj: (object | BigNumberish)[]) => unknown, thisArg?: any): object | BigNumberish | undefined;
|
|
3174
|
+
findIndex(predicate: (value: object | BigNumberish, index: number, obj: (object | BigNumberish)[]) => unknown, thisArg?: any): number;
|
|
3175
|
+
fill(value: object | BigNumberish, start?: number | undefined, end?: number | undefined): (object | BigNumberish)[];
|
|
3176
|
+
copyWithin(target: number, start: number, end?: number | undefined): (object | BigNumberish)[];
|
|
3177
|
+
entries(): IterableIterator<[number, object | BigNumberish]>;
|
|
3178
|
+
keys(): IterableIterator<number>;
|
|
3179
|
+
values(): IterableIterator<object | BigNumberish>;
|
|
3180
|
+
includes(searchElement: object | BigNumberish, fromIndex?: number | undefined): boolean;
|
|
3181
|
+
flatMap<U_3, This = undefined>(callback: (this: This, value: object | BigNumberish, index: number, array: (object | BigNumberish)[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
|
|
3182
|
+
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
3183
|
+
[Symbol.iterator](): IterableIterator<object | BigNumberish>;
|
|
3184
|
+
[Symbol.unscopables](): {
|
|
3185
|
+
copyWithin: boolean;
|
|
3186
|
+
entries: boolean;
|
|
3187
|
+
fill: boolean;
|
|
3188
|
+
find: boolean;
|
|
3189
|
+
findIndex: boolean;
|
|
3190
|
+
keys: boolean;
|
|
3191
|
+
values: boolean;
|
|
3192
|
+
};
|
|
3193
|
+
at(index: number): object | BigNumberish | undefined;
|
|
3194
|
+
};
|
|
3195
|
+
/**
|
|
3196
|
+
* felt cairo type
|
|
3197
|
+
*/
|
|
3198
|
+
declare function felt(it: BigNumberish): string;
|
|
3199
|
+
|
|
3200
|
+
type cairo_Uint = Uint;
|
|
3201
|
+
declare const cairo_Uint: typeof Uint;
|
|
3202
|
+
declare const cairo_isLen: typeof isLen;
|
|
3203
|
+
declare const cairo_isTypeFelt: typeof isTypeFelt;
|
|
3204
|
+
declare const cairo_isTypeArray: typeof isTypeArray;
|
|
3205
|
+
declare const cairo_isTypeTuple: typeof isTypeTuple;
|
|
3206
|
+
declare const cairo_isTypeNamedTuple: typeof isTypeNamedTuple;
|
|
3207
|
+
declare const cairo_isTypeStruct: typeof isTypeStruct;
|
|
3208
|
+
declare const cairo_isTypeUint: typeof isTypeUint;
|
|
3209
|
+
declare const cairo_isTypeBool: typeof isTypeBool;
|
|
3210
|
+
declare const cairo_isTypeContractAddress: typeof isTypeContractAddress;
|
|
3211
|
+
declare const cairo_isCairo1Type: typeof isCairo1Type;
|
|
3212
|
+
declare const cairo_getArrayType: typeof getArrayType;
|
|
3213
|
+
declare const cairo_uint256: typeof uint256;
|
|
3214
|
+
declare const cairo_tuple: typeof tuple;
|
|
3215
|
+
declare const cairo_felt: typeof felt;
|
|
3216
|
+
declare namespace cairo {
|
|
3217
|
+
export {
|
|
3218
|
+
cairo_Uint as Uint,
|
|
3219
|
+
cairo_isLen as isLen,
|
|
3220
|
+
cairo_isTypeFelt as isTypeFelt,
|
|
3221
|
+
cairo_isTypeArray as isTypeArray,
|
|
3222
|
+
cairo_isTypeTuple as isTypeTuple,
|
|
3223
|
+
cairo_isTypeNamedTuple as isTypeNamedTuple,
|
|
3224
|
+
cairo_isTypeStruct as isTypeStruct,
|
|
3225
|
+
cairo_isTypeUint as isTypeUint,
|
|
3226
|
+
cairo_isTypeBool as isTypeBool,
|
|
3227
|
+
cairo_isTypeContractAddress as isTypeContractAddress,
|
|
3228
|
+
cairo_isCairo1Type as isCairo1Type,
|
|
3229
|
+
cairo_getArrayType as getArrayType,
|
|
3230
|
+
cairo_uint256 as uint256,
|
|
3231
|
+
cairo_tuple as tuple,
|
|
3232
|
+
cairo_felt as felt,
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3103
3236
|
declare class CallData {
|
|
3104
3237
|
abi: Abi;
|
|
3105
3238
|
protected readonly structs: AbiStructs;
|
|
@@ -3132,7 +3265,7 @@ declare class CallData {
|
|
|
3132
3265
|
* @param response - response from the method
|
|
3133
3266
|
* @return - parsed response corresponding to the abi
|
|
3134
3267
|
*/
|
|
3135
|
-
parse(method: string, response: string[]):
|
|
3268
|
+
parse(method: string, response: string[]): Result;
|
|
3136
3269
|
/**
|
|
3137
3270
|
* Format cairo method response data to native js values based on provided format schema
|
|
3138
3271
|
* @param method - cairo method name
|
|
@@ -3152,4 +3285,4 @@ declare class CallData {
|
|
|
3152
3285
|
/** @deprecated prefer the 'num' naming */
|
|
3153
3286
|
declare const number: typeof num;
|
|
3154
3287
|
|
|
3155
|
-
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,
|
|
3288
|
+
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, transaction, index as typedData, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
|
package/dist/index.global.js
CHANGED
|
@@ -630,6 +630,7 @@ var starknet = (() => {
|
|
|
630
630
|
TransactionType: () => TransactionType,
|
|
631
631
|
addAddressPadding: () => addAddressPadding,
|
|
632
632
|
buildUrl: () => buildUrl,
|
|
633
|
+
cairo: () => cairo_exports,
|
|
633
634
|
constants: () => constants_exports,
|
|
634
635
|
defaultProvider: () => defaultProvider,
|
|
635
636
|
ec: () => ec_exports,
|
|
@@ -5309,6 +5310,26 @@ var starknet = (() => {
|
|
|
5309
5310
|
]
|
|
5310
5311
|
];
|
|
5311
5312
|
|
|
5313
|
+
// src/utils/calldata/cairo.ts
|
|
5314
|
+
var cairo_exports = {};
|
|
5315
|
+
__export(cairo_exports, {
|
|
5316
|
+
Uint: () => Uint,
|
|
5317
|
+
felt: () => felt,
|
|
5318
|
+
getArrayType: () => getArrayType,
|
|
5319
|
+
isCairo1Type: () => isCairo1Type,
|
|
5320
|
+
isLen: () => isLen,
|
|
5321
|
+
isTypeArray: () => isTypeArray,
|
|
5322
|
+
isTypeBool: () => isTypeBool,
|
|
5323
|
+
isTypeContractAddress: () => isTypeContractAddress,
|
|
5324
|
+
isTypeFelt: () => isTypeFelt,
|
|
5325
|
+
isTypeNamedTuple: () => isTypeNamedTuple,
|
|
5326
|
+
isTypeStruct: () => isTypeStruct,
|
|
5327
|
+
isTypeTuple: () => isTypeTuple,
|
|
5328
|
+
isTypeUint: () => isTypeUint,
|
|
5329
|
+
tuple: () => tuple,
|
|
5330
|
+
uint256: () => uint256
|
|
5331
|
+
});
|
|
5332
|
+
|
|
5312
5333
|
// src/utils/num.ts
|
|
5313
5334
|
var num_exports = {};
|
|
5314
5335
|
__export(num_exports, {
|
|
@@ -5464,8 +5485,8 @@ var starknet = (() => {
|
|
|
5464
5485
|
isUint256: () => isUint256,
|
|
5465
5486
|
uint256ToBN: () => uint256ToBN
|
|
5466
5487
|
});
|
|
5467
|
-
function uint256ToBN(
|
|
5468
|
-
return (toBigInt(
|
|
5488
|
+
function uint256ToBN(uint2562) {
|
|
5489
|
+
return (toBigInt(uint2562.high) << 128n) + toBigInt(uint2562.low);
|
|
5469
5490
|
}
|
|
5470
5491
|
var UINT_128_MAX = (1n << 128n) - 1n;
|
|
5471
5492
|
var UINT_256_MAX = (1n << 256n) - 1n;
|
|
@@ -5483,13 +5504,41 @@ var starknet = (() => {
|
|
|
5483
5504
|
}
|
|
5484
5505
|
|
|
5485
5506
|
// src/utils/calldata/cairo.ts
|
|
5507
|
+
var Uint = /* @__PURE__ */ ((Uint2) => {
|
|
5508
|
+
Uint2["u8"] = "core::integer::u8";
|
|
5509
|
+
Uint2["u16"] = "core::integer::u16";
|
|
5510
|
+
Uint2["u32"] = "core::integer::u32";
|
|
5511
|
+
Uint2["u64"] = "core::integer::u64";
|
|
5512
|
+
Uint2["u128"] = "core::integer::u128";
|
|
5513
|
+
Uint2["u256"] = "core::integer::u256";
|
|
5514
|
+
return Uint2;
|
|
5515
|
+
})(Uint || {});
|
|
5486
5516
|
var isLen = (name) => /_len$/.test(name);
|
|
5487
|
-
var isTypeFelt = (type) => type === "felt";
|
|
5488
|
-
var
|
|
5489
|
-
var isTypeArray = (type) => /\*/.test(type);
|
|
5517
|
+
var isTypeFelt = (type) => type === "felt" || type === "core::felt252";
|
|
5518
|
+
var isTypeArray = (type) => /\*/.test(type) || type.includes("core::array::Array::");
|
|
5490
5519
|
var isTypeTuple = (type) => /^\(.*\)$/i.test(type);
|
|
5491
5520
|
var isTypeNamedTuple = (type) => /\(.*\)/i.test(type) && type.includes(":");
|
|
5492
5521
|
var isTypeStruct = (type, structs) => type in structs;
|
|
5522
|
+
var isTypeUint = (type) => Object.values(Uint).includes(type);
|
|
5523
|
+
var isTypeBool = (type) => type === "core::bool";
|
|
5524
|
+
var isTypeContractAddress = (type) => type === "core::starknet::contract_address::ContractAddress";
|
|
5525
|
+
var isCairo1Type = (type) => type.includes("core::");
|
|
5526
|
+
var getArrayType = (type) => {
|
|
5527
|
+
if (isCairo1Type(type)) {
|
|
5528
|
+
return type.substring(type.indexOf("<") + 1, type.indexOf(">"));
|
|
5529
|
+
}
|
|
5530
|
+
return type.replace("*", "");
|
|
5531
|
+
};
|
|
5532
|
+
var uint256 = (it) => {
|
|
5533
|
+
const bn = BigInt(it);
|
|
5534
|
+
if (!isUint256(bn))
|
|
5535
|
+
throw new Error("Number is too large");
|
|
5536
|
+
return {
|
|
5537
|
+
low: (bn & UINT_128_MAX).toString(10),
|
|
5538
|
+
high: (bn >> 128n).toString(10)
|
|
5539
|
+
};
|
|
5540
|
+
};
|
|
5541
|
+
var tuple = (...args) => ({ ...args });
|
|
5493
5542
|
function felt(it) {
|
|
5494
5543
|
if (isBigInt(it) || typeof it === "number" && Number.isInteger(it)) {
|
|
5495
5544
|
return it.toString();
|
|
@@ -11335,6 +11384,12 @@ var starknet = (() => {
|
|
|
11335
11384
|
}
|
|
11336
11385
|
};
|
|
11337
11386
|
}
|
|
11387
|
+
parseSierraContractClassResponse(res) {
|
|
11388
|
+
return {
|
|
11389
|
+
...res,
|
|
11390
|
+
abi: JSON.parse(res.abi)
|
|
11391
|
+
};
|
|
11392
|
+
}
|
|
11338
11393
|
};
|
|
11339
11394
|
|
|
11340
11395
|
// src/utils/url.ts
|
|
@@ -11542,16 +11597,24 @@ var starknet = (() => {
|
|
|
11542
11597
|
}
|
|
11543
11598
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
11544
11599
|
return this.fetchEndpoint("get_full_contract", { blockIdentifier, contractAddress }).then(
|
|
11545
|
-
|
|
11600
|
+
(res) => {
|
|
11601
|
+
if (isSierra(res)) {
|
|
11602
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
11603
|
+
}
|
|
11604
|
+
return parseContract(res);
|
|
11605
|
+
}
|
|
11546
11606
|
);
|
|
11547
11607
|
}
|
|
11548
11608
|
async getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
11549
11609
|
return this.fetchEndpoint("get_class_hash_at", { blockIdentifier, contractAddress });
|
|
11550
11610
|
}
|
|
11551
11611
|
async getClassByHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
11552
|
-
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
11553
|
-
|
|
11554
|
-
|
|
11612
|
+
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then((res) => {
|
|
11613
|
+
if (isSierra(res)) {
|
|
11614
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
11615
|
+
}
|
|
11616
|
+
return parseContract(res);
|
|
11617
|
+
});
|
|
11555
11618
|
}
|
|
11556
11619
|
async getCompiledClassByClassHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
11557
11620
|
return this.fetchEndpoint("get_compiled_class_by_class_hash", { classHash, blockIdentifier });
|
|
@@ -11984,7 +12047,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
11984
12047
|
result
|
|
11985
12048
|
};
|
|
11986
12049
|
}
|
|
11987
|
-
function
|
|
12050
|
+
function extractCairo0Tuple(type) {
|
|
11988
12051
|
const cleanType = type.replace(/\s/g, "").slice(1, -1);
|
|
11989
12052
|
const { subTuple, result } = parseSubTuple(cleanType);
|
|
11990
12053
|
let recomposed = result.split(",").map((it) => {
|
|
@@ -11997,6 +12060,16 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
11997
12060
|
}
|
|
11998
12061
|
return recomposed;
|
|
11999
12062
|
}
|
|
12063
|
+
function extractCairo1Tuple(type) {
|
|
12064
|
+
const cleanType = type.replace(/\s/g, "").slice(1, -1);
|
|
12065
|
+
return cleanType.split(",");
|
|
12066
|
+
}
|
|
12067
|
+
function extractTupleMemberTypes(type) {
|
|
12068
|
+
if (isCairo1Type(type)) {
|
|
12069
|
+
return extractCairo1Tuple(type);
|
|
12070
|
+
}
|
|
12071
|
+
return extractCairo0Tuple(type);
|
|
12072
|
+
}
|
|
12000
12073
|
|
|
12001
12074
|
// src/utils/calldata/requestParser.ts
|
|
12002
12075
|
function parseTuple(element, typeStr) {
|
|
@@ -12055,16 +12128,21 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12055
12128
|
}
|
|
12056
12129
|
const result = [];
|
|
12057
12130
|
result.push(felt(value.length));
|
|
12131
|
+
const arrayType = getArrayType(input.type);
|
|
12058
12132
|
return value.reduce((acc, el) => {
|
|
12059
|
-
if (
|
|
12133
|
+
if (isTypeFelt(arrayType) || isTypeUint(arrayType) || isTypeContractAddress(arrayType)) {
|
|
12060
12134
|
acc.push(felt(el));
|
|
12135
|
+
} else if (isTypeBool(arrayType) && typeof el === "boolean") {
|
|
12136
|
+
acc.push(el.toString());
|
|
12061
12137
|
} else {
|
|
12062
|
-
acc.push(...parseCalldataValue(el,
|
|
12138
|
+
acc.push(...parseCalldataValue(el, arrayType, structs));
|
|
12063
12139
|
}
|
|
12064
12140
|
return acc;
|
|
12065
12141
|
}, result);
|
|
12066
12142
|
case (isTypeStruct(type, structs) || isTypeTuple(type)):
|
|
12067
12143
|
return parseCalldataValue(value, type, structs);
|
|
12144
|
+
case isTypeBool(type):
|
|
12145
|
+
return value;
|
|
12068
12146
|
default:
|
|
12069
12147
|
return felt(value);
|
|
12070
12148
|
}
|
|
@@ -12097,8 +12175,20 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12097
12175
|
case isLen(name):
|
|
12098
12176
|
temp = responseIterator.next().value;
|
|
12099
12177
|
return BigInt(temp);
|
|
12178
|
+
case isTypeBool(type):
|
|
12179
|
+
temp = responseIterator.next().value;
|
|
12180
|
+
return Boolean(BigInt(temp));
|
|
12100
12181
|
case isTypeArray(type):
|
|
12101
12182
|
const parsedDataArr = [];
|
|
12183
|
+
if (isCairo1Type(type)) {
|
|
12184
|
+
responseIterator.next();
|
|
12185
|
+
let it = responseIterator.next();
|
|
12186
|
+
while (!it.done) {
|
|
12187
|
+
parsedDataArr.push(BigInt(it.value));
|
|
12188
|
+
it = responseIterator.next();
|
|
12189
|
+
}
|
|
12190
|
+
return parsedDataArr;
|
|
12191
|
+
}
|
|
12102
12192
|
if (parsedResult && parsedResult[`${name}_len`]) {
|
|
12103
12193
|
const arrLen = parsedResult[`${name}_len`];
|
|
12104
12194
|
while (parsedDataArr.length < arrLen) {
|
|
@@ -12120,7 +12210,66 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12120
12210
|
var validateFelt = (parameter, input) => {
|
|
12121
12211
|
assert2(
|
|
12122
12212
|
typeof parameter === "string" || typeof parameter === "number" || typeof parameter === "bigint",
|
|
12123
|
-
`Validate: arg ${input.name} should be a felt (
|
|
12213
|
+
`Validate: arg ${input.name} should be a felt typed as (String, Number or BigInt)`
|
|
12214
|
+
);
|
|
12215
|
+
};
|
|
12216
|
+
var validateUint = (parameter, input) => {
|
|
12217
|
+
if (typeof parameter === "number") {
|
|
12218
|
+
assert2(
|
|
12219
|
+
parameter <= Number.MAX_SAFE_INTEGER,
|
|
12220
|
+
`Validation: Parameter is to large to be typed as Number use (BigInt or String)`
|
|
12221
|
+
);
|
|
12222
|
+
}
|
|
12223
|
+
assert2(
|
|
12224
|
+
typeof parameter === "string" || typeof parameter === "number" || typeof parameter === "bigint",
|
|
12225
|
+
`Validate: arg ${input.name} of cairo type ${input.type} should be type (String, Number or BigInt)`
|
|
12226
|
+
);
|
|
12227
|
+
const param = toBigInt(parameter);
|
|
12228
|
+
switch (input.type) {
|
|
12229
|
+
case "core::integer::u8" /* u8 */:
|
|
12230
|
+
assert2(
|
|
12231
|
+
param >= 0n && param <= 255n,
|
|
12232
|
+
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0 - 255]`
|
|
12233
|
+
);
|
|
12234
|
+
break;
|
|
12235
|
+
case "core::integer::u16" /* u16 */:
|
|
12236
|
+
assert2(
|
|
12237
|
+
param >= 0n && param <= 65535n,
|
|
12238
|
+
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 65535]`
|
|
12239
|
+
);
|
|
12240
|
+
break;
|
|
12241
|
+
case "core::integer::u32" /* u32 */:
|
|
12242
|
+
assert2(
|
|
12243
|
+
param >= 0n && param <= 4294967295n,
|
|
12244
|
+
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 4294967295]`
|
|
12245
|
+
);
|
|
12246
|
+
break;
|
|
12247
|
+
case "core::integer::u64" /* u64 */:
|
|
12248
|
+
assert2(
|
|
12249
|
+
param >= 0n && param <= 2n ** 64n - 1n,
|
|
12250
|
+
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^64-1]`
|
|
12251
|
+
);
|
|
12252
|
+
break;
|
|
12253
|
+
case "core::integer::u128" /* u128 */:
|
|
12254
|
+
assert2(
|
|
12255
|
+
param >= 0n && param <= 2n ** 128n - 1n,
|
|
12256
|
+
`Validate: arg ${input.name} cairo typed ${input.type} should be in range [0, 2^128-1]`
|
|
12257
|
+
);
|
|
12258
|
+
break;
|
|
12259
|
+
case "core::integer::u256" /* u256 */:
|
|
12260
|
+
assert2(
|
|
12261
|
+
param >= 0n && param <= 2n ** 256n - 1n,
|
|
12262
|
+
`Validate: arg ${input.name} is ${input.type} 0 - 2^256-1`
|
|
12263
|
+
);
|
|
12264
|
+
break;
|
|
12265
|
+
default:
|
|
12266
|
+
break;
|
|
12267
|
+
}
|
|
12268
|
+
};
|
|
12269
|
+
var validateBool = (parameter, input) => {
|
|
12270
|
+
assert2(
|
|
12271
|
+
typeof parameter === "boolean",
|
|
12272
|
+
`Validate: arg ${input.name} of cairo type ${input.type} should be type (Boolean)`
|
|
12124
12273
|
);
|
|
12125
12274
|
};
|
|
12126
12275
|
var validateStruct = (parameter, input, structs) => {
|
|
@@ -12142,7 +12291,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12142
12291
|
);
|
|
12143
12292
|
};
|
|
12144
12293
|
var validateArray = (parameter, input, structs) => {
|
|
12145
|
-
const baseType = input.type
|
|
12294
|
+
const baseType = getArrayType(input.type);
|
|
12146
12295
|
if (isTypeFelt(baseType) && isLongText(parameter))
|
|
12147
12296
|
return;
|
|
12148
12297
|
assert2(Array.isArray(parameter), `Validate: arg ${input.name} should be an Array`);
|
|
@@ -12158,6 +12307,12 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12158
12307
|
(it) => validateStruct(it, { name: input.name, type: baseType }, structs)
|
|
12159
12308
|
);
|
|
12160
12309
|
break;
|
|
12310
|
+
case isTypeUint(baseType):
|
|
12311
|
+
parameter.forEach((param) => validateUint(param, input));
|
|
12312
|
+
break;
|
|
12313
|
+
case isTypeBool(baseType):
|
|
12314
|
+
parameter.forEach((param) => validateBool(param, input));
|
|
12315
|
+
break;
|
|
12161
12316
|
default:
|
|
12162
12317
|
throw new Error(
|
|
12163
12318
|
`Validate Unhandled: argument ${input.name}, type ${input.type}, value ${parameter}`
|
|
@@ -12173,6 +12328,14 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12173
12328
|
case isTypeFelt(input.type):
|
|
12174
12329
|
validateFelt(parameter, input);
|
|
12175
12330
|
break;
|
|
12331
|
+
case isTypeUint(input.type):
|
|
12332
|
+
validateUint(parameter, input);
|
|
12333
|
+
break;
|
|
12334
|
+
case isTypeBool(input.type):
|
|
12335
|
+
validateBool(parameter, input);
|
|
12336
|
+
break;
|
|
12337
|
+
case isTypeContractAddress(input.type):
|
|
12338
|
+
break;
|
|
12176
12339
|
case isTypeStruct(input.type, structs):
|
|
12177
12340
|
validateStruct(parameter, input, structs);
|
|
12178
12341
|
break;
|
|
@@ -12202,7 +12365,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12202
12365
|
const invocableFunctionNames = this.abi.filter((abi) => {
|
|
12203
12366
|
if (abi.type !== "function")
|
|
12204
12367
|
return false;
|
|
12205
|
-
const isView = abi.stateMutability === "view";
|
|
12368
|
+
const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
|
|
12206
12369
|
return type === "INVOKE" ? !isView : isView;
|
|
12207
12370
|
}).map((abi) => abi.name);
|
|
12208
12371
|
assert2(
|
|
@@ -12261,13 +12424,15 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12261
12424
|
parse(method, response) {
|
|
12262
12425
|
const { outputs } = this.abi.find((abi) => abi.name === method);
|
|
12263
12426
|
const responseIterator = response.flat()[Symbol.iterator]();
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12427
|
+
const parsed = outputs.flat().reduce((acc, output2, idx) => {
|
|
12428
|
+
const propName = output2.name ?? idx;
|
|
12429
|
+
acc[propName] = responseParser(responseIterator, output2, this.structs, acc);
|
|
12430
|
+
if (acc[propName] && acc[`${propName}_len`]) {
|
|
12431
|
+
delete acc[`${propName}_len`];
|
|
12268
12432
|
}
|
|
12269
12433
|
return acc;
|
|
12270
12434
|
}, {});
|
|
12435
|
+
return Object.keys(parsed).length === 1 && 0 in parsed ? parsed[0] : parsed;
|
|
12271
12436
|
}
|
|
12272
12437
|
format(method, response, format) {
|
|
12273
12438
|
const parsed = this.parse(method, response);
|
|
@@ -12324,7 +12489,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12324
12489
|
};
|
|
12325
12490
|
}
|
|
12326
12491
|
function buildDefault(contract, functionAbi) {
|
|
12327
|
-
if (functionAbi.stateMutability === "view") {
|
|
12492
|
+
if (functionAbi.stateMutability === "view" || functionAbi.state_mutability === "view") {
|
|
12328
12493
|
return buildCall(contract, functionAbi);
|
|
12329
12494
|
}
|
|
12330
12495
|
return buildInvoke(contract, functionAbi);
|
|
@@ -12339,13 +12504,20 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12339
12504
|
return contract.estimate(functionAbi.name, args);
|
|
12340
12505
|
};
|
|
12341
12506
|
}
|
|
12507
|
+
var detectCairoVersion = (abi) => {
|
|
12508
|
+
if (!abi)
|
|
12509
|
+
return "0";
|
|
12510
|
+
return abi.find((it) => "state_mutability" in it) ? "1" : "0";
|
|
12511
|
+
};
|
|
12342
12512
|
var Contract = class {
|
|
12343
|
-
constructor(abi, address, providerOrAccount = defaultProvider) {
|
|
12513
|
+
constructor(abi, address, providerOrAccount = defaultProvider, cairoVersion = detectCairoVersion(abi)) {
|
|
12514
|
+
this.version = "0";
|
|
12344
12515
|
this.address = address && address.toLowerCase();
|
|
12345
12516
|
this.providerOrAccount = providerOrAccount;
|
|
12346
12517
|
this.callData = new CallData(abi);
|
|
12347
12518
|
this.structs = CallData.getAbiStruct(abi);
|
|
12348
12519
|
this.abi = abi;
|
|
12520
|
+
this.version = cairoVersion;
|
|
12349
12521
|
const options = { enumerable: true, value: {}, writable: false };
|
|
12350
12522
|
Object.defineProperties(this, {
|
|
12351
12523
|
functions: { enumerable: true, value: {}, writable: false },
|
|
@@ -13194,8 +13366,8 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
13194
13366
|
return parseUDCEvent(txReceipt);
|
|
13195
13367
|
}
|
|
13196
13368
|
async declareAndDeploy(payload, details) {
|
|
13197
|
-
const {
|
|
13198
|
-
const { transaction_hash, class_hash } = await this.declare(
|
|
13369
|
+
const { constructorCalldata, salt, unique } = payload;
|
|
13370
|
+
const { transaction_hash, class_hash } = await this.declare(payload, details);
|
|
13199
13371
|
const declare = await this.waitForTransaction(transaction_hash, {
|
|
13200
13372
|
successStates: ["ACCEPTED_ON_L2" /* ACCEPTED_ON_L2 */]
|
|
13201
13373
|
});
|