CCC Docs
    Preparing search index...

    Hierarchy

    Index

    Constructors

    Properties

    codeHash: `0x${string}`
    hashType: HashType
    args: `0x${string}`
    byteLength?: number

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

    encode: (
        _: {} & { codeHash: BytesLike; hashType: HashTypeLike; args: BytesLike },
    ) => Bytes

    Encode the entity into bytes

    Type Declaration

    Will throw an error if the entity is not serializable

    decode: (_: BytesLike, _config?: { isExtraFieldIgnored?: boolean }) => Script

    Decode the entity from bytes

    Type Declaration

      • (_: BytesLike, _config?: { isExtraFieldIgnored?: boolean }): Script
      • Parameters

        • _: BytesLike

          The bytes to decode

        • Optional_config: { isExtraFieldIgnored?: boolean }

          The configuration for decoding, including whether to ignore extra fields

        Returns Script

        The decoded entity

    Will throw an error if the entity is not serializable

    fromBytes: (
        _bytes: BytesLike,
        _config?: { isExtraFieldIgnored?: boolean },
    ) => Script

    Create an entity from bytes

    Type Declaration

      • (_bytes: BytesLike, _config?: { isExtraFieldIgnored?: boolean }): Script
      • Parameters

        • _bytes: BytesLike
        • Optional_config: { isExtraFieldIgnored?: boolean }

          The configuration for decoding, including whether to ignore extra fields

        Returns Script

        The created entity

    Will throw an error if the entity is not serializable

    from: (
        _: {} & { codeHash: BytesLike; hashType: HashTypeLike; args: BytesLike },
    ) => Script

    Create an entity from a serializable object

    Type Declaration

    Will throw an error if the entity is not serializable

    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

      Returns boolean

      True if the scripts are equal, false otherwise

      const isEqual = script0.eq(script1);
      
    • 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..."
      );
    • 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

    • Convert the entity to a full-byte untrimmed Hex representation

      Returns `0x${string}`

      The entity full-byte untrimmed hexadecimal representation