Sign Message
{
address?: boolean; // Should we include the address of the account in the message
application?: boolean; // Should we include the domain of the dapp
chainId?: boolean; // Should we include the current chain id the wallet is connected to
message: string; // The message to be signed and displayed to the user
nonce: string; // A nonce the dapp should generate,
}{
message: string || Uint8Array; // The message to be signed and displayed to the user
}const metadata = {
address: true,
application: true,
chainId: true,
message: "This is a sample message",
nonce: 12345,
};
const signature = await window.martian.signMessage(metadata);
console.log(signature)
// {
// "address": "0x34c1e7efa0808b7b0113d71b722f483585e4c4b47ba2b0e703b090937f0c63a1",
// "application": "main.d3c4qcdwu8dzdc.amplifyapp.com",
// "chainId": 25,
// "message": "This is a sample message",
// "nonce": 12345,
// "fullMessage": "APTOS\naddress: 0x34c1e7efa0808b7b0113d71b722f483585e4c4b47ba2b0e703b090937f0c63a1\napplication: main.d3c4qcdwu8dzdc.amplifyapp.com\nchainId: 25\nmessage: This is a sample message\nnonce: 12345",
// "prefix": "APTOS",
// "signature": "0x6f9ee0929285b83d385b93ac615784964269e64d756c9538d5fd8c999d9c5b4d3085c363cd034ecd537ea9e522ea0a2a8c7ab898b79b0eb4d7b3cb853291f801"
// }const metadata = {
message: "<Uint8Array>",
};
const signature = await window.martian.sui.signMessage(metadata);
console.log(signature)
// {
// "messageBytes": string
// "signature": string
// }Last updated