The capacity of the cell.
The lock script of the cell.
OptionaltypeThe optional type script of the cell.
Static OptionalbyteThe bytes length of the entity, if it is fixed, otherwise undefined
StaticfromCreates a CellOutput instance from a CellOutputLike object. This method supports automatic capacity calculation when capacity is 0 or omitted.
A CellOutputLike object or an instance of CellOutput.
OptionaloutputData: null | BytesLikeOptional output data used for automatic capacity calculation. When provided and capacity is 0, the capacity will be calculated as occupiedSize + outputData.length.
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
StaticencodeEncode the entity into bytes
The entity to encode
The encoded bytes
StaticdecodeDecode the entity from bytes
The bytes to decode
The decoded entity
StaticfromCheck if the entity is equal to another entity
The other entity to compare with
True if the entities are equal, false otherwise
Calculate the hash of the entity
The hash of the entity
Creates an instance of CellOutput.