ScriptHash.ts
ScriptHash overview
Table of contents
arbitrary
arbitrary
FastCheck arbitrary for generating random ScriptHash instances. Used for property-based testing to generate valid test data.
Signature
export declare const arbitrary: FastCheck.Arbitrary<ScriptHash>Added in v2.0.0
computation
fromScript
Compute a script hash (policy id) from any Script variant.
Conway-era rule: prepend a 1-byte language tag to the script bytes, then hash with blake2b-224.
- 0x00: native/multisig (hash over CBOR of native_script)
- 0x01: Plutus V1 (hash over raw script bytes)
- 0x02: Plutus V2 (hash over raw script bytes)
- 0x03: Plutus V3 (hash over raw script bytes)
Signature
export declare const fromScript: (script: Script.Script) => ScriptHashAdded in v2.0.0
encoding
toBytes
Convert a ScriptHash to raw bytes.
Signature
export declare const toBytes: (a: ScriptHash, overrideOptions?: ParseOptions) => Uint8ArrayAdded in v2.0.0
toHex
Convert a ScriptHash to a hex string.
Signature
export declare const toHex: (a: ScriptHash, overrideOptions?: ParseOptions) => stringAdded in v2.0.0
parsing
fromBytes
Parse a ScriptHash from raw bytes. Expects exactly 28 bytes.
Signature
export declare const fromBytes: (i: Uint8Array, overrideOptions?: ParseOptions) => ScriptHashAdded in v2.0.0
fromHex
Parse a ScriptHash from a hex string. Expects exactly 56 hex characters (28 bytes).
Signature
export declare const fromHex: (i: string, overrideOptions?: ParseOptions) => ScriptHashAdded in v2.0.0
schemas
FromBytes
Schema for transforming between Uint8Array and ScriptHash.
Signature
export declare const FromBytes: Schema.transform<
Schema.SchemaClass<Uint8Array, Uint8Array, never>,
Schema.SchemaClass<ScriptHash, ScriptHash, never>
>Added in v2.0.0
FromHex
Schema for transforming between hex string and ScriptHash.
Signature
export declare const FromHex: Schema.transform<
Schema.filter<Schema.Schema<Uint8Array, string, never>>,
Schema.transform<Schema.SchemaClass<Uint8Array, Uint8Array, never>, Schema.SchemaClass<ScriptHash, ScriptHash, never>>
>Added in v2.0.0
ScriptHash (class)
Schema for ScriptHash representing a script hash credential.
script_hash = hash28Follows CIP-0019 binary representation.
Stores raw 28-byte value for performance.
Signature
export declare class ScriptHashAdded in v2.0.0
toJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): number