Receive
Show the addresses others can send funds to — one per chain the app is provisioned on. Pollar renders the address and its QR code inside a modal.
Drop-in button that opens a prebuilt modal showing the connected wallet's address and a QR code.
openReceiveModal() takes no arguments — it reads the connected wallet address from context.
Hook & values used
All of these come from the usePollar() hook — the react layer built on top of getClient().
usePollar()hookparams: No arguments. Call it at the top level of a component — it reads React context, so it must run during render.
returns: PollarContextValue — the whole SDK surface: reactive state values, modal openers, and getClient() to drop down to core.
openReceiveModal()syncparams: No arguments — it reads the connected wallet address from context.
returns: void — opens the prebuilt modal with the address and QR code.
walletreactive valueparams: Not a function — a WalletInfo object read from usePollar(), or null when not connected.
returns: The Stellar wallet (wallet.address holds the public key, wallet.custody/provider its type); re-renders when the session changes.
walletsreactive valueparams: Not a function — a WalletInfo[] read from usePollar(); [] when unauthenticated.
returns: Every wallet the user holds, one per chain — a superset of wallet, with chain populated. This is what drives a network selector.
useChains()hookparams: No arguments. Cross-references the app's configured chains with the wallets the user actually holds.
returns: { chains, primaryChain, primaryAddress, ready } — chains is [] until /config resolves, so gate any picker on ready.
addressForChain(wallets, chain)syncparams: wallets: WalletInfo[] (from usePollar); chain: WalletChain | null.
returns: string — the address to show for that chain, or '' when the user holds no wallet there.
<ChainSelect />componentparams: value, options, onChange, plus optional label and disabled. Feed options from useChains().chains.
returns: The network picker, or null when there is a single option — a one-chain app renders no selector at all.
import { usePollar, useChains, addressForChain, } from '@pollar/react'; export function Receive() { const { wallets, openReceiveModal } = usePollar(); const { chains, primaryChain } = useChains(); // the address to show for the app's first configured chain const address = addressForChain(wallets, primaryChain); return ( <> <code>{address}</code> <button onClick={openReceiveModal}>Receive</button> </> ); }
Connect a wallet to see its addresses.