@bsv/wallet-toolbox-client
Version:
Client only Wallet Storage
72 lines • 2.19 kB
TypeScript
import { BlockHeader } from '../../../../sdk/WalletServices.interfaces';
export interface HeightRangeApi {
minHeight: number;
maxHeight: number;
}
export interface HeightRanges {
bulk: HeightRange;
live: HeightRange;
}
export declare class HeightRange implements HeightRangeApi {
minHeight: number;
maxHeight: number;
constructor(minHeight: number, maxHeight: number);
static readonly empty: HeightRange;
/**
* @param headers
* @returns range of height values from the given headers, or the empty range if there are no headers.
*/
static from(headers: BlockHeader[]): HeightRange;
get length(): number;
get isEmpty(): boolean;
toString(): string;
/**
* @param range HeightRange or single height value.
* @returns true if `range` is entirely within this range.
*/
contains(range: HeightRange | number): boolean;
/**
* Return the intersection with another height range.
*
* Intersection with an empty range is always empty.
*
* The result is always a single, possibly empty, range.
* @param range
* @returns
*/
intersect(range: HeightRange): HeightRange;
/**
* Return the union with another height range.
*
* Only valid if the two ranges overlap or touch, or one is empty.
*
* Throws an error if the union would create two disjoint ranges.
*
* @param range
* @returns
*/
union(range: HeightRange): HeightRange;
/**
* Returns `range` subtracted from this range.
*
* Throws an error if the subtraction would create two disjoint ranges.
*
* @param range
* @returns
*/
subtract(range: HeightRange): HeightRange;
/**
* If `range` is not empty and this is not empty, returns a new range minHeight
* replaced by to range.maxHeight + 1.
*
* Otherwise returns a copy of this range.
*
* This returns the portion of this range that is strictly above `range`.
*/
above(range: HeightRange): HeightRange;
/**
* Return a copy of this range.
*/
copy(): HeightRange;
}
//# sourceMappingURL=HeightRange.d.ts.map