diff options
author | Fabio Berger <me@fabioberger.com> | 2017-07-08 05:20:59 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-07-08 05:20:59 +0800 |
commit | bdfbfb829b66b57ecb26a053a2b23665c9fd1549 (patch) | |
tree | 0bb029a7fb95a092146454119254095866c81b61 /src | |
parent | 712a1ba36ee9f60e56b36533f10e7ad4ce4998e8 (diff) | |
download | dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.gz dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.zst dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.zip |
Remove duplication of 27, 28 v values
Diffstat (limited to 'src')
-rw-r--r-- | src/0x.ts | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -225,16 +225,17 @@ export class ZeroEx { // v + r + s OR r + s + v, and different clients (even different versions of the same client) // return the signature params in different orders. In order to support all client implementations, // we parse the signature in both ways, and evaluate if either one is a valid signature. - const ecSignatureVRS = this.parseSignatureHexAsVRS(signature); - if (ecSignatureVRS.v === 27 || ecSignatureVRS.v === 28) { + const validVParamValues = [27, 28]; + const ecSignatureVRS = signatureUtils.parseSignatureHexAsVRS(signature); + if (_.includes(validVParamValues, ecSignatureVRS.v)) { const isValidVRSSignature = ZeroEx.isValidSignature(orderHash, ecSignatureVRS, signerAddress); if (isValidVRSSignature) { return ecSignatureVRS; } } - const ecSignatureRSV = this.parseSignatureHexAsRSV(signature); - if (ecSignatureRSV.v === 27 || ecSignatureRSV.v === 28) { + const ecSignatureRSV = signatureUtils.parseSignatureHexAsRSV(signature); + if (_.includes(validVParamValues, ecSignatureRSV.v)) { const isValidRSVSignature = ZeroEx.isValidSignature(orderHash, ecSignatureRSV, signerAddress); if (isValidRSVSignature) { return ecSignatureRSV; |