Creates an instance of an on-chain Cell.
The output point of the cell.
The cell output of the cell.
The output data of the cell.
The cell output of the cell.
The output data of the cell.
The output point 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
.
Checks if the cell is a Nervos DAO cell and optionally checks its phase.
A CKB client instance to fetch known script information.
Optional
phase: "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.
Static
fromCreates a Cell instance from a CellLike object.
This method accepts either outPoint
or previousOutput
to specify the cell's location,
and supports automatic capacity calculation for the cell output.
A CellLike object or an instance of Cell. The object can use either:
- outPoint
: For referencing a cell output
- previousOutput
: For referencing a cell input (alternative name for outPoint)
The cellOutput can omit capacity for automatic calculation.
A Cell instance.
// Using outPoint with explicit capacity
const cell1 = Cell.from({
outPoint: { txHash: "0x...", index: 0 },
cellOutput: {
capacity: 1000n,
lock: { codeHash: "0x...", hashType: "type", args: "0x..." }
},
outputData: "0x"
});
// Using previousOutput with automatic capacity calculation
const cell2 = Cell.from({
previousOutput: { txHash: "0x...", index: 0 },
cellOutput: {
lock: { codeHash: "0x...", hashType: "type", args: "0x..." }
// capacity will be calculated automatically
},
outputData: "0x1234"
});
Gets confirmed Nervos DAO profit of a Cell It returns non-zero value only when the cell is in withdrawal phase 2 See https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0023-dao-deposit-withdraw/0023-dao-deposit-withdraw.md
A client for searching DAO related headers
Profit
Retrieves detailed information about a Nervos DAO cell, including its deposit and withdrawal headers.
A CKB client instance to fetch cell and header data.
A promise that resolves to an object containing header information.
- If not a DAO cell, returns {}
.
- If a deposited DAO cell, returns { depositHeader }
.
- If a withdrawn DAO cell, returns { depositHeader, withdrawHeader }
.
Represents an on-chain CKB cell, which is a
CellAny
that is guaranteed to have anoutPoint
. This class is typically used for cells that are already part of the blockchain state, such as transaction inputs.