signMessage()

Use agent.signMessage() to cryptographically sign messages on EVM networks. Supports both EIP-191 (simple text messages) and EIP-712 (typed structured data) signing standards. Returns signature components (v, r, s) and a formatted signature string. Commonly used for authentication, off-chain orders, and proving wallet ownership.

Signature

agent.signMessage(
  request: {
    network: string;
    request: {
      messageType: "eip191" | "eip712";
      chainId: number;
      data: object;
    };
  }
): Promise<SignMessageResponse>

Parameters

Param
Type
Description

request

object

Message signing configuration

request.network

string

Network identifier: 'ethereum:{chainId}' | 'solana'

request.request

object

Transaction details

request.request.messageType

string

Signing standard to use; 'eip191' | 'eip712'

request.request.chainId

number

Ethereum Chain ID

request.request.data

object

Message data (see formats below)

EIP-191 Data Format

For simple message signing

EIP-712 Data Format

For typed structured data

Returns

  • Promise<SignMessageResponse>

Examples

EIP-191 (Simple Message)

EIP-712 (Typed Data)

Common Errors

Error
Cause
Solution

"Invalid chain ID"

Chain ID doesn't match network

Ensure chainId matches network (e.g., mainnet is 1, or ethereum:1)

"Invalid EIP-712 data"

Malformed typed data structure

Validate domain, types, primaryType, and message format

"Invalid message"

Empty or malformed message for EIP-191

Ensure data.message is a non-empty string

Last updated