aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-15 05:39:59 +0800
committerFabio Berger <me@fabioberger.com>2018-08-15 05:39:59 +0800
commit1d9408a8e04aaea35bcf517fd3332b9bcc62bba0 (patch)
treee49c2ee1763134c9d56255a643b25f8aaa3e858d /packages/order-utils
parent2f2582a0da3095d61a99ef09744dc0995677558e (diff)
downloaddexon-sol-tools-1d9408a8e04aaea35bcf517fd3332b9bcc62bba0.tar.gz
dexon-sol-tools-1d9408a8e04aaea35bcf517fd3332b9bcc62bba0.tar.zst
dexon-sol-tools-1d9408a8e04aaea35bcf517fd3332b9bcc62bba0.zip
Fix additional merge conflicts
Diffstat (limited to 'packages/order-utils')
-rw-r--r--packages/order-utils/src/signature_utils.ts2
-rw-r--r--packages/order-utils/test/market_utils_test.ts3
-rw-r--r--packages/order-utils/test/signature_utils_test.ts39
-rw-r--r--packages/order-utils/test/utils/test_order_factory.ts3
4 files changed, 33 insertions, 14 deletions
diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts
index d466bb00d..40bbcef98 100644
--- a/packages/order-utils/src/signature_utils.ts
+++ b/packages/order-utils/src/signature_utils.ts
@@ -49,7 +49,7 @@ export const signatureUtils = {
case SignatureType.EthSign: {
const ecSignature = signatureUtils.parseECSignature(signature);
- const prefixedMessageHex = signatureUtils.addSignedMessagePrefix(data, SignerType.EthSign);
+ const prefixedMessageHex = signatureUtils.addSignedMessagePrefix(data, SignerType.Default);
return signatureUtils.isValidECSignature(prefixedMessageHex, ecSignature, signerAddress);
}
diff --git a/packages/order-utils/test/market_utils_test.ts b/packages/order-utils/test/market_utils_test.ts
index 21c0a4802..5d94cc55c 100644
--- a/packages/order-utils/test/market_utils_test.ts
+++ b/packages/order-utils/test/market_utils_test.ts
@@ -2,7 +2,8 @@ import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import 'mocha';
-import { constants, marketUtils } from '../src';
+import { marketUtils } from '../src';
+import { constants } from '../src/constants';
import { chaiSetup } from './utils/chai_setup';
import { testOrderFactory } from './utils/test_order_factory';
diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts
index 06ff86515..4ce99a1c7 100644
--- a/packages/order-utils/test/signature_utils_test.ts
+++ b/packages/order-utils/test/signature_utils_test.ts
@@ -6,8 +6,8 @@ import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
-import { signatureUtils, generatePseudoRandomSalt } from '../src';
-import { convertECSignatureToSignatureHex, isValidSignatureAsync } from '../src/signature_utils';
+import { generatePseudoRandomSalt } from '../src';
+import { signatureUtils } from '../src/signature_utils';
import { chaiSetup } from './utils/chai_setup';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -16,7 +16,7 @@ chaiSetup.configure();
const expect = chai.expect;
describe('Signature utils', () => {
- describe('#isValidSignature', () => {
+ describe('#isValidSignatureAsync', () => {
let dataHex = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0';
const ethSignSignature =
'0x1B61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403';
@@ -255,7 +255,12 @@ describe('Signature utils', () => {
SignerType.Default,
);
- const isValidSignature = await isValidSignatureAsync(provider, orderHash, ecSignature, makerAddress);
+ const isValidSignature = await signatureUtils.isValidSignatureAsync(
+ provider,
+ orderHash,
+ ecSignature,
+ makerAddress,
+ );
expect(isValidSignature).to.be.true();
});
});
@@ -268,32 +273,44 @@ describe('Signature utils', () => {
it('should concatenate v,r,s and append the Trezor signature type', async () => {
const expectedSignatureWithSignatureType =
'0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf208';
- const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Trezor);
+ const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex(
+ ecSignature,
+ SignerType.Trezor,
+ );
expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType);
});
it('should concatenate v,r,s and append the EthSign signature type when SignerType is Default', async () => {
const expectedSignatureWithSignatureType =
'0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203';
- const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Default);
+ const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex(
+ ecSignature,
+ SignerType.Default,
+ );
expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType);
});
it('should concatenate v,r,s and append the EthSign signature type when SignerType is Ledger', async () => {
const expectedSignatureWithSignatureType =
'0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203';
- const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Ledger);
+ const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex(
+ ecSignature,
+ SignerType.Ledger,
+ );
expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType);
});
it('should concatenate v,r,s and append the EthSign signature type when SignerType is Metamask', async () => {
const expectedSignatureWithSignatureType =
'0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203';
- const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Metamask);
+ const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex(
+ ecSignature,
+ SignerType.Metamask,
+ );
expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType);
});
it('should throw if the SignerType is invalid', async () => {
const expectedMessage = 'Unrecognized SignerType: INVALID_SIGNER';
- expect(() => convertECSignatureToSignatureHex(ecSignature, 'INVALID_SIGNER' as SignerType)).to.throw(
- expectedMessage,
- );
+ expect(() =>
+ signatureUtils.convertECSignatureToSignatureHex(ecSignature, 'INVALID_SIGNER' as SignerType),
+ ).to.throw(expectedMessage);
});
});
});
diff --git a/packages/order-utils/test/utils/test_order_factory.ts b/packages/order-utils/test/utils/test_order_factory.ts
index 75dc6f1f2..69184f129 100644
--- a/packages/order-utils/test/utils/test_order_factory.ts
+++ b/packages/order-utils/test/utils/test_order_factory.ts
@@ -1,7 +1,8 @@
import { Order, SignedOrder } from '@0xproject/types';
import * as _ from 'lodash';
-import { constants, orderFactory } from '../../src';
+import { constants } from '../../src/constants';
+import { orderFactory } from '../../src/order_factory';
const BASE_TEST_ORDER: Order = orderFactory.createOrder(
constants.NULL_ADDRESS,