UNPKG

@bitgo/utxo-ord

Version:

Utilities for building ordinals with BitGo utxo-lib

65 lines 2.3 kB
import { SatRange } from './SatRange'; export declare class InvalidOrdOutput extends Error { value: bigint; ordinals: SatRange[]; constructor(message: string, value: bigint, ordinals: SatRange[]); } /** * The ordinal metadata for an output */ export declare class OrdOutput { value: bigint; ordinals: SatRange[]; /** * @param value - the input value * @param ordinals - The ordinal ranges of an output, relative to the first satoshi. * Required to be ordered and non-overlapping. * Not required to be exhaustive. */ constructor(value: bigint, ordinals?: SatRange[]); /** * @param other * @return OrdOutput extended by other.value and SatRanges shifted by this.value */ joinedWith(other: OrdOutput): OrdOutput; /** * @param ords * @return single OrdOutput containing all SatRanges, shifted by preceding output values */ static joinAll(ords: OrdOutput[]): OrdOutput; asSatRange(): SatRange; /** * @param r * @return new OrdOutput with all ranges fully contained in _r_. SatRanges are aligned to new start. */ fromSatRange(r: SatRange): OrdOutput; /** * @param value * @return first OrdOutput with value `value`, second OrdOutput with remaining value. * With respective SatRanges */ splitAt(value: bigint): [OrdOutput, OrdOutput]; /** * Like splitAt but returns _null_ where a zero-sized OrdOutput would be * @param value */ splitAtAllowZero(value: bigint): [OrdOutput | null, OrdOutput | null]; /** * Split output successively at values. * @param values * @param exact - when set, ensure that value sum matches _this.value_ * @param allowZero - when set, return _null_ for zero-sized values * @return (OrdOutput | null)[]. Zero-sized outputs are substituted with _null_. */ splitAllWithParams(values: bigint[], { exact, allowZero }: { allowZero?: boolean; exact?: boolean; }): (OrdOutput | null)[]; /** * Split output successively at values. * @param values * @return OrdOutput[] with length _values.length + 1_ */ splitAll(values: bigint[]): OrdOutput[]; } //# sourceMappingURL=OrdOutput.d.ts.map