tests: add tests for EIP-712 payload aliases
This commit is contained in:
parent
56c1361ee8
commit
a513e406ad
@ -135,6 +135,15 @@ describe("Tests Typed Data (EIP-712) aliases", function() {
|
|||||||
const encoder = TypedDataEncoder.from(test.types);
|
const encoder = TypedDataEncoder.from(test.types);
|
||||||
assert.equal(encoder.primaryType, "foo", "primaryType");
|
assert.equal(encoder.primaryType, "foo", "primaryType");
|
||||||
assert.equal(encoder.encodeData("foo", test.data), test.encoded, "encoded");
|
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");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user