Warning

B3 Global Accounts are deprecated. Upside and AnySpend now sign in with your own wallet. If you held funds in a Global Account and need help, ask in the B3 Discord. The team never DMs first and will never ask for your seed phrase or private key.

Account Hooks

useAccountWallet

Returns the wallet of the active account.

tsx
import { useAccountWallet } from "@b3dotfun/sdk/global-account/react";function WalletAddress() { const { address, ensName } = useAccountWallet(); return <p>{ensName ?? address ?? "No wallet connected"}</p>;}

Return Values

PropertyTypeDescription
walletobjectThe active account, with address and ensName. Its meta.icon is always an empty string in 0.1.70
addressstring | undefinedAddress of the active account
ensNamestring | undefinedThe B3 profile display name of that address, without .b3.fun. It is not an ENS lookup
connectedSmartWalletWallet | undefinedThe connected Global Account smart wallet
connectedEOAWalletWallet | undefinedThe connected external wallet
isActiveSmartWalletboolean | undefinedWhether the smart wallet is the active one
isActiveEOAWalletboolean | undefinedWhether the external wallet is the active one
eoaWalletIconstring | undefinedAlways an empty string in 0.1.70
smartWalletIconstring | undefinedIcon of the smart wallet

Asset Management Hooks

useAccountAssets

useAccountAssets(address) returns a TanStack Query result whose data.nftResponse lists the NFTs that address holds. The query runs only when you pass an address.

tsx
import { useAccountAssets, useAccountWallet } from "@b3dotfun/sdk/global-account/react";function AssetsComponent() { const { address } = useAccountWallet(); const { data, isLoading, error } = useAccountAssets(address); if (isLoading) return <div>Loading assets...</div>; if (error) return <div>Error loading assets: {error.message}</div>; return <pre>{JSON.stringify(data?.nftResponse, null, 2)}</pre>;}

Configuration Hooks

useB3Config

Returns the configuration passed to B3Provider.

tsx
import { useB3Config } from "@b3dotfun/sdk/global-account/react";function ConfigComponent() { const { environment, partnerId } = useB3Config(); return ( <div> <p>Environment: {environment}</p> <p>Partner ID: {partnerId}</p> </div> );}

Return Values

PropertyTypeDescription
environment"development" | "production"The environment set on B3Provider
partnerIdstringYour partner ID
theme"light" | "dark"The theme set on B3Provider
clientTypeClientTypeThe API client type
authStrategyAuthStrategyThe sign-in strategy

It also returns accountOverride, automaticallySetFirstEoa, defaultPermissions, stripePublishableKey and createClientReferenceId. No other B3Provider prop is returned.

useB3

Deprecated. useB3 is an alias for useB3Config and returns the same configuration, not the signed-in account. Use useB3Config instead.

Next Steps

Examples

See complete examples using these hooks.

Learn More
Ask a question... ⌘I