aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio B <kandinsky454@protonmail.ch>2019-02-07 09:24:32 +0800
committerGitHub <noreply@github.com>2019-02-07 09:24:32 +0800
commit3af6c8fe1d1a2643cc92d601a38b258fcf352107 (patch)
tree873cca00f5266ab4c586d645126cc26d06349319
parentac58ace8cfd02e0d6f39fc833eb515fbd8340482 (diff)
parentb883b183a6c6011e306fee4338eb4d0da698911a (diff)
downloaddexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.tar
dexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.tar.gz
dexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.tar.bz2
dexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.tar.lz
dexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.tar.xz
dexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.tar.zst
dexon-0x-contracts-3af6c8fe1d1a2643cc92d601a38b258fcf352107.zip
Merge pull request #1595 from 0xProject/fix-order-utils-doc-rendering
Stop exporting EIP712 schemas
-rw-r--r--packages/order-utils/CHANGELOG.json6
-rw-r--r--packages/order-utils/src/eip712_utils.ts20
-rw-r--r--packages/order-utils/src/index.ts9
-rw-r--r--packages/order-utils/test/eip712_utils_test.ts17
4 files changed, 20 insertions, 32 deletions
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index b5eb209d7..fcecdd48e 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -1,5 +1,11 @@
[
{
+ "version": "6.0.0",
+ "changes": {
+ "note": "Stop exporting the EIP712 schemas"
+ }
+ },
+ {
"version": "5.0.0",
"changes": [
{
diff --git a/packages/order-utils/src/eip712_utils.ts b/packages/order-utils/src/eip712_utils.ts
index 313653c63..685fdc8c8 100644
--- a/packages/order-utils/src/eip712_utils.ts
+++ b/packages/order-utils/src/eip712_utils.ts
@@ -12,12 +12,6 @@ import * as _ from 'lodash';
import { constants } from './constants';
-export const DEFAULT_DOMAIN_SCHEMA = constants.DEFAULT_DOMAIN_SCHEMA;
-export const EXCHANGE_DOMAIN_NAME = constants.EXCHANGE_DOMAIN_NAME;
-export const EXCHANGE_DOMAIN_VERSION = constants.EXCHANGE_DOMAIN_VERSION;
-export const EXCHANGE_ORDER_SCHEMA = constants.EXCHANGE_ORDER_SCHEMA;
-export const EXCHANGE_ZEROEX_TRANSACTION_SCHEMA = constants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA;
-
export const eip712Utils = {
/**
* Creates a EIP712TypedData object specific to the 0x protocol for use with signTypedData.
@@ -37,12 +31,12 @@ export const eip712Utils = {
assert.isString('primaryType', primaryType);
const typedData = {
types: {
- EIP712Domain: DEFAULT_DOMAIN_SCHEMA.parameters,
+ EIP712Domain: constants.DEFAULT_DOMAIN_SCHEMA.parameters,
...types,
},
domain: {
- name: _.isUndefined(domain.name) ? EXCHANGE_DOMAIN_NAME : domain.name,
- version: _.isUndefined(domain.version) ? EXCHANGE_DOMAIN_VERSION : domain.version,
+ name: _.isUndefined(domain.name) ? constants.EXCHANGE_DOMAIN_NAME : domain.name,
+ version: _.isUndefined(domain.version) ? constants.EXCHANGE_DOMAIN_VERSION : domain.version,
verifyingContract: domain.verifyingContractAddress,
},
message,
@@ -65,8 +59,8 @@ export const eip712Utils = {
verifyingContractAddress: order.exchangeAddress,
};
const typedData = eip712Utils.createTypedData(
- EXCHANGE_ORDER_SCHEMA.name,
- { Order: EXCHANGE_ORDER_SCHEMA.parameters },
+ constants.EXCHANGE_ORDER_SCHEMA.name,
+ { Order: constants.EXCHANGE_ORDER_SCHEMA.parameters },
normalizedOrder,
domain,
);
@@ -88,8 +82,8 @@ export const eip712Utils = {
verifyingContractAddress: zeroExTransaction.verifyingContractAddress,
};
const typedData = eip712Utils.createTypedData(
- EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.name,
- { ZeroExTransaction: EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.parameters },
+ constants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.name,
+ { ZeroExTransaction: constants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.parameters },
normalizedTransaction,
domain,
);
diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts
index 436677efc..ff37d7088 100644
--- a/packages/order-utils/src/index.ts
+++ b/packages/order-utils/src/index.ts
@@ -19,14 +19,7 @@ export { ExchangeTransferSimulator } from './exchange_transfer_simulator';
export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store';
export { OrderFilledCancelledLazyStore } from './store/order_filled_cancelled_lazy_store';
-export {
- eip712Utils,
- DEFAULT_DOMAIN_SCHEMA,
- EXCHANGE_DOMAIN_NAME,
- EXCHANGE_DOMAIN_VERSION,
- EXCHANGE_ORDER_SCHEMA,
- EXCHANGE_ZEROEX_TRANSACTION_SCHEMA,
-} from './eip712_utils';
+export { eip712Utils } from './eip712_utils';
export {
Provider,
diff --git a/packages/order-utils/test/eip712_utils_test.ts b/packages/order-utils/test/eip712_utils_test.ts
index 4208e9beb..c97bed144 100644
--- a/packages/order-utils/test/eip712_utils_test.ts
+++ b/packages/order-utils/test/eip712_utils_test.ts
@@ -3,12 +3,7 @@ import * as chai from 'chai';
import 'mocha';
import { constants } from '../src/constants';
-import {
- eip712Utils,
- EXCHANGE_DOMAIN_NAME,
- EXCHANGE_DOMAIN_VERSION,
- EXCHANGE_ZEROEX_TRANSACTION_SCHEMA,
-} from '../src/eip712_utils';
+import { eip712Utils } from '../src/eip712_utils';
import { chaiSetup } from './utils/chai_setup';
@@ -28,8 +23,8 @@ describe('EIP712 Utils', () => {
expect(typedData.domain).to.not.be.undefined();
expect(typedData.types.EIP712Domain).to.not.be.undefined();
const domainObject = typedData.domain;
- expect(domainObject.name).to.eq(EXCHANGE_DOMAIN_NAME);
- expect(domainObject.version).to.eq(EXCHANGE_DOMAIN_VERSION);
+ expect(domainObject.name).to.eq(constants.EXCHANGE_DOMAIN_NAME);
+ expect(domainObject.version).to.eq(constants.EXCHANGE_DOMAIN_VERSION);
expect(domainObject.verifyingContract).to.eq(constants.NULL_ADDRESS);
expect(typedData.primaryType).to.eq(primaryType);
});
@@ -60,11 +55,11 @@ describe('EIP712 Utils', () => {
signerAddress: constants.NULL_ADDRESS,
verifyingContractAddress: constants.NULL_ADDRESS,
});
- expect(typedData.primaryType).to.eq(EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.name);
+ expect(typedData.primaryType).to.eq(constants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.name);
expect(typedData.types.EIP712Domain).to.not.be.undefined();
const domainObject = typedData.domain;
- expect(domainObject.name).to.eq(EXCHANGE_DOMAIN_NAME);
- expect(domainObject.version).to.eq(EXCHANGE_DOMAIN_VERSION);
+ expect(domainObject.name).to.eq(constants.EXCHANGE_DOMAIN_NAME);
+ expect(domainObject.version).to.eq(constants.EXCHANGE_DOMAIN_VERSION);
expect(domainObject.verifyingContract).to.eq(constants.NULL_ADDRESS);
});
});