aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src/order_factory.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/order-utils/src/order_factory.ts')
-rw-r--r--packages/order-utils/src/order_factory.ts25
1 files changed, 3 insertions, 22 deletions
diff --git a/packages/order-utils/src/order_factory.ts b/packages/order-utils/src/order_factory.ts
index 14727fd97..4a6f3924b 100644
--- a/packages/order-utils/src/order_factory.ts
+++ b/packages/order-utils/src/order_factory.ts
@@ -1,14 +1,13 @@
-import { ECSignature, Order, SignedOrder } from '@0xproject/types';
+import { Order, SignedOrder, SignerType } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Provider } from 'ethereum-types';
-import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { constants } from './constants';
import { orderHashUtils } from './order_hash';
import { generatePseudoRandomSalt } from './salt';
import { ecSignOrderHashAsync } from './signature_utils';
-import { CreateOrderOpts, MessagePrefixType } from './types';
+import { CreateOrderOpts } from './types';
export const orderFactory = {
createOrder(
@@ -59,12 +58,7 @@ export const orderFactory = {
createOrderOpts,
);
const orderHash = orderHashUtils.getOrderHashHex(order);
- const messagePrefixOpts = {
- prefixType: MessagePrefixType.EthSign,
- shouldAddPrefixBeforeCallingEthSign: false,
- };
- const ecSignature = await ecSignOrderHashAsync(provider, orderHash, makerAddress, messagePrefixOpts);
- const signature = getVRSHexString(ecSignature);
+ const signature = await ecSignOrderHashAsync(provider, orderHash, makerAddress, SignerType.Default);
const signedOrder: SignedOrder = _.assign(order, { signature });
return signedOrder;
},
@@ -89,16 +83,3 @@ function generateDefaultCreateOrderOpts(): {
expirationTimeSeconds: constants.INFINITE_TIMESTAMP_SEC,
};
}
-
-function getVRSHexString(ecSignature: ECSignature): string {
- const ETH_SIGN_SIGNATURE_TYPE = '03';
- const vrs = `${intToHex(ecSignature.v)}${ethUtil.stripHexPrefix(ecSignature.r)}${ethUtil.stripHexPrefix(
- ecSignature.s,
- )}${ETH_SIGN_SIGNATURE_TYPE}`;
- return vrs;
-}
-
-function intToHex(i: number): string {
- const hex = ethUtil.bufferToHex(ethUtil.toBuffer(i));
- return hex;
-}