Thorchain client

Hierarchy

  • default
    • Client

Implements

Constructors

  • Thorchain client constructor

    Parameters

    • config: Partial<CosmosSdkClientParams> = defaultClientConfig

      Optional - Client configuration. If it is not set, default values will be used

    Returns Client

Properties

baseDenom: string
chain: string
clientUrls: Record<Network, string>
defaultDecimals: number
feeBounds: FeeBounds
network: Network
phrase: string
prefix: string
registry: Registry
rootDerivationPaths: undefined | RootDerivationPaths
startgateClient: CachedValue<StargateClient>

Methods

  • Get Asset from denomination

    Parameters

    • denom: string

      The denomination for which to get the asset.

    Returns null | Asset

    The asset of the given denomination.

  • Parameters

    • txHex: string

    Returns Promise<string>

  • Parameters

    • Optional walletIndex: number

    Returns string

    Deprecated

    this function eventually will be removed use getAddressAsync instead

  • Get an address derived from the phrase defined in the constructor.

    Parameters

    • Optional index: number

    Returns Promise<string>

    user address at index defined on walletIndex

  • Returns the number of the decimals of known assets

    Parameters

    • asset: Asset

      Asset of which return the number of decimals

    Returns number

    the number of decimals of the assets

  • Get client native asset

    Returns AssetInfo

    Thorchain native asset

  • Obtains all the balances of the address passed as parameter for all the assets of the network. For the moment for this client the assets parameter is ignored. Do not hesitate to open a PR if you need it and it is not yet available.

    Parameters

    • address: string

      address to be validated

    • Optional _assets: Asset[]

      IGNORED FOR THIS IMPLEMENTATION

    Returns Promise<Balance[]>

    array of balances

  • Get denomination from Asset

    Parameters

    • asset: Asset

      The asset for which to get the denomination.

    Returns null | string

    The denomination of the given asset.

  • Get the explorer url for the given address.

    Parameters

    • address: string

      The address for which to get the explorer URL.

    Returns string

    The explorer url for the given address.

  • Get the explorer url for the given transaction id.

    Parameters

    • txID: string

      The transaction ID for which to get the explorer URL.

    Returns string

    The explorer url for the given transaction id.

  • Get the explorer url.

    Returns string

    The explorer url for thorchain based on the current network.

  • Returns Promise<number>

  • This function returns the fee object in a generalised way for a simple transfer function. In this case this funcion use the default fee defined in the constructor.

    Returns Promise<Fees>

    fees estimation for average, fast and fastests scenarios.

  • Get getFullDerivationPath

    Parameters

    • walletIndex: number

      HD wallet index

    Returns string

    The bitcoin derivation path based on the network.

  • Get the message type url by type used by the cosmos-sdk client to make certain actions

    Parameters

    • msgType: TRANSFER

      The message type of which return the type url

    Returns string

    the type url of the message

  • Get the current network.

    Returns Network

  • Get address prefix by network

    Parameters

    • network: Network

      The network of which return the prefix

    Returns string

    the address prefix

  • Returns the private key associated with an index

    Parameters

    • index: number = 0

      Optional - The index to use to generate the private key. If it is not set, address associated with index 0 will be used

    Returns Promise<Uint8Array>

    The private key

  • Returns the compressed public key associated with an index

    Parameters

    • index: number = 0

      Optional - The index to use to generate the private key. If it is not set, address associated with index 0 will be used

    Returns Promise<Uint8Array>

    The public key

  • Returns the standard fee used by the client

    Returns StdFee

    the standard fee

  • Get transaction info using txId

    Parameters

    • txId: string

      Idetifier of transaction

    • Optional _assetAddress: string

    Returns Promise<Tx>

    Transaction data

  • Get transactions filtered using params

    Parameters

    • Optional params: TxHistoryParams

      Only param address IS SUPPORTED FOR THIS CLIENT, new feature will be added in the future

    Returns Promise<TxsPage>

    array of balances

  • Prepare transfer transaction.

    Parameters

    • params: TxParams & {
          sender: string;
      }

      The transfer options.

    Returns Promise<PreparedTx>

    The raw unsigned transaction.

  • Purge client.

    Returns void

  • Set client network to work with.

    Parameters

    • network: Network

    Returns void

  • Set/update a new phrase

    Parameters

    • phrase: string

      A new phrase.

    • Optional walletIndex: number

      (optional) HD wallet index

    Returns string

    The address from the given phrase

    Throws

    Thrown if the given phase is invalid.

  • Parameters

    • endpoint: string

    Returns Promise<unknown>

  • Parameters

    • params: TxParams

    Returns Promise<string>

  • Create and sign transaction without broadcasting it

    Parameters

    • __namedParameters: TxParams & {
          gasLimit?: BigNumber;
      } & {
          gasLimit?: BigNumber;
      }

    Returns Promise<string>

    Deprecated

    Use prepare Tx instead

  • Validate the address format.

    Parameters

    • address: string

      address to be validated

    Returns boolean

    represents whether the address is valid or invalid

Generated using TypeDoc