Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

wallet_sign

Unified signing method supporting multiple message formats (ERC-7871). Delegates to personal_sign or eth_signTypedData_v4 based on the request type.

Authentication Required: Yes

Request

await jaw.provider.request({
  method: 'wallet_sign',
  params: [{
    request: {
      type: '0x45', // or '0x01'
      data: { message: 'Hello World' } // or TypedData object for 0x01
    },
  }],
});

Parameters

NameTypeRequiredDescription
request.typestringYesSignature type: "0x45" (personal_sign) or "0x01" (signTypedData_v4)
request.dataobjectYesFor 0x45: { message: string }. For 0x01: TypedData object (EIP-712)

Supported Types

TypeEIP StandardDescriptionData Format
0x45EIP-191Personal message signing{ message: string } - UTF-8 message string
0x01EIP-712Structured typed data signingTypedData object with types, domain, primaryType, message

Response

Returns the signature as a hexadecimal string.

Type: 0x${string}

Example

"0x1234567890abcdef..."

Behavior

  • Type 0x45: Delegates to personal_sign - adds EIP-191 prefix and signs the UTF-8 message
  • Type 0x01: Delegates to eth_signTypedData_v4 - signs structured EIP-712 data
  • Opens popup for user approval
  • Returns signature in same format as the underlying method

Errors

CodeDescription
4001User rejected the request
4100Unauthorized (not authenticated)
-32602Invalid params (unsupported type or malformed data)

Example

Personal Message (Type 0x45)

const message = 'Hello World';
 
const signature = await jaw.provider.request({
  method: 'wallet_sign',
  params: [{
    request: {
      type: '0x45',
      data: {
        message: message, // UTF-8 message string
      },
    },
  }],
});

Typed Data (Type 0x01)

const typedData = {
  types: {
    EIP712Domain: [
      { name: 'name', type: 'string' },
      { name: 'version', type: 'string' },
      { name: 'chainId', type: 'uint256' },
    ],
    Person: [
      { name: 'name', type: 'string' },
      { name: 'wallet', type: 'address' },
    ],
  },
  primaryType: 'Person',
  domain: {
    name: 'My DApp',
    version: '1',
    chainId: 1,
  },
  message: {
    name: 'Alice',
    wallet: '0x...',
  },
};
 
const signature = await jaw.provider.request({
  method: 'wallet_sign',
  params: [{
    request: {
      type: '0x01',
      data: typedData, // TypedData object directly
    },
  }],
});

SIWE (Sign-In With Ethereum)

const siweMessage = `example.com wants you to sign in with your Ethereum account:
0x1234...
 
Sign in to Example DApp
 
URI: https://example.com
Version: 1
Chain ID: 1
Nonce: ${crypto.randomUUID()}
Issued At: ${new Date().toISOString()}`;
 
const signature = await jaw.provider.request({
  method: 'wallet_sign',
  params: [{
    request: {
      type: '0x45',
      data: {
        message: siweMessage, // UTF-8 message string
      },
    },
  }],
});

Related Methods