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
, content?
): CairoOption
<T
>
Type parameters​
Name |
---|
T |
Parameters​
Name | Type |
---|---|
variant | number |
content? | T |
Returns​
CairoOption
<T
>
Defined in​
src/utils/calldata/enum/CairoOption.ts:26
Properties​
Some​
• Optional
Readonly
Some: T
Defined in​
src/utils/calldata/enum/CairoOption.ts:22
None​
• Optional
Readonly
None: boolean
Defined in​
src/utils/calldata/enum/CairoOption.ts:24
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:49
isSome​
â–¸ isSome(): boolean
Returns​
boolean
true if the valid variant is 'isSome'.
Defined in​
src/utils/calldata/enum/CairoOption.ts:57
isNone​
â–¸ isNone(): boolean
Returns​
boolean
true if the valid variant is 'isNone'.