Use the signMessage method exported from the useSolanaWallets hook to sign a message with an Solana wallet.
signMessage
useSolanaWallets
signMessage: (message: Uint8Array) => Promise<Uint8Array>;
// This assumes you have already created a Solana wallet for the user or they have connected one const {wallets} = useSolanaWallets(); const message = 'Hello world'; const {signature} = await wallets[0].signMessage(new TextEncoder().encode(message));
Message to be signed.
The signature produced by the wallet.
Was this page helpful?