diff --git a/src/sign-typed-data.ts b/src/sign-typed-data.ts index c0ce1d3c..0da59a81 100644 --- a/src/sign-typed-data.ts +++ b/src/sign-typed-data.ts @@ -105,6 +105,22 @@ export type TypedMessage = { message: Record; }; +const PERMIT_TYPE_SCHEMA = { + properties: { + message: { + type: 'object', + properties: { + owner: { type: 'string' }, + spender: { type: 'string' }, + value: { type: 'string' }, + nonce: { type: 'string' }, + deadline: { type: 'string' }, + }, + required: ['owner', 'spender', 'value', 'nonce', 'deadline'], + }, + }, +}; + export const TYPED_MESSAGE_SCHEMA = { type: 'object', properties: { @@ -127,6 +143,10 @@ export const TYPED_MESSAGE_SCHEMA = { message: { type: 'object' }, }, required: ['types', 'primaryType', 'domain', 'message'], + if: { + properties: { primaryType: { const: 'Permit' } }, + }, + then: PERMIT_TYPE_SCHEMA, }; /**