The capacity of the cell.
The lock script of the cell.
Optional
typeThe optional type script of the cell.
Static
Optional
byteThe bytes length of the entity, if it is fixed, otherwise undefined
Static
fromCreates 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. Can also be an object without capacity when outputData is provided.
Optional
outputData: 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
Clone a CellOutput.
A cloned CellOutput instance.
Static
encodeEncode the entity into bytes
The entity to encode
The encoded bytes
Static
decodeDecode the entity from bytes
The bytes to decode
The decoded entity
Static
fromCreate an entity from bytes
The created entity
Check if the entity is equal to another entity
The other entity to compare with
True if the entities are equal, false otherwise
Creates an instance of CellOutput.