import { ApiPromise } from "@polkadot/api";
import { AccountId, BlockHash } from "@polkadot/types/interfaces";
import Big from "big.js";
import { Network } from "bitcoinjs-lib";
import { MonetaryAmount, Currency, BitcoinUnit } from "@interlay/monetary-js";
import { InterbtcPrimitivesVaultId, VaultRegistryVault } from "@polkadot/types/lookup";
import { TokensAPI } from "./tokens";
import { OracleAPI } from "./oracle";
import { FeeAPI } from "./fee";
import { TransactionAPI } from "./transaction";
import { ElectrsAPI } from "../external";
import { CollateralUnit, VaultExt, SystemVaultExt, CollateralCurrency, WrappedCurrency, CurrencyIdLiteral, WrappedIdLiteral, CollateralIdLiteral, GovernanceUnit, CurrencyUnit, GovernanceIdLiteral, GovernanceCurrency } from "../types";
import { RewardsAPI } from "./rewards";
import { SystemAPI } from ".";
/**
 * @category BTC Bridge
 */
export interface VaultsAPI {
    /**
     * @returns An array containing the vaults with non-zero backing collateral
     */
    list(atBlock?: BlockHash): Promise<VaultExt<BitcoinUnit>[]>;
    /**
     * @param vaultAccountId The ID of the vault to fetch
     * @param collateralCurrencyIdLiteral Collateral used by vault
     * @returns A vault object
     */
    get(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CurrencyIdLiteral): Promise<VaultExt<BitcoinUnit>>;
    /**
     * Get the collateralization of a single vault measured by dividing the value of issued (wrapped) tokens
     * by the value of total locked collateral.
     *
     * @remarks Undefined collateralization is handled as infinite collateralization in the UI.
     * If no tokens have been issued, the `collateralFunds / issuedFunds` ratio divides by zero,
     * which means collateralization is infinite.
     * @param vaultAccountId the vault account id
     * @param collateralCurrencyIdLiteral Collateral used by vault
     * @param newCollateral use this instead of the vault's actual collateral
     * @param onlyIssued optional, defaults to `false`. Specifies whether the collateralization
     * should only include the issued tokens, leaving out unsettled ("to-be-issued") tokens
     * @returns the vault collateralization
     */
    getVaultCollateralization<C extends CollateralUnit>(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral, newCollateral?: MonetaryAmount<Currency<C>, C>, onlyIssued?: boolean): Promise<Big | undefined>;
    /**
     * Get the amount of collateral required for the given vault to be at the
     * current SecureCollateralThreshold with the current exchange rate
     *
     * @param vaultAccountId The vault account ID
     * @param collateralCurrency The currency specification, a `Monetary.js` object
     * @returns The required collateral the vault needs to deposit to stay
     * above the threshold limit
     */
    getRequiredCollateralForVault<C extends CollateralUnit>(vaultAccountId: AccountId, collateralCurrency: Currency<C>): Promise<MonetaryAmount<Currency<C>, C>>;
    /**
     * @param vaultAccountId The vault account ID
     * @param collateralCurrency The currency specification, a `Monetary.js` object
     * @returns The amount of wrapped tokens issued by the given vault
     */
    getIssuedAmount(vaultAccountId: AccountId, collateralCurrency: CurrencyIdLiteral): Promise<MonetaryAmount<WrappedCurrency, BitcoinUnit>>;
    /**
     * @returns The total amount of wrapped tokens issued by the vaults
     */
    getTotalIssuedAmount(): Promise<MonetaryAmount<WrappedCurrency, BitcoinUnit>>;
    /**
     * @returns The total amount of wrapped tokens that can be issued, considering the collateral
     * locked by the vaults
     */
    getTotalIssuableAmount(): Promise<MonetaryAmount<WrappedCurrency, BitcoinUnit>>;
    /**
     * @param collateral Amount of collateral to calculate issuable capacity for
     * @returns Issuable amount by the vault, given the collateral amount
     */
    calculateCapacity<C extends CollateralUnit>(collateral: MonetaryAmount<Currency<C>, C>): Promise<MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>;
    /**
     * @param amount Wrapped tokens amount to issue
     * @returns A vault that has sufficient collateral to issue the given amount
     */
    selectRandomVaultIssue(amount: MonetaryAmount<WrappedCurrency, BitcoinUnit>): Promise<InterbtcPrimitivesVaultId>;
    /**
     * @param amount Wrapped tokens amount to redeem
     * @returns A vault that has issued sufficient wrapped tokens to redeem the given amount
     */
    selectRandomVaultRedeem(amount: MonetaryAmount<WrappedCurrency, BitcoinUnit>): Promise<InterbtcPrimitivesVaultId>;
    /**
     * @returns Vaults below the premium redeem threshold, sorted in descending order of their redeemable tokens
     */
    getPremiumRedeemVaults(): Promise<Map<InterbtcPrimitivesVaultId, MonetaryAmount<WrappedCurrency, BitcoinUnit>>>;
    /**
     * @returns Vaults with issuable tokens, not sorted in any particular order.
     * @remarks The result is not sorted as an attempt to randomize the assignment of requests to vaults.
     */
    getVaultsWithIssuableTokens(): Promise<Map<InterbtcPrimitivesVaultId, MonetaryAmount<WrappedCurrency, BitcoinUnit>>>;
    /**
     * @returns Vaults with redeemable tokens, sorted in descending order.
     */
    getVaultsWithRedeemableTokens(): Promise<Map<InterbtcPrimitivesVaultId, MonetaryAmount<WrappedCurrency, BitcoinUnit>>>;
    /**
     * @param vaultAccountId The vault account ID
     * @param collateralCurrency The currency specification, a `Monetary.js` object
     * @param btcTxId ID of the Bitcoin transaction to check
     * @returns A bollean value
     */
    isVaultFlaggedForTheft(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral, btcTxId: string): Promise<boolean>;
    /**
     * @param collateralCurrency
     * @returns The lower bound for vault collateralization.
     * If a Vault’s collateral rate
     * drops below this, automatic liquidation (forced Redeem) is triggered.
     */
    getLiquidationCollateralThreshold(collateralCurrency: CollateralCurrency): Promise<Big>;
    /**
     * @param collateralCurrency
     * @returns The collateral rate at which users receive
     * a premium allocated from the Vault’s collateral, when performing a redeem with this Vault.
     */
    getPremiumRedeemThreshold(collateralCurrency: CollateralCurrency): Promise<Big>;
    /**
     * @param collateralCurrency
     * @returns The over-collateralization rate for collateral locked
     * by Vaults, necessary for issuing wrapped tokens
     */
    getSecureCollateralThreshold(collateralCurrency: CollateralCurrency): Promise<Big>;
    /**
     * Get the total APY for a vault based on the income in wrapped and collateral tokens
     * divided by the locked collateral.
     *
     * @note this does not account for interest compounding
     *
     * @param vaultAccountId The vault account ID
     * @param collateralCurrency The currency specification, a `Monetary.js` object
     * @param governanceCurrency The governance currency we're using for block rewards
     * @returns the APY as a percentage string
     */
    getAPY(vaultAccountId: AccountId, collateralCurrency: CurrencyIdLiteral): Promise<Big>;
    /**
     * Gets the estimated APY for just the block rewards (in governance tokens).
     * @param vaultAccountId: the vault account ID
     * @param nominatorId: an account nominating this vault
     * @param collateralCurrency: the vault's collateral currency
     * @param governanceCurrency: the governance token that block rewards are paid in
     * @returns the APY as a percentage string
     */
    getBlockRewardAPY(vaultAccountId: AccountId, nominatorId: AccountId, collateralCurrency: CollateralIdLiteral, governanceCurrency: GovernanceIdLiteral): Promise<Big>;
    /**
     * @returns Fee that a Vault has to pay, as a percentage, if it fails to execute
     * redeem or replace requests (for redeem, on top of the slashed wrapped-token-to-collateral
     * value of the request). The fee is paid in collateral currency based on the wrapped token
     * amount at the current exchange rate.
     */
    getPunishmentFee(): Promise<Big>;
    /**
     * @param amount The amount of collateral to withdraw
     */
    withdrawCollateral<C extends CollateralUnit>(amount: MonetaryAmount<Currency<C>, C>): Promise<void>;
    /**
     * @param amount The amount of extra collateral to lock
     */
    depositCollateral<C extends CollateralUnit>(amount: MonetaryAmount<Currency<C>, C>): Promise<void>;
    /**
     * @param collateralCurrency
     * @returns A vault object representing the liquidation vault
     */
    getLiquidationVault(collateralCurrency: CollateralCurrency): Promise<SystemVaultExt<BitcoinUnit>>;
    /**
     * @param vaultAccountId The vault account ID
     * @param collateralCurrency The currency specification, a `Monetary.js` object
     * @returns The collateral of a vault, taking slashes into account.
     */
    getCollateral(vaultId: AccountId, collateralCurrencyIdLiteral: CurrencyIdLiteral): Promise<MonetaryAmount<Currency<CollateralUnit>, CollateralUnit>>;
    /**
     * @param collateralCurrency The collateral currency specification, a `Monetary.js` object
     * @returns The maximum collateral a vault can accept as nomination, as a ratio of its own collateral
     */
    getMaxNominationRatio(collateralCurrency: CollateralCurrency): Promise<Big>;
    /**
     * @param vaultAccountId The vault account ID
     * @param collateralCurrency The currency specification, a `Monetary.js` object
     * @returns Staking capacity, as a collateral currency (e.g. DOT)
     */
    getStakingCapacity(vaultAccountId: AccountId, collateralCurrency: CurrencyIdLiteral): Promise<MonetaryAmount<Currency<CollateralUnit>, CollateralUnit>>;
    /**
     * @param vaultId Vault ID object
     * @param nonce Nonce of the staking pool
     * @returns The entire collateral backing a vault's issued tokens.
     */
    computeBackingCollateral(vaultId: InterbtcPrimitivesVaultId, nonce?: number): Promise<MonetaryAmount<Currency<CollateralUnit>, CollateralUnit>>;
    /**
     * A relayer may report Vault misbehavior by providing a fraud proof
     * (malicious Bitcoin transaction and transaction inclusion proof).
     * @remarks If `txId` is not set, the `merkleProof` and `rawTx` must both be set.
     *
     * @param vaultId The account of the vault to check.
     * @param btcTxId Bitcoin transaction ID
     */
    reportVaultTheft(vaultAccountId: AccountId, btcTxId: string): Promise<void>;
    /**
     * @returns The wrapped currency issued by the vaults
     */
    getWrappedCurrency(): WrappedCurrency;
    /**
     * Compute the total reward, including the staking (local) pool and the rewards (global) pool
     * @param vaultAccountId The vault ID whose reward pool to check
     * @param nominatorId The account ID of the staking pool nominator
     * @param vaultCollateralIdLiteral Collateral used by the vault. This is the currency used as
     * stake in the `staking` and `rewards` pools.
     * @param rewardCurrencyIdLiteral The reward currency, e.g. kBTC, KINT, interBTC, INTR
     * @returns A Monetary.js amount object, representing the total reward in the given currency
     */
    computeReward(vaultAccountId: AccountId, nominatorId: AccountId, collateralCurrencyId: CollateralIdLiteral, rewardCurrencyIdLiteral: CurrencyIdLiteral, nonce?: number): Promise<MonetaryAmount<Currency<CurrencyUnit>, CurrencyUnit>>;
    /**
     * @param vaultAccountId The vault ID whose reward pool to check
     * @param vaultCollateralIdLiteral Collateral used by the vault
     * @param rewardCurrencyIdLiteral The fee reward currency
     * @returns The total reward collected by the vault
     */
    getWrappedReward(vaultAccountId: AccountId, vaultCollateralIdLiteral: CollateralIdLiteral, rewardCurrencyIdLiteral: WrappedIdLiteral): Promise<MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>;
    /**
     * @param vaultAccountId The vault ID whose reward pool to check
     * @param vaultCollateralIdLiteral Collateral used by the vault
     * @param governanceCurrencyIdLiteral The fee reward currency
     * @returns The total reward collected by the vault
     */
    getGovernanceReward(vaultAccountId: AccountId, vaultCollateralIdLiteral: CollateralIdLiteral, governanceCurrencyIdLiteral: GovernanceIdLiteral): Promise<MonetaryAmount<Currency<GovernanceUnit>, GovernanceUnit>>;
    /**
     * Enables or disables issue requests for given vault
     * @param vaultId The vault ID whose issuing will be toggled
     * @param acceptNewIssues Boolean denoting whether issuing should be enabled or not
     */
    toggleIssueRequests(vaultId: InterbtcPrimitivesVaultId, acceptNewIssues: boolean): Promise<void>;
}
export declare class DefaultVaultsAPI implements VaultsAPI {
    private api;
    private btcNetwork;
    private electrsAPI;
    private wrappedCurrency;
    private governanceCurrency;
    private tokensAPI;
    private oracleAPI;
    private feeAPI;
    private rewardsAPI;
    private systemAPI;
    private transactionAPI;
    constructor(api: ApiPromise, btcNetwork: Network, electrsAPI: ElectrsAPI, wrappedCurrency: WrappedCurrency, governanceCurrency: GovernanceCurrency, tokensAPI: TokensAPI, oracleAPI: OracleAPI, feeAPI: FeeAPI, rewardsAPI: RewardsAPI, systemAPI: SystemAPI, transactionAPI: TransactionAPI);
    getWrappedCurrency(): WrappedCurrency;
    register<C extends CollateralUnit>(amount: MonetaryAmount<Currency<C>, C>, publicKey: string): Promise<void>;
    withdrawCollateral<C extends CollateralUnit>(amount: MonetaryAmount<Currency<C>, C>): Promise<void>;
    depositCollateral<C extends CollateralUnit>(amount: MonetaryAmount<Currency<C>, C>): Promise<void>;
    list(atBlock?: BlockHash): Promise<VaultExt<BitcoinUnit>[]>;
    get(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral): Promise<VaultExt<BitcoinUnit>>;
    getCollateral(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral): Promise<MonetaryAmount<Currency<CollateralUnit>, CollateralUnit>>;
    getMaxNominationRatio(collateralCurrency: CollateralCurrency): Promise<Big>;
    computeBackingCollateral(vaultId: InterbtcPrimitivesVaultId, nonce?: number): Promise<MonetaryAmount<Currency<CollateralUnit>, CollateralUnit>>;
    backingCollateralProportion(vaultAccountId: AccountId, nominatorId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral): Promise<Big>;
    getBlockRewardAPY(vaultAccountId: AccountId, nominatorId: AccountId, collateralCurrency: CollateralIdLiteral, governanceCurrency: GovernanceIdLiteral): Promise<Big>;
    computeReward(vaultAccountId: AccountId, nominatorId: AccountId, collateralCurrencyId: CollateralIdLiteral, rewardCurrencyIdLiteral: CurrencyIdLiteral, nonce?: number): Promise<MonetaryAmount<Currency<CurrencyUnit>, CurrencyUnit>>;
    getWrappedReward(vaultAccountId: AccountId, collateralCurrency: CollateralIdLiteral): Promise<MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>;
    getGovernanceReward(vaultAccountId: AccountId, vaultCollateralIdLiteral: CollateralIdLiteral, governanceCurrencyIdLiteral: GovernanceIdLiteral): Promise<MonetaryAmount<Currency<GovernanceUnit>, GovernanceUnit>>;
    getStakingCapacity(vaultAccountId: AccountId, collateralCurrency: CollateralIdLiteral): Promise<MonetaryAmount<Currency<CollateralUnit>, CollateralUnit>>;
    getLiquidationVault(collateralCurrency: CollateralCurrency): Promise<SystemVaultExt<BitcoinUnit>>;
    private isNoTokensIssuedError;
    isBelowPremiumThreshold(vaultId: InterbtcPrimitivesVaultId): Promise<boolean>;
    getVaultCollateralization<C extends CollateralUnit>(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral, newCollateral?: MonetaryAmount<Currency<C>, C>, onlyIssued?: boolean): Promise<Big | undefined>;
    getCollateralizationFromVault(vaultId: InterbtcPrimitivesVaultId, onlyIssued?: boolean): Promise<Big>;
    getCollateralizationFromVaultAndCollateral<C extends CollateralUnit>(vaultId: InterbtcPrimitivesVaultId, newCollateral: MonetaryAmount<Currency<C>, C>, onlyIssued: boolean): Promise<Big>;
    getSystemCollateralization(): Promise<Big | undefined>;
    getRequiredCollateralForVault<C extends CollateralUnit>(vaultAccountId: AccountId, currency: Currency<C>): Promise<MonetaryAmount<Currency<C>, C>>;
    getRequiredCollateralForWrapped<C extends CollateralUnit>(wrappedAmount: MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>, currency: Currency<C>): Promise<MonetaryAmount<Currency<C>, C>>;
    getIssuedAmount(vaultAccountId: AccountId, collateralCurrency: CollateralIdLiteral): Promise<MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>;
    getTotalIssuedAmount(): Promise<MonetaryAmount<WrappedCurrency, BitcoinUnit>>;
    getTotalIssuableAmount(): Promise<MonetaryAmount<WrappedCurrency, BitcoinUnit>>;
    calculateCapacity<C extends CollateralUnit>(collateral: MonetaryAmount<Currency<C>, C>): Promise<MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>;
    selectRandomVaultIssue(amount: MonetaryAmount<WrappedCurrency, BitcoinUnit>): Promise<InterbtcPrimitivesVaultId>;
    selectRandomVaultRedeem(amount: MonetaryAmount<WrappedCurrency, BitcoinUnit>): Promise<InterbtcPrimitivesVaultId>;
    getPremiumRedeemVaults(): Promise<Map<InterbtcPrimitivesVaultId, MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>>;
    getVaultsWithIssuableTokens(): Promise<Map<InterbtcPrimitivesVaultId, MonetaryAmount<Currency<BitcoinUnit>, BitcoinUnit>>>;
    private isVaultEligibleForRedeem;
    private getVaultsEligibleForRedeeming;
    getVaultsWithRedeemableTokens(): Promise<Map<InterbtcPrimitivesVaultId, MonetaryAmount<WrappedCurrency, BitcoinUnit>>>;
    isVaultFlaggedForTheft(vaultAccountId: AccountId, collateralCurrencyIdLiteral: CollateralIdLiteral, btcTxId: string): Promise<boolean>;
    getLiquidationCollateralThreshold(collateralCurrency: CollateralCurrency): Promise<Big>;
    getPremiumRedeemThreshold(collateralCurrency: CollateralCurrency): Promise<Big>;
    getSecureCollateralThreshold(collateralCurrency: CollateralCurrency): Promise<Big>;
    getAPY(vaultAccountId: AccountId, collateralCurrency: CollateralIdLiteral): Promise<Big>;
    getPunishmentFee(): Promise<Big>;
    private wrapCurrency;
    private unwrapCurrency;
    private parseVaultStatus;
    parseVault(vault: VaultRegistryVault, network: Network): Promise<VaultExt<BitcoinUnit>>;
    reportVaultTheft(vaultAccountId: AccountId, btcTxId: string): Promise<void>;
    toggleIssueRequests(vaultId: InterbtcPrimitivesVaultId, acceptNewIssues: boolean): Promise<void>;
}
