Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests: add tests for EIP-712 payload aliases
  • Loading branch information
ricmoo committed Jan 18, 2024
1 parent 56c1361 commit a513e40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src.ts/_tests/test-hash-typeddata.ts
Expand Up @@ -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");
});
}

Expand Down

0 comments on commit a513e40

Please sign in to comment.