Hook to access the Bigmi configuration.
import { useConfig } from '@bigmi/react'
function Component() {
const config = useConfig()
// Use config...
}The current Bigmi configuration.
Hook to access the connected account information.
import { useAccount, useConnect } from '@bigmi/react'
function Component() {
const { address, isConnected, connector: activeWallet } = useAccount()
const { connect, connectors } = useConnect()
return (
<div>
{isConnected ? (
<>
<p>Connected: {address}</p>
<button onClick={() => activeWallet.disconnect()}>Disconnect</button>
</>
) : (
<button onClick={() => connect({connector: connectors[0]})}>Connect Wallet</button>
)}
</div>
)
}address: The connected Bitcoin addressisConnected: Whether a wallet is connected
Hook to access available wallet connectors.
import { useConnectors } from '@bigmi/react'
function Component() {
const { connectors } = useConnectors()
return (
<div>
{connectors.map((connector) => (
<button
key={connector.id}
onClick={() => connector.connect()}
>
Connect {connector.name}
</button>
))}
</div>
)
}connectors: Array of available wallet connectors
Hook to create a connection between a client and a connector, authorizing the client to send requests to a wallet via the connector.
connect(): A function to run the connect logic synchronouslyconnectAsync(): A async connect functionconnectors: Array of available wallet connectors
This hook reconnects to a wallet connector if a connection already exists or the client is already authorized to use the connector.