Developer Docs
Search
K

useWallet

Allows you to connect to wallet providers to access wallet address and wallet balance and network information
React / Next
// Import
import { useWalletAuth } from "@xircus-web3/react"
// Declare
const wallet = useWallet()
// or const { connectMetamask } = useWallet()
// Usage
return <button onClick={wallet.connectMetamask}>Connect</button>

Fields

Name
Description
ready
Returns true once SDK is initialized
status
Returns the status of the wallet connection
balance
Returns the balance of the wallet account
account
Returns the wallet address
network
Returns the info of the network
connector
Returns the info of the chain connector type e.g evm, solana, near
getBalance(account, token)
Returns the token balance of an account
getBalances (account, tokens = [])
Returns the token balances of wallet address e.g
getAccountBalance
Returns the native balance of wallet address
getBalanceFromChains (account, chains = [])
Returns the native balances of wallet address from different chains, use the short e.g. chains = ["bsc", "polygon"]
connectMetamask()
Connect via Metamask
connectWalletConnect()
Connect via WalletConnect
connectCoinbase()
Connect via Coinbase Wallet
connectPhantom
Connect via Solana Phantom
connectSender
Connect via Near Sender Wallet
connectRandom
Connect via Random Seed Key
connectSafe
Connect via Gnosis Safe
connect(chain)
Connect via RPC, chain can be short or network id e.g "bsc" or "56"
signMessage(message)
Returns the signed message after eth_personal_sign
switchNetwork(networkId)
Switch to another chain via wallet provider
getSigner
Returns the signer from wallet provider