Use the signMessage method exported from the useSolanaWallets hook to sign a message with an Solana wallet.

signMessage: (message: Uint8Array) => Promise<Uint8Array>;

Usage

// 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));

Parameters

message
string
required

Message to be signed.

Response

signature
string

The signature produced by the wallet.