Tomo Wallet Provider

Tomo wallet provider defines the top level functions, which can be used in all the wallet provider implementations, such as Bitcoin provider, Cosmos provider, etc.

export abstract class WalletProvider {
  chains: TomoChain[]
  option: ProviderOption
  constructor(option: ProviderOption) {
    this.chains = option.chains
    this.option = option
  }
  /**
   * Connects to the wallet and returns the instance of the wallet provider.
   * @returns A promise that resolves to an instance of the wrapper wallet provider in babylon friendly format.
   * @throws An error if the wallet is not installed or if connection fails.
   */
  abstract connectWallet(): Promise<this>

  /**
   * Gets the address of the connected wallet.
   * @returns A promise that resolves to the address of the connected wallet.
   */
  abstract getAddress(): Promise<string>

  /**
   * Gets the network of the current account.
   * @returns A promise that resolves to the network of the current account.
   */
  abstract getNetwork(): Promise<string>

  /**
   * Gets the name of the wallet provider.
   * @returns Name of the wallet provider.
   */
  abstract getWalletProviderName(): Promise<string>

  /**
   * Gets the icon URL of the wallet provider.
   * @returns Icon URL of the wallet provider.
   */
  abstract getWalletProviderIcon(): Promise<string>
}

Last updated