Constructors

  • Constructor to create a wallet with the desired clients

    Parameters

    • clients: Record<string, XChainClient>

      Clients mapped by chain with which the wallet works

    Returns Wallet

    Wallet instance

Properties

clients: Record<string, XChainClient>
network: Network

Methods

  • Add a new client to the wallet

    Parameters

    • chain: string

      Chain to add the client for

    • client: XChainClient

    Returns boolean

    True if client is successfully added, otherwise false

    Throws

    If trying to add a client on a different network compared to others

  • Check if an spenderAddress is allowed to spend in name of another address certain asset amount

    Parameters

    • asset: Asset

      The asset to check

    • amount: {
          amount: (() => BigNumber);
          decimal: number;
          div: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          eq: ((value) => boolean);
          gt: ((value) => boolean);
          gte: ((value) => boolean);
          lt: ((value) => boolean);
          lte: ((value) => boolean);
          minus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          plus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          times: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          type: Base;
      }

      The amount to check

      • amount: (() => BigNumber)
          • (): BigNumber
          • Returns BigNumber

      • decimal: number
      • div: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • eq: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • gt: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • gte: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • lt: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • lte: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • minus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • plus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • times: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • type: Base
    • spenderAddress: string

      The spender to check if it is allowed to spend

    Returns Promise<TransactionResponse>

    true if the spenderAddress is allowed to spend the amount, otherwise, false

    Throws

    If asset is a non ERC20 asset

  • Broadcast transaction

    Parameters

    • chain: string

      The chain in which broadcast the signed raw transaction

    • txHex: string

      signed raw transaction

    Returns Promise<string>

    the broadcasted transaction hash

  • Make a deposit

    Parameters

    • depositParams: DepositParam & {
          asset: Asset;
          chain: string;
      }

    Returns Promise<string>

    the hash of the deposit

    Throws

    if cannot make deposit with the asset

  • Estimate transfer fees

    Parameters

    • params: UtxoTxParams | EvmTxParams

      to make the transfer estimation

    Returns Promise<Fees>

    Estimated fees

  • Get chain address

    Parameters

    • chain: string

      The chain

    Returns Promise<string>

    The chain address

  • Get the wallet chain addresses.

    Parameters

    • Optional chains: string[]

      Optional chains to get addresses for, if not provided, returns all wallet addresses

    Returns Promise<Record<string, string>>

    Addresses mapped by chain

  • Get chain balances

    Parameters

    • chain: string

      The chain to retrieve the balance of

    • Optional assets: Asset[]

    Returns Promise<Balance[]>

    the chain balances

  • By default, it returns all the wallet balances unless assets are provided, in that case, only asset balances will be returned by chain

    Parameters

    • Optional assets: Asset[]

      Optional. Assets of which return the balance

    Returns Promise<Record<string, Balance[]>>

    Balances by chain

  • Get chain wallet. Only available for EVM clients

    Parameters

    • chain: string

      of which return the wallet

    Returns Wallet

    the chain wallet

    Throws

    wallet can not be retrieve from chain

  • Get chain client

    Parameters

    • chain: string

      The chain of which to return the client

    Returns XChainClient

    The chain client

    Throws

    If the client does not exist

  • Get address URL

    Parameters

    • chain: string

      Chain of the address

    • address: string

      The address to retrieve the URL of

    Returns Promise<string>

    The address URL

  • Get transaction URL

    Parameters

    • chain: string

      Chain of the transaction

    • hash: string

      Hash of the transaction

    Returns Promise<string>

    the transaction URL

  • Get explorer url

    Parameters

    • chain: string

      The chain to retrieve the explorer of

    Returns Promise<string>

    the transaction URL

  • Get chain feeRates.

    Parameters

    • chain: string

      of which return the feeRates

    • Optional protocol: THORCHAIN

      to interact with. If it is not set, fee rates are calculated as chain rules

    Returns Promise<Record<FeeOption, {
        amount: (() => BigNumber);
        decimal: number;
        div: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
        eq: ((value) => boolean);
        gt: ((value) => boolean);
        gte: ((value) => boolean);
        lt: ((value) => boolean);
        lte: ((value) => boolean);
        minus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
        plus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
        times: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
        type: Base;
    }>>

    the fee rates

    Throws

    if the fee rates can not be returned from the chain

  • Parameters

    • chain: string

      Chain of which return the feeRates

    Returns Promise<GasPrices>

    Chain of which return the feeRates

    Deprecated

    Get feeRates. Only available for EVM clients. Use getFeeRates instead

    Throws

    If gas fee rates cannot be returned from the chain

  • Get transaction data from hash

    Parameters

    • chain: string

      Chain in which the transaction was done

    • hash: string

      Hash of the transaction

    Returns Promise<Tx>

  • Get wallet histories. By default, it returns all the wallet histories unless chains are provided, in that case, only chain histories will be returned by chain

    Parameters

    • Optional chains: string[]

      Optional. Chain of which return the transaction history

    Returns Promise<Record<string, TxsPage>>

    the chain transaction history

  • Returns the transaction history of a chain

    Parameters

    • chain: string

      Chain of which return the transaction history

    Returns Promise<TxsPage>

    the chain transaction history

  • Check if an spenderAddress is allowed to spend in name of another address certain asset amount

    Parameters

    • asset: Asset

      The asset to check

    • amount: {
          amount: (() => BigNumber);
          decimal: number;
          div: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          eq: ((value) => boolean);
          gt: ((value) => boolean);
          gte: ((value) => boolean);
          lt: ((value) => boolean);
          lte: ((value) => boolean);
          minus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          plus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          times: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
          type: Base;
      }

      The amount to check

      • amount: (() => BigNumber)
          • (): BigNumber
          • Returns BigNumber

      • decimal: number
      • div: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • eq: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • gt: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • gte: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • lt: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • lte: ((value) => boolean)
          • (value): boolean
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value

            Returns boolean

      • minus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • plus: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • times: ((value, decimal?) => { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
          • (value, decimal?): { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
          • Parameters

            • value: ({ type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }) | Value
            • Optional decimal: number

            Returns { type: Denomination.Base; amount: () => BigNumber; plus: (value: ... | Value, decimal?: number | undefined) => ...; minus: (value: ... | Value, decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

      • type: Base
    • fromAddress: string

      oThe wner of the amount asset from

    • spenderAddress: string

      Spender to check if it is allowed to spend

    Returns Promise<boolean>

    true if the spenderAddress is allowed to spend the amount, otherwise, false

    Throws

    If asset is a non ERC20 asset

  • Check if params type is compatible with EvmTxParams

    Parameters

    • params: UtxoTxParams | EvmTxParams

      Params to validate the type of

    Returns params is EvmTxParams

    True if params is EvmTxParams

  • Check if params type is compatible with UtxoTxParams

    Parameters

    • params: UtxoTxParams | EvmTxParams

      Params to validate the type of

    Returns params is UtxoTxParams

    True if params is UtxoTxParams

  • Purge and remove client from the wallet

    Parameters

    • chain: string

      Chain to remove the client for

    Returns boolean

    True if the client is successfully purged and removed, otherwise false

  • Purge and remove all clients from wallet

    Returns boolean

    True if the wallet is successfully purged and removed, otherwise false

  • Set the network that the clients are working in

    Parameters

    • network: Network

      The Network to set

    Returns void

  • Make a transaction

    Parameters

    • params: UtxoTxParams | EvmTxParams

    Returns Promise<string>

    The transaction hash

  • Check if address is valid

    Parameters

    • chain: string

      The chain in which the address has to be valid

    • address: string

      The address to validate

    Returns boolean

    true if it is a valid address, otherwise, false

Generated using TypeDoc