Creates an instance of CellAny.
The cell output of the cell.
The output data of the cell.
OptionaloutPoint: OutPointThe optional output point of the cell. If provided, the cell is considered on-chain.
The cell output of the cell.
The output data of the cell.
Calculates the total occupied size of the cell in bytes.
This includes the size of the CellOutput structure plus the size of the outputData.
The total occupied size in bytes.
Calculates the free capacity of the cell. Free capacity is the total capacity minus the capacity occupied by the cell's structure and data.
The free capacity in shannons as a Num.
StaticfromCreates a CellAny instance from a CellAnyLike object.
This factory method provides a convenient way to create CellAny instances
from plain objects, automatically handling the optional outPoint or previousOutput.
A CellAnyLike object.
A new CellAny instance.
// Create an off-chain cell (e.g., a new output)
const offChainCell = CellAny.from({
cellOutput: { capacity: 1000n, lock: lockScript },
outputData: "0x"
});
// Create an on-chain cell from an input
const onChainCell = CellAny.from({
outPoint: { txHash: "0x...", index: 0 },
cellOutput: { capacity: 2000n, lock: lockScript },
outputData: "0x1234"
});
Checks if the cell is a Nervos DAO cell and optionally checks its phase.
A CKB client instance to fetch known script information.
Optionalphase: "deposited" | "withdrew"Optional phase to check: "deposited" or "withdrew". If omitted, it checks if the cell is a DAO cell regardless of phase.
A promise that resolves to true if the cell is a matching Nervos DAO cell, false otherwise.
Clones the CellAny instance.
A new CellAny instance that is a deep copy of the current one.
Represents a CKB cell that can be either on-chain (with an
outPoint) or off-chain (without anoutPoint). This class provides a unified interface for handling cells before they are included in a transaction, or for cells that are already part of the blockchain state.