import { ErrorCode } from "@ethersproject/logger"; import { CollateralGainTransferDetails, Decimal, Decimalish, LiquidationDetails, ARTHReceipt, MinedReceipt, PopulatableARTH, PopulatedARTHTransaction, PopulatedRedemption, RedemptionDetails, SentARTHTransaction, StabilityDepositChangeDetails, StabilityPoolGainsWithdrawalDetails, Trove, TroveAdjustmentDetails, TroveAdjustmentParams, TroveClosureDetails, TroveCreationDetails, TroveCreationParams } from "@mahadao/arth-base"; import { EthersPopulatedTransaction, EthersTransactionOverrides, EthersTransactionReceipt, EthersTransactionResponse } from "./types"; import { EthersARTHConnection } from "./EthersARTHConnection"; import { ReadableEthersARTH } from "./ReadableEthersARTH"; /** @internal */ export declare const _redeemMaxIterations = 70; /** @internal */ export declare enum _RawErrorReason { TRANSACTION_FAILED = "transaction failed", TRANSACTION_CANCELLED = "cancelled", TRANSACTION_REPLACED = "replaced", TRANSACTION_REPRICED = "repriced" } /** @internal */ export interface _RawTransactionReplacedError extends Error { code: ErrorCode.TRANSACTION_REPLACED; reason: _RawErrorReason.TRANSACTION_CANCELLED | _RawErrorReason.TRANSACTION_REPLACED | _RawErrorReason.TRANSACTION_REPRICED; cancelled: boolean; hash: string; replacement: EthersTransactionResponse; receipt: EthersTransactionReceipt; } /** * Thrown when a transaction is cancelled or replaced by a different transaction. * * @public */ export declare class EthersTransactionCancelledError extends Error { readonly rawReplacementReceipt: EthersTransactionReceipt; readonly rawError: Error; /** @internal */ constructor(rawError: _RawTransactionReplacedError); } /** * A transaction that has already been sent. * * @remarks * Returned by {@link SendableEthersARTH} functions. * * @public */ export declare class SentEthersARTHTransaction implements SentARTHTransaction> { /** Ethers' representation of a sent transaction. */ readonly rawSentTransaction: EthersTransactionResponse; private readonly _connection; private readonly _parse; /** @internal */ constructor(rawSentTransaction: EthersTransactionResponse, connection: EthersARTHConnection, parse: (rawReceipt: EthersTransactionReceipt) => T); private _receiptFrom; private _waitForRawReceipt; /** {@inheritDoc @mahadao/arth-base#SentARTHTransaction.getReceipt} */ getReceipt(): Promise>; /** * {@inheritDoc @mahadao/arth-base#SentARTHTransaction.waitForReceipt} * * @throws * Throws {@link EthersTransactionCancelledError} if the transaction is cancelled or replaced. */ waitForReceipt(): Promise>; } /** * Optional parameters of a transaction that borrows ARTH. * * @public */ export interface BorrowingOperationOptionalParams { /** * Maximum acceptable {@link @mahadao/arth-base#Fees.borrowingRate | borrowing rate} * (default: current borrowing rate plus 0.5%). */ maxBorrowingRate?: Decimalish; /** * Control the amount of extra gas included attached to the transaction. * * @remarks * Transactions that borrow ARTH must pay a variable borrowing fee, which is added to the Trove's * debt. This fee increases whenever a redemption occurs, and otherwise decays exponentially. * Due to this decay, a Trove's collateral ratio can end up being higher than initially calculated * if the transaction is pending for a long time. When this happens, the backend has to iterate * over the sorted list of Troves to find a new position for the Trove, which costs extra gas. * * The SDK can estimate how much the gas costs of the transaction may increase due to this decay, * and can include additional gas to ensure that it will still succeed, even if it ends up pending * for a relatively long time. This parameter specifies the length of time that should be covered * by the extra gas. * * Default: 10 minutes. */ borrowingFeeDecayToleranceMinutes?: number; } /** * A transaction that has been prepared for sending. * * @remarks * Returned by {@link PopulatableEthersARTH} functions. * * @public */ export declare class PopulatedEthersARTHTransaction implements PopulatedARTHTransaction> { /** Unsigned transaction object populated by Ethers. */ readonly rawPopulatedTransaction: EthersPopulatedTransaction; /** * Extra gas added to the transaction's `gasLimit` on top of the estimated minimum requirement. * * @remarks * Gas estimation is based on blockchain state at the latest block. However, most transactions * stay in pending state for several blocks before being included in a block. This may increase * the actual gas requirements of certain ARTH transactions by the time they are eventually * mined, therefore the ARTH SDK increases these transactions' `gasLimit` by default (unless * `gasLimit` is {@link EthersTransactionOverrides | overridden}). * * Note: even though the SDK includes gas headroom for many transaction types, currently this * property is only implemented for {@link PopulatableEthersARTH.openTrove | openTrove()}, * {@link PopulatableEthersARTH.adjustTrove | adjustTrove()} and its aliases. */ readonly gasHeadroom?: number; private readonly _connection; private readonly _parse; /** @internal */ constructor(rawPopulatedTransaction: EthersPopulatedTransaction, connection: EthersARTHConnection, parse: (rawReceipt: EthersTransactionReceipt) => T, gasHeadroom?: number); /** {@inheritDoc @mahadao/arth-base#PopulatedARTHTransaction.send} */ send(): Promise>; } /** * {@inheritDoc @mahadao/arth-base#PopulatedRedemption} * * @public */ export declare class PopulatedEthersRedemption extends PopulatedEthersARTHTransaction implements PopulatedRedemption { /** {@inheritDoc @mahadao/arth-base#PopulatedRedemption.attemptedARTHAmount} */ readonly attemptedARTHAmount: Decimal; /** {@inheritDoc @mahadao/arth-base#PopulatedRedemption.redeemableARTHAmount} */ readonly redeemableARTHAmount: Decimal; /** {@inheritDoc @mahadao/arth-base#PopulatedRedemption.isTruncated} */ readonly isTruncated: boolean; private readonly _increaseAmountByMinimumNetDebt?; /** @internal */ constructor(rawPopulatedTransaction: EthersPopulatedTransaction, connection: EthersARTHConnection, attemptedARTHAmount: Decimal, redeemableARTHAmount: Decimal, increaseAmountByMinimumNetDebt?: (maxRedemptionRate?: Decimalish) => Promise); /** {@inheritDoc @mahadao/arth-base#PopulatedRedemption.increaseAmountByMinimumNetDebt} */ increaseAmountByMinimumNetDebt(maxRedemptionRate?: Decimalish): Promise; } /** @internal */ export interface _TroveChangeWithFees { params: T; newTrove: Trove; fee: Decimal; } /** * Ethers-based implementation of {@link @mahadao/arth-base#PopulatableARTH}. * * @public */ export declare class PopulatableEthersARTH implements PopulatableARTH { private readonly _readable; constructor(readable: ReadableEthersARTH); private _wrapSimpleTransaction; private _wrapTroveChangeWithFees; private _wrapTroveClosure; private _wrapLiquidation; private _extractStabilityPoolGainsWithdrawalDetails; private _wrapStabilityPoolGainsWithdrawal; private _wrapStabilityDepositTopup; private _wrapStabilityDepositWithdrawal; private _wrapCollateralGainTransfer; private _findHintsForNominalCollateralRatio; private _findHints; private _findRedemptionHints; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.openTrove} */ openTrove(params: TroveCreationParams, maxBorrowingRateOrOptionalParams?: Decimalish | BorrowingOperationOptionalParams, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.closeTrove} */ closeTrove(overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.depositCollateral} */ depositCollateral(amount: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.withdrawCollateral} */ withdrawCollateral(amount: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.borrowARTH} */ borrowARTH(amount: Decimalish, maxBorrowingRate?: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.repayARTH} */ repayARTH(amount: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.adjustTrove} */ adjustTrove(params: TroveAdjustmentParams, maxBorrowingRateOrOptionalParams?: Decimalish | BorrowingOperationOptionalParams, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.claimCollateralSurplus} */ claimCollateralSurplus(overrides?: EthersTransactionOverrides): Promise>; /** @internal */ setPrice(price: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.liquidate} */ liquidate(address: string | string[], overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.liquidateUpTo} */ liquidateUpTo(maximumNumberOfTrovesToLiquidate: number, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.depositARTHInStabilityPool} */ depositARTHInStabilityPool(amount: Decimalish, frontendTag?: string, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.withdrawARTHFromStabilityPool} */ withdrawARTHFromStabilityPool(amount: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.withdrawGainsFromStabilityPool} */ withdrawGainsFromStabilityPool(overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.transferCollateralGainToTrove} */ transferCollateralGainToTrove(overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.sendARTH} */ sendARTH(toAddress: string, amount: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.sendMAHA} */ sendMAHA(toAddress: string, amount: Decimalish, overrides?: EthersTransactionOverrides): Promise>; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.redeemARTH} */ redeemARTH(amount: Decimalish, maxRedemptionRate?: Decimalish, overrides?: EthersTransactionOverrides): Promise; /** {@inheritDoc @mahadao/arth-base#PopulatableARTH.registerFrontend} */ registerFrontend(kickbackRate: Decimalish, overrides?: EthersTransactionOverrides): Promise>; } //# sourceMappingURL=PopulatableEthersARTH.d.ts.map