UNPKG

@bombearn/sdk

Version:

Interaction framework for the yearn protocol

94 lines (93 loc) 4.95 kB
import { Service } from "../common"; import { Address, Balance, BalancesMap, Integer, Token } from "../types"; import { GasPrice, ZapApprovalStateOutput, ZapApprovalTransactionOutput, ZapOutput, ZapProtocol } from "../types/custom/zapper"; /** * [[ZapperService]] interacts with the zapper api to gather more insight for * tokens and user positions. */ export declare class ZapperService extends Service { /** * Fetch all the tokens supported by the zapper protocol along with some basic * metadata. * @returns list of tokens supported by the zapper protocol. */ supportedTokens(): Promise<Token[]>; /** * Fetch token balances from the {@link ZapperService.supportedTokens} list * for a particular address. * @param address */ balances<T extends Address>(address: T): Promise<Balance[]>; /** * Fetch token balances from the {@link ZapperService.supportedTokens} list * for a list of addresses. * @param addresses */ balances<T extends Address>(addresses: T[]): Promise<BalancesMap<T>>; balances<T extends Address>(addresses: T[] | T): Promise<BalancesMap<T> | Balance[]>; /** * Fetches vault token market data for the Yearn application * @returns list of zapper supported vault addresses */ supportedVaultAddresses(): Promise<Address[]>; /** * Fetch up to date gas prices in gwei * @returns gas prices */ gas(): Promise<GasPrice>; /** * Fetches the data needed to check token ZapIn contract approval state * @param from - the address that is depositing * @param token - the token to be sold to pay for the deposit * @param zapProtocol the protocol to use with zapper e.g. Yearn, Pickle */ zapInApprovalState(from: Address, token: Address, zapProtocol?: ZapProtocol): Promise<ZapApprovalStateOutput>; /** * Fetches the data needed to approve ZapIn Contract for a token * @param from - the address that is depositing * @param token - the token to be sold to pay for the deposit * @param gasPrice * @param zapProtocol the protocol to use with zapper e.g. Yearn, Pickle */ zapInApprovalTransaction(from: Address, token: Address, gasPrice: Integer, zapProtocol?: ZapProtocol): Promise<ZapApprovalTransactionOutput>; /** * Fetches the data needed to check token ZapOut contract approval state * @param from - the address that is withdrawing * @param token - the vault token to be withdrawn * @param zapProtocol the protocol to use with zapper e.g. Yearn, Pickle */ zapOutApprovalState(from: Address, token: Address, zapProtocol?: ZapProtocol): Promise<ZapApprovalStateOutput>; /** * Fetches the data needed to approve ZapOut Contract for a token * @param from - the address that is withdrawing * @param token - the vault token to be withdrawn * @param gasPrice * @param zapProtocol the protocol to use with zapper e.g. Yearn, Pickle */ zapOutApprovalTransaction(from: Address, token: Address, gasPrice: Integer, zapProtocol?: ZapProtocol): Promise<ZapApprovalTransactionOutput>; /** * Fetches the data needed to zap into a vault * @param from - the address that is depositing * @param token - the token to be sold to pay for the deposit * @param amount - the amount of tokens to be sold * @param vault - the vault to zap into * @param gasPrice * @param slippagePercentage - slippage as a decimal * @param skipGasEstimate - provide the gasLimit in the response. Should be set to true when simulating a zap without approval * @param zapProtocol the protocol to use with zapper e.g. Yearn, Pickle */ zapIn(from: Address, token: Address, amount: Integer, vault: Address, gasPrice: Integer, slippagePercentage: number, skipGasEstimate: boolean, zapProtocol?: ZapProtocol, partnerId?: string): Promise<ZapOutput>; /** * Fetches the data needed to zap out of a vault * @param from - the address that is withdrawing * @param token - the token that'll be received * @param amount - the amount of tokens to sell * @param vault - the vault to zap out of * @param gasPrice * @param slippagePercentage - slippage as a decimal * @param skipGasEstimate - provide the gasLimit in the response. Should be set to true when simulating a zap without approval * @param zapProtocol the protocol to use with zapper e.g. Yearn, Pickle * @param signature - the account valid secp256k1 signature of Permit encoded from r, s, v. (https://eips.ethereum.org/EIPS/eip-2612) */ zapOut(from: Address, token: Address, amount: Integer, vault: Address, gasPrice: Integer, slippagePercentage: number, skipGasEstimate: boolean, zapProtocol?: ZapProtocol, signature?: string): Promise<ZapOutput>; }