import { ApiPromise } from "@polkadot/api"; import { AccountId } from "@polkadot/types/interfaces"; import { Currency, MonetaryAmount } from "@interlay/monetary-js"; import type { InterbtcPrimitivesVaultId } from "@polkadot/types/lookup"; import { VaultsAPI } from "./vaults"; import { CollateralCurrencyExt, ExtrinsicData, NominationStatus, WrappedCurrency } from "../types"; import { RewardsAPI } from "./rewards"; import { SubmittableExtrinsic } from "@polkadot/api/types"; import { ISubmittableResult } from "@polkadot/types/types"; export declare enum NominationAmountType { Raw = "raw", Parsed = "parsed" } export type NominationData = { nonce: number; vaultId: InterbtcPrimitivesVaultId; nominatorId: AccountId; amount: MonetaryAmount; }; export type RawNomination = NominationData & { type: NominationAmountType.Raw; }; export type Nomination = NominationData & { type: NominationAmountType.Parsed; }; export type NominationReward = NominationData; /** * @category BTC Bridge */ export interface NominationAPI { /** * @param vaultAccountId Vault to nominate collateral to * @param amount Amount to deposit, as a `Monetary.js` object or `ForeignAsset` * @returns {ExtrinsicData} A submittable extrinsic and an event that is emitted when extrinsic is submitted. */ depositCollateral(vaultAccountId: AccountId, amount: MonetaryAmount): ExtrinsicData; /** * @param vaultAccountId Vault that collateral was nominated to * @param amount Amount to withdraw, as a `Monetary.js` object or `ForeignAsset` * @returns {Promise} A submittable extrinsic and an event that is emitted when extrinsic is submitted. */ withdrawCollateral(vaultAccountId: AccountId, amount: MonetaryAmount): Promise; /** * @param collateralCurrency Currency to accept as nomination * @returns {ExtrinsicData} A submittable extrinsic and an event that is emitted when extrinsic is submitted. * @remarks Function callable by vaults to opt in to the nomination feature */ optIn(collateralCurrency: CollateralCurrencyExt): ExtrinsicData; /** * @param collateralCurrency Currency to stop accepting as nomination * @returns {ExtrinsicData} A submittable extrinsic and an event that is emitted when extrinsic is submitted. * @remarks Function callable by vaults to opt out of the nomination feature */ optOut(collateralCurrency: CollateralCurrencyExt): ExtrinsicData; /** * @returns {ExtrinsicData} A submittable extrinsic and an event that is emitted when extrinsic is submitted. * @remarks Testnet utility function */ setNominationEnabled(enabled: boolean): ExtrinsicData; /** * @returns A boolean value representing whether the vault nomination feature is enabled */ isNominationEnabled(): Promise; /** * @returns All nominations for the wrapped currency set in the API */ list(): Promise; /** * @param currency The currency of the nominations * @returns The rewards a nominator has accumulated, in wrapped token (e.g. interBTC, kBTC) */ listNominatorRewards(): Promise; /** * @returns A list of all vaults that opted in to the nomination feature. */ listVaults(): Promise; /** * @param A string representing the vault's account ID * @returns A boolean value */ isVaultOptedIn(accountId: AccountId, collateralCurrency: CollateralCurrencyExt): Promise; /** * @remarks At least one of the parameters must be specified * @param vaultAccountId Id of vault who is opted in to nomination * @param collateralCurrencyId The collateral currency of the nominations * @param nominatorId Id of user who nominated to one or more vaults */ getFilteredNominations(vaultAccountId?: AccountId, collateralCurrency?: CollateralCurrencyExt, nominatorId?: AccountId): Promise; /** * @remarks At least one of the parameters must be specified * @param vaultAccountId Id of vault who is opted in to nomination * @param collateralCurrency The collateral currency of the nominations * @param nominatorId Id of user who nominated to one or more vaults * @returns The total nominated amount, filtered using the given parameters */ getTotalNomination(vaultAccountId?: AccountId, collateralCurrency?: CollateralCurrencyExt, nominatorId?: AccountId): Promise>; /** * * @param nominatorId Id of user who nominated to one or more vaults * @returns The rewards a currently active nominator has accumulated */ getActiveNominatorRewards(nominatorId: AccountId): Promise; /** * @param vaultAccountId Id of nominated vault * @param collateralCurrency The currency towards whose issuance the nomination was made * @param rewardCurrency The reward currency, e.g. kBTC, KINT, interBTC, INTR * @param nominatorId Id of user who nominated to one or more vaults * @returns The rewards a (possibly inactive) nominator has accumulated */ getNominatorReward(vaultId: AccountId, collateralCurrency: CollateralCurrencyExt, rewardCurrency: Currency, nominatorId: AccountId): Promise>; /** * @returns A map (vaultId => nonce), representing the nonces for each reward pool with the given currency */ getNonces(): Promise>; } export declare class DefaultNominationAPI implements NominationAPI { private api; private wrappedCurrency; private vaultsAPI; private rewardsAPI; constructor(api: ApiPromise, wrappedCurrency: WrappedCurrency, vaultsAPI: VaultsAPI, rewardsAPI: RewardsAPI); static buildDepositCollateralExtrinsic(api: ApiPromise, vaultAccountId: AccountId, amount: MonetaryAmount, wrappedCurrency: Currency): SubmittableExtrinsic<"promise", ISubmittableResult>; depositCollateral(vaultAccountId: AccountId, amount: MonetaryAmount): ExtrinsicData; static buildWithdrawCollateralExtrinsic(api: ApiPromise, rewardsAPI: RewardsAPI, vaultAccountId: AccountId, amount: MonetaryAmount, wrappedCurrency: Currency, nonce?: number): Promise>; static buildWithdrawAllCollateralExtrinsic(api: ApiPromise, rewardsAPI: RewardsAPI, vaultAccountId: AccountId, collateralCurrency: Currency, wrappedCurrency: Currency, nonce?: number): Promise>; withdrawCollateral(vaultAccountId: AccountId, amount: MonetaryAmount, nonce?: number): Promise; optIn(collateralCurrency: CollateralCurrencyExt): ExtrinsicData; optOut(collateralCurrency: CollateralCurrencyExt): ExtrinsicData; setNominationEnabled(enabled: boolean): ExtrinsicData; isNominationEnabled(): Promise; getNonces(): Promise>; listAllNominations(): Promise; listNominatorRewards(): Promise; getActiveNominatorRewards(nominatorId: AccountId): Promise; getNominatorReward(vaultId: AccountId, collateralCurrency: CollateralCurrencyExt, rewardCurrency: Currency): Promise>; list(): Promise; getFilteredNominations(vaultId?: AccountId, collateralCurrency?: CollateralCurrencyExt, nominatorId?: AccountId): Promise; getNominationStatus(vaultId: AccountId, collateralCurrency: CollateralCurrencyExt, nominatorId: AccountId): Promise; getTotalNomination(vaultId?: AccountId, collateralCurrency?: CollateralCurrencyExt, nominatorId?: AccountId): Promise>; listVaults(): Promise; isVaultOptedIn(accountId: AccountId, collateralCurrency: CollateralCurrencyExt): Promise; }