SDK
Javascript
How to
Wallet Operation
Sign Message

Sign Message

This method allows users to sign a message using their MPC wallet.

Method Signature

async signMessage(config: SignMessageConfig): Promise<string>

Parameters

config: SignMessageConfig - An object with the following properties:

  • network: Network (required) - The network used for transactions. You can use the Network enum to specify the network.
  • message: string (required) - The message to sign.

Returns

Promise<string> - The signature of the message.

Example Usage

const signature = await sdk.wallet.signMessage({
  network: Network.ETHEREUM,
  message: 'Hello, world!',
});
console.log(signature);

Response Example

"0x6b589c68bdcd3024232d60d10ec12a6ed1c5efd14855d3ea49a43b7f79c01649514a73d2d1a25151642f1a207ffcd3ba0b22f7241970f0fc8612b1d7718ca4ed1b"
ℹ️

The response is a string representing the signature of the message.

Additional Information

  • This method requires a valid wallet token in the SDK configuration.
  • The signature can be used to prove that the owner of the private key signed the message without revealing the private key.
  • The network parameter is required to determine which blockchain network's signing algorithm to use.

For more information, see the Xellar Sign Message API Documentation (opens in a new tab).