Custom Binance client

Hierarchy

  • BaseXChainClient
    • Client

Implements

Constructors

  • Constructor Client has to be initialised with network type and phrase. It will throw an error if an invalid phrase has been passed.

    Parameters

    • params: XChainClientParams

    Returns Client

    Throws

    Thrown if the given phase is invalid.

Properties

bncClient: BncClient
chain: string
feeBounds: FeeBounds
network: Network
phrase: string
rootDerivationPaths: undefined | RootDerivationPaths

Methods

  • Broadcast a raw transaction.

    Parameters

    • txHex: string

      The hexadecimal representation of the raw transaction.

    Returns Promise<string>

    The result of broadcasting the transaction.

  • Get account data for a given address.

    Parameters

    • Optional address: string

      The address to get account data for. (optional) By default, it will return account data for the current wallet.

    • index: number = 0

      The account index for the derivation path. (optional)

    Returns Promise<Account>

    A promise resolving to the account details of the given address.

  • Get the address for a given account index.

    Parameters

    • index: number = 0

    Returns string

    Deprecated

    Use getAddressAsync instead.

  • Get the current address asynchronously for a given account index.

    Parameters

    • index: number = 0

      The account index for the derivation path. (optional)

    Returns Promise<string>

    A promise resolving to the current address.

    Throws

    Thrown if the phrase has not been set before. A phrase is needed to create a wallet and to derive an address from it.

  • Get asset information.

    Returns AssetInfo

    Asset information.

  • Get the balance of a given address.

    Parameters

    • address: string

      The address to get the balance for. (optional) By default, it will return the balance of the current wallet.

    • Optional assets: Asset[]

    Returns Promise<Balance[]>

    The balance of the address.

  • Get the client URL based on the network.

    Returns string

    The client URL for binance chain based on the network.

  • Get the explorer URL for a given address based on the network.

    Parameters

    • address: string

      The address to generate the explorer URL for.

    Returns string

    The explorer URL for the given address.

  • Get the explorer URL for a given transaction ID based on the network.

    Parameters

    • txID: string

      The transaction ID to generate the explorer URL for.

    Returns string

    The explorer URL for the given transaction ID.

  • Get the explorer URL based on the network.

    Returns string

    The explorer URL based on the network.

  • Get the fee rate from the Thorchain API.

    Returns Promise<number>

    The fee rate

  • Get the current fee. If the fee rate cannot be obtained from Thorchain, it falls back to fetching transfer fees from the Binance API.

    Returns Promise<Fees>

    The current fee.

  • Get the full derivation path based on the wallet index.

    Parameters

    • walletIndex: number

      The HD wallet index

    Returns string

    The full derivation path

  • Get the current network.

    Returns Network

    The current network

  • Private

    Get the private key for a given account index.

    Parameters

    • index: number

      The account index for the derivation path.

    Returns string

    The private key generated from the given phrase.

    Throws

    Thrown if the phrase has not been set befor Throws an error if phrase has not been set before

  • Get the current fee for both single and multi-send transaction.

    Returns Promise<{
        multi: Fees;
        single: Fees;
    }>

    The current fee for both single and multi-send transaction.

  • Get the transaction details of a given transaction id.

    Parameters

    • txId: string

      The transaction id.

    Returns Promise<Tx>

    The transaction details of the given transaction id.

  • Get transaction history of a given address with pagination options. By default it will return the transaction history of the current wallet.

    Parameters

    • Optional params: TxHistoryParams

      The options to get transaction history. (optional)

    Returns Promise<TxsPage>

    The transaction history.

  • Prepare transfer. Currently not supported for Binance chain.

    Returns Promise<PreparedTx>

    The unsigned transaction data.

  • Purge the client by clearing the mnemonic phrase.

    Returns void

  • Private

    Search transactions with parameters.

    Parameters

    • Optional params: {
          [x: string]: string | undefined;
      }
      • [x: string]: string | undefined

    Returns Promise<TxsPage>

    The parameters to be used for transaction search.

  • Set/update the current network.

    Parameters

    • network: Network

    Returns void

    Throws

    Thrown if network has not been set before.

  • Set or update the mnemonic phrase.

    Parameters

    • phrase: string

      The new mnemonic phrase

    • Optional walletIndex: number

      (Optional) The HD wallet index

    Returns string

    The address derived from the provided phrase

    Throws

    Thrown if an invalid mnemonic phrase is provided

  • Make a GET request to the Thorchain API.

    Parameters

    • endpoint: string

      The API endpoint

    Returns Promise<unknown>

    The response data

  • Transfer balances.

    Parameters

    • params: TxParams

      The transfer options.

    Returns Promise<string>

    The transaction hash.

  • Validate the given address.

    Parameters

    • address: string

      The address to validate.

    Returns boolean

    true if the address is valid, false otherwise.

Generated using TypeDoc