@bombearn/sdk
Version:
Interaction framework for the yearn protocol
205 lines (204 loc) • 7.79 kB
TypeScript
import { ChainId } from "../chain";
import { ServiceInterface } from "../common";
import { Address, Balance, Integer, Position, Token, TokenAllowance, TransactionOutcome, VotingEscrow, VotingEscrowDynamic, VotingEscrowStatic, VotingEscrowTransactionType, VotingEscrowUserMetadata, WriteTransactionProps, WriteTransactionResult } from "../types";
interface ApproveLockProps extends WriteTransactionProps {
accountAddress: Address;
tokenAddress: Address;
votingEscrowAddress: Address;
amount?: Integer;
}
interface LockProps extends WriteTransactionProps {
accountAddress: Address;
tokenAddress: Address;
votingEscrowAddress: Address;
amount: Integer;
time: number;
}
interface IncreaseLockAMountProps extends WriteTransactionProps {
accountAddress: Address;
votingEscrowAddress: Address;
amount: Integer;
}
interface ExtendLockTimeProps extends WriteTransactionProps {
accountAddress: Address;
votingEscrowAddress: Address;
time: number;
}
interface WithdrawUnlockedProps extends WriteTransactionProps {
accountAddress: Address;
votingEscrowAddress: Address;
}
interface WithdrawLockedProps extends WriteTransactionProps {
accountAddress: Address;
votingEscrowAddress: Address;
}
interface ClaimRewardsProps extends WriteTransactionProps {
accountAddress: Address;
votingEscrowAddress: Address;
}
export declare class VotingEscrowInterface<T extends ChainId> extends ServiceInterface<T> {
/**
* Get all Voting Escrow assets
* @param addresses filter, if not provided, all are returned
* @returns VotingEscrow array
*/
get({ addresses }: {
addresses?: Address[];
}): Promise<VotingEscrow[]>;
/**
* Get static properties of Voting Escrows
* @param addresses filter, if not provided, all are returned
* @returns VotingEscrowStatic array
*/
getStatic({ addresses }: {
addresses?: Address[];
}): Promise<VotingEscrowStatic[]>;
/**
* Get dynamic properties of Voting Escrows
* @param addresses filter, if not provided, all are returned
* @returns VotingEscrowDynamic array
*/
getDynamic({ addresses }: {
addresses?: Address[];
}): Promise<VotingEscrowDynamic[]>;
/**
* Get all Voting Escrows positions of an account
* @param accountAddress user wallet address
* @param addresses filter, if not provided, all are returned
* @returns Position array
*/
positionsOf({ accountAddress, addresses, }: {
accountAddress: Address;
addresses?: Address[];
}): Promise<Position[]>;
/**
* Get the Voting Escrows user metadata of an account
* @param accountAddress
* @param addresses filter, if not provided, all are returned
* @returns
*/
metadataOf({ accountAddress, addresses, }: {
accountAddress: Address;
addresses?: Address[];
}): Promise<VotingEscrowUserMetadata[]>;
/**
* Get all Voting Escrows underlying token balances of an account
* @param accountAddress user wallet address
* @param addresses filter, if not provided, all are returned
* @returns Balance array
*/
balances({ accountAddress, addresses, }: {
accountAddress: Address;
addresses?: Address[];
}): Promise<Balance[]>;
/**
* Get the expected outcome of executing a transaction
* @param accountAddress user wallet address
* @param votingEscrowTransactionType transaction type
* @param tokenAddress
* @param votingEscrowAddress
* @param amount
* @param time In seconds
* @returns ExpectedOutcome
*/
getExpectedTransactionOutcome({ accountAddress, votingEscrowTransactionType, tokenAddress, votingEscrowAddress, amount, time, }: {
accountAddress: Address;
votingEscrowTransactionType: VotingEscrowTransactionType;
tokenAddress: Address;
votingEscrowAddress: Address;
amount?: Integer;
time?: number;
}): Promise<TransactionOutcome>;
/**
* Get all Voting Escrows underlying tokens
* @param addresses filter, if not provided, all are returned
* @returns Token array
*/
tokens({ addresses }: {
addresses?: Address[];
}): Promise<Token[]>;
/**
* Fetch the token amount that has been allowed to be used to lock
* @param accountAddress
* @param tokenAddress
* @param votingEscrowAddress
* @returns TokenAllowance
*/
getLockAllowance({ accountAddress, tokenAddress, votingEscrowAddress, }: {
accountAddress: Address;
tokenAddress: Address;
votingEscrowAddress: Address;
}): Promise<TokenAllowance>;
/**
* Approve the token amount to allow to be used to lock
* @param accountAddress
* @param tokenAddress
* @param votingEscrowAddress
* @param amount
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
approveLock<P extends ApproveLockProps>(props: P): WriteTransactionResult<P>;
/**
* Lock an amount of tokens into a Voting Escrow for the specified amount of time
* @param accountAddress
* @param tokenAddress
* @param votingEscrowAddress
* @param amount
* @param time In seconds
* @param populate return populated transaction payload when truthy
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
lock<P extends LockProps>(props: P): WriteTransactionResult<P>;
/**
* Increase the amount of tokens locked on the Voting Escrow
* @param accountAddress
* @param votingEscrowAddress
* @param amount
* @param populate return populated transaction payload when truthy
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
increaseLockAmount<P extends IncreaseLockAMountProps>(props: P): WriteTransactionResult<P>;
/**
* Extend the time to lock the tokens on the Voting Escrow
* @param accountAddress
* @param votingEscrowAddress
* @param time New period in seconds
* @param populate return populated transaction payload when truthy
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
extendLockTime<P extends ExtendLockTimeProps>(props: P): WriteTransactionResult<P>;
/**
* Withdraw unlocked tokens from Voting Escrow
* @param accountAddress
* @param votingEscrowAddress
* @param populate return populated transaction payload when truthy
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
withdrawUnlocked<P extends WithdrawUnlockedProps>(props: P): WriteTransactionResult<P>;
/**
* Withdraw locked tokens from Voting Escrow with a penalty
* @param accountAddress
* @param votingEscrowAddress
* @param populate return populated transaction payload when truthy
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
withdrawLocked<P extends WithdrawLockedProps>(props: P): WriteTransactionResult<P>;
/**
* Claim reward tokens from from Voting Escrow
* @param accountAddress
* @param votingEscrowAddress
* @param populate return populated transaction payload when truthy
* @param overrides
* @returns TransactionResponse | PopulatedTransaction
*/
claimRewards<P extends ClaimRewardsProps>(props: P): WriteTransactionResult<P>;
private getSupportedAddresses;
private getVotingPower;
}
export {};