stx_signStructuredMessage

Request the signature of a structured message using the Stacks address of an account.

Method name

stx_signStructuredMessage


Parameters

Parameter
Description
Required
Type

message

The structured message to sign, represented as a Clarity value. Can be a hex-encoded string

string | object

domain

The domain tuple that defines the signing context, following SIP-018. Can be a hex-encoded string.

string | object


Example request

try {
  // Request signature
  const response = await window.LeatherProvider.request("stx_signStructuredMessage", {
    message: "3e5f6a7b9d8c1f2e4a6b",
    domain: "2c26b46b68ffc68ff99b453c1d3041344b947b77"
  });

  console.log("Response:", response);

Example response

{
  "jsonrpc": "2.0",
  "id": "a1b2c3d4-e5f6-7890-1234-56789abcdef0",
  "result": {
    "signature": "0x8d3340a7b071ba29fa210cd7e079edd44e004a8611132fcfa475244b00dcf7",
    "publicKey": "0x04bfcab890d2a5b3c1df8e47a9c2f7e5a1..."
  }
}

Last updated