Description

The client module provides many web3 tasks, including the monitor changes to users' wallets. Every second, the module will poll for the web3 client to determine its status (i.e. whether it's locked, what network it's on, etc). This all happens behind the scenes to power other modules. There is an in-depth guide to utilizing the client under the documentation section.

Actions

getTokenBalance(address)

Fills the balance field in the modules state with the balance of the specified token for the Ethereum address associated with the current wallet.

State

{
  "locked": bool,
  "hasWallet": bool,
  "network": string,
  "initialized": bool,
  "address": string,
  "balanceInfo": {
    "loading": bool,
    "loaded": bool,
    "error": bool,
    "tokenAddress": string,
    balance: number
  }
}

Selectors

networkSelector(state)

Ethereum network the user's wallet is currently connect to (i.e. Main, Rinkeby, etc.)

addressSelector(state)

Current address being injected by the user's wallet

walletLockedSelector(state)

Whether the user's wallet is locked or unlocked

hasWalletSelector(state)

If the user has a web3 enabled wallet connected to their browser

initializedSelector(state)

Flag that is set once the wallet is retrieved for the first time

balanceInfoSelector(state)

State related to the current user's token balances