From 45355aa89b7d9dd325471869cbc9b92cbfbcca9e Mon Sep 17 00:00:00 2001 From: nickmzero <32622260+nickmzero@users.noreply.github.com> Date: Fri, 8 Jul 2022 09:37:59 -0500 Subject: [PATCH] Update kyc coupon types to match KycOnboarding coupon changes (#40) --- index.ts | 5 ++- .../getCouponKycDomainDefinition.unit.test.ts | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/getCouponKycDomainDefinition.unit.test.ts diff --git a/index.ts b/index.ts index 83b8b53..1ec58b5 100644 --- a/index.ts +++ b/index.ts @@ -270,7 +270,10 @@ export const getCouponKycDomainDefinition = ( const domain = getMessageDomainType(chainId, verifyingContract, actionId); const types = { - Message: [{ name: "kycedMember", type: "address" }], + Message: [ + { name: "kycedMember", type: "address" }, + { name: "memberNonce", type: "uint256"} + ], EIP712Domain: getDomainType(), }; diff --git a/tests/getCouponKycDomainDefinition.unit.test.ts b/tests/getCouponKycDomainDefinition.unit.test.ts new file mode 100644 index 0000000..42f79bf --- /dev/null +++ b/tests/getCouponKycDomainDefinition.unit.test.ts @@ -0,0 +1,33 @@ +import { + DEFAULT_ACTION_ID, + DEFAULT_CHAIN_ID, + DEFAULT_VERIFYING_CONTRACT, +} from "./utils"; +import { getDomainType, getCouponKycDomainDefinition } from "../index"; + +describe("getCouponKycDomainDefinition unit tests", () => { + test("should return correct data", () => { + expect( + getCouponKycDomainDefinition( + DEFAULT_VERIFYING_CONTRACT, + DEFAULT_ACTION_ID, + DEFAULT_CHAIN_ID + ) + ).toEqual({ + domain: { + actionId: DEFAULT_ACTION_ID, + chainId: DEFAULT_CHAIN_ID, + name: "Snapshot Message", + verifyingContract: DEFAULT_VERIFYING_CONTRACT, + version: "4", + }, + types: { + Message: [ + { name: "kycedMember", type: "address" }, + { name: "memberNonce", type: "uint256" }, + ], + EIP712Domain: getDomainType(), + }, + }); + }); +});