getAddData

Prepares the data required for signing an Add message according to EIP-712.

Example

const message: AddMessage = {
owner: "0xYourAddress",
keyType: 1,
key: "0xYourPublicKey",
metadataType: 1,
metadata: "0xYourMetadata",
nonce: BigInt("YourNonce"),
deadline: BigInt("YourDeadline"),
};
const data = getAddData(message);
function getAddData(message: AddMessage): {
domain: {
readonly chainId: 10;
readonly name: "Farcaster KeyGateway";
readonly verifyingContract: "0x00000000fC56947c7E7183f8Ca4B62398CaAdf0B";
readonly version: "1";
};
message: AddMessage;
primaryType: "Add";
types: {
readonly Add: readonly [
{ readonly name: "owner"; readonly type: "address" },
{ readonly name: "keyType"; readonly type: "uint32" },
{ readonly name: "key"; readonly type: "bytes" },
{ readonly name: "metadataType"; readonly type: "uint8" },
{ readonly name: "metadata"; readonly type: "bytes" },
{ readonly name: "nonce"; readonly type: "uint256" },
{ readonly name: "deadline"; readonly type: "uint256" },
];
};
};

Parameters

The AddMessage object containing the message to be signed.

Type

let message: {
deadline: bigint;
key: Hex;
keyType: number;
metadata: Hex;
metadataType: number;
nonce: bigint;
owner: Address;
};

Returns

let returnType: {
domain: {
readonly chainId: 10;
readonly name: "Farcaster KeyGateway";
readonly verifyingContract: "0x00000000fC56947c7E7183f8Ca4B62398CaAdf0B";
readonly version: "1";
};
message: AddMessage;
primaryType: "Add";
types: {
readonly Add: readonly [
{ readonly name: "owner"; readonly type: "address" },
{ readonly name: "keyType"; readonly type: "uint32" },
{ readonly name: "key"; readonly type: "bytes" },
{ readonly name: "metadataType"; readonly type: "uint8" },
{ readonly name: "metadata"; readonly type: "bytes" },
{ readonly name: "nonce"; readonly type: "uint256" },
{ readonly name: "deadline"; readonly type: "uint256" },
];
};
};

The data object structured according to EIP-712, ready for signing.