@sovryn-zero/lib-base
Version:
Sovryn Zero SDK shared interfaces
785 lines (699 loc) • 33.3 kB
Markdown
## API Report File for "@sovryn-zero/lib-base"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
// @internal (undocumented)
export class _CachedReadableLiquity<T extends unknown[]> implements _ReadableLiquityWithExtraParams<T> {
constructor(readable: _ReadableLiquityWithExtraParams<T>, cache: _LiquityReadCache<T>);
// (undocumented)
getCollateralSurplusBalance(address?: string, ...extraParams: T): Promise<Decimal>;
// (undocumented)
getFees(...extraParams: T): Promise<Fees>;
// (undocumented)
getFrontendStatus(address?: string, ...extraParams: T): Promise<FrontendStatus>;
// (undocumented)
getNumberOfTroves(...extraParams: T): Promise<number>;
// (undocumented)
getPrice(...extraParams: T): Promise<Decimal>;
// (undocumented)
getStabilityDeposit(address?: string, ...extraParams: T): Promise<StabilityDeposit>;
// (undocumented)
getTotal(...extraParams: T): Promise<Trove>;
// (undocumented)
getTotalRedistributed(...extraParams: T): Promise<Trove>;
// (undocumented)
getTotalStakedZERO(...extraParams: T): Promise<Decimal>;
// (undocumented)
getTrove(address?: string, ...extraParams: T): Promise<UserTrove>;
// (undocumented)
getTroveBeforeRedistribution(address?: string, ...extraParams: T): Promise<TroveWithPendingRedistribution>;
// (undocumented)
getTroves(params: TroveListingParams & {
beforeRedistribution: true;
}, ...extraParams: T): Promise<TroveWithPendingRedistribution[]>;
// (undocumented)
getTroves(params: TroveListingParams, ...extraParams: T): Promise<UserTrove[]>;
// (undocumented)
getZEROBalance(address?: string, ...extraParams: T): Promise<Decimal>;
// (undocumented)
getZEROStake(address?: string, ...extraParams: T): Promise<ZEROStake>;
// (undocumented)
getZUSDBalance(address?: string, ...extraParams: T): Promise<Decimal>;
// (undocumented)
getZUSDInStabilityPool(...extraParams: T): Promise<Decimal>;
}
// @internal (undocumented)
export type _CollateralChange<T> = (_CollateralDeposit<T> & _NoCollateralWithdrawal) | (_CollateralWithdrawal<T> & _NoCollateralDeposit);
// @internal (undocumented)
export type _CollateralDeposit<T> = {
depositCollateral: T;
};
// @public
export interface CollateralGainTransferDetails extends StabilityPoolGainsWithdrawalDetails {
newTrove: Trove;
}
// @internal (undocumented)
export type _CollateralWithdrawal<T> = {
withdrawCollateral: T;
};
// @public
export const CRITICAL_COLLATERAL_RATIO: Decimal;
// @internal (undocumented)
export type _DebtChange<T> = (_ZUSDBorrowing<T> & _NoZUSDRepayment) | (_ZUSDRepayment<T> & _NoZUSDBorrowing);
// @public
export class Decimal {
// @internal (undocumented)
get absoluteValue(): this;
// (undocumented)
add(addend: Decimalish): Decimal;
// @internal (undocumented)
get bigNumber(): string;
// (undocumented)
div(divider: Decimalish): Decimal;
// @internal (undocumented)
_divCeil(divider: Decimalish): Decimal;
// (undocumented)
eq(that: Decimalish): boolean;
// (undocumented)
get finite(): this | undefined;
// (undocumented)
static from(decimalish: Decimalish): Decimal;
// (undocumented)
static fromBigNumberString(bigNumberString: string): Decimal;
// (undocumented)
gt(that: Decimalish): boolean;
// (undocumented)
gte(that: Decimalish): boolean;
// (undocumented)
static readonly HALF: Decimal;
// @internal (undocumented)
get hex(): string;
// (undocumented)
get infinite(): this | undefined;
// (undocumented)
static readonly INFINITY: Decimal;
// (undocumented)
get isZero(): boolean;
// (undocumented)
lt(that: Decimalish): boolean;
// (undocumented)
lte(that: Decimalish): boolean;
// (undocumented)
static max(a: Decimalish, b: Decimalish): Decimal;
// (undocumented)
static min(a: Decimalish, b: Decimalish): Decimal;
// (undocumented)
mul(multiplier: Decimalish): Decimal;
// (undocumented)
mulDiv(multiplier: Decimalish, divider: Decimalish): Decimal;
// (undocumented)
get nonZero(): this | undefined;
// (undocumented)
static readonly ONE: Decimal;
// (undocumented)
pow(exponent: number): Decimal;
// (undocumented)
prettify(precision?: number): string;
// (undocumented)
shorten(): string;
// (undocumented)
sub(subtrahend: Decimalish): Decimal;
// (undocumented)
toString(precision?: number): string;
// (undocumented)
static readonly ZERO: Decimal;
// (undocumented)
get zero(): this | undefined;
}
// @public
export type Decimalish = Decimal | number | string;
// @alpha (undocumented)
export class Difference {
// (undocumented)
get absoluteValue(): Decimal | undefined;
// (undocumented)
static between(d1: Decimalish | undefined, d2: Decimalish | undefined): Difference;
// (undocumented)
get finite(): this | undefined;
// (undocumented)
get infinite(): this | undefined;
// (undocumented)
mul(multiplier: Decimalish): Difference;
// (undocumented)
get negative(): this | undefined;
// (undocumented)
get nonZero(): this | undefined;
// (undocumented)
get positive(): this | undefined;
// (undocumented)
prettify(precision?: number): string;
// (undocumented)
toString(precision?: number): string;
}
// @internal (undocumented)
export const _emptyTrove: Trove;
// @public
export type FailedReceipt<R = unknown> = {
status: "failed";
rawReceipt: R;
};
// @internal (undocumented)
export const _failedReceipt: <R>(rawReceipt: R) => FailedReceipt<R>;
// @public
export class Fees {
// @internal
constructor(baseRateWithoutDecay: Decimalish, minuteDecayFactor: Decimalish, beta: Decimalish, lastFeeOperation: Date, timeOfLatestBlock: Date, recoveryMode: boolean);
// @internal (undocumented)
baseRate(when?: Date): Decimal;
borrowingRate(when?: Date): Decimal;
equals(that: Fees): boolean;
redemptionRate(redeemedFractionOfSupply?: Decimalish, when?: Date): Decimal;
// @internal (undocumented)
_setRecoveryMode(recoveryMode: boolean): Fees;
// @internal (undocumented)
toString(): string;
}
// @public
export type FrontendStatus = {
status: "unregistered";
} | {
status: "registered";
kickbackRate: Decimal;
};
// @public
export interface LiquidationDetails {
collateralGasCompensation: Decimal;
liquidatedAddresses: string[];
totalLiquidated: Trove;
zusdGasCompensation: Decimal;
}
// @internal (undocumented)
export interface _LiquityReadCache<T extends unknown[]> extends _LiquityReadCacheBase<T> {
// (undocumented)
getTroves(params: TroveListingParams & {
beforeRedistribution: true;
}, ...extraParams: T): TroveWithPendingRedistribution[] | undefined;
// (undocumented)
getTroves(params: TroveListingParams, ...extraParams: T): UserTrove[] | undefined;
}
// @internal (undocumented)
export type _LiquityReadCacheBase<T extends unknown[]> = {
[P in keyof ReadableLiquity]: ReadableLiquity[P] extends (...args: infer A) => Promise<infer R> ? (...params: [...originalParams: A, ...extraParams: T]) => R | undefined : never;
};
// @public
export type LiquityReceipt<R = unknown, D = unknown> = PendingReceipt | MinedReceipt<R, D>;
// @public
export abstract class LiquityStore<T = unknown> {
// @internal (undocumented)
protected abstract _doStart(): () => void;
// @internal (undocumented)
protected _load(baseState: LiquityStoreBaseState, extraState?: T): void;
// @internal (undocumented)
protected _loaded: boolean;
logging: boolean;
onLoaded?: () => void;
// @internal (undocumented)
protected abstract _reduceExtra(extraState: T, extraStateUpdate: Partial<T>): T;
start(): () => void;
get state(): LiquityStoreState<T>;
subscribe(listener: (params: LiquityStoreListenerParams<T>) => void): () => void;
// @internal (undocumented)
protected _update(baseStateUpdate?: Partial<LiquityStoreBaseState>, extraStateUpdate?: Partial<T>): void;
}
// @public
export interface LiquityStoreBaseState {
accountBalance: Decimal;
collateralSurplusBalance: Decimal;
// @internal (undocumented)
_feesInNormalMode: Fees;
frontend: FrontendStatus;
nueBalance: Decimal;
numberOfTroves: number;
ownFrontend: FrontendStatus;
price: Decimal;
// @internal (undocumented)
_riskiestTroveBeforeRedistribution: TroveWithPendingRedistribution;
stabilityDeposit: StabilityDeposit;
total: Trove;
totalRedistributed: Trove;
totalStakedZERO: Decimal;
troveBeforeRedistribution: TroveWithPendingRedistribution;
zeroBalance: Decimal;
zeroStake: ZEROStake;
zusdBalance: Decimal;
zusdInStabilityPool: Decimal;
}
// @public
export interface LiquityStoreDerivedState {
borrowingRate: Decimal;
fees: Fees;
haveUndercollateralizedTroves: boolean;
redemptionRate: Decimal;
trove: UserTrove;
}
// @public
export interface LiquityStoreListenerParams<T = unknown> {
newState: LiquityStoreState<T>;
oldState: LiquityStoreState<T>;
stateChange: Partial<LiquityStoreState<T>>;
}
// @public
export type LiquityStoreState<T = unknown> = LiquityStoreBaseState & LiquityStoreDerivedState & T;
// @public
export const MAXIMUM_BORROWING_RATE: Decimal;
// @public
export type MinedReceipt<R = unknown, D = unknown> = FailedReceipt<R> | SuccessfulReceipt<R, D>;
// @public
export const MINIMUM_BORROWING_RATE: Decimal;
// @public
export const MINIMUM_COLLATERAL_RATIO: Decimal;
// @public
export const MINIMUM_REDEMPTION_RATE: Decimal;
// @internal (undocumented)
export type _NoCollateralChange = _NoCollateralDeposit & _NoCollateralWithdrawal;
// @internal (undocumented)
export type _NoCollateralDeposit = Partial<_CollateralDeposit<undefined>>;
// @internal (undocumented)
export type _NoCollateralWithdrawal = Partial<_CollateralWithdrawal<undefined>>;
// @internal (undocumented)
export type _NoDebtChange = _NoZUSDBorrowing & _NoZUSDRepayment;
// @internal (undocumented)
export const _normalizeTroveAdjustment: (params: Record<string, Decimalish | undefined>) => TroveAdjustmentParams<Decimal>;
// @internal (undocumented)
export const _normalizeTroveCreation: (params: Record<string, Decimalish | undefined>) => TroveCreationParams<Decimal>;
// @internal (undocumented)
export type _NoZUSDBorrowing = Partial<_ZUSDBorrowing<undefined>>;
// @internal (undocumented)
export type _NoZUSDRepayment = Partial<_ZUSDRepayment<undefined>>;
// @alpha (undocumented)
export interface ObservableLiquity {
// (undocumented)
watchNumberOfTroves(onNumberOfTrovesChanged: (numberOfTroves: number) => void): () => void;
// (undocumented)
watchPrice(onPriceChanged: (price: Decimal) => void): () => void;
// (undocumented)
watchStabilityDeposit(onStabilityDepositChanged: (stabilityDeposit: StabilityDeposit) => void, address?: string): () => void;
// (undocumented)
watchTotal(onTotalChanged: (total: Trove) => void): () => void;
// (undocumented)
watchTotalRedistributed(onTotalRedistributedChanged: (totalRedistributed: Trove) => void): () => void;
// (undocumented)
watchTroveWithoutRewards(onTroveChanged: (trove: TroveWithPendingRedistribution) => void, address?: string): () => void;
// (undocumented)
watchZUSDBalance(onZUSDBalanceChanged: (balance: Decimal) => void, address?: string): () => void;
// (undocumented)
watchZUSDInStabilityPool(onZUSDInStabilityPoolChanged: (zusdInStabilityPool: Decimal) => void): () => void;
}
// @public
export type PendingReceipt = {
status: "pending";
};
// @internal (undocumented)
export const _pendingReceipt: PendingReceipt;
// @alpha (undocumented)
export class Percent<T extends {
infinite?: T | undefined;
absoluteValue?: A | undefined;
mul?(hundred: 100): T;
toString(precision?: number): string;
}, A extends {
gte(n: string): boolean;
}> {
constructor(ratio: T);
// (undocumented)
nonZeroish(precision: number): this | undefined;
// (undocumented)
prettify(): string;
// (undocumented)
toString(precision: number): string;
}
// @internal (undocumented)
export type _PopulatableFrom<T, P> = {
[M in keyof T]: T[M] extends (...args: infer A) => Promise<infer U> ? U extends SentLiquityTransaction ? (...args: A) => Promise<PopulatedLiquityTransaction<P, U>> : never : never;
};
// Warning: (ae-incompatible-release-tags) The symbol "PopulatableLiquity" is marked as @public, but its signature references "_PopulatableFrom" which is marked as @internal
//
// @public
export interface PopulatableLiquity<R = unknown, S = unknown, P = unknown> extends _PopulatableFrom<SendableLiquity<R, S>, P> {
adjustTrove(params: TroveAdjustmentParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
borrowZUSD(amount: Decimalish, maxBorrowingRate?: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
claimCollateralSurplus(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
closeTrove(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveClosureDetails>>>>;
depositCollateral(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
depositZUSDInStabilityPool(amount: Decimalish, frontendTag?: string): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>>;
liquidate(address: string | string[]): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>>;
liquidateUpTo(maximumNumberOfTrovesToLiquidate: number): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>>;
openTrove(params: TroveCreationParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveCreationDetails>>>>;
redeemZUSD(amount: Decimalish, maxRedemptionRate?: Decimalish): Promise<PopulatedRedemption<P, S, R>>;
registerFrontend(kickbackRate: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
repayZUSD(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
sendZERO(toAddress: string, amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
sendZUSD(toAddress: string, amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
// @internal (undocumented)
setPrice(price: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
stakeZERO(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
transferCollateralGainToTrove(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, CollateralGainTransferDetails>>>>;
unstakeZERO(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
withdrawCollateral(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
withdrawGainsFromStabilityPool(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, StabilityPoolGainsWithdrawalDetails>>>>;
withdrawGainsFromStaking(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
withdrawZUSDFromStabilityPool(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>>;
}
// @public
export interface PopulatedLiquityTransaction<P = unknown, T extends SentLiquityTransaction = SentLiquityTransaction> {
readonly rawPopulatedTransaction: P;
send(): Promise<T>;
}
// @public
export interface PopulatedRedemption<P = unknown, S = unknown, R = unknown> extends PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, RedemptionDetails>>> {
readonly attemptedZUSDAmount: Decimal;
increaseAmountByMinimumNetDebt(maxRedemptionRate?: Decimalish): Promise<PopulatedRedemption<P, S, R>>;
readonly isTruncated: boolean;
readonly redeemableZUSDAmount: Decimal;
}
// @public
export interface ReadableLiquity {
getCollateralSurplusBalance(address?: string): Promise<Decimal>;
getFees(): Promise<Fees>;
getFrontendStatus(address?: string): Promise<FrontendStatus>;
getNumberOfTroves(): Promise<number>;
getPrice(): Promise<Decimal>;
getStabilityDeposit(address?: string): Promise<StabilityDeposit>;
getTotal(): Promise<Trove>;
getTotalRedistributed(): Promise<Trove>;
getTotalStakedZERO(): Promise<Decimal>;
getTrove(address?: string): Promise<UserTrove>;
getTroveBeforeRedistribution(address?: string): Promise<TroveWithPendingRedistribution>;
// @internal (undocumented)
getTroves(params: TroveListingParams & {
beforeRedistribution: true;
}): Promise<TroveWithPendingRedistribution[]>;
getTroves(params: TroveListingParams): Promise<UserTrove[]>;
getZEROBalance(address?: string): Promise<Decimal>;
getZEROStake(address?: string): Promise<ZEROStake>;
getZUSDBalance(address?: string): Promise<Decimal>;
getZUSDInStabilityPool(): Promise<Decimal>;
}
// @internal (undocumented)
export interface _ReadableLiquityWithExtraParams<T extends unknown[]> extends _ReadableLiquityWithExtraParamsBase<T> {
// (undocumented)
getTroves(params: TroveListingParams & {
beforeRedistribution: true;
}, ...extraParams: T): Promise<TroveWithPendingRedistribution[]>;
// (undocumented)
getTroves(params: TroveListingParams, ...extraParams: T): Promise<UserTrove[]>;
}
// @internal (undocumented)
export type _ReadableLiquityWithExtraParamsBase<T extends unknown[]> = {
[P in keyof ReadableLiquity]: ReadableLiquity[P] extends (...params: infer A) => infer R ? (...params: [...originalParams: A, ...extraParams: T]) => R : never;
};
// @public
export interface RedemptionDetails {
actualZUSDAmount: Decimal;
attemptedZUSDAmount: Decimal;
collateralTaken: Decimal;
fee: Decimal;
}
// @internal (undocumented)
export type _SendableFrom<T, R, S> = {
[M in keyof T]: T[M] extends (...args: infer A) => Promise<infer D> ? (...args: A) => Promise<SentLiquityTransaction<S, LiquityReceipt<R, D>>> : never;
};
// Warning: (ae-incompatible-release-tags) The symbol "SendableLiquity" is marked as @public, but its signature references "_SendableFrom" which is marked as @internal
//
// @public
export interface SendableLiquity<R = unknown, S = unknown> extends _SendableFrom<TransactableLiquity, R, S> {
adjustTrove(params: TroveAdjustmentParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
borrowZUSD(amount: Decimalish, maxBorrowingRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
claimCollateralSurplus(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
closeTrove(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveClosureDetails>>>;
depositCollateral(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
depositZUSDInStabilityPool(amount: Decimalish, frontendTag?: string): Promise<SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>;
liquidate(address: string | string[]): Promise<SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>;
liquidateUpTo(maximumNumberOfTrovesToLiquidate: number): Promise<SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>;
openTrove(params: TroveCreationParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveCreationDetails>>>;
redeemZUSD(amount: Decimalish, maxRedemptionRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, RedemptionDetails>>>;
registerFrontend(kickbackRate: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
repayZUSD(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
sendZERO(toAddress: string, amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
sendZUSD(toAddress: string, amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
// @internal (undocumented)
setPrice(price: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
stakeZERO(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
transferCollateralGainToTrove(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, CollateralGainTransferDetails>>>;
unstakeZERO(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
withdrawCollateral(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
withdrawGainsFromStabilityPool(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, StabilityPoolGainsWithdrawalDetails>>>;
withdrawGainsFromStaking(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
withdrawZUSDFromStabilityPool(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>;
}
// @public
export interface SentLiquityTransaction<S = unknown, T extends LiquityReceipt = LiquityReceipt> {
getReceipt(): Promise<T>;
readonly rawSentTransaction: S;
waitForReceipt(): Promise<Extract<T, MinedReceipt>>;
}
// @public
export class StabilityDeposit {
// @internal
constructor(initialZUSD: Decimal, currentZUSD: Decimal, collateralGain: Decimal, zeroReward: Decimal, frontendTag: string);
apply(change: StabilityDepositChange<Decimalish> | undefined): Decimal;
readonly collateralGain: Decimal;
readonly currentZUSD: Decimal;
equals(that: StabilityDeposit): boolean;
readonly frontendTag: string;
readonly initialZUSD: Decimal;
// (undocumented)
get isEmpty(): boolean;
// @internal (undocumented)
toString(): string;
whatChanged(thatZUSD: Decimalish): StabilityDepositChange<Decimal> | undefined;
readonly zeroReward: Decimal;
}
// @public
export type StabilityDepositChange<T> = {
depositZUSD: T;
withdrawZUSD?: undefined;
} | {
depositZUSD?: undefined;
withdrawZUSD: T;
withdrawAllZUSD: boolean;
};
// @public
export interface StabilityDepositChangeDetails extends StabilityPoolGainsWithdrawalDetails {
change: StabilityDepositChange<Decimal>;
}
// @public
export interface StabilityPoolGainsWithdrawalDetails {
collateralGain: Decimal;
newZUSDDeposit: Decimal;
zeroReward: Decimal;
zusdLoss: Decimal;
}
// @public
export type SuccessfulReceipt<R = unknown, D = unknown> = {
status: "succeeded";
rawReceipt: R;
details: D;
};
// @internal (undocumented)
export const _successfulReceipt: <R, D>(rawReceipt: R, details: D, toString?: (() => string) | undefined) => SuccessfulReceipt<R, D>;
// @public
export interface TransactableLiquity {
adjustTrove(params: TroveAdjustmentParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<TroveAdjustmentDetails>;
borrowZUSD(amount: Decimalish, maxBorrowingRate?: Decimalish): Promise<TroveAdjustmentDetails>;
claimCollateralSurplus(): Promise<void>;
closeTrove(): Promise<TroveClosureDetails>;
depositCollateral(amount: Decimalish): Promise<TroveAdjustmentDetails>;
depositZUSDInStabilityPool(amount: Decimalish, frontendTag?: string): Promise<StabilityDepositChangeDetails>;
liquidate(address: string | string[]): Promise<LiquidationDetails>;
liquidateUpTo(maximumNumberOfTrovesToLiquidate: number): Promise<LiquidationDetails>;
openTrove(params: TroveCreationParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<TroveCreationDetails>;
redeemZUSD(amount: Decimalish, maxRedemptionRate?: Decimalish): Promise<RedemptionDetails>;
registerFrontend(kickbackRate: Decimalish): Promise<void>;
repayZUSD(amount: Decimalish): Promise<TroveAdjustmentDetails>;
sendZERO(toAddress: string, amount: Decimalish): Promise<void>;
sendZUSD(toAddress: string, amount: Decimalish): Promise<void>;
// @internal (undocumented)
setPrice(price: Decimalish): Promise<void>;
stakeZERO(amount: Decimalish): Promise<void>;
transferCollateralGainToTrove(): Promise<CollateralGainTransferDetails>;
unstakeZERO(amount: Decimalish): Promise<void>;
withdrawCollateral(amount: Decimalish): Promise<TroveAdjustmentDetails>;
withdrawGainsFromStabilityPool(): Promise<StabilityPoolGainsWithdrawalDetails>;
withdrawGainsFromStaking(): Promise<void>;
withdrawZUSDFromStabilityPool(amount: Decimalish): Promise<StabilityDepositChangeDetails>;
}
// @public
export class TransactionFailedError<T extends FailedReceipt = FailedReceipt> extends Error {
// @internal
constructor(name: string, message: string, failedReceipt: T);
// (undocumented)
readonly failedReceipt: T;
}
// @public
export class Trove {
// @internal
constructor(collateral?: Decimal, debt?: Decimal);
// (undocumented)
add(that: Trove): Trove;
// (undocumented)
addCollateral(collateral: Decimalish): Trove;
// (undocumented)
addDebt(debt: Decimalish): Trove;
adjust(params: TroveAdjustmentParams<Decimalish>, borrowingRate?: Decimalish): Trove;
adjustTo(that: Trove, borrowingRate?: Decimalish): TroveAdjustmentParams<Decimal>;
apply(change: TroveChange<Decimal> | undefined, borrowingRate?: Decimalish): Trove;
readonly collateral: Decimal;
collateralRatio(price: Decimalish): Decimal;
collateralRatioIsBelowCritical(price: Decimalish): boolean;
collateralRatioIsBelowMinimum(price: Decimalish): boolean;
static create(params: TroveCreationParams<Decimalish>, borrowingRate?: Decimalish): Trove;
readonly debt: Decimal;
// (undocumented)
equals(that: Trove): boolean;
// (undocumented)
get isEmpty(): boolean;
isOpenableInRecoveryMode(price: Decimalish): boolean;
// (undocumented)
multiply(multiplier: Decimalish): Trove;
get netDebt(): Decimal;
// @internal (undocumented)
get _nominalCollateralRatio(): Decimal;
static recreate(that: Trove, borrowingRate?: Decimalish): TroveCreationParams<Decimal>;
// (undocumented)
setCollateral(collateral: Decimalish): Trove;
// (undocumented)
setDebt(debt: Decimalish): Trove;
// (undocumented)
subtract(that: Trove): Trove;
// (undocumented)
subtractCollateral(collateral: Decimalish): Trove;
// (undocumented)
subtractDebt(debt: Decimalish): Trove;
// @internal (undocumented)
toString(): string;
whatChanged(that: Trove, borrowingRate?: Decimalish): TroveChange<Decimal> | undefined;
}
// @public
export interface TroveAdjustmentDetails {
fee: Decimal;
newTrove: Trove;
params: TroveAdjustmentParams<Decimal>;
}
// Warning: (ae-incompatible-release-tags) The symbol "TroveAdjustmentParams" is marked as @public, but its signature references "_CollateralChange" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveAdjustmentParams" is marked as @public, but its signature references "_NoDebtChange" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveAdjustmentParams" is marked as @public, but its signature references "_DebtChange" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveAdjustmentParams" is marked as @public, but its signature references "_NoCollateralChange" which is marked as @internal
//
// @public
export type TroveAdjustmentParams<T = unknown> = (_CollateralChange<T> & _NoDebtChange) | (_DebtChange<T> & _NoCollateralChange) | (_CollateralChange<T> & _DebtChange<T>);
// @public
export type TroveChange<T> = {
type: "invalidCreation";
invalidTrove: Trove;
error: TroveCreationError;
} | {
type: "creation";
params: TroveCreationParams<T>;
} | {
type: "closure";
params: TroveClosureParams<T>;
} | {
type: "adjustment";
params: TroveAdjustmentParams<T>;
setToZero?: "collateral" | "debt";
};
// @public
export interface TroveClosureDetails {
params: TroveClosureParams<Decimal>;
}
// Warning: (ae-incompatible-release-tags) The symbol "TroveClosureParams" is marked as @public, but its signature references "_CollateralWithdrawal" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveClosureParams" is marked as @public, but its signature references "_NoCollateralDeposit" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveClosureParams" is marked as @public, but its signature references "_ZUSDRepayment" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveClosureParams" is marked as @public, but its signature references "_NoZUSDBorrowing" which is marked as @internal
//
// @public
export type TroveClosureParams<T> = _CollateralWithdrawal<T> & _NoCollateralDeposit & Partial<_ZUSDRepayment<T>> & _NoZUSDBorrowing;
// @public
export interface TroveCreationDetails {
fee: Decimal;
newTrove: Trove;
params: TroveCreationParams<Decimal>;
}
// @public
export type TroveCreationError = "missingLiquidationReserve";
// Warning: (ae-incompatible-release-tags) The symbol "TroveCreationParams" is marked as @public, but its signature references "_CollateralDeposit" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveCreationParams" is marked as @public, but its signature references "_NoCollateralWithdrawal" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveCreationParams" is marked as @public, but its signature references "_ZUSDBorrowing" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "TroveCreationParams" is marked as @public, but its signature references "_NoZUSDRepayment" which is marked as @internal
//
// @public
export type TroveCreationParams<T = unknown> = _CollateralDeposit<T> & _NoCollateralWithdrawal & _ZUSDBorrowing<T> & _NoZUSDRepayment;
// @public
export interface TroveListingParams {
readonly beforeRedistribution?: boolean;
readonly first: number;
readonly sortedBy: "ascendingCollateralRatio" | "descendingCollateralRatio";
readonly startingAt?: number;
}
// @public
export class TroveWithPendingRedistribution extends UserTrove {
// @internal
constructor(ownerAddress: string, status: UserTroveStatus, collateral?: Decimal, debt?: Decimal, stake?: Decimal, snapshotOfTotalRedistributed?: Trove);
// (undocumented)
applyRedistribution(totalRedistributed: Trove): UserTrove;
// (undocumented)
equals(that: TroveWithPendingRedistribution): boolean;
}
// @public
export class UserTrove extends Trove {
// @internal
constructor(ownerAddress: string, status: UserTroveStatus, collateral?: Decimal, debt?: Decimal);
// (undocumented)
equals(that: UserTrove): boolean;
readonly ownerAddress: string;
readonly status: UserTroveStatus;
// @internal (undocumented)
toString(): string;
}
// @public
export type UserTroveStatus = "nonExistent" | "open" | "closedByOwner" | "closedByLiquidation" | "closedByRedemption";
// @public
export class ZEROStake {
// @internal
constructor(stakedZERO?: Decimal, collateralGain?: Decimal, zusdGain?: Decimal);
apply(change: ZEROStakeChange<Decimalish> | undefined): Decimal;
readonly collateralGain: Decimal;
equals(that: ZEROStake): boolean;
// (undocumented)
get isEmpty(): boolean;
readonly stakedZERO: Decimal;
// @internal (undocumented)
toString(): string;
whatChanged(thatStakedZERO: Decimalish): ZEROStakeChange<Decimal> | undefined;
readonly zusdGain: Decimal;
}
// @public
export type ZEROStakeChange<T> = {
stakeZERO: T;
unstakeZERO?: undefined;
} | {
stakeZERO?: undefined;
unstakeZERO: T;
unstakeAllZERO: boolean;
};
// @public
export const ZUSD_LIQUIDATION_RESERVE: Decimal;
// @public
export const ZUSD_MINIMUM_DEBT: Decimal;
// @public
export const ZUSD_MINIMUM_NET_DEBT: Decimal;
// @internal (undocumented)
export type _ZUSDBorrowing<T> = {
borrowZUSD: T;
};
// @internal (undocumented)
export type _ZUSDRepayment<T> = {
repayZUSD: T;
};
// (No @packageDocumentation comment for this package)
```