Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ZapperService

ZapperService interacts with the zapper api to gather more insight for tokens and user positions.

Hierarchy

  • Service
    • ZapperService

Index

Constructors

Properties

chainId: 1 | 10 | 250 | 1337 | 42161
ctx: Context
events: Emittery<Record<string, unknown>, Record<string, unknown> & OmnipresentEventData, never>

Methods

  • supportedTokens(): Promise<Token[]>
  • Fetch all the tokens supported by the zapper protocol along with some basic metadata.

    Returns Promise<Token[]>

    list of tokens supported by the zapper protocol.

  • supportedVaultAddresses(): Promise<string[]>
  • Fetches vault token market data for the Yearn application

    Returns Promise<string[]>

    list of zapper supported vault addresses

  • zapIn(from: string, token: string, amount: string, vault: string, gasPrice: string, slippagePercentage: number, skipGasEstimate: boolean, zapProtocol?: ZapProtocol, partnerId?: string): Promise<ZapOutput>
  • Fetches the data needed to zap into a vault

    Parameters

    • from: string

      the address that is depositing

    • token: string

      the token to be sold to pay for the deposit

    • amount: string

      the amount of tokens to be sold

    • vault: string

      the vault to zap into

    • gasPrice: string
    • slippagePercentage: number

      slippage as a decimal

    • skipGasEstimate: boolean

      provide the gasLimit in the response. Should be set to true when simulating a zap without approval

    • zapProtocol: ZapProtocol = ZapProtocol.YEARN

      the protocol to use with zapper e.g. Yearn, Pickle

    • Optional partnerId: string

    Returns Promise<ZapOutput>

  • Fetches the data needed to check token ZapIn contract approval state

    Parameters

    • from: string

      the address that is depositing

    • token: string

      the token to be sold to pay for the deposit

    • zapProtocol: ZapProtocol = ZapProtocol.YEARN

      the protocol to use with zapper e.g. Yearn, Pickle

    Returns Promise<ZapApprovalStateOutput>

  • Fetches the data needed to approve ZapIn Contract for a token

    Parameters

    • from: string

      the address that is depositing

    • token: string

      the token to be sold to pay for the deposit

    • gasPrice: string
    • zapProtocol: ZapProtocol = ZapProtocol.YEARN

      the protocol to use with zapper e.g. Yearn, Pickle

    Returns Promise<ZapApprovalTransactionOutput>

  • zapOut(from: string, token: string, amount: string, vault: string, gasPrice: string, slippagePercentage: number, skipGasEstimate: boolean, zapProtocol?: ZapProtocol, signature?: string): Promise<ZapOutput>
  • Fetches the data needed to zap out of a vault

    Parameters

    • from: string

      the address that is withdrawing

    • token: string

      the token that'll be received

    • amount: string

      the amount of tokens to sell

    • vault: string

      the vault to zap out of

    • gasPrice: string
    • slippagePercentage: number

      slippage as a decimal

    • skipGasEstimate: boolean

      provide the gasLimit in the response. Should be set to true when simulating a zap without approval

    • zapProtocol: ZapProtocol = ZapProtocol.YEARN

      the protocol to use with zapper e.g. Yearn, Pickle

    • Optional signature: string

      the account valid secp256k1 signature of Permit encoded from r, s, v. (https://eips.ethereum.org/EIPS/eip-2612)

    Returns Promise<ZapOutput>

  • Fetches the data needed to check token ZapOut contract approval state

    Parameters

    • from: string

      the address that is withdrawing

    • token: string

      the vault token to be withdrawn

    • zapProtocol: ZapProtocol = ZapProtocol.YEARN

      the protocol to use with zapper e.g. Yearn, Pickle

    Returns Promise<ZapApprovalStateOutput>

  • Fetches the data needed to approve ZapOut Contract for a token

    Parameters

    • from: string

      the address that is withdrawing

    • token: string

      the vault token to be withdrawn

    • gasPrice: string
    • zapProtocol: ZapProtocol = ZapProtocol.YEARN

      the protocol to use with zapper e.g. Yearn, Pickle

    Returns Promise<ZapApprovalTransactionOutput>

Generated using TypeDoc