diff --git a/index.ts b/index.ts index 768ff63..542aa21 100644 --- a/index.ts +++ b/index.ts @@ -124,6 +124,12 @@ export const getDomainDefinition = ( actionId, chainId ); + case "coupon-update-delegate-key": + return getCouponUpdateDelegateKeyDomainDefinition( + verifyingContract, + actionId, + chainId + ); default: throw new Error("unknown type " + message.type); } @@ -365,6 +371,25 @@ export const getCouponBurnDomainDefinition = ( return { domain, types }; }; +export const getCouponUpdateDelegateKeyDomainDefinition = ( + verifyingContract: string, + actionId: string, + chainId: number +) => { + const domain = getMessageDomainType(chainId, verifyingContract, actionId); + + const types = { + Message: [ + { name: "authorizedMember", type: "address" }, + { name: "newDelegateKey", type: "address" }, + { name: "nonce", type: "uint256" }, + ], + EIP712Domain: getDomainType(), + }; + + return { domain, types }; +}; + export const getDomainType = () => { return [ { name: "name", type: "string" }, @@ -400,6 +425,8 @@ export const prepareMessage = (message: MessageWithType) => { return message; case "coupon-burn": return message; + case "coupon-update-delegate-key": + return message; default: throw new Error("unknown type " + message.type); } diff --git a/types.ts b/types.ts index 70632f3..cbde9a5 100644 --- a/types.ts +++ b/types.ts @@ -87,7 +87,8 @@ export type MessageWithType = Record & { | "coupon-kyc" | "manager-coupon" | "coupon-nft" - | "coupon-burn"; + | "coupon-burn" + | "coupon-update-delegate-key"; }; export type VoteEntry = {