Created
October 4, 2023 14:09
-
-
Save Luke-Rogerson/3a68ae90535ab6a45a9596f778b4ca85 to your computer and use it in GitHub Desktop.
signTypedData MessageTypes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface MessageTypes { | |
EIP712Domain: MessageTypeProperty[]; | |
[additionalProperties: string]: MessageTypeProperty[]; | |
} | |
/** | |
* This is the message format used for `signTypeData`, for all versions | |
* except `V1`. | |
* | |
* @template T - The custom types used by this message. | |
* @property types - The custom types used by this message. | |
* @property primaryType - The type of the message. | |
* @property domain - Signing domain metadata. The signing domain is the intended context for the | |
* signature (e.g. the dapp, protocol, etc. that it's intended for). This data is used to | |
* construct the domain seperator of the message. | |
* @property domain.name - The name of the signing domain. | |
* @property domain.version - The current major version of the signing domain. | |
* @property domain.chainId - The chain ID of the signing domain. | |
* @property domain.verifyingContract - The address of the contract that can verify the signature. | |
* @property domain.salt - A disambiguating salt for the protocol. | |
* @property message - The message to be signed. | |
*/ | |
export interface TypedMessage<T extends MessageTypes> { | |
types: T; | |
primaryType: keyof T; | |
domain: { | |
name?: string; | |
version?: string; | |
chainId?: number; | |
verifyingContract?: string; | |
salt?: ArrayBuffer; | |
}; | |
message: Record<string, unknown>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment