Wallet Hooks

React hooks for interacting with connected wallets.

React Hooks allow function components to have access to state and other React features. With Mesh Hooks, you can easily interact and access wallet data.

useWallet Hook

Provide information on the current wallet's state, and functions for connecting and disconnecting user wallet.

wallet is a Browser Wallet instance, which expose all CIP wallets functions from getting assets to signing tranasction.

connected, a boolean, true if user's wallet is connected.

name, a string, the name of the connect wallet.

connecting, a boolean, true if the wallet is connecting and initializing.

connect(walletName: string), a function, provide the wallet name to connect wallet. Retrive a list of available wallets with useWalletList().

disconnect(), a function, to disconnect the connected wallet.

error, returns the error object if any error occurs during wallet connection, such as "account not set".

useWallet Hook

Interact with user's wallet

No Wallet Found

Connected?: Not connected

Connecting wallet?: No

Name of connected wallet:

useWalletList Hook

Returns a list of wallets installed on user's device.

You can define the NuFi network to connect to by adding the network prop.

useWalletList Hook

List of wallets installed on user's device

useAddress Hook

Return address of connected wallet.

accountId is an optional parameter, that allows you to choose which address to return.

useAddress Hook

List of wallets installed on user's device

No wallets installed

useAssets Hook

Return a list of assets in connected wallet from all UTXOs.

useAssets Hook

List assets of connected wallet

No wallets installed

useLovelace Hook

Return amount of lovelace in wallet.

useLovelace Hook

Fetch the lovelace balance of the connected wallet

No wallets installed

useNetwork Hook

Return the network of connected wallet.

useNetwork Hook

Fetch the network of the connected wallet

No wallets installed