The capacity of the cell.
OptionaltypeStatic OptionalbyteThe bytes length of the entity, if it is fixed, otherwise undefined
StaticencodeEncode the entity into bytes
The entity to encode
The encoded bytes
StaticdecodeDecode the entity from bytes
The bytes to decode
Optional_config: { isExtraFieldIgnored?: boolean }The configuration for decoding, including whether to ignore extra fields
The decoded entity
StaticfromCreate an entity from bytes
Optional_config: { isExtraFieldIgnored?: boolean }The configuration for decoding, including whether to ignore extra fields
The created entity
StaticfromCreates a CellOutput instance from a CellOutputLike object. This method supports automatic capacity calculation when outputData is provided and capacity is 0 or omitted.
A CellOutputLike object or an instance of CellOutput.
OptionaloutputData: BytesLike | nullOptional 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
StaticBaseGenerate a base class of CCC to create a serializable instance. This should be used with the codec decorator.
Check 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
Convert the entity to a full-byte untrimmed Hex representation
The entity full-byte untrimmed hexadecimal representation
StaticBaseGenerate a base class of CCC to create a serializable Union instance. This should be used with the codec decorator.
Creates an instance of CellOutput.