starknet 5.18.0 → 5.19.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 CHANGED
@@ -1,21 +1,30 @@
1
- # [5.18.0](https://github.com/0xs34n/starknet.js/compare/v5.17.0...v5.18.0) (2023-08-05)
1
+ ## [5.19.1](https://github.com/0xs34n/starknet.js/compare/v5.19.0...v5.19.1) (2023-08-16)
2
2
 
3
3
  ### Bug Fixes
4
4
 
5
- - getevents range blocks optional ([a746354](https://github.com/0xs34n/starknet.js/commit/a746354db49260cc3538c10a1c8278ad680c660e))
6
- - hotfixed deault provider to issued RPC spec ([4a8f4f9](https://github.com/0xs34n/starknet.js/commit/4a8f4f9aba89aaf52dd8c9048f87294df21edfc0))
7
- - optional keys and address in eventfilters ([4077b48](https://github.com/0xs34n/starknet.js/commit/4077b48cfa8f7e739897b1b2327a6658f3b33029))
8
- - pathfinder pascal status patch, fixed GetSyncingStatsResponse schema ([89c0f25](https://github.com/0xs34n/starknet.js/commit/89c0f25fa0295f9f6f1bc25aac0848abe5187ea6))
9
- - repair RPC simulation flag serialization ([e5af0a0](https://github.com/0xs34n/starknet.js/commit/e5af0a091321bb6519ca15d8733f8ffbc56db2cd))
10
- - string ([c6ae7bd](https://github.com/0xs34n/starknet.js/commit/c6ae7bd89ca2f5a8d682b73925efbc321bfa7a48))
11
- - undefined transaction GetTransactionResponse provide LibraryError ([f57e844](https://github.com/0xs34n/starknet.js/commit/f57e844fe9b70457fcda22942e5d2329d7198ba1))
12
- - unfinished get_transaction_receipt default provider types ([6589b2c](https://github.com/0xs34n/starknet.js/commit/6589b2cb0850216ce3abe6b842ec68a49f6cd489))
5
+ - repair CallData compilation faulty ordering ([e8cbedc](https://github.com/0xs34n/starknet.js/commit/e8cbedc3eac39cb0662e958ad5056750f8dc4069))
6
+
7
+ # [5.19.0](https://github.com/0xs34n/starknet.js/compare/v5.18.0...v5.19.0) (2023-08-11)
8
+
9
+ ### Bug Fixes
10
+
11
+ - add function definition to the contract interface + doc ([06498d5](https://github.com/0xs34n/starknet.js/commit/06498d539bc2b816982e0245ae3b6508665f03f7))
12
+ - contract test status ([53cfaf9](https://github.com/0xs34n/starknet.js/commit/53cfaf935d1b053f5bcd17ffcb1ae48d9e8a4eef))
13
+ - fix multiple same events + add cairo code + seperate tests, legacy and Cairo1 ([7c93157](https://github.com/0xs34n/starknet.js/commit/7c93157d60864989efec37a05521979a2548e4d8))
14
+ - modify parseEvents structure + add testcase for multiple different event in same tx ([b63b0d6](https://github.com/0xs34n/starknet.js/commit/b63b0d631d163e181c8a42a634f107d2761e35ca))
15
+ - optional struct and enum in responseParser ([14d3cca](https://github.com/0xs34n/starknet.js/commit/14d3cca97a3cebedf07466f98dd46639999421c2))
16
+ - patch merge, and add enums to event parser ([00f8073](https://github.com/0xs34n/starknet.js/commit/00f8073418eef1e2eebf105884357561b959fb7c))
17
+ - remove exports from responseParser functions ([3d86446](https://github.com/0xs34n/starknet.js/commit/3d864463579fc68c4538bbbc7820420ec64b15eb))
18
+ - repair SequencerProvider network resolution ([e42dfc1](https://github.com/0xs34n/starknet.js/commit/e42dfc1e722d4a77bc52102a94295ee7ab6a460d))
19
+ - restore package-lock to previous state ([2fe0564](https://github.com/0xs34n/starknet.js/commit/2fe0564ed042537e480ea8481c787fe7359ba4a8))
13
20
 
14
21
  ### Features
15
22
 
16
- - rpc 0.4.0-rc3, no cleanup ([54674cb](https://github.com/0xs34n/starknet.js/commit/54674cb203d0989c4e8ee5a14aec65fdd63f36e2))
17
- - rpc default to pending block tag (fix wrong nonce issue), reverted estimate versio of rpc spec ([2049b4f](https://github.com/0xs34n/starknet.js/commit/2049b4f9dba383357650a7d8d10a2ee176507787))
18
- - waitForTransaction Sequencer reworked with execution and finality status, 5s steps, not_rec ([f4e414f](https://github.com/0xs34n/starknet.js/commit/f4e414fac6a2cb05c8dff9d55107cf5a58a274ca))
23
+ - add ethAddress handling ([2a93f90](https://github.com/0xs34n/starknet.js/commit/2a93f90cc9e7e697a153e42b9ebd19dec6f1880f))
24
+ - cairo enum in request parser ([ad44481](https://github.com/0xs34n/starknet.js/commit/ad4448129058b76fede61675d46a37a6c74f0d16))
25
+ - cairo enum in response parser ([a936a11](https://github.com/0xs34n/starknet.js/commit/a936a11ca34af628ec187740616b8c5a804e9d65)), closes [#670](https://github.com/0xs34n/starknet.js/issues/670) [#665](https://github.com/0xs34n/starknet.js/issues/665) [#664](https://github.com/0xs34n/starknet.js/issues/664) [#1](https://github.com/0xs34n/starknet.js/issues/1) [#675](https://github.com/0xs34n/starknet.js/issues/675) [#1](https://github.com/0xs34n/starknet.js/issues/1) [#675](https://github.com/0xs34n/starknet.js/issues/675) [#1](https://github.com/0xs34n/starknet.js/issues/1) [#670](https://github.com/0xs34n/starknet.js/issues/670) [#665](https://github.com/0xs34n/starknet.js/issues/665) [#664](https://github.com/0xs34n/starknet.js/issues/664) [#1](https://github.com/0xs34n/starknet.js/issues/1) [#675](https://github.com/0xs34n/starknet.js/issues/675) [#1](https://github.com/0xs34n/starknet.js/issues/1)
26
+ - implement event parsing ([86cc430](https://github.com/0xs34n/starknet.js/commit/86cc430cff2b6f338edecce29819260b475a3907))
27
+ - new Cairo types ([f9db09e](https://github.com/0xs34n/starknet.js/commit/f9db09eeab05fd0c1692229fcdbbc020b4954f3e))
19
28
 
20
29
  # [5.17.0](https://github.com/0xs34n/starknet.js/compare/v5.16.0...v5.17.0) (2023-07-18)
21
30
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as weierstrass from '@noble/curves/abstract/weierstrass';
2
+ import { Abi as Abi$1, TypedContract as TypedContract$1 } from 'abi-wan-kanabi';
2
3
  import * as poseidon from '@noble/curves/abstract/poseidon';
3
4
  import * as json$1 from 'lossless-json';
4
5
  import * as microStarknet from 'micro-starknet';
@@ -163,12 +164,125 @@ declare namespace ec {
163
164
  };
164
165
  }
165
166
 
167
+ type CairoEnumRaw = {
168
+ [key: string]: any;
169
+ };
170
+ /**
171
+ * Class to handle Cairo custom Enum
172
+ * @param enumContent object containing the variants and its content. Example :
173
+ * {Success: 234, Warning: undefined, Error: undefined}.
174
+ * Only one variant with a value, object, array.
175
+ * @returns an instance representing a Cairo custom Enum.
176
+ * @example ```typescript
177
+ * const myCairoEnum = new CairoCustomEnum( {Success: undefined, Warning: "0x7f32ea", Error: undefined})
178
+ * ```
179
+ */
180
+ declare class CairoCustomEnum {
181
+ /**
182
+ * direct readonly access to variants of the Cairo Custom Enum.
183
+ * @returns a value of type any
184
+ * @example ```typescript
185
+ * const successValue = myCairoEnum.variant.Success;
186
+ */
187
+ readonly variant: CairoEnumRaw;
188
+ /**
189
+ * @param enumContent an object with the variants as keys and the content as value. Only one content shall be defined.
190
+ */
191
+ constructor(enumContent: CairoEnumRaw);
192
+ /**
193
+ *
194
+ * @returns the content of the valid variant of a Cairo custom Enum.
195
+ */
196
+ unwrap(): any;
197
+ /**
198
+ *
199
+ * @returns the name of the valid variant of a Cairo custom Enum.
200
+ */
201
+ activeVariant(): string;
202
+ }
203
+
204
+ declare enum CairoOptionVariant {
205
+ Some = 0,
206
+ None = 1
207
+ }
208
+ /**
209
+ * Class to handle Cairo Option
210
+ * @param variant CairoOptionVariant.Some or CairoOptionVariant.None
211
+ * @param someContent value of type T.
212
+ * @returns an instance representing a Cairo Option.
213
+ * @example ```typescript
214
+ * const myOption = new CairoOption<BigNumberish>(CairoOptionVariant.Some, "0x54dda8");
215
+ * ```
216
+ */
217
+ declare class CairoOption<T> {
218
+ readonly Some?: T;
219
+ readonly None?: boolean;
220
+ constructor(variant: CairoOptionVariant, someContent?: T);
221
+ /**
222
+ *
223
+ * @returns the content of the valid variant of a Cairo custom Enum.
224
+ * If None, returns 'undefined'.
225
+ */
226
+ unwrap(): T | undefined;
227
+ /**
228
+ *
229
+ * @returns true if the valid variant is 'isSome'.
230
+ */
231
+ isSome(): boolean;
232
+ /**
233
+ *
234
+ * @returns true if the valid variant is 'isNone'.
235
+ */
236
+ isNone(): boolean;
237
+ }
238
+
239
+ declare enum CairoResultVariant {
240
+ Ok = 0,
241
+ Err = 1
242
+ }
243
+ /**
244
+ * Class to handle Cairo Result
245
+ * @param variant CairoResultVariant.Ok or CairoResultVariant.Err
246
+ * @param resultContent value of type T or U.
247
+ * @returns an instance representing a Cairo Result.
248
+ * @example ```typescript
249
+ * const myOption = new CairoResult<BigNumberish,CustomError>(CairoResultVariant.Ok, "0x54dda8");
250
+ * ```
251
+ */
252
+ declare class CairoResult<T, U> {
253
+ readonly Ok?: T;
254
+ readonly Err?: U;
255
+ constructor(variant: CairoResultVariant, resultContent: T | U);
256
+ /**
257
+ *
258
+ * @returns the content of the valid variant of a Cairo Result.
259
+ */
260
+ unwrap(): T | U;
261
+ /**
262
+ *
263
+ * @returns true if the valid variant is 'Ok'.
264
+ */
265
+ isOk(): boolean;
266
+ /**
267
+ *
268
+ * @returns true if the valid variant is 'isErr'.
269
+ */
270
+ isErr(): boolean;
271
+ }
272
+
273
+ type CairoEnum = CairoCustomEnum | CairoOption<any> | CairoResult<any, any>;
274
+
166
275
  /** ABI */
167
- type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
276
+ type Abi = Array<FunctionAbi | EventAbi | StructAbi | any>;
168
277
  type AbiEntry = {
169
278
  name: string;
170
279
  type: 'felt' | 'felt*' | string;
171
280
  };
281
+ type EventEntry = {
282
+ name: string;
283
+ type: 'felt' | 'felt*' | string;
284
+ kind: 'key' | 'data';
285
+ };
172
286
  declare enum FunctionAbiType {
173
287
  'function' = 0,
174
288
  'l1_handler' = 1,
@@ -193,7 +307,33 @@ type StructAbi = {
193
307
  size: number;
194
308
  type: 'struct';
195
309
  };
196
- type EventAbi = any;
310
+ type AbiEnums = {
311
+ [name: string]: EnumAbi;
312
+ };
313
+ type EnumAbi = {
314
+ variants: (AbiEntry & {
315
+ offset: number;
316
+ })[];
317
+ name: string;
318
+ size: number;
319
+ type: 'enum';
320
+ };
321
+ type AbiEvents = {
322
+ [hash: string]: EventAbi;
323
+ };
324
+ type EventAbi = Cairo1Event | LegacyEvent;
325
+ type Cairo1Event = {
326
+ name: string;
327
+ members: EventEntry[];
328
+ kind: 'struct';
329
+ type: 'event';
330
+ };
331
+ type LegacyEvent = {
332
+ name: string;
333
+ type: 'event';
334
+ data: EventEntry[];
335
+ keys: EventEntry[];
336
+ };
197
337
 
198
338
  /** LEGACY CONTRACT */
199
339
  /**
@@ -331,7 +471,7 @@ type RawArgsObject = {
331
471
  [inputName: string]: MultiType | MultiType[] | RawArgs;
332
472
  };
333
473
  type RawArgsArray = Array<MultiType | MultiType[] | RawArgs>;
334
- type MultiType = BigNumberish | Uint256 | object | boolean;
474
+ type MultiType = BigNumberish | Uint256 | object | boolean | CairoEnum;
335
475
  type UniversalDeployerContractPayload = {
336
476
  classHash: BigNumberish;
337
477
  salt?: string;
@@ -475,7 +615,7 @@ type Args = {
475
615
  [inputName: string]: BigNumberish | BigNumberish[] | ParsedStruct | ParsedStruct[];
476
616
  };
477
617
  type ParsedStruct = {
478
- [key: string]: BigNumberish | ParsedStruct;
618
+ [key: string]: BigNumberish | BigNumberish[] | ParsedStruct | Uint256;
479
619
  };
480
620
  type waitForTransactionOptions = {
481
621
  retryInterval?: number;
@@ -2209,12 +2349,16 @@ declare enum Uint {
2209
2349
  u128 = "core::integer::u128",
2210
2350
  u256 = "core::integer::u256"
2211
2351
  }
2352
+ declare enum Litteral {
2353
+ ClassHash = "core::starknet::class_hash::ClassHash",
2354
+ ContractAddress = "core::starknet::contract_address::ContractAddress"
2355
+ }
2212
2356
 
2213
2357
  type AsyncContractFunction<T = any> = (...args: ArgsOrCalldataWithOptions) => Promise<T>;
2214
2358
  type ContractFunction = (...args: ArgsOrCalldataWithOptions) => any;
2215
2359
  type Result = {
2216
2360
  [key: string]: any;
2217
- } | Result[] | bigint | string | boolean;
2361
+ } | Result[] | bigint | string | boolean | CairoEnum;
2218
2362
  type ArgsOrCalldata = RawArgsArray | [Calldata] | Calldata;
2219
2363
  type ArgsOrCalldataWithOptions = ArgsOrCalldata & ContractOptions;
2220
2364
  type ContractOptions = {
@@ -2231,6 +2375,10 @@ type ContractOptions = {
2231
2375
  };
2232
2376
  type CallOptions = Pick<ContractOptions, 'blockIdentifier' | 'parseRequest' | 'parseResponse' | 'formatResponse'>;
2233
2377
  type InvokeOptions = Pick<ContractOptions, 'maxFee' | 'nonce' | 'signature' | 'parseRequest'>;
2378
+ type ParsedEvent = {
2379
+ [name: string]: ParsedStruct;
2380
+ };
2381
+ type ParsedEvents = Array<ParsedEvent>;
2234
2382
 
2235
2383
  interface InvocationsSignerDetails extends Required<InvocationsDetails> {
2236
2384
  walletAddress: string;
@@ -2286,6 +2434,8 @@ interface TypedData {
2286
2434
 
2287
2435
  type index_Abi = Abi;
2288
2436
  type index_AbiEntry = AbiEntry;
2437
+ type index_AbiEnums = AbiEnums;
2438
+ type index_AbiEvents = AbiEvents;
2289
2439
  type index_AbiStructs = AbiStructs;
2290
2440
  type index_AccountInvocationItem = AccountInvocationItem;
2291
2441
  type index_AccountInvocations = AccountInvocations;
@@ -2305,8 +2455,10 @@ type index_BlockTag = BlockTag;
2305
2455
  declare const index_BlockTag: typeof BlockTag;
2306
2456
  type index_Builtins = Builtins;
2307
2457
  type index_ByteCode = ByteCode;
2458
+ type index_Cairo1Event = Cairo1Event;
2308
2459
  type index_CairoAssembly = CairoAssembly;
2309
2460
  type index_CairoContract = CairoContract;
2461
+ type index_CairoEnum = CairoEnum;
2310
2462
  type index_CairoVersion = CairoVersion;
2311
2463
  type index_Call = Call;
2312
2464
  type index_CallContractResponse = CallContractResponse;
@@ -2345,6 +2497,7 @@ type index_Details = Details;
2345
2497
  type index_EntryPointType = EntryPointType;
2346
2498
  declare const index_EntryPointType: typeof EntryPointType;
2347
2499
  type index_EntryPointsByType = EntryPointsByType;
2500
+ type index_EnumAbi = EnumAbi;
2348
2501
  type index_EstimateFee = EstimateFee;
2349
2502
  type index_EstimateFeeAction = EstimateFeeAction;
2350
2503
  type index_EstimateFeeBulk = EstimateFeeBulk;
@@ -2352,6 +2505,8 @@ type index_EstimateFeeDetails = EstimateFeeDetails;
2352
2505
  type index_EstimateFeeResponse = EstimateFeeResponse;
2353
2506
  type index_EstimateFeeResponseBulk = EstimateFeeResponseBulk;
2354
2507
  type index_Event = Event;
2508
+ type index_EventAbi = EventAbi;
2509
+ type index_EventEntry = EventEntry;
2355
2510
  type index_ExecutionResources = ExecutionResources;
2356
2511
  type index_FunctionAbi = FunctionAbi;
2357
2512
  type index_FunctionInvocation = FunctionInvocation;
@@ -2373,12 +2528,17 @@ type index_InvokeTransactionReceiptResponse = InvokeTransactionReceiptResponse;
2373
2528
  type index_InvokeTransactionResponse = InvokeTransactionResponse;
2374
2529
  type index_LegacyCompiledContract = LegacyCompiledContract;
2375
2530
  type index_LegacyContractClass = LegacyContractClass;
2531
+ type index_LegacyEvent = LegacyEvent;
2532
+ type index_Litteral = Litteral;
2533
+ declare const index_Litteral: typeof Litteral;
2376
2534
  type index_MessageToL1 = MessageToL1;
2377
2535
  type index_MessageToL2 = MessageToL2;
2378
2536
  type index_MultiDeployContractResponse = MultiDeployContractResponse;
2379
2537
  type index_MultiType = MultiType;
2380
2538
  type index_Nonce = Nonce;
2381
2539
  type index_OptionalPayload<T> = OptionalPayload<T>;
2540
+ type index_ParsedEvent = ParsedEvent;
2541
+ type index_ParsedEvents = ParsedEvents;
2382
2542
  type index_ParsedStruct = ParsedStruct;
2383
2543
  type index_Program = Program;
2384
2544
  type index_ProviderOptions = ProviderOptions;
@@ -2431,6 +2591,8 @@ declare namespace index {
2431
2591
  export {
2432
2592
  index_Abi as Abi,
2433
2593
  index_AbiEntry as AbiEntry,
2594
+ index_AbiEnums as AbiEnums,
2595
+ index_AbiEvents as AbiEvents,
2434
2596
  index_AbiStructs as AbiStructs,
2435
2597
  index_AccountInvocationItem as AccountInvocationItem,
2436
2598
  index_AccountInvocations as AccountInvocations,
@@ -2448,8 +2610,10 @@ declare namespace index {
2448
2610
  index_BlockTag as BlockTag,
2449
2611
  index_Builtins as Builtins,
2450
2612
  index_ByteCode as ByteCode,
2613
+ index_Cairo1Event as Cairo1Event,
2451
2614
  index_CairoAssembly as CairoAssembly,
2452
2615
  index_CairoContract as CairoContract,
2616
+ index_CairoEnum as CairoEnum,
2453
2617
  index_CairoVersion as CairoVersion,
2454
2618
  index_Call as Call,
2455
2619
  index_CallContractResponse as CallContractResponse,
@@ -2488,6 +2652,7 @@ declare namespace index {
2488
2652
  index_Details as Details,
2489
2653
  index_EntryPointType as EntryPointType,
2490
2654
  index_EntryPointsByType as EntryPointsByType,
2655
+ index_EnumAbi as EnumAbi,
2491
2656
  index_EstimateFee as EstimateFee,
2492
2657
  index_EstimateFeeAction as EstimateFeeAction,
2493
2658
  index_EstimateFeeBulk as EstimateFeeBulk,
@@ -2495,6 +2660,8 @@ declare namespace index {
2495
2660
  index_EstimateFeeResponse as EstimateFeeResponse,
2496
2661
  index_EstimateFeeResponseBulk as EstimateFeeResponseBulk,
2497
2662
  index_Event as Event,
2663
+ index_EventAbi as EventAbi,
2664
+ index_EventEntry as EventEntry,
2498
2665
  index_ExecutionResources as ExecutionResources,
2499
2666
  index_FunctionAbi as FunctionAbi,
2500
2667
  index_FunctionInvocation as FunctionInvocation,
@@ -2516,12 +2683,16 @@ declare namespace index {
2516
2683
  index_InvokeTransactionResponse as InvokeTransactionResponse,
2517
2684
  index_LegacyCompiledContract as LegacyCompiledContract,
2518
2685
  index_LegacyContractClass as LegacyContractClass,
2686
+ index_LegacyEvent as LegacyEvent,
2687
+ index_Litteral as Litteral,
2519
2688
  index_MessageToL1 as MessageToL1,
2520
2689
  index_MessageToL2 as MessageToL2,
2521
2690
  index_MultiDeployContractResponse as MultiDeployContractResponse,
2522
2691
  index_MultiType as MultiType,
2523
2692
  index_Nonce as Nonce,
2524
2693
  index_OptionalPayload as OptionalPayload,
2694
+ index_ParsedEvent as ParsedEvent,
2695
+ index_ParsedEvents as ParsedEvents,
2525
2696
  index_ParsedStruct as ParsedStruct,
2526
2697
  index_Program as Program,
2527
2698
  index_ProviderOptions as ProviderOptions,
@@ -3367,6 +3538,7 @@ declare class Account extends Provider implements AccountInterface {
3367
3538
  StarknetIdContract?: string): Promise<string>;
3368
3539
  }
3369
3540
 
3541
+ type TypedContract<TAbi extends Abi$1> = TypedContract$1<TAbi> & ContractInterface;
3370
3542
  declare abstract class ContractInterface {
3371
3543
  abstract abi: Abi;
3372
3544
  abstract address: string;
@@ -3440,6 +3612,13 @@ declare abstract class ContractInterface {
3440
3612
  * @returns Invocation object
3441
3613
  */
3442
3614
  abstract populate(method: string, args?: ArgsOrCalldata): Invocation;
3615
+ /**
3616
+ * Parse contract events of a GetTransactionReceiptResponse received from waitForTransaction. Based on contract's abi
3617
+ *
3618
+ * @param receipt transaction receipt
3619
+ * @returns Events parsed
3620
+ */
3621
+ abstract parseEvents(receipt: GetTransactionReceiptResponse): ParsedEvents;
3443
3622
  /**
3444
3623
  * tells if the contract comes from a Cairo 1 contract
3445
3624
  *
@@ -3450,6 +3629,7 @@ declare abstract class ContractInterface {
3450
3629
  * ```
3451
3630
  */
3452
3631
  abstract isCairo1(): boolean;
3632
+ abstract typed<TAbi extends Abi$1>(tAbi: TAbi): TypedContract<TAbi>;
3453
3633
  }
3454
3634
 
3455
3635
  declare const splitArgsAndOptions: (args: ArgsOrCalldataWithOptions) => {
@@ -3471,6 +3651,7 @@ declare class Contract implements ContractInterface {
3471
3651
  protected readonly structs: {
3472
3652
  [name: string]: StructAbi;
3473
3653
  };
3654
+ protected readonly events: AbiEvents;
3474
3655
  readonly functions: {
3475
3656
  [name: string]: AsyncContractFunction;
3476
3657
  };
@@ -3500,7 +3681,9 @@ declare class Contract implements ContractInterface {
3500
3681
  invoke(method: string, args?: ArgsOrCalldata, { parseRequest, maxFee, nonce, signature }?: InvokeOptions): Promise<InvokeFunctionResponse>;
3501
3682
  estimate(method: string, args?: ArgsOrCalldata): Promise<EstimateFeeResponse>;
3502
3683
  populate(method: string, args?: RawArgs): Call;
3684
+ parseEvents(receipt: GetTransactionReceiptResponse): ParsedEvents;
3503
3685
  isCairo1(): boolean;
3686
+ typed<TAbi extends Abi$1>(tAbi: TAbi): TypedContract<TAbi>;
3504
3687
  }
3505
3688
 
3506
3689
  type ContractFactoryParams = {
@@ -4153,10 +4336,15 @@ declare const isTypeArray: (type: string) => boolean;
4153
4336
  declare const isTypeTuple: (type: string) => boolean;
4154
4337
  declare const isTypeNamedTuple: (type: string) => boolean;
4155
4338
  declare const isTypeStruct: (type: string, structs: AbiStructs) => boolean;
4339
+ declare const isTypeEnum: (type: string, enums: AbiEnums) => boolean;
4340
+ declare const isTypeOption: (type: string) => boolean;
4341
+ declare const isTypeResult: (type: string) => boolean;
4156
4342
  declare const isTypeUint: (type: string) => boolean;
4343
+ declare const isTypeLitteral: (type: string) => boolean;
4157
4344
  declare const isTypeUint256: (type: string) => boolean;
4158
4345
  declare const isTypeBool: (type: string) => boolean;
4159
4346
  declare const isTypeContractAddress: (type: string) => boolean;
4347
+ declare const isTypeEthAddress: (type: string) => boolean;
4160
4348
  declare const isCairo1Type: (type: string) => boolean;
4161
4349
  declare const getArrayType: (type: string) => string;
4162
4350
  /**
@@ -4196,8 +4384,13 @@ declare const cairo_isLen: typeof isLen;
4196
4384
  declare const cairo_isTypeArray: typeof isTypeArray;
4197
4385
  declare const cairo_isTypeBool: typeof isTypeBool;
4198
4386
  declare const cairo_isTypeContractAddress: typeof isTypeContractAddress;
4387
+ declare const cairo_isTypeEnum: typeof isTypeEnum;
4388
+ declare const cairo_isTypeEthAddress: typeof isTypeEthAddress;
4199
4389
  declare const cairo_isTypeFelt: typeof isTypeFelt;
4390
+ declare const cairo_isTypeLitteral: typeof isTypeLitteral;
4200
4391
  declare const cairo_isTypeNamedTuple: typeof isTypeNamedTuple;
4392
+ declare const cairo_isTypeOption: typeof isTypeOption;
4393
+ declare const cairo_isTypeResult: typeof isTypeResult;
4201
4394
  declare const cairo_isTypeStruct: typeof isTypeStruct;
4202
4395
  declare const cairo_isTypeTuple: typeof isTypeTuple;
4203
4396
  declare const cairo_isTypeUint: typeof isTypeUint;
@@ -4214,8 +4407,13 @@ declare namespace cairo {
4214
4407
  cairo_isTypeArray as isTypeArray,
4215
4408
  cairo_isTypeBool as isTypeBool,
4216
4409
  cairo_isTypeContractAddress as isTypeContractAddress,
4410
+ cairo_isTypeEnum as isTypeEnum,
4411
+ cairo_isTypeEthAddress as isTypeEthAddress,
4217
4412
  cairo_isTypeFelt as isTypeFelt,
4413
+ cairo_isTypeLitteral as isTypeLitteral,
4218
4414
  cairo_isTypeNamedTuple as isTypeNamedTuple,
4415
+ cairo_isTypeOption as isTypeOption,
4416
+ cairo_isTypeResult as isTypeResult,
4219
4417
  cairo_isTypeStruct as isTypeStruct,
4220
4418
  cairo_isTypeTuple as isTypeTuple,
4221
4419
  cairo_isTypeUint as isTypeUint,
@@ -4229,6 +4427,7 @@ declare class CallData {
4229
4427
  abi: Abi;
4230
4428
  parser: AbiParserInterface;
4231
4429
  protected readonly structs: AbiStructs;
4430
+ protected readonly enums: AbiEnums;
4232
4431
  constructor(abi: Abi);
4233
4432
  /**
4234
4433
  * Validate arguments passed to the method as corresponding to the ones in the abi
@@ -4279,6 +4478,12 @@ declare class CallData {
4279
4478
  * @returns AbiStructs - structs from abi
4280
4479
  */
4281
4480
  static getAbiStruct(abi: Abi): AbiStructs;
4481
+ /**
4482
+ * Helper to extract enums from abi
4483
+ * @param abi Abi
4484
+ * @returns AbiEnums - enums from abi
4485
+ */
4486
+ static getAbiEnum(abi: Abi): AbiEnums;
4282
4487
  /**
4283
4488
  * Helper: Compile HexCalldata | RawCalldata | RawArgs
4284
4489
  * @param rawCalldata HexCalldata | RawCalldata | RawArgs
@@ -4328,4 +4533,4 @@ declare function parseUDCEvent(txReceipt: InvokeTransactionReceiptResponse): {
4328
4533
  /** @deprecated prefer the 'num' naming */
4329
4534
  declare const number: typeof num;
4330
4535
 
4331
- export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AccountInvocationItem, AccountInvocations, AccountInvocationsFactoryDetails, AllowArray, Args, ArgsOrCalldata, ArgsOrCalldataWithOptions, ArraySignatureType, AsyncContractFunction, BigNumberish, BlockIdentifier, BlockNumber, BlockStatus, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass$1 as ContractClass, ContractClassResponse, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFactoryParams, ContractFunction, ContractInterface, ContractOptions, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractResponse, DeployContractUDCResponse, DeployTransactionReceiptResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HexCalldata, HttpError, Invocation, Invocations, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeOptions, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, MultiType, Nonce, OptionalPayload, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, rpc as RPC, RawArgs, RawArgsArray, RawArgsObject, RawCalldata, RejectedTransactionReceiptResponse, RejectedTransactionResponse, Result, RevertedTransactionReceiptResponse, RpcProvider, RpcProviderOptions, SIMULATION_FLAG, sequencer as Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, SimulateTransactionDetails, SimulateTransactionResponse, SimulatedTransaction, SimulationFlags, StarkNetDomain, StarkNetMerkleType, StarkNetType, StateUpdateResponse, Storage, StructAbi, SuccessfulTransactionReceiptResponse, TransactionExecutionStatus$1 as TransactionExecutionStatus, TransactionFinalityStatus$1 as TransactionFinalityStatus, TransactionStatus, TransactionType$1 as TransactionType, Tupled, TypedData, Uint, Uint256, UniversalDeployerContractPayload, ValidateType, WeierstrassSignatureType, addAddressPadding, buildUrl, cairo, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, getEstimateFeeBulkOptions, getSimulateTransactionOptions, hash, isSierra, isUrl, json, merkle, num, number, parseUDCEvent, provider, selector, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index as types, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
4536
+ export { Abi, AbiEntry, AbiEnums, AbiEvents, AbiStructs, Account, AccountInterface, AccountInvocationItem, AccountInvocations, AccountInvocationsFactoryDetails, AllowArray, Args, ArgsOrCalldata, ArgsOrCalldataWithOptions, ArraySignatureType, AsyncContractFunction, BigNumberish, BlockIdentifier, BlockNumber, BlockStatus, BlockTag, Builtins, ByteCode, Cairo1Event, CairoAssembly, CairoContract, CairoCustomEnum, CairoEnum, CairoEnumRaw, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass$1 as ContractClass, ContractClassResponse, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFactoryParams, ContractFunction, ContractInterface, ContractOptions, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractResponse, DeployContractUDCResponse, DeployTransactionReceiptResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EnumAbi, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, EventAbi, EventEntry, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HexCalldata, HttpError, Invocation, Invocations, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeOptions, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LegacyEvent, LibraryError, Litteral, MessageToL1, MessageToL2, MultiDeployContractResponse, MultiType, Nonce, OptionalPayload, ParsedEvent, ParsedEvents, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, rpc as RPC, RawArgs, RawArgsArray, RawArgsObject, RawCalldata, RejectedTransactionReceiptResponse, RejectedTransactionResponse, Result, RevertedTransactionReceiptResponse, RpcProvider, RpcProviderOptions, SIMULATION_FLAG, sequencer as Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, SimulateTransactionDetails, SimulateTransactionResponse, SimulatedTransaction, SimulationFlags, StarkNetDomain, StarkNetMerkleType, StarkNetType, StateUpdateResponse, Storage, StructAbi, SuccessfulTransactionReceiptResponse, TransactionExecutionStatus$1 as TransactionExecutionStatus, TransactionFinalityStatus$1 as TransactionFinalityStatus, TransactionStatus, TransactionType$1 as TransactionType, Tupled, TypedContract, TypedData, Uint, Uint256, UniversalDeployerContractPayload, ValidateType, WeierstrassSignatureType, addAddressPadding, buildUrl, cairo, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, getEstimateFeeBulkOptions, getSimulateTransactionOptions, hash, isSierra, isUrl, json, merkle, num, number, parseUDCEvent, provider, selector, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index as types, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };