walletuseShieldedWallet

Access shielded public and wallet clients from context

Hook that consumes the ShieldedWalletProvider context. Returns the shielded public client, wallet client, connected address, error state, and a loaded flag indicating whether initialization is complete.

import { useShieldedWallet } from "seismic-react";

Return Type

Property
Type
Description

publicClient

ShieldedPublicClient | null

Shielded public client for reads

walletClient

ShieldedWalletClient | null

Shielded wallet client for writes

address

Hex | null

Connected wallet address

error

string | null

Error message if initialization failed

loaded

boolean

Whether the wallet client has finished initializing


Usage

Basic

import { useShieldedWallet } from 'seismic-react'

function WalletInfo() {
  const { address, walletClient, publicClient } = useShieldedWallet()

  if (!walletClient) return <div>Connect your wallet</div>

  return <div>Connected: {address}</div>
}

Handling loading state

The loaded flag is false until the shielded clients have been fully initialized. Use it to avoid rendering components that depend on the wallet client before it is ready.

Error handling

If initialization fails (for example, the node is unreachable or the wallet connector is incompatible), the error field contains the error message.

Accessing clients for direct seismic-viem calls

The returned publicClient and walletClient are full seismic-viem client instances. You can use them directly for operations not covered by the higher-level hooks.

circle-exclamation

See Also

Last updated