Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 21x 21x 9x 21x 13x 21x | import { ClarityType } from '../common/constants';
import { ClarityValue } from '../clarity-value/types';
export type OptionalCV<T extends ClarityValue> = NoneCV | SomeCV<T>;
export interface NoneCV {
readonly type: ClarityType.OptionalNone;
}
export interface SomeCV<T extends ClarityValue = ClarityValue> {
readonly type: ClarityType.OptionalSome;
readonly value: T;
}
export function noneCV(): NoneCV {
return { type: ClarityType.OptionalNone };
}
export function someCV<T extends ClarityValue = ClarityValue>(value: T): OptionalCV<T> {
return { type: ClarityType.OptionalSome, value };
}
export function optionalCVOf<T extends ClarityValue = ClarityValue>(value?: T): OptionalCV<T> {
return value ? someCV(value) : noneCV();
}
|