aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-07-08 05:20:59 +0800
committerFabio Berger <me@fabioberger.com>2017-07-08 05:20:59 +0800
commitbdfbfb829b66b57ecb26a053a2b23665c9fd1549 (patch)
tree0bb029a7fb95a092146454119254095866c81b61
parent712a1ba36ee9f60e56b36533f10e7ad4ce4998e8 (diff)
downloaddexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar
dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.gz
dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.bz2
dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.lz
dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.xz
dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.tar.zst
dexon-sol-tools-bdfbfb829b66b57ecb26a053a2b23665c9fd1549.zip
Remove duplication of 27, 28 v values
-rw-r--r--src/0x.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/0x.ts b/src/0x.ts
index 837855426..3ff7c830b 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -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;