Options
All
  • Public
  • Public/Protected
  • All
Menu

Module XToken JS

Index

Functions

Const getXAavePrices

  • getXAavePrices(xaaveContract: XAAVE): Promise<ITokenPrices>
  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, X_AAVE_A } from '@xtoken/abis'
    import { getXAavePrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xaaveContract = new ethers.Contract(ADDRESSES[X_AAVE_A][chainId], Abi.xAAVE, provider)
    
    const { priceEth, priceUsd } = await getXAavePrices(xaaveContract)
    

    Parameters

    • xaaveContract: XAAVE

      xAAVEa/xAAVEb token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXAlphaPrices

  • getXAlphaPrices(xalphaContract: XALPHA): Promise<ITokenPrices>
  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, X_ALPHA_A } from '@xtoken/abis'
    import { getXAlphaPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xalphaContract = new ethers.Contract(ADDRESSES[X_ALPHA_A][chainId], Abi.xALPHA, provider)
    
    const { priceEth, priceUsd } = await getXAlphaPrices(xalphaContract)
    

    Parameters

    • xalphaContract: XALPHA

      xALPHAa token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXAssetCLRPrices

  • getXAssetCLRPrices(xAssetCLRContract: XAssetCLR): Promise<ITokenPrices>
  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, AAVE_X_AAVE_A_CLR } from '@xtoken/abis'
    import { getXAssetCLRPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xAssetCLRContract = new ethers.Contract(ADDRESSES[AAVE_X_AAVE_A_CLR][chainId], Abi.xAssetCLR, provider)
    
    const { priceEth, priceUsd } = await getXAssetCLRPrices(xAssetCLRContract)
    

    Parameters

    • xAssetCLRContract: XAssetCLR

      xAssetCLR token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXAssetLevPrices

  • getXAssetLevPrices(xassetlevContract: XAssetLev): Promise<ITokenPrices>
  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, X_ETH_3X } from '@xtoken/abis'
    import { getXAssetLevPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xassetlevContract = new ethers.Contract(ADDRESSES[X_ETH_3X][chainId], Abi.xAssetLev, provider)
    
    const { priceEth, priceUsd } = await getXAssetLevPrices(xassetlevContract)
    

    Parameters

    • xassetlevContract: XAssetLev

      xAssetLev token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXBntPrices

  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, X_BNT_A } from '@xtoken/abis'
    import { getXBntPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xbntContract = new ethers.Contract(ADDRESSES[X_BNT_A][chainId], Abi.xBNT, provider)
    
    const { priceEth, priceUsd } = await getXBntPrices(xbntContract)
    

    Parameters

    • xbntContract: XBNT

      xBNTa token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXInchPrices

  • getXInchPrices(xinchContract: XINCH): Promise<ITokenPrices>
  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, INCH_LIQUIDITY_PROTOCOL, X_INCH_A } from '@xtoken/abis'
    import { getXInchPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xinchContract = new ethers.Contract(ADDRESSES[X_INCH_A][chainId], Abi.xINCH, provider)
    
    const { priceEth, priceUsd } = await getXInchPrices(xinchContract)
    

    Parameters

    • xinchContract: XINCH

      xINCHa/xINCHb token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXKncPrices

  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, X_KNC_A } from '@xtoken/abis'
    import { getXKncPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xkncContract = new ethers.Contract(ADDRESSES[X_KNC_A][chainId], Abi.xKNC, provider)
    
    const { priceEth, priceUsd } = await getXKncPrices(xkncContract)
    

    Parameters

    • xkncContract: XKNC

      xKNCa/xKNCb token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXSnxPrices

  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, X_SNX_A } from '@xtoken/abis'
    import { getXSnxPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    const xsnxContract = new ethers.Contract(ADDRESSES[X_SNX_A][chainId], Abi.xSNX, provider)
    
    const { priceEth, priceUsd } = await getXSnxPrices(xsnxContract)
    

    Parameters

    • xsnxContract: XSNX

      xSNXa token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM

Const getXU3LPPrices

  • getXU3LPPrices(xu3lpContract: XU3LP): Promise<ITokenPrices>
  • example
    import { ethers } from 'ethers'
    import { Abi, ADDRESSES, KYBER_PROXY, X_U3LP_A } from '@xtoken/abis'
    import { getXU3LPPrices } from '@xtoken/js'
    
    const provider = new ethers.providers.InfuraProvider('homestead', <INFURA_API_KEY>)
    
    const xu3lpContract = new ethers.Contract(ADDRESSES[X_U3LP_A][chainId], Abi.xU3LP, provider)
    const kyberProxyContract = new ethers.Contract(ADDRESSES[KYBER_PROXY][chainId], Abi.KyberProxy, provider)
    
    const { priceEth, priceUsd } = await getXU3LPPrices(
      xu3lpContract,
      kyberProxyContract,
    )
    

    Parameters

    • xu3lpContract: XU3LP

      xU3LPa token contract

    Returns Promise<ITokenPrices>

    A promise of the token prices in ETH/USD along with AUM