⌘K

Icon SunFilledIcon MoonStars
Signing a Message

Icon LinkSigning a Message

With access to the user address and the connection authorized, you can request the user's signature using fuel.signMessage.

const accounts = await fuel.accounts();
const account = accounts[0];
const wallet = await fuel.getWallet(account);
const signedMessage = await wallet.signMessage(message);
console.log("Message signature", signedMessage);

Icon LinkWith React

In a react app, once the connection is established, you can use the useWallet hook to get a wallet instance and sign the transaction.

import { useAccount, useWallet } from '@fuel-wallet/react';
// ...
const { account } = useAccount();
const { wallet } = useWallet({ address: account });
 
const signedMessage = await wallet.signMessage('Message to sign');
console.log('Message signature', signedMessage);
// Message signature 0x59160a10fee638458aaadd7eb...