Class: CairoOption<T>
Class to handle Cairo Option
Param
CairoOptionVariant.Some or CairoOptionVariant.None
Param
value of type T.
Example
const myOption = new CairoOption<BigNumberish>(CairoOptionVariant.Some, '0x54dda8');
Type parameters​
Name |
---|
T |
Constructors​
constructor​
• new CairoOption<T
>(variant
, someContent?
): CairoOption
<T
>
Type parameters​
Name |
---|
T |
Parameters​
Name | Type |
---|---|
variant | CairoOptionVariant |
someContent? | T |
Returns​
CairoOption
<T
>
Defined in​
src/utils/calldata/enum/CairoOption.ts:21
Properties​
Some​
• Optional
Readonly
Some: T
Defined in​
src/utils/calldata/enum/CairoOption.ts:17
None​
• Optional
Readonly
None: boolean
Defined in​
src/utils/calldata/enum/CairoOption.ts:19
Methods​
unwrap​
â–¸ unwrap(): undefined
| T
Returns​
undefined
| T
the content of the valid variant of a Cairo custom Enum. If None, returns 'undefined'.
Defined in​
src/utils/calldata/enum/CairoOption.ts:44
isSome​
â–¸ isSome(): boolean
Returns​
boolean
true if the valid variant is 'isSome'.
Defined in​
src/utils/calldata/enum/CairoOption.ts:55
isNone​
â–¸ isNone(): boolean
Returns​
boolean
true if the valid variant is 'isNone'.