CCC Docs
    Preparing search index...

    Hierarchy

    Index

    Constructors

    • Creates an instance of Script.

      Parameters

      • codeHash: `0x${string}`

        The code hash of the script.

      • hashType: HashType

        The hash type of the script.

      • args: `0x${string}`

        The arguments for the script.

      Returns Script

    Properties

    codeHash: `0x${string}`

    The code hash of the script.

    hashType: HashType

    The hash type of the script.

    args: `0x${string}`

    The arguments for the script.

    byteLength?: number

    The bytes length of the entity, if it is fixed, otherwise undefined

    Accessors

    Methods

    • Clone a script.

      Returns Script

      A cloned Script instance.

      const script1 = script0.clone();
      
    • Check if the script is equal to another script.

      Parameters

      • other: ScriptLike

        The other script to compare with

      Returns boolean

      True if the scripts are equal, false otherwise

      const isEqual = script0.eq(script1);
      
    • Creates a Script instance from a ScriptLike object.

      Parameters

      • script: ScriptLike

        A ScriptLike object or an instance of Script.

      Returns Script

      A Script instance.

      const script = Script.from({
      codeHash: "0x1234...",
      hashType: "type",
      args: "0xabcd..."
      });
    • Creates a Script instance from client and known script.

      Parameters

      • client: Client

        A ScriptLike object or an instance of Script.

      • knownScript: KnownScript

        A KnownScript enum.

      • args: BytesLike

        Args for the script.

      Returns Promise<Script>

      A promise that resolves to the script instance.

      const script = await Script.fromKnownScript(
      client,
      KnownScript.XUdt,
      args: "0xabcd..."
      );
    • Encode the entity into bytes

      Parameters

      Returns Bytes

      The encoded bytes

      Will throw an error if the entity is not serializable

    • Decode the entity from bytes

      Parameters

      Returns Script

      The decoded entity

      Will throw an error if the entity is not serializable

    • Create an entity from bytes

      Parameters

      Returns Script

      The created entity

      Will throw an error if the entity is not serializable

    • Convert the entity to bytes

      Returns Bytes

      The bytes representation of the entity

    • Calculate the hash of the entity

      Returns `0x${string}`

      The hash of the entity