Options
All
  • Public
  • Public/Protected
  • All
Menu

Class XToken

Helper class providing the wrapper around the methods to interact with the xToken contracts. Depends on ethers.js v5

example
import { ethers } from 'ethers'
import { XToken } from '@xtoken/js'

// Metamask provider
const provider = new ethers.providers.Web3Provider(window.ethereum)
const xToken = new XToken(provider)

Hierarchy

  • XToken

Index

Constructors

constructor

  • new XToken(provider: BaseProvider): XToken

Properties

Protected Readonly provider

provider: BaseProvider

Methods

approve

  • approve(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "AAVE-xAAVEa-CLR" | "BNT-xBNTa-CLR" | "1INCH-xINCHa-CLR" | "1INCH-xINCHb-CLR" | "xAAVEb-AAVE-CLR" | "xALPHAa-ALPHA-CLR" | "xKNCa-KNC-CLR" | "xKNCb-KNC-CLR" | "xSNXa-SNX-CLR" | "XTK-ETH-CLR" | "xBTC3x" | "xETH3x", amount?: string, inputAsset?: 0 | 1, spenderAddress?: string): Promise<ContractTransaction>
  • Approve specified amount of xToken by contract before minting

    example
    const tx = await xToken.approve('xAAVEa', '100') // Approve 100 xAAVEa tokens
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "AAVE-xAAVEa-CLR" | "BNT-xBNTa-CLR" | "1INCH-xINCHa-CLR" | "1INCH-xINCHb-CLR" | "xAAVEb-AAVE-CLR" | "xALPHAa-ALPHA-CLR" | "xKNCa-KNC-CLR" | "xKNCb-KNC-CLR" | "xSNXa-SNX-CLR" | "XTK-ETH-CLR" | "xBTC3x" | "xETH3x"

      Symbol of the token to be approved

    • Optional amount: string

      Amount of the token to be approved, MAX_UINT will be used by default

    • Optional inputAsset: 0 | 1

      Token0/Token1

    • Optional spenderAddress: string

      Spender address to be approved for the specified ERC20 token

    Returns Promise<ContractTransaction>

    A promise of the transaction response

approveUsdc

  • approveUsdc(amount?: string): Promise<any>
  • Approve specified amount of USDC by lending liquidity pool contract

    example
    const tx = await xToken.approveUsdc('100') // Approve 100 USDC tokens for lending
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • Optional amount: string

      Amount of the token to be approved, MAX_UINT will be used by default

    Returns Promise<any>

    A promise of the transaction response

approveXtk

  • approveXtk(amount?: string): Promise<any>
  • Approve specified amount of XTK by staking contract

    example
    const tx = await xToken.approveXtk('100') // Approve 100 XTK tokens for staking
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • Optional amount: string

      Amount of the token to be approved, MAX_UINT will be used by default

    Returns Promise<any>

    A promise of the transaction response

burn

  • burn(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x", sellForEth: boolean, amount: string): Promise<ContractTransaction>
  • Sell specified amount of xToken, either for ETH or Token

    example
    // Sell 1000 xAAVEa for ETH
    const tx = await xToken.burn('xAAVEa', true, '1000')
    await tx.wait() // Wait for transaction confirmation
    
    // Sell 1000 xU3LPa for USDC
    const tx = await xToken.burn('xU3LPa', true, '1000') // true = outputAsset `1`
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x"

      Symbol of the xToken to be sold

    • sellForEth: boolean

      Sell for ETH/Token or Token0/Token1 outputAsset in boolean value

    • amount: string

      Amount of xTokens to be sold, cannot exceed max redeemable for xAAVEa/xAAVEb/xSNXa tokens

    Returns Promise<ContractTransaction>

    A promise of the transaction response

burnXAssetCLR

  • burnXAssetCLR(symbol: IXAssetCLR, amount: string): Promise<ContractTransaction>
  • Sell specified amount of xAssetCLR tokens

    example
    import { AAVE_X_AAVE_A_CLR } from '@xtoken/abis'
    
    // Sell 100 AAVE_X_AAVE_A_CLR
    const tx = await xToken.burnXAssetCLR(AAVE_X_AAVE_A_CLR, '100')
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • symbol: IXAssetCLR

      Symbol of the xAssetCLR to be sold

    • amount: string

      Amount of xAssetCLR tokens to be sold, cannot exceed max redeemable tokens

    Returns Promise<ContractTransaction>

    A promise of the transaction response

collateral

  • example
    import { LENDING_X_AAVE_A_MARKET, SUPPLY } from '@xtoken/abis'
    
    // Add xAAVEa to Lending market
    const tx = await xToken.collateral(LENDING_X_AAVE_A_MARKET, '100', SUPPLY)
    await tx.wait() // Wait for transaction confirmation
    

    Add/remove xAsset collateral to a Lending Market

    Parameters

    • marketName: ILendingMarket

      Name of the market

    • amount: string

      Amount of xAsset to add/remove

    • type: ICollateralType

      Supply/Withdraw action to be performed on the provided collateral

    Returns Promise<ContractTransaction>

    A promise of the transaction response

getBestReturn

  • getBestReturn(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x", tradeWithEth: boolean, amount: string, tradeType: ITradeType): Promise<IReturns>
  • example
    // Get best return and estimated quantities for the trading pair from available sources
    const return = await xToken.getBestReturn('xAAVEa', true, '100')
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x"

      Symbol of the xToken to burn

    • tradeWithEth: boolean

      True, if selling the xToken for ETH

    • amount: string

      Quantity of the xToken to be traded

    • tradeType: ITradeType

      Buy/sell type of the trade

    Returns Promise<IReturns>

    Estimated quantities from available sources for trading the given xToken

getBorrowRatePerBlock

  • getBorrowRatePerBlock(): Promise<string>
  • Get Borrow rate per block of Liquidity Pool contract

    Returns Promise<string>

getBorrowingCapacity

  • getBorrowingCapacity(): Promise<string>
  • Get Borrowing Capacity for an address

    Returns Promise<string>

getExpectedQuantityOnBurn

  • getExpectedQuantityOnBurn(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x", sellForEth: boolean, amount: string): Promise<string>
  • example
    // Get expected quantity of ETH when selling 100 xAAVEa
    const expectedQty = await xToken.getExpectedQuantityOnBurn('xAAVEa', true, '100')
    
    // Get expected quantity of USDC when selling 100 xU3LPa
    const expectedQty = await xToken.burn('xU3LPa', true, '100') // true = outputAsset `1`
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x"

      Symbol of the xToken to burn

    • sellForEth: boolean

      True, if selling the xToken for ETH or Token0/Token1 outputAsset in boolean value

    • amount: string

      Quantity of the xToken to be traded

    Returns Promise<string>

    Expected quantity for selling the given xToken / underlying assets in case of xAssetCLR

getExpectedQuantityOnMint

  • getExpectedQuantityOnMint(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x", tradeWithEth: boolean, amount: string): Promise<string>
  • example
    // Get expected quantity of xAAVEa for minting 1 ETH
    const expectedQty = await xToken.getExpectedQuantityOnMint('xAAVEa', true, '1')
    
    // Get expected quantity of xU3LPa for minting 1 DAI
    const expectedQty = await xToken.getExpectedQuantityOnMint('xU3LPa', false, '1') // false = inputAsset `0`
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x"

      Symbol of the xToken to be minted

    • tradeWithEth: boolean

      True, if buying the xToken with ETH or Token0/Token1 inputAsset in boolean value

    • amount: string

      Quantity of the token to be traded

    Returns Promise<string>

    Expected quantity of xToken upon minting

getFeeFactors

  • getFeeFactors(): Promise<{ reserveFactor: string; xtkFeeFactor: string }>
  • Get Lending reserveFee and xtkFee factors

    Returns Promise<{ reserveFactor: string; xtkFeeFactor: string }>

getHealthRatio

  • getHealthRatio(): Promise<string>
  • Get Health Ratio for an address

    Returns Promise<string>

getLPTBaseValue

  • getLPTBaseValue(): Promise<string>
  • Get liquidity pool token base value

    Returns Promise<string>

getLPTValue

  • getLPTValue(): Promise<string>
  • Get liquidity pool token value

    Returns Promise<string>

getLendingMarkets

getLendingPrice

getLiquidityPoolItems

  • example
    // Get available liquidity pools for xTokens
    const liquidityPools = await xToken.getLiquidityPoolItems()
    

    Returns Promise<readonly ILiquidityPoolItem[]>

    Returns available liquidity pools for xTokens along with their balances

getMaxRedeemable

  • getMaxRedeemable(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "AAVE-xAAVEa-CLR" | "BNT-xBNTa-CLR" | "1INCH-xINCHa-CLR" | "1INCH-xINCHb-CLR" | "xAAVEb-AAVE-CLR" | "xALPHAa-ALPHA-CLR" | "xKNCa-KNC-CLR" | "xKNCb-KNC-CLR" | "xSNXa-SNX-CLR" | "XTK-ETH-CLR" | "xBTC3x" | "xETH3x", outputAsset?: 0 | 1): Promise<string>
  • example
    // Get maximum redeemable tokens for xAAVEa
    const maxRedeemable = await xToken.getMaxRedeemable('xAAVEa')
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "AAVE-xAAVEa-CLR" | "BNT-xBNTa-CLR" | "1INCH-xINCHa-CLR" | "1INCH-xINCHb-CLR" | "xAAVEb-AAVE-CLR" | "xALPHAa-ALPHA-CLR" | "xKNCa-KNC-CLR" | "xKNCb-KNC-CLR" | "xSNXa-SNX-CLR" | "XTK-ETH-CLR" | "xBTC3x" | "xETH3x"

      Symbol of the xToken

    • Optional outputAsset: 0 | 1

      Sell for Token0/Token1

    Returns Promise<string>

    Maximum redeemable tokens for the given xToken

getPoolRatio

  • getPoolRatio(symbol: IXAssetCLR): Promise<string>
  • Get xAssetCLR pool deposit ratio

    example
    // Pool deposit ratio for AAVE-xAAVEa CLR
    const history = await xToken.getPoolRatio('AAVE-xAAVEa-CLR')
    

    Parameters

    Returns Promise<string>

    Returns ratio of liquidity deposited in the pool

getPortfolioItems

  • Returns balances along with prices for all the xTokens owned by an address

    example
    // Get portfolio items for the logged in address
    const portfolio = await xToken.getPortfolioItems()
    

    Returns Promise<readonly IPortfolioItem[]>

    Array of each xToken in the portfolio with their corresponding balance and price

getTokenAllowance

  • getTokenAllowance(symbol: "aave" | "alpha" | "bnt" | "inch" | "knc" | "snx" | "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "LPT", spenderAddress: string): Promise<string>
  • Get token allowance for an address on ERC20 token or xAssets

    Parameters

    • symbol: "aave" | "alpha" | "bnt" | "inch" | "knc" | "snx" | "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "LPT"
    • spenderAddress: string

    Returns Promise<string>

getTokenBalance

  • getTokenBalance(symbol: "aave" | "alpha" | "bnt" | "inch" | "knc" | "snx" | "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "LPT"): Promise<string>
  • Get token balance for an address of ERC20 token or xAssets

    Parameters

    • symbol: "aave" | "alpha" | "bnt" | "inch" | "knc" | "snx" | "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "LPT"

    Returns Promise<string>

getTokenSupply

  • getTokenSupply(symbol: "aave" | "alpha" | "bnt" | "inch" | "knc" | "snx" | "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "LPT"): Promise<string>
  • Get token supply of ERC20 token or xAssets

    Parameters

    • symbol: "aave" | "alpha" | "bnt" | "inch" | "knc" | "snx" | "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "busd" | "dai" | "frax" | "renBTC" | "sETH" | "sUSD" | "usdc" | "usdt" | "ust" | "wbtc" | "weth" | "link" | "LPT"

    Returns Promise<string>

getTradeEstimateXAssetCLR

  • example
    import { AAVE_X_AAVE_A_CLR } from '@xtoken/abis'
    
    // Get estimated quantity of minting AAVE_X_AAVE_A_CLR for 100 xAAVEa
    const return = await xToken.getTradeEstimateXAssetCLR(AAVE_X_AAVE_A_CLR, 1, '100')
    

    Parameters

    • symbol: IXAssetCLR

      Symbol of the xToken to burn

    • tradeAsset: IAssetId

      True, if selling the xToken for ETH

    • amount: string

      Quantity of the xToken to be traded

    • tradeType: ITradeType

      Buy/sell type of the trade

    Returns Promise<ICLRBurnQty | ICLRMintQty>

    Estimated quantity for trading the given xAssetCLR

getUpdatedBorrowBy

  • getUpdatedBorrowBy(): Promise<string>

getUtilizationRates

  • getUtilizationRates(): Promise<{ optimalUtilizationRate: string; utilizationRate: string }>
  • Get liquidity pool token utilization and optimal utilization rates

    Returns Promise<{ optimalUtilizationRate: string; utilizationRate: string }>

getXAssetPrices

  • example
    import { X_AAVE_A } from '@xtoken/abis'
    
    // Get xAAVEa asset price
    const xTokensList = await xToken.getXAssetPrices(X_AAVE_A)
    

    Parameters

    Returns Promise<ITokenPrices>

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

getXAssets

  • getXAssets(): Promise<readonly IAsset[]>
  • example
    // Get available xTokens list
    const xTokensList = await xToken.getXAssets()
    

    Returns Promise<readonly IAsset[]>

    Returns list of all the xTokens along with their asset details: AUM, Mandate & USD price

getXLPAssets

  • getXLPAssets(): Promise<readonly ILPAsset[]>
  • example
    // Get available xU3LP tokens list
    const xU3LPTokensList = await xToken.getXLPAssets()
    

    Returns Promise<readonly ILPAsset[]>

    Returns list of all the xU3LP tokens along with their asset details, AUM & USD price

getXLevAssets

  • getXLevAssets(): Promise<readonly ILevAsset[]>
  • example
    // Get available xAssetLev tokens list
    const xAssetLevTokensList = await xToken.getXLevAssets()
    

    Returns Promise<readonly ILevAsset[]>

    Returns list of all the xAssetLev tokens along with their asset details, AUM & USD price

getXtkHistory

  • Get Stake/Unstake history of XTK

    example
    // Stake history of XTK
    const history = await xToken.getXtkHistory('Stake')
    

    Parameters

    Returns Promise<readonly IStakeHistory[]>

    Returns list of all Stake/Unstake history of XTK

lend

  • lend(amount: string, type: ILendingType): Promise<ContractTransaction>

mint

  • mint(symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x", tradeWithEth: boolean, amount: string, affiliate?: string): Promise<ContractTransaction>
  • Mint xToken for specified amount of ETH/Token

    example
    // Buy xAAVEa for 1 ETH
    const tx = await xToken.mint('xAAVEa', true, '1')
    await tx.wait() // Wait for transaction confirmation
    
    // Buy xU3LPa for 1 DAI
    const tx = await xToken.mint('xU3LPa', false, '1') // false = inputAsset `0`
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • symbol: "xAAVEa" | "xAAVEb" | "xALPHAa" | "xBNTa" | "xINCHa" | "xINCHb" | "xKNCa" | "xKNCb" | "xSNXa" | "xU3LPa" | "xU3LPb" | "xU3LPc" | "xU3LPd" | "xU3LPe" | "xU3LPf" | "xU3LPg" | "xU3LPh" | "xBTC3x" | "xETH3x"

      Symbol of the xAsset to be minted

    • tradeWithEth: boolean

      Mint with ETH/Token or Token0/Token1 inputAsset in boolean value

    • amount: string

      Quantity of token to be minted, tokens need to be approved before minting using approve method

    • affiliate: string = ...

      Affiliate address to whom the affiliate fees should be sent to

    Returns Promise<ContractTransaction>

    A promise of the transaction response

mintXAssetCLR

  • mintXAssetCLR(symbol: IXAssetCLR, inputAsset: IAssetId, amount: string): Promise<ContractTransaction>
  • Mint xAssetCLR token for specified amount of Token0/Token1

    example
    import { AAVE_X_AAVE_A_CLR } from '@xtoken/abis'
    
    // Buy AAVE_X_AAVE_A_CLR for 1 AAVE
    const tx = await xToken.mintXAssetCLR(AAVE_X_AAVE_A_CLR, 0, '1')
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • symbol: IXAssetCLR

      Symbol of the xAssetCLR to be minted

    • inputAsset: IAssetId

      Mint with Token0/Token1 inputAsset

    • amount: string

      Quantity of xAssetCLR token to be minted, tokens need to be approved before minting using approve method

    Returns Promise<ContractTransaction>

    A promise of the transaction response

stakeXtk

  • stakeXtk(amount: string): Promise<ContractTransaction>
  • Stake XTK

    example
    // Stake 10 XTK
    const tx = await xToken.stakeXtk('10')
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • amount: string

      Quantity of token to be staked, tokens need to be approved before staking using approve method

    Returns Promise<ContractTransaction>

    A promise of the transaction response

unstakeXXtkA

  • unstakeXXtkA(amount: string): Promise<ContractTransaction>
  • Unstake xXTKa to get back XTK

    example
    // Unstake 10 xXTKa
    const tx = await xToken.unstakeXXtkA('10')
    await tx.wait() // Wait for transaction confirmation
    

    Parameters

    • amount: string

      Quantity of token to be unstaked

    Returns Promise<ContractTransaction>

    A promise of the transaction response