Evolution SDK

Script.ts

Script overview


Table of contents


arbitrary

arbitrary

FastCheck arbitrary for Script.

Signature

export declare const arbitrary: FastCheck.Arbitrary<
  NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3
>

Added in v2.0.0

model

Script

Script union type following Conway CDDL specification.

CDDL:

script =
  [ 0, native_script ]
/ [ 1, plutus_v1_script ]
/ [ 2, plutus_v2_script ]
/ [ 3, plutus_v3_script ]

Signature

export declare const Script: Schema.Union<
  [typeof NativeScripts.NativeScript, typeof PlutusV1.PlutusV1, typeof PlutusV2.PlutusV2, typeof PlutusV3.PlutusV3]
>

Added in v2.0.0

schemas

FromCDDL

Transformation between CDDL representation and Script union.

Signature

export declare const FromCDDL: Schema.transformOrFail<
  Schema.Union<
    [
      Schema.Tuple2<
        Schema.Literal<[0n]>,
        Schema.Schema<NativeScripts.NativeScriptCDDL, NativeScripts.NativeScriptCDDL, never>
      >,
      Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
      Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
      Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>
    ]
  >,
  Schema.SchemaClass<
    NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
    NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
    never
  >,
  never
>

Added in v2.0.0

ScriptCDDL

CDDL schema for Script as tagged tuples.

Signature

export declare const ScriptCDDL: Schema.Union<
  [
    Schema.Tuple2<
      Schema.Literal<[0n]>,
      Schema.Schema<NativeScripts.NativeScriptCDDL, NativeScripts.NativeScriptCDDL, never>
    >,
    Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
    Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
    Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>
  ]
>

Added in v2.0.0

utils

FromCBORBytes

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]>,
          Schema.Schema<NativeScripts.NativeScriptCDDL, NativeScripts.NativeScriptCDDL, never>
        >,
        Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
        Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
        Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>
      ]
    >,
    Schema.SchemaClass<
      NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
      NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
      never
    >,
    never
  >
>

FromCBORHex

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]>,
            Schema.Schema<NativeScripts.NativeScriptCDDL, NativeScripts.NativeScriptCDDL, never>
          >,
          Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
          Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
          Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>
        ]
      >,
      Schema.SchemaClass<
        NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
        NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
        never
      >,
      never
    >
  >
>

Script (type alias)

Signature

export type Script = typeof Script.Type

ScriptCDDL (type alias)

Signature

export type ScriptCDDL = typeof ScriptCDDL.Type

fromCBOR

Signature

export declare const fromCBOR: (
  bytes: Uint8Array,
  options?: CBOR.CodecOptions
) => NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3

fromCBORHex

Signature

export declare const fromCBORHex: (
  hex: string,
  options?: CBOR.CodecOptions
) => NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3

toCBOR

Signature

export declare const toCBOR: (data: Script, options?: CBOR.CodecOptions) => any

toCBORHex

Signature

export declare const toCBORHex: (data: Script, options?: CBOR.CodecOptions) => string