Abstract class representing a generic implementation of an XChainClient interface for chains built with Cosmos SDK. Uses dependencies from the official

Cosmjs

monorepo.

Hierarchy

  • BaseXChainClient
    • Client

Implements

  • XChainClient

Constructors

Properties

baseDenom: string
chain: string
clientUrls: Record<Network, string>
defaultDecimals: number
defaultFee: {
    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;
}

Type declaration

  • 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
feeBounds: FeeBounds
network: Network
phrase: string
prefix: string
registry: Registry
rootDerivationPaths: undefined | RootDerivationPaths
startgateClient: CachedValue<StargateClient>

Methods

  • Abstract method to retrieve asset information from its denomination.

    Parameters

    • denom: string

      The denomination of the asset.

    Returns null | Asset

    The asset corresponding to the denomination, or null if not found.

  • Broadcasts a transaction to the blockchain network.

    Parameters

    • txHex: string

      The hexadecimal representation of the transaction.

    Returns Promise<string>

    A promise that resolves to the transaction hash.

  • Private

    Connects the client to a given client URL.

    Parameters

    • clientUrl: string

      The URL of the client to connect to

    Returns Promise<StargateClient>

    The connected StargateClient instance

  • Obtains the address derived from the provided phrase.

    Parameters

    • Optional walletIndex: number

      The index of the address derivation path. Default is 0.

    Returns string

    The user address at the specified walletIndex.

  • Asynchronously obtains the address derived from the provided phrase.

    Parameters

    • index: number = 0

      Derivation path index of the address to be generated.

    Returns Promise<string>

    A promise that resolves to the generated address.

  • Abstract method to retrieve the number of decimals for a given asset.

    Parameters

    • asset: Asset

      The asset for which the number of decimals is required.

    Returns number

    The number of decimals for the asset.

  • Abstract method to retrieve information about supported assets.

    Returns AssetInfo

    Information about the supported assets.

  • Retrieves the balances of the specified address for all assets on the network.

    Parameters

    • address: string

      The address for which balances are to be retrieved.

    • Optional _assets: Asset[]

      An array of assets. Ignored in this implementation.

    Returns Promise<Balance[]>

    A promise that resolves to an array of balances.

  • Abstract method to retrieve the denomination of an asset.

    Parameters

    • asset: Asset

      The asset for which the denomination is required.

    Returns null | string

    The denomination of the asset, or null if not found.

  • Abstract method to retrieve the URL of the blockchain explorer for a specific address.

    Parameters

    • _address: string

      The address for which the explorer URL is required.

    Returns string

    The URL of the blockchain explorer for the address.

  • Abstract method to retrieve the URL of the blockchain explorer for a specific transaction.

    Parameters

    • txID: string

      The ID of the transaction for which the explorer URL is required.

    Returns string

    The URL of the blockchain explorer for the transaction.

  • Abstract method to retrieve the URL of the blockchain explorer.

    Returns string

    The URL of the blockchain explorer.

  • Returns Promise<number>

  • Asynchronously retrieves the default fees.

    Returns Promise<Fees>

    A promise that resolves to the default fees.

  • Get getFullDerivationPath

    Parameters

    • walletIndex: number

      HD wallet index

    Returns string

    The bitcoin derivation path based on the network.

  • Abstract method to retrieve the message type URL by its type.

    Parameters

    • msgType: TRANSFER

      The type of the message.

    Returns string

    The URL of the message type.

  • Get the current network.

    Returns Network

  • Abstract method to retrieve the prefix for a given network.

    Parameters

    • network: Network

      The network for which the prefix is required.

    Returns string

    The prefix for the network.

  • Abstract method to retrieve the standard fee for a given asset.

    Parameters

    • asset: Asset

      The asset for which the fee is required.

    Returns StdFee

    The standard fee for the asset.

  • Retrieves transaction data using the transaction ID.

    Parameters

    • txId: string

      The identifier of the transaction.

    • Optional _assetAddress: string

      Ignored parameter.

    Returns Promise<Tx>

    A promise that resolves to transaction data.

  • Retrieves transactions filtered using specified parameters.

    Parameters

    • Optional params: TxHistoryParams

      Parameters for filtering transactions. Only the 'address' parameter is supported in this client.

    Returns Promise<TxsPage>

    A promise that resolves to an array of transactions.

  • Hashes a buffer using SHA256 followed by RIPEMD160 or RMD160.

    Parameters

    • buffer: Uint8Array

      The buffer to hash.

    Returns Buffer

    The hashed buffer.

  • Private

    Maps the indexed transaction to the transaction type used by xchainjs.

    Parameters

    • indexedTx: IndexedTx

      The indexed transaction to transform

    Returns Promise<Tx>

    The transformed transaction

  • Abstract method for preparing a transaction.

    Parameters

    • params: TxParams & {
          sender: string;
      }

      Parameters required for preparing the transaction.

    Returns Promise<PreparedTx>

    A promise that resolves to the prepared transaction.

  • Purge client.

    Returns void

  • Sets the network for the client to work with.

    Parameters

    • network: Network

      The network to set

    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.

  • Private

    Splits the amount and denomination strings.

    Parameters

    • amountsAndDenoms: string[]

      The strings in the format '3000uatom'

    Returns {
        amount: string;
        denom: string;
    }[]

    An array of objects containing the amount and denomination

  • Parameters

    • endpoint: string

    Returns Promise<unknown>

  • Parameters

    • params: TxParams

    Returns Promise<string>

  • Validates the format of the provided address.

    Parameters

    • address: string

      The address to be validated.

    Returns boolean

    Returns true if the address is valid, otherwise false.

Generated using TypeDoc