Cosmos client class extending the Cosmos SDK client.

Hierarchy

  • default
    • Client

Constructors

  • Constructor for the Cosmos client.

    Parameters

    • config: Partial<CosmosSdkClientParams> = defaultClientConfig

      Configuration parameters for the client.

    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 the asset from a given denomination.

    Parameters

    • denom: string

      The denomination to convert.

    Returns null | Asset

    The asset corresponding to 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

  • Get the number of decimals for a given asset.

    Parameters

    • asset: Asset

      The asset to get the decimals for.

    Returns number

    The number of decimals.

  • Get information about the client's native asset.

    Returns AssetInfo

    Information about the 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 the denomination from a given asset.

    Parameters

    • asset: Asset

      The asset to get the denomination for.

    Returns null | string

    The denomination of the given asset.

  • Get the explorer url for the given address.

    Parameters

    • address: string

    Returns string

    The explorer url for the given address.

  • Get the explorer url for the given transaction id.

    Parameters

    • txID: string

    Returns string

    The explorer url for the given transaction id.

  • Get the explorer URL.

    Returns string

    The explorer URL.

  • Returns Promise<number>

  • Get the current fees. If possible, fetches the fees from THORChain's inbound_addresses. Otherwise, returns default fees.

    Returns Promise<Fees>

    The current fees.

  • Get getFullDerivationPath

    Parameters

    • walletIndex: number

      HD wallet index

    Returns string

    The bitcoin derivation path based on the network.

  • Get the message type URL by message type.

    Parameters

    • msgType: TRANSFER

      The message type.

    Returns string

    The message type URL.

  • Get the current network.

    Returns Network

  • Get the address prefix based on the network.

    Returns string

    the address prefix

  • Returns the standard fee used by the client for an asset.

    Parameters

    • asset: Asset

      The asset to retrieve the fee for.

    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 a transaction for signing.

    Parameters

    • params: TxParams & {
          sender: string;
      }

      Transaction parameters including sender address.

    Returns Promise<PreparedTx>

    The prepared transaction.

    Throws

    Thrown if the sender address is invalid.

    Throws

    Thrown if the recipient address is invalid.

    Throws

    Thrown if the asset is invalid or not supported.

  • 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>

  • Creates and signs a transaction without broadcasting it.

    Parameters

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

    Returns Promise<string>

    Deprecated

    Use prepareTx 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