Options
All
  • Public
  • Public/Protected
  • All
Menu

BinanceSDK allows you to interact with Binance Liquid Staking smart contracts on BNB Smart Chain: aBNBb, ankrBNB, WBNB, and BinancePool.

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

Hierarchy

Implements

Index

Constructors

Properties

apiUrl?: string

apiUrl — URL of the advanced API.

readonly
contractConfig: IBinanceConfig

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?: BinanceSDK

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.
  • checkExistPartnerCode(partnerCode: string): Promise<boolean>
  • claimPartnerRewards(): Promise<IWeb3SendResult>
  • convertCode(code: string, padding?: number): Promise<string>
  • convertFromWei(amount: string, unit?: Unit): BigNumber
  • convertToHex(amount: BigNumber): string
  • executeBatchCalls<T>(web3: default, calls: TWeb3Call<T>[]): Promise<T[]>
  • fetchFlashUnstakeTxData(txHash: string): Promise<IFetchTxData>
  • Fetch transaction receipt.

    deprecated

    usefull only for old BNB tokens contracts in the testnet.

    note

    Scans logs to find topic 0x0f0bc5b519ddefdd8e5f9e6423433aa2b869738de2ae34d58ebc796fc749fa0d to show the ankrBNB amount.

    Parameters

    • txHash: string

      transaction hash.

    Returns Promise<null | IGetTxReceipt>

  • flashUnstake(amount: BigNumber, token: string, scale?: number): Promise<IWeb3SendResult>
  • getABBalance(): Promise<BigNumber>
  • getABNBBContract(): Contract
  • getACAllowance(): Promise<BigNumber>
  • getACBalance(): Promise<BigNumber>
  • getACRatio(): Promise<BigNumber>
  • getAETHBalance(): Promise<BigNumber>
  • getAETHContract(): Contract
  • getAETHRatio(): Promise<BigNumber>
  • getAnkrBNBContract(): Contract
  • getAnkrETHBalance(): Promise<BigNumber>
  • getAnkrETHContract(): Contract
  • getAvailableToSwapAnkrETH(): Promise<BigNumber>
  • getBNBBalance(): Promise<BigNumber>
  • getBNBFlashUnstakeLiquidity(): Promise<BigNumber>
  • getBinancePartersContract(): Contract
  • getBinancePoolContract(): Contract
  • getBinancePoolContractOld(): Contract
  • getBlocks(web3: default, blockNumbers: number[]): Promise<BlockTransactionObject[]>
  • getFlashUnstakeFee(): Promise<BigNumber>
  • Get transaction history for all period that starts from contract creation.

    note

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

    Returns Promise<ITxHistory>

    full transaction history.

  • getIncreasedGasLimit(gasLimit: number): number
  • getLatestBlock(): Promise<number>
  • getMaxBlockRange(): number
  • getMinimumStake(): Promise<BigNumber>
  • getMinimumUnstake(): Promise<BigNumber>
  • getPartnerClaimableRewards(code: string): Promise<BigNumber>
  • getPartnerCodeByAddress(address: string): Promise<string>
  • getPendingClaim(): Promise<BigNumber>
  • getPoolEventsBatch(from: number, to: number): Promise<IEventsBatch>
  • getSafeBinanceHexAmount(amount: BigNumber): string
  • getStakeGasFee(amount: BigNumber): Promise<BigNumber>
  • getStakeMethodName(token: "aBNBb" | "ankrBNB" | "aETH" | "ankrETH", withCode?: boolean): string
  • getStakeTxData(address: string, blockNumber: number): Promise<{ lstAmount: BigNumber; nativeAmount: BigNumber }>
  • Returns Stake transaction data.

    Parameters

    • address: string

      staker wallet address

    • blockNumber: number

      block number, where the stake event was emitted

    Returns Promise<{ lstAmount: BigNumber; nativeAmount: BigNumber }>

  • 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 BNB. If you need ankrBNB, 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
  • getTxHistoryRangeNew(lowestBlock: number, highestBlock: number, isUnstakeOnly?: boolean): Promise<ITxHistory>
  • getTxHistoryRangeOld(lowestBlock: number, highestBlock: number, isUnstakeOnly?: boolean): Promise<ITxHistory>
  • getTxType(rawTxType?: string): null | string
  • getUnstakeTxData(address: string, blockNumber: number): Promise<{ lstAmount: BigNumber; nativeAmount: BigNumber; receiver: string }>
  • Returns Unstake transaction data.

    Parameters

    • address: string

      unstake wallet address

    • blockNumber: number

      block number, where the unstake event was emitted

    Returns Promise<{ lstAmount: BigNumber; nativeAmount: BigNumber; receiver: string }>

  • getWrappedBNBContract(): Contract
  • isValidStakeAmount(amount: BigNumber): Promise<boolean>
  • lockShares(args: IShareArgs): Promise<IWeb3SendResult>
  • stake(amount: BigNumber, token: string, scale?: number, referralCode?: string): Promise<IStakeData>
  • stakeCerts(amount: BigNumber, code?: string): Promise<IStakeData>
  • swapOldAnkrETH(amount: BigNumber): Promise<IWeb3SendResult>
  • unlockShares(args: IShareArgs): Promise<IWeb3SendResult>
  • unstake(amount: BigNumber, token: string): Promise<IWeb3SendResult>
  • unstakeToExternal(amount: BigNumber, token: string, externalAddress: string): Promise<IWeb3SendResult>

Generated using TypeDoc