From a513e406ad0f6125acce446ff58367356130a12c Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Wed, 17 Jan 2024 20:36:06 -0500 Subject: [PATCH] tests: add tests for EIP-712 payload aliases --- src.ts/_tests/test-hash-typeddata.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src.ts/_tests/test-hash-typeddata.ts b/src.ts/_tests/test-hash-typeddata.ts index 5b0a82744..95d675a9d 100644 --- a/src.ts/_tests/test-hash-typeddata.ts +++ b/src.ts/_tests/test-hash-typeddata.ts @@ -135,6 +135,15 @@ describe("Tests Typed Data (EIP-712) aliases", function() { const encoder = TypedDataEncoder.from(test.types); assert.equal(encoder.primaryType, "foo", "primaryType"); assert.equal(encoder.encodeData("foo", test.data), test.encoded, "encoded"); + + const encoderAlias = TypedDataEncoder.from(test.typesAlias); + assert.equal(encoderAlias.primaryType, "foo", "primaryType"); + assert.equal(encoderAlias.encodeData("foo", test.data), test.encoded, "encoded"); + + const payload = TypedDataEncoder.getPayload({ }, test.types, test.data); + const payloadAlias = TypedDataEncoder.getPayload({ }, test.typesAlias, test.data); + + assert.equal(JSON.stringify(payloadAlias), JSON.stringify(payload), "payload"); }); }