🟠signMessage

You can request your user to sign a message with their wallet's Bitcoin addresses, by invoking the signMessage method.

import {
  Wallet,
  BitcoinNetworkType,
  RpcErrorCode,
} from "sats-connect";

try {
  const response = await Wallet.request("signMessage", {
    address,
    message,
  });
  if (response.status === "success") {
    // handle success response
  } else {
    if (response.error.code === RpcErrorCode.USER_REJECTION) {
       // handle user request cancelation
    } else {
       // handle request error
    }
  }
} catch (err) {
  alert('Something Went Wrong');
}

The signMessage method returns a Promise that resolves to the SignMessageResult object:

Last updated