I'm facing a problem when I try to sign data with Nami Wallet API.
Here is the code snippet:
let namiAPI = await window.cardano.nami.enable();
let addr = await namiAPI.getUsedAddresses();
let payload = "48656C6C6F20576F726C6421"; //hex of "Hello World!"
let signed = await namiAPI.signData(addr.get(0), payload);
I get the following error:
{
"code": 4,
"info": "If a wallet enforces data format requirements, this error signifies that the data did not conform to valid formats."
}
What could be the problem? Am I encoding the payload wrong?