To request a signature from a wallet, first find your desired wallet from the wallets array and get its EIP-1193 provider via its getEthereumProvider method:

const {wallets} = useWallets();
const wallet = wallets[0]; // Replace this with your desired wallet
const provider = await wallet.getEthereumProvider();

Then, using the provider’s request method, send a personal_sign JSON-RPC to the wallet. In the params array, include the message to sign as the first entry, and the wallet’s address as the second entry.

const address = wallet.address;
const message = 'This is the message I am signing';
const signature = await provider.request({
  method: 'personal_sign',
  params: [message, address]
});

If you’ve integrated Privy with another web3 library, you can also use that library’s syntax for requesting a signature from the wallet:

LibraryMethod
ViemUse the wallet client’s signMessage method.
EthersUse the signer’s signMessage method.
WagmiUse the useSignMessage hook.

When requesting a signature from an embedded wallet, you can customize the signature prompt by using Privy’s native signMessage method.