Closed Rohitbagul003 closed 1 year ago
Closing this as in sign function I needed to change base64Encode to base64UrlEncode.
Updated function:-
void _signMessages() async {
const String description = "Sign Messages";
try {
debugPrint("Create $description... account base58 ${solanaWalletAdapter?.connectedAccount?.addressBase58}");
final List<String> messages = List.generate(1, (index) => base64UrlEncode('Sign message $index'.codeUnits));
debugPrint("description -> $description...");
SignMessagesResult? result = await solanaWalletAdapter?.signMessages(
messages: messages,
addresses: [base58ToBase64(solanaWalletAdapter!.connectedAccount!.addressBase58)],
);
debugPrint("Signed Messages ${result?.signedPayloads.join('\n')}");
} catch (error, stack) {
print('$description Error: $error');
print('$description Stack: $stack');
debugPrint("catch error in sign ${error.toString()}, $stack");
}
}
is the signMessage Function and error log:-