CCC Docs
    Preparing search index...

    Class CellOutput

    Hierarchy

    Index
    • Creates an instance of CellOutput.

      Parameters

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

        The capacity of the cell.

      Returns CellOutput

    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, _context?: any) => CellOutput

    Decode the entity from bytes

    Type Declaration

    Will throw an error if the entity is not serializable

    fromBytes: (_bytes: BytesLike, _context?: any) => CellOutput

    Create an entity from bytes

    Type Declaration

    Will throw an error if the entity is not serializable

    • Creates a CellOutput instance from a CellOutputLike object.

      If outputData is provided, capacity is ensured to meet the occupied minimum. Valid instances are returned as-is, while invalid instances are reconstructed shallowly without mutating the original.

      Parameters

      • cellOutput: CellOutputLike

        A CellOutputLike object or an instance of CellOutput.

      • OptionaloutputData: BytesLike | null

        Optional output data for capacity verification.

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