@provablehq/veil-aleo-react-hooks
React bindings for Veil. A batteries-included provider auto-configures the
known Aleo wallet adapters (Shield, Leo, Puzzle, Fox), and a hook returns
ready-to-use clients — wallet connection and chain access without wiring
adapters by hand. Applies to React apps; framework-agnostic code uses
@provablehq/veil-aleo-wallet-adapter directly.
Installation
npm install @provablehq/veil-core @provablehq/veil-aleo-react-hooks
Key exports
VeilProvider— wraps the app tree and configures wallets. Props includenetwork(defaults to'mainnet'),autoConnect(defaults totrue),decryptPermission,programs, awalletsoverride, and the privacy-preserving connect optionsrecordAccess,readAddress, andalgorithmsAllowed.useVeilWallet(config?)— returnspublicClient,walletClient,address,connected,connecting,connect,disconnect,wallets,selectWallet.config.rpcUrloverrides the node endpoint (defaults to the Provable API);config.networkpins the transport's network instead of following the connected wallet.
Example
import { VeilProvider, useVeilWallet } from '@provablehq/veil-aleo-react-hooks'
function Root() {
return (
<VeilProvider network="mainnet">
<App />
</VeilProvider>
)
}
function App() {
const { publicClient, walletClient, address, connect } = useVeilWallet()
// publicClient works before a wallet connects; walletClient is
// undefined until connect() resolves.
return address ? <p>{address}</p> : <button onClick={() => connect()}>Connect</button>
}
See React overview, VeilProvider,
and useVeilWallet for the full provider and hook
API.