diff options
author | Jacob Evans <jacob@dekz.net> | 2018-08-14 06:32:16 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-08-14 07:18:13 +0800 |
commit | a3517574936aa6a4911003dbff06302926b04cb4 (patch) | |
tree | 86e4c20aee5ddf4e3641d6b13e1379d1b7c26930 | |
parent | ca4905c3436931684d113ec66882836a4d0b265b (diff) | |
download | dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.tar dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.tar.gz dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.tar.bz2 dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.tar.lz dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.tar.xz dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.tar.zst dexon-0x-contracts-a3517574936aa6a4911003dbff06302926b04cb4.zip |
Update version numbers.
Add source for Metamask future fix.
Consolidate switch statement to one return
-rw-r--r-- | packages/0x.js/CHANGELOG.json | 2 | ||||
-rw-r--r-- | packages/0x.js/src/0x.ts | 2 | ||||
-rw-r--r-- | packages/order-utils/CHANGELOG.json | 2 | ||||
-rw-r--r-- | packages/order-utils/src/signature_utils.ts | 14 | ||||
-rw-r--r-- | packages/types/CHANGELOG.json | 2 |
5 files changed, 12 insertions, 10 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 88c1bd3a3..a1bdcc506 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "pending", + "version": "1.0.1-rc.4", "changes": [ { "pr": 914, diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 80d784552..48d00c1ac 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -237,7 +237,7 @@ export class ZeroEx { * @param orderHash Hex encoded orderHash to sign. * @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address * must be available via the Provider supplied to 0x.js. - * @param signerType the type signer that will perform the `eth_sign` operation. E.g Default, Metamask, Ledger or Trezor. + * @param signerType the signer type that will perform the `eth_sign` operation. E.g Default, Metamask, Ledger or Trezor. * Some implementations exhibit different behaviour. Default will assume a spec compliant eth_sign implementation. * This parameter is defaulted to `SignerType.Default`. * @return A hex encoded string of the Elliptic curve signature parameters generated by signing the orderHash and signature type. diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index c70448d69..6f59580b3 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "pending", + "version": "1.0.1-rc.4", "changes": [ { "pr": 914, diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index 5a58edf38..870aef2ed 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -216,6 +216,7 @@ export async function ecSignOrderHashAsync( let msgHashHex = orderHash; const prefixedMsgHashHex = addSignedMessagePrefix(orderHash, signerType); // Metamask incorrectly implements eth_sign and does not prefix the message as per the spec + // Source: https://github.com/MetaMask/metamask-extension/commit/a9d36860bec424dcee8db043d3e7da6a5ff5672e if (signerType === SignerType.Metamask) { msgHashHex = prefixedMsgHashHex; } @@ -260,22 +261,23 @@ export function convertECSignatureToSignatureHex(ecSignature: ECSignature, signe ethUtil.toBuffer(ecSignature.s), ]); const signatureHex = `0x${signatureBuffer.toString('hex')}`; + let signatureType; switch (signerType) { case SignerType.Metamask: case SignerType.Ledger: case SignerType.Default: { - const signatureType = SignatureType.EthSign; - const signatureWithType = convertToSignatureWithType(signatureHex, signatureType); - return signatureWithType; + signatureType = SignatureType.EthSign; + break; } case SignerType.Trezor: { - const signatureType = SignatureType.Trezor; - const signatureWithType = convertToSignatureWithType(signatureHex, signatureType); - return signatureWithType; + signatureType = SignatureType.Trezor; + break; } default: throw new Error(`Unrecognized SignerType: ${signerType}`); } + const signatureWithType = convertToSignatureWithType(signatureHex, signatureType); + return signatureWithType; } /** * Combines the signature proof and the Signature Type. diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 4f60310e6..9d78d3dc0 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "pending", + "version": "1.0.1-rc.4", "changes": [ { "pr": 914, |