Hooks

Quirks provides several useful hooks for integrating the library and its functionality within your React codebase.

useConnect

Provides the methods and information required to use the wallets, connect to them, and obtain status information about the connection.

import {  } from "@quirks/react";
 
const {
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
} = ();

useChain

Provides information about the previously configured chain, along with the address for that wallet/chain pair if the wallet is connected.

Note

The list of supported chains depends on the wallet you are using; not all wallets allow you to add custom chains. Therefore, it may not be possible to get information for some chains.

import {  } from "@quirks/react";
 
/**
 * The name of the chain for which you want to obtain information
 * corresponds to the one you have used in the Config object.
 */
const  = "osmosis";
 
const {
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
} = ();

useChains

Provides information about all connected chains, along with the address for those wallet/chain pairs if the wallet is connected.

Note

The list of supported chains depends on the wallet you are using; not all wallets allow you to add custom chains. Therefore, it may not be possible to get information for some chains.

import {  } from "@quirks/react";
 
const { , , , ,  } =
  ();

useConfig

Provides information about the configuration of Quirks previously defined in the Config object.

import {  } from "@quirks/react";
 
const { , ,  } = ();

useWalletConnect

Provides information about WalletConnect connection, including the pairing URI if connecting to a wallet that supports it.

import {  } from "@quirks/react";
 
const { , ,  } = ();

useWalletEvents

A utility that allows you to subscribe to Quirks events to perform custom actions.

import {  } from "@quirks/react";
 
("ac
  • accountsChanged
countsChanged", () => {
// your custom code });

On this page