eth_signTypedData_v4

Presents a data message for the user to sign in a structured and readable format and returns the signed response. Introduced by EIP-712. This method requires that the user has granted permission to interact with their account first, so make sure to call eth_requestAccounts first.

Params

1. Address (required)

The address of the requested signing account.

string

Match pattern:^0x[0-9a-fA-F]{40}$

2. TypedData (required)

type TypedDataParameters = {
    types: MessageTypes;
    primaryType: keyof MessageTypes;
    domain: {
        name?: string;
        version?: string;
        chainId?: number;
        verifyingContract?: string;
        salt?: ArrayBuffer;
    };
    message: Record<string, unknown>; // The message you're proposing the user to sign.
};

type MessageTypes = {
    EIP712Domain: MessageTypeProperty[];
    [additionalProperties: string]: MessageTypeProperty[];
};

type MessageTypeProperty = {
    name: string;
    type: string;
};

Result

string

Match pattern: ^0x[0-9a-f]*$

Example

Request

Result

最后更新于

这有帮助吗?