CCC Docs
    Preparing search index...

    Hierarchy

    Index

    Constructors

    • Creates an instance of CellOutput.

      Parameters

      • capacity: DecodedRecord<
            {
                capacity: Codec<NumLike, bigint>;
                lock: typeof Script;
                type: Codec<
                    | {} & {
                        codeHash: BytesLike;
                        hashType: HashTypeLike;
                        args: BytesLike;
                    }
                    | null
                    | undefined,
                    Script
                    | undefined,
                >;
            },
        >

        The capacity of the cell.

      Returns CellOutput

    Properties

    capacity: bigint
    lock: Script
    type?: Script
    byteLength?: number

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

    encode: (_: CellOutputLike) => Bytes

    Encode the entity into bytes

    Type Declaration

    Will throw an error if the entity is not serializable

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

    Decode the entity from bytes

    Type Declaration

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

        • _: BytesLike

          The bytes to decode

        • Optional_config: { isExtraFieldIgnored?: boolean }

          The configuration for decoding, including whether to ignore extra fields

        Returns CellOutput

        The decoded entity

    Will throw an error if the entity is not serializable

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

    Create an entity from bytes

    Type Declaration

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

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

          The configuration for decoding, including whether to ignore extra fields

        Returns CellOutput

        The created entity

    Will throw an error if the entity is not serializable

    Accessors

    Methods

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

      Parameters

      • cellOutput: CellOutputLike

        A CellOutputLike object or an instance of CellOutput.

      • OptionaloutputData: BytesLike | null

        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();
      
    • 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

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

      Returns `0x${string}`

      The entity full-byte untrimmed hexadecimal representation