Hi I am trying to sign a message using solana/wallet-adapter and gets error: "Cannot sign transaction using sign message"
code example below, Solflare and Wallet Connect treats Uint8Array encoded message fine, so trying to figure out
import { serialize } from 'borsh';
const message = new Mail({
from: new Person({
name: 'Cow',
wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'
}),
to: new Person({
name: 'Bob',
wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'
}),
contents: 'Hello, Bob!'
});
// Serialize the data
const serializedData = serialize(schema, message);
// Sign the serialized data
const signature = await phantomWalletProvider.signMessage(serializedData);
this variant doesnt work also:
signature = await walletProvider.signMessage(new TextEncoder().encode(JSON.stringify(message)));