Skip to content

Commit

Permalink
adds a test for long primary types like hyperliquid
Browse files Browse the repository at this point in the history
  • Loading branch information
netbonus committed Jun 14, 2024
1 parent 68a8242 commit bfa4643
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/__test__/e2e/eth.msg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,65 @@ describe('ETH Messages', () => {
await runEthMsg(buildEthMsgReq(msg, 'eip712'), client);
});

it('Signs long primary types', async () => {
const msg = {
types: {
EIP712Domain: [
{
name: 'name',
type: 'string',
},
{
name: 'version',
type: 'string',
},
{
name: 'chainId',
type: 'uint256',
},
{
name: 'verifyingContract',
type: 'address',
},
],
'HyperliquidTransaction:ApproveAgent': [
{
name: 'hyperliquidChain',
type: 'string',
},
{
name: 'agentAddress',
type: 'address',
},
{
name: 'agentName',
type: 'string',
},
{
name: 'nonce',
type: 'uint64',
},
],
},
primaryType: 'HyperliquidTransaction:ApproveAgent',
domain: {
name: 'HyperliquidSignTransaction',
version: '1',
chainId: 1,
verifyingContract: '0x0000000000000000000000000000000000000000',
},
message: {
hyperliquidChain: 'Mainnet',
signatureChainId: '0x1',
agentAddress: '0x343ab48c498a5b71e93a0c4c6e7f783ee8950436',
agentName: '',
nonce: 1718376161247,
type: 'approveAgent',
},
};
await runEthMsg(buildEthMsgReq(msg, 'eip712'), client);
});

describe(`test ${numRandom} random payloads`, () => {
for (let i = 0; i < numRandom; i++) {
it(`Payload #: ${i}`, async () => {
Expand Down

0 comments on commit bfa4643

Please sign in to comment.