SDK
Javascript
How to
Wallet Operation
Sign Typed Data

Sign Typed Data

This method allows users to sign typed data using their MPC wallet.

Method Signature

async signTypedData(config: SignTypedDataConfig): Promise<string>

Parameters

config: SignTypedDataConfig - An object with the following properties:

  • network: Network (required) - The network used for transactions. You can use the Network enum to specify the network.
  • data: string (required) - The raw data you get from dApps or WalletConnect.

Returns

Promise<string> - The signature of the typed data.

Example Usage

const signature = await sdk.wallet.sign.signTypedData({
  network: Network.ETHEREUM,
  data: '0x', // Replace with actual typed data
});
console.log(signature);

Response Example

"0x7e335fd65539e5c6c726be97f93e3e69019d899969d21023d2c6da51622a817d016c2e036a06b734d6de93f01a63e49460d783af8d2eb467d95a487e2028f9751c"
ℹ️

The response is a string representing the signature of the typed data.

Additional Information

  • This method requires a valid wallet token in the SDK configuration.
  • The network parameter is required to determine which blockchain network's signing algorithm to use.
  • The data parameter should contain the raw typed data message you receive from dApps or WalletConnect.

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