@allbridge/bridge-core-sdk
    Preparing search index...

    Class AllbridgeCoreSdk

    Index

    Constructors

    Properties

    utils: Utils

    Methods

    • Convert APR to percentage view

      Parameters

      • apr: string

      Returns string

      aprPercentageView

    • Parameters

      • amountFloat: BigSource

        initial amount of tokens to swap

      • sourceChainToken: TokenWithChainDetails

        selected token on the source chain

      • destinationChainToken: TokenWithChainDetails

        selected token on the destination chain

      Returns Promise<number>

      fee percent

      Calculates the percentage of fee that is charged when swapping to the selected destination chain. The destination chain fee percent applies to the amount after the source chain fee. (Does not include fee related to the source chain. Does not include gas fee)

    • Parameters

      • amountFloat: BigSource

        initial amount of tokens to swap

      • sourceChainToken: TokenWithChainDetails

        selected token on the source chain

      Returns Promise<number>

      fee percent

      Calculates the percentage of fee from the initial amount that is charged when swapping from the selected source chain. (Does not include fee related to the destination chain. Does not include gas fee)

    • Returns ChainDetailsMap containing a list of supported tokens groped by chain.

      Parameters

      • type: "swap" | "pool" = "swap"

        A string value which specifies ChainDetailsMap to retrieve. Can be either 'swap' for send or 'pool' for liquidity pools setup. Defaults to 'swap'.

      Returns Promise<ChainDetailsMap>

    • Check address and show gas balance

      Parameters

      • _chainSymbol: string

        The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: ChainSymbol.

      • _recipientAddress: string
      • Optional_tokenAddress: string

      Returns Promise<CheckAddressResponse>

    • Calculates the amount of tokens to be received as a result of transfer.

      Parameters

      • amountToSendFloat: BigSource

        the amount of tokens that will be sent

      • sourceChainToken: TokenWithChainDetails

        selected token on the source chain

      • destinationChainToken: TokenWithChainDetails

        selected token on the destination chain

      • messenger: Messenger = Messenger.ALLBRIDGE

        selected messenger

      Returns Promise<string>

    • Calculates the amount of tokens to be received as a result of transfer based on actual blockchain pool state.

      Parameters

      • amountToSendFloat: BigSource

        the amount of tokens that will be sent

      • sourceChainToken: TokenWithChainDetails

        selected token on the source chain

      • destinationChainToken: TokenWithChainDetails

        selected token on the destination chain

      • messenger: Messenger = Messenger.ALLBRIDGE

        selected messenger

      • OptionalsourceProvider: Provider

        Optional. source chain Provider

      • OptionaldestinationProvider: Provider

        Optional. destination chain Provider

      Returns Promise<string>

    • Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer.

      Parameters

      • amountToBeReceivedFloat: BigSource

        the amount of tokens that should be received

      • sourceChainToken: TokenWithChainDetails

        selected token on the source chain

      • destinationChainToken: TokenWithChainDetails

        selected token on the destination chain

      • messenger: Messenger = Messenger.ALLBRIDGE

        selected messenger

      Returns Promise<string>

    • Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on actual blockchain pool state.

      Parameters

      • amountToBeReceivedFloat: BigSource

        the amount of tokens that should be received

      • sourceChainToken: TokenWithChainDetails

        selected token on the source chain

      • destinationChainToken: TokenWithChainDetails

        selected token on the destination chain

      • messenger: Messenger = Messenger.ALLBRIDGE

        selected messenger

      • OptionalsourceProvider: Provider

        Optional. source chain Provider

      • OptionaldestinationProvider: Provider

        Optional. destination chain Provider

      Returns Promise<string>

    • Gets the average time in ms to complete a transfer for given tokens and messenger.

      Parameters

      Returns number | null

      Average transfer time in milliseconds or null if a given combination of tokens and messenger is not supported.

    • Get gas balance

      Parameters

      • chainSymbol: string

        The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: ChainSymbol.

      • address: string

      Returns Promise<GasBalanceResponse>

    • Fetches information about tokens transfer by chosen chainSymbol and transaction Id from the Allbridge Core API.

      Parameters

      • chainSymbol: string

        The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: ChainSymbol.

      • txId: string

      Returns Promise<TransferStatusResponse>

    • Forces refresh of cached information about the state of liquidity pools. Outdated cache leads to calculated amounts being less accurate. The cache is invalidated at regular intervals, but it can be forced to be refreshed by calling this method.+

      Parameters

      Returns Promise<void>

    • Returns a list of supported tokens.

      Parameters

      • type: "swap" | "pool" = "swap"

        A string value which specifies a set of tokens to retrieve. Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations. Defaults to 'swap'.

      Returns Promise<TokenWithChainDetails[]>

      A promise that resolves to an array of TokenWithChainDetails.

    • Returns a list of supported tokens on the selected chain.

      Parameters

      • chainSymbol: string

        The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: ChainSymbol.

      • type: "swap" | "pool" = "swap"

        A string value which specifies a set of tokens to retrieve. Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations. Defaults to 'swap'.

      Returns Promise<TokenWithChainDetails[]>