Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TokenInterface<C>

Type parameters

Hierarchy

  • ServiceInterface<C>
    • TokenInterface

Index

Constructors

Properties

cachedFetcher: CachedFetcher<TokenMetadata[]> = ...
cachedFetcherSupported: CachedFetcher<Token[]> = ...
chainId: 1 | 10 | 250 | 1337 | 42161
ctx: Context
events: Emittery<Record<string, unknown>, Record<string, unknown> & OmnipresentEventData, never>
yearn: Yearn<C>

Methods

  • allowance(ownerAddress: string, tokenAddress: string, spenderAddress: string): Promise<TokenAllowance>
  • Fetch the token amount that spender is allowed to spend on behalf of owner

    Parameters

    • ownerAddress: string
    • tokenAddress: string
    • spenderAddress: string

    Returns Promise<TokenAllowance>

    TokenAllowance

  • approve(ownerAddress: string, tokenAddress: string, spenderAddress: string, amount: string, overrides?: CallOverrides): Promise<TransactionResponse>
  • Approve the token amount that spender is allowed to spend on behalf of owner

    Parameters

    • ownerAddress: string
    • tokenAddress: string
    • spenderAddress: string
    • amount: string
    • overrides: CallOverrides = {}

    Returns Promise<TransactionResponse>

    TransactionResponse

  • balances(account: string, tokenAddresses?: string[]): Promise<Balance[]>
  • Fetch token balance for a particular account and token addresses.

    Parameters

    • account: string

      user wallet address

    • Optional tokenAddresses: string[]

      list of token addresses

    Returns Promise<Balance[]>

    list of balances for the supported tokens

  • findByAddress(address: string): Promise<undefined | Token>
  • TODO: Should get a single token directly instead of filtering

    Parameters

    • address: string

      then token address

    Returns Promise<undefined | Token>

    the token

  • getTestBalance(account: string): Promise<Balance>
  • getZapTokensWithIcons(): Promise<Token[]>
  • icon<T>(address: T): Icon
  • icon<T>(addresses: T[]): IconMap<T>
  • populateApprove(ownerAddress: string, tokenAddress: string, spenderAddress: string, amount: string, overrides?: CallOverrides): Promise<PopulatedTransaction>
  • Returns the populated transaction to approve the token amount that spender is allowed to spend on behalf of owner

    Parameters

    • ownerAddress: string
    • tokenAddress: string
    • spenderAddress: string
    • amount: string
    • overrides: CallOverrides = {}

    Returns Promise<PopulatedTransaction>

    PopulatedTransaction

  • price(from: string, to: string): Promise<string>
  • Get exchange rate between two tokens.

    Parameters

    • from: string
    • to: string

    Returns Promise<string>

    exchange rate

  • priceUsdc<T>(token: T, overrides?: CallOverrides): Promise<string>
  • priceUsdc<T>(tokens: T[], overrides?: CallOverrides): Promise<TypedMap<T, string>>
  • Get the suggested Usdc exchange rate for an token.

    Type parameters

    • T: string

    Parameters

    • token: T
    • Optional overrides: CallOverrides

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • Get the suggested Usdc exchange rate for list of tokens.

    Type parameters

    • T: string

    Parameters

    • tokens: T[]
    • Optional overrides: CallOverrides

    Returns Promise<TypedMap<T, string>>

    Usdc exchange rate map (6 decimals)

  • supported(): Promise<Token[]>

Generated using TypeDoc