DatumOption.ts
DatumOption overview
Table of contents
conversion
fromCBORBytes
Convert CBOR bytes to DatumOption.
Signature
export declare const fromCBORBytes: (
bytes: Uint8Array,
options?: CBOR.CodecOptions
) => DatumHash.DatumHash | InlineDatum.InlineDatumAdded in v2.0.0
fromCBORHex
Convert CBOR hex string to DatumOption.
Signature
export declare const fromCBORHex: (
hex: string,
options?: CBOR.CodecOptions
) => DatumHash.DatumHash | InlineDatum.InlineDatumAdded in v2.0.0
encoding
toCBORBytes
Convert DatumOption to CBOR bytes.
Signature
export declare const toCBORBytes: (data: DatumOption, options?: CBOR.CodecOptions) => anyAdded in v2.0.0
toCBORHex
Convert DatumOption to CBOR hex.
Signature
export declare const toCBORHex: (data: DatumOption, options?: CBOR.CodecOptions) => stringAdded in v2.0.0
model
DatumOption (type alias)
Type alias for DatumOption representing optional datum information. Can be either a hash reference to datum data or inline plutus data.
Signature
export type DatumOption = typeof DatumOptionSchema.TypeAdded in v2.0.0
predicates
isDatumHash
Check if a DatumOption is a datum hash.
Signature
export declare const isDatumHash: (u: unknown, overrideOptions?: ParseOptions | number) => u is DatumHash.DatumHashAdded in v2.0.0
isInlineDatum
Check if a DatumOption is inline data.
Signature
export declare const isInlineDatum: (
u: unknown,
overrideOptions?: ParseOptions | number
) => u is InlineDatum.InlineDatumAdded in v2.0.0
schemas
DatumOptionSchema
Schema for DatumOption representing optional datum information in transaction outputs.
CDDL: datum_option = [0, Bytes32// 1, data]
Where:
- [0, Bytes32] represents a datum hash reference
- [1, data] represents inline plutus data
Signature
export declare const DatumOptionSchema: Schema.Union<[typeof DatumHash.DatumHash, typeof InlineDatum.InlineDatum]>Added in v2.0.0
FromCBORBytes
CBOR bytes transformation schema for DatumOption. Transforms between Uint8Array and DatumOption using CBOR encoding.
Signature
export declare const FromCBORBytes: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<
Schema.Literal<[1n]>,
Schema.TaggedStruct<"Tag", { tag: Schema.Literal<[24]>; value: typeof Schema.Uint8ArrayFromSelf }>
>
]
>,
Schema.SchemaClass<
DatumHash.DatumHash | InlineDatum.InlineDatum,
DatumHash.DatumHash | InlineDatum.InlineDatum,
never
>,
never
>
>Added in v2.0.0
FromCBORHex
CBOR hex transformation schema for DatumOption. Transforms between hex string and DatumOption using CBOR encoding.
Signature
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<
Schema.Literal<[1n]>,
Schema.TaggedStruct<"Tag", { tag: Schema.Literal<[24]>; value: typeof Schema.Uint8ArrayFromSelf }>
>
]
>,
Schema.SchemaClass<
DatumHash.DatumHash | InlineDatum.InlineDatum,
DatumHash.DatumHash | InlineDatum.InlineDatum,
never
>,
never
>
>
>Added in v2.0.0
FromCDDL
CDDL schema for DatumOption. datum_option = [0, Bytes32] / [1, #6.24(bytes)]
Where:
- [0, Bytes32] represents a datum hash (tag 0 with 32-byte hash)
- [1, #6.24(bytes)] represents inline data (tag 1 with CBOR tag 24 containing plutus data as bytes)
Signature
export declare const FromCDDL: Schema.transformOrFail<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<
Schema.Literal<[1n]>,
Schema.TaggedStruct<"Tag", { tag: Schema.Literal<[24]>; value: typeof Schema.Uint8ArrayFromSelf }>
>
]
>,
Schema.SchemaClass<
DatumHash.DatumHash | InlineDatum.InlineDatum,
DatumHash.DatumHash | InlineDatum.InlineDatum,
never
>,
never
>Added in v2.0.0
testing
arbitrary
FastCheck arbitrary for generating random DatumOption instances
Signature
export declare const arbitrary: FastCheck.Arbitrary<DatumHash.DatumHash | InlineDatum.InlineDatum>Added in v2.0.0
utils
CDDLSchema
Signature
export declare const CDDLSchema: Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<
Schema.Literal<[1n]>,
Schema.TaggedStruct<"Tag", { tag: Schema.Literal<[24]>; value: typeof Schema.Uint8ArrayFromSelf }>
>
]
>