@bitgo-beta/utxo-ord
Version:
Utilities for building ordinals with BitGo utxo-lib
65 lines • 2.31 kB
TypeScript
import { OrdOutput } from './OrdOutput';
/**
* A range constraint
*/
export declare class Constraint {
minValue: bigint;
maxValue: bigint;
/**
* @param minValue - inclusive
* @param maxValue - inclusive
*/
constructor(minValue: bigint, maxValue: bigint);
/** @return true iff value satisfies constraint */
check(v: bigint): boolean;
static ZERO: Constraint;
/** infinity for all practical purposes */
static MAXSAT: bigint;
}
declare type Parameters<T> = {
/** Padding preceding the inscription output */
firstChangeOutput: T;
/** The inscription output that will inherit the input inscription */
inscriptionOutput: T;
/** Padding following the inscription output */
secondChangeOutput: T;
/** Not a real output, used only to simplify calculations */
feeOutput: T;
};
/** @return canonical sequence of parameters */
export declare function toArray<T>(p: Parameters<T>): [T, T, T, T];
export declare function toParameters<T>(firstChangeOutput: T, inscriptionOutput: T, secondChangeOutput: T, feeOutput: T): Parameters<T>;
/** A finished output layout */
export declare type OutputLayout = Parameters<bigint>;
/**
* Translates a layout into OrdOutputs. Absent outputs are set to `null`.
*
* @param inscriptionInput
* @param layout
* @return OrdOutputs for layout
*/
export declare function getOrdOutputsForLayout(inscriptionInput: OrdOutput, layout: OutputLayout): Parameters<OrdOutput | null>;
/**
* High-level constraints for output layout
*/
export declare type SearchParams = {
minChangeOutput: bigint;
maxChangeOutput: bigint;
minInscriptionOutput: bigint;
maxInscriptionOutput: bigint;
feeFixed: bigint;
feePerOutput: bigint;
};
/**
* @param inscriptionInput
* @param minChangeOutput
* @param maxChangeOutput
* @param minInscriptionOutput
* @param maxInscriptionOutput
* @param feeFixed
* @param feePerOutput
* @return a solution that satisfies constraints. If no solution can be found, return `undefined`.
*/
export declare function findOutputLayout(inscriptionInput: OrdOutput, { minChangeOutput, maxChangeOutput, minInscriptionOutput, maxInscriptionOutput, feeFixed, feePerOutput }: SearchParams): OutputLayout | undefined;
export {};
//# sourceMappingURL=OutputLayout.d.ts.map