@privy-io/cross-app-connect/solana registers a Privy global wallet as a Wallet Standard wallet, so existing @solana/wallet-adapter code picks it up with no custom adapter.
1. Install dependencies
Install the SDK and the Wallet Standard packages it requires:./solana subpath.
2. Register the wallet
CallregisterPrivyCrossAppWallet once, early in the app’s lifecycle:
Parameters
The function accepts an object with the following fields:Wallet name shown in a Wallet Standard app, such as a
@solana/wallet-adapter wallet list.Wallet icon shown alongside
name. Wallet Standard types this as a base64 data URI:
data:image/svg+xml;base64,…, data:image/png;base64,…, data:image/webp;base64,…, or
data:image/gif;base64,…. An ordinary HTTPS URL does not satisfy the type.The Solana cluster, meaning the network such as mainnet or devnet, that scopes the connection.
Defaults to mainnet.
How the requester asks for its response. A headless provider built on
@privy-io/cross-app-provider always replies over postMessage, so leave this at message to
match.Milliseconds before a wallet request closes with a timeout error. Defaults to two minutes.
Overrides the default Privy API URL. Intended for local development against a non-default stack.
Returns
Removes the wallet from every registry that accepted it and stops listening for apps that
initialize later.
3. Manage the registration lifecycle
Registration is a side effect onwindow, so pair it with cleanup. In React, register in a useEffect and return unregister:
registerPrivyCrossAppWallet once per provider app ID. Each registration keeps its own stored approval, and all of them appear in the wallet list below.
4. Wrap the app with providers
The wallet announces itself over thewallet-standard:register-wallet event and also answers apps that initialize after that event fires. WalletProvider therefore finds it without an entry in wallets:
autoConnect. The wallet responds as follows:
- With no stored connection, the wallet answers a silent probe with an empty account list and opens no popup. Page load never surprises the user with a consent window.
- With a stored connection, the wallet exposes its account immediately and
autoConnectreconnects without a popup. Connections live inlocalStorageand the provider stamps them with a 14-day expiry. - The wallet clears an expired or malformed stored connection, leaving an empty account list. The next explicit connect opens the consent popup as usual.
Complete example
All together, this should look like:window, so it must run on the client. In the Next.js App Router, mark both files 'use client'.
5. Connect the wallet
useWallet lists every registered wallet. Selecting one connects it, which opens the provider’s consent popup:
select only records the choice: WalletProvider connects the selected wallet because autoConnect is set.
Accepted chain identifiers
Three forms name the same cluster. All normalize to the genesis-hash CAIP-2 ID, the chain-agnostic identifier format Privy sends on the wire.
Any other value throws at registration. The wallet reports its cluster as the alias form through
wallet.chains.
