Class: CairoResult<T, U>
Class to handle Cairo Result
Param
CairoResultVariant.Ok or CairoResultVariant.Err
Param
value of type T or U.
Example
const myOption = new CairoResult<BigNumberish, CustomError>(CairoResultVariant.Ok, "0x54dda8");
Type parameters​
Name |
---|
T |
U |
Constructors​
constructor​
• new CairoResult<T
, U
>(variant
, resultContent
): CairoResult
<T
, U
>
Type parameters​
Name |
---|
T |
U |
Parameters​
Name | Type |
---|---|
variant | number |
resultContent | T | U |
Returns​
CairoResult
<T
, U
>
Defined in​
src/utils/calldata/enum/CairoResult.ts:26
Properties​
Ok​
• Optional
Readonly
Ok: T
Defined in​
src/utils/calldata/enum/CairoResult.ts:22
Err​
• Optional
Readonly
Err: U
Defined in​
src/utils/calldata/enum/CairoResult.ts:24
Methods​
unwrap​
â–¸ unwrap(): T
| U
Returns​
T
| U
the content of the valid variant of a Cairo Result.
Defined in​
src/utils/calldata/enum/CairoResult.ts:43
isOk​
â–¸ isOk(): boolean
Returns​
boolean
true if the valid variant is 'Ok'.
Defined in​
src/utils/calldata/enum/CairoResult.ts:57
isErr​
â–¸ isErr(): boolean
Returns​
boolean
true if the valid variant is 'isErr'.