Options
All
  • Public
  • Public/Protected
  • All
Menu

AvalancheSDK allows you to interact with Avalanche Liquid Staking smart contracts on Avalanche network: aAVAXb, ankrAVAX, and AvalanchePool.

For more information on Avalanche Liquid Staking from Ankr, refer to the development details.

Hierarchy

Implements

Index

Constructors

Properties

apiUrl?: string

apiUrl — URL of the advanced API.

readonly
contractConfig: IAvalancheConfig

Contract addresses by current network mode.

currentAccount: string

currentAccount — connected account.

networkMode: ENetworkMode

Network mode.

readonly
readProvider: Web3KeyReadProvider

readProvider — provider which allows to read data without connecting the wallet.

readonly
stakeGasFee?: BigNumber

stakeGasFee — cached stake gas fee.

writeProvider: Web3KeyWriteProvider

writeProvider — provider which has signer for signing transactions.

readonly
instance?: AvalancheSDK

instance — SDK instance.

static

Accessors

  • get isMainnet(): boolean

Methods

  • addTokenToWallet(token: string): Promise<boolean>
  • approveACForAB(amount?: BigNumber, scale?: number): Promise<undefined | IWeb3SendResult>
  • checkAllowance(hexAmount: string): Promise<boolean>
  • Checks if allowance is greater or equal to amount.

    note

    Allowance is the amount which spender is still allowed to withdraw from owner.

    Parameters

    • hexAmount: string

    Returns Promise<boolean>

    • true if amount doesn't exceed allowance, false - otherwise.
  • convertFromWei(amount: string): BigNumber
  • convertToHex(amount: BigNumber): string
  • executeBatchCalls<T>(web3: default, calls: TWeb3Call<T>[]): Promise<T[]>
  • fetchTxReceipt(txHash: string): Promise<null | TransactionReceipt>
  • getAAVAXBTokenContract(): Contract
  • getABBalance(): Promise<BigNumber>
  • getACAllowance(spender?: string): Promise<BigNumber>
  • getACBalance(): Promise<BigNumber>
  • getACRatio(): Promise<BigNumber>
  • getAVAXBalance(): Promise<BigNumber>
  • getAnkrAVAXTokenContract(): Contract
  • getAvalanchePoolContract(): Contract
  • getBlocks(web3: default, blockNumbers: number[]): Promise<BlockTransactionObject[]>
  • Get transaction history for all period that starts from contract creation.

    note

    Amount of certificate event is in AVAX. If you need ankrAVAX, multiply by ratio. Pending status is not specified.

    Returns Promise<ITxHistory>

    full transaction history.

  • getLatestBlock(): Promise<number>
  • getMinimumStake(): Promise<BigNumber>
  • getPendingClaim(): Promise<BigNumber>
  • getPoolEventsBatch(from: number, to: number): Promise<IEventsBatch>
  • getPoolMinStake(): Promise<BigNumber>
  • getStakeGasFee(amount: BigNumber, token: string): Promise<BigNumber>
  • Get stake gas fee.

    note

    Caches computed gas fee value for future computations.

    Parameters

    • amount: BigNumber

      amount to stake

    • token: string

      token symbol (aAVAXb or ankrAVAX)

    Returns Promise<BigNumber>

  • getStakeMethodName(token: string): string
  • getTxEventsHistoryGroup(rawEvents?: EventData[]): Promise<ITxHistoryItem[]>
  • getTxHistoryRange(lowestBlock: number, highestBlock: number, isUnstakeOnly?: boolean): Promise<ITxHistory>
  • Get transaction history for block range.

    note

    Amount of each event is in AVAX. If you need ankrAVAX, multiply by ratio. Pending status is not specified.

    Parameters

    • lowestBlock: number

      from block number

    • highestBlock: number

      to block number

    • isUnstakeOnly: boolean = false

      if true, only unstake events will be returned

    Returns Promise<ITxHistory>

    • transaction history
  • getTxType(rawTxType?: string): null | string
  • getUnstakeMethodName(token: string): string
  • lockShares(args: IShareArgs): Promise<IWeb3SendResult>
  • stake(amount: BigNumber, token: string): Promise<IStakeData>
  • unlockShares(args: IShareArgs): Promise<IWeb3SendResult>
  • unstake(amount: BigNumber, token: string): Promise<IWeb3SendResult>
  • getIncreasedGasLimit(gasLimit: number): number

Generated using TypeDoc