CCC Docs
    Preparing search index...

    Hierarchy

    Index

    Constructors

    • Creates an instance of CellOutput.

      Parameters

      • capacity: bigint

        The capacity of the cell.

      • lock: Script

        The lock script of the cell.

      • Optionaltype: Script

        The optional type script of the cell.

      Returns CellOutput

    Properties

    capacity: bigint

    The capacity of the cell.

    lock: Script

    The lock script of the cell.

    type?: Script

    The optional type script of the cell.

    byteLength?: number

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

    Accessors

    Methods

    • Creates a CellOutput instance from a CellOutputLike object. This method supports automatic capacity calculation when capacity is 0 or omitted.

      Parameters

      • cellOutput: CellOutputLike

        A CellOutputLike object or an instance of CellOutput.

      • OptionaloutputData: null | BytesLike

        Optional output data used for automatic capacity calculation. When provided and capacity is 0, the capacity will be calculated as occupiedSize + outputData.length.

      Returns CellOutput

      A CellOutput instance.

      // Basic usage with explicit capacity
      const cellOutput1 = CellOutput.from({
      capacity: 1000n,
      lock: { codeHash: "0x...", hashType: "type", args: "0x..." },
      type: { codeHash: "0x...", hashType: "type", args: "0x..." }
      });

      // Automatic capacity calculation
      const cellOutput2 = CellOutput.from({
      lock: { codeHash: "0x...", hashType: "type", args: "0x..." }
      }, "0x1234"); // Capacity will be calculated automatically
    • Clone a CellOutput.

      Returns CellOutput

      A cloned CellOutput instance.

      const cellOutput1 = cellOutput0.clone();
      
    • 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 CellOutput

      The decoded entity

      Will throw an error if the entity is not serializable

    • Create an entity from bytes

      Parameters

      Returns CellOutput

      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

    • Check if the entity is equal to another entity

      Parameters

      Returns boolean

      True if the entities are equal, false otherwise

    • Calculate the hash of the entity

      Returns `0x${string}`

      The hash of the entity