getKeyRequestData

Prepares the data required for signing a key request using EIP-712 typed data signing. This includes the domain, types, primary type, and the message to be signed.

Example

const message = {
requestFid: 123456789n,
key: "0x04bfc...",
deadline: 1657758061n,
};
const eip712Data = getKeyRequestData(message);
function getKeyRequestData(message: SignedKeyRequestMessage): {
domain: {
readonly chainId: 10;
readonly name: "Farcaster SignedKeyRequestValidator";
readonly verifyingContract: "0x00000000FC700472606ED4fA22623Acf62c60553";
readonly version: "1";
};
primaryType: "SignedKeyRequest";
types: {
readonly SignedKeyRequest: Array<{ name: string; type: string }>;
};
};

Parameters

The message to be signed, containing the request FID, key, and deadline.

Type

let message: { deadline: bigint; key: Hex; requestFid: bigint };

Returns

let returnType: {
domain: {
readonly chainId: 10;
readonly name: "Farcaster SignedKeyRequestValidator";
readonly verifyingContract: "0x00000000FC700472606ED4fA22623Acf62c60553";
readonly version: "1";
};
primaryType: "SignedKeyRequest";
types: {
readonly SignedKeyRequest: Array<{ name: string; type: string }>;
};
};

An object containing the domain, types, primary type, and the message for EIP-712 signing.