aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test/eip712_utils_test.ts
blob: a54e499580104f45fd57304644c58ed4a1ebdc7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import 'mocha';

import { constants } from '../src/constants';
import { eip712Utils } from '../src/eip712_utils';

import { chaiSetup } from './utils/chai_setup';

chaiSetup.configure();
const expect = chai.expect;

describe('EIP712 Utils', () => {
    describe('createTypedData', () => {
        it('adds in the EIP712DomainSeparator', () => {
            const primaryType = 'Test';
            const typedData = eip712Utils.createTypedData(
                primaryType,
                { Test: [{ name: 'testValue', type: 'uint256' }] },
                { testValue: '1' },
                constants.NULL_ADDRESS,
            );
            expect(typedData.domain).to.not.be.undefined();
            expect(typedData.types.EIP712Domain).to.not.be.undefined();
            const domainObject = typedData.domain;
            expect(domainObject.name).to.eq(constants.EIP712_DOMAIN_NAME);
            expect(typedData.primaryType).to.eq(primaryType);
        });
    });
    describe('createTypedData', () => {
        it('adds in the EIP712DomainSeparator', () => {
            const typedData = eip712Utils.createZeroExTransactionTypedData(
                {
                    salt: new BigNumber('0'),
                    data: constants.NULL_BYTES,
                    signerAddress: constants.NULL_ADDRESS,
                },
                constants.NULL_ADDRESS,
            );
            expect(typedData.primaryType).to.eq(constants.EIP712_ZEROEX_TRANSACTION_SCHEMA.name);
            expect(typedData.types.EIP712Domain).to.not.be.undefined();
        });
    });
});
ss='insertions'>+4 * Clean up LIB_DEPENDSAntoine Brodin2019-12-171-2/+2 * - update to 5.61Jason Helfman2019-12-142-7/+13 * - fix compilation for MESAGL optionJason Helfman2019-10-231-1/+2 * - update to 5.59Jason Helfman2019-10-053-72/+38 * - update OPTIONS handlingJason Helfman2019-09-062-98/+34 * - update to 5.58Jason Helfman2019-08-222-5/+16 * Cleanup LIB_DEPENDSAntoine Brodin2019-08-081-1/+1 * - update to 5.57Jason Helfman2019-08-072-17/+9 * Return jgh's ports to the various pools after his commit bit was safekept.Rene Ladan2019-08-061-1/+1 * x11/xlockmore: Actually make JP=on imply MB=onTobias Kortkamp2019-05-281-1/+3 * Update ImageMagick to 6.9.10.14 [1]Koop Mast2018-11-111-1/+1 * Remove compatibility code for FreeBSD < 11.2 from all ports.Rene Ladan2018-11-021-1/+1 * - update to 5.55Jason Helfman2018-07-194-5/+41 * - Fix hidden dependency on ftglDmitry Marakasov2018-06-071-3/+4 * - Fix condition for fortune binary locationDmitry Marakasov2018-05-081-2/+3 * - Remove always-true OSVERSION conditionDmitry Marakasov2018-05-071-1/+1 * - update to 5.54Jason Helfman2017-07-262-5/+4 * Revision bump of all ports with USE_GL after consolidation of mesa-libsMatthew Rezny2017-05-231-0/+1 * - Always check OPSYS along with OSVERSIONDmitry Marakasov2017-04-121-1/+1 * - update to version 5.51Jason Helfman2017-03-223-10/+15 * - fix for MESAGLJason Helfman2016-06-111-1/+1 * - add/enable xinerama support (default)Jason Helfman2016-06-101-1/+8