1

I'm using the walletMultiButton component from "@solana/wallet-adapter-react-ui" and I'm finding it challenging to access error messages when the user rejects request

I tried checking with the catch blocks but it doesn't work.

my code:

const signCustomMessage = async () => {
const address = publicKey.toBase58();
const chain = "devnet";
const account = {
  address: address,
  chain: chain,
  network: "solana",
};

const { data } = await axios
  .post("/", account)
  .then((res) => {
    return res;
  })
  .catch((err) => {
    console.error(err);
  });

const message = data.message;
const encodedMessage = new TextEncoder().encode(data.message);
const signedMessage = await signMessage(encodedMessage, "utf8");
setSigned(true);
const signature = base58.encode(signedMessage);

try {
  await signIn("credentials", {
    message,
    signature,
    redirect: false,
  });
} catch (e) {
  return;
}};

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.