Mobile (WalletConnect)
generate
Create a WalletConnect URI and Joey deep link for your own connect button or QR code.
generate creates a connection URI and a deep link without relying on the connect modal. Use it to build your own "Connect with Joey" button or QR code.
const { actions } = useProvider();
const { data, error } = await actions.generate();
Parameters (optional)
{
walletId?: string; // a wallet from config.walletDetails, e.g. Joey's ID
chain?: string;
pairing?: { topic: string };
openModal?: boolean;
}
When walletId matches an entry in walletDetails, the deep link uses that wallet's format: joey://settings/wc?uri=… for Joey. Otherwise it falls back to the generic wc:// format.
Returns
Promise<{
data: { uri: string; deeplink: string } | null;
error: Error | null;
}>
Example: a custom Joey button
'use client';
import core from '@joey-wallet/wc-client/core';
import { useProvider } from './provider';
export function JoeyButton({ onShowQr }: { onShowQr: (uri: string) => void }) {
const { actions } = useProvider();
const handleClick = async () => {
const { data, error } = await actions.generate({
walletId: core.constants.wallets.joey.projectId,
openModal: false,
});
if (error || !data) throw error ?? new Error('Could not create a connection');
if (/Android|iPhone|iPad/i.test(navigator.userAgent)) {
window.location.href = data.deeplink; // opens Joey directly
} else {
onShowQr(data.uri); // render as a QR code for the user to scan
}
};
return <button onClick={handleClick}>Connect with Joey</button>;
}
The connection completes when the user approves in Joey; the provider's session updates and a connect event fires. See Deeplinking for more on the link formats.