aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.js.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-01 22:07:43 +0800
committerFabio Berger <me@fabioberger.com>2017-06-01 22:07:43 +0800
commita1041348d5695ee3b84433e9874176e85543a4e0 (patch)
tree4743e84bcc19ebf2df0919a9ba1a0d9dffb75046 /src/0x.js.ts
parent88a70afa70f84efc866ff53121d05a6d8d77bff8 (diff)
downloaddexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.tar
dexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.tar.gz
dexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.tar.bz2
dexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.tar.lz
dexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.tar.xz
dexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.tar.zst
dexon-sol-tools-a1041348d5695ee3b84433e9874176e85543a4e0.zip
Get getSenderAddressOrThrowAsync everywhere where we throw if the senderAddress doesn't exist
Diffstat (limited to 'src/0x.js.ts')
-rw-r--r--src/0x.js.ts11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts
index 1a46fe9a5..a29c25e0c 100644
--- a/src/0x.js.ts
+++ b/src/0x.js.ts
@@ -157,6 +157,8 @@ export class ZeroEx {
public async signOrderHashAsync(orderHashHex: string): Promise<ECSignature> {
assert.isHexString('orderHashHex', orderHashHex);
+ const makerAddress = await this.web3Wrapper.getSenderAddressOrThrowAsync();
+
let msgHashHex;
const nodeVersion = await this.web3Wrapper.getNodeVersionAsync();
const isParityNode = utils.isParityNode(nodeVersion);
@@ -169,12 +171,7 @@ export class ZeroEx {
msgHashHex = ethUtil.bufferToHex(msgHashBuff);
}
- const makerAddressIfExists = await this.web3Wrapper.getSenderAddressIfExistsAsync();
- if (_.isUndefined(makerAddressIfExists)) {
- throw new Error(ZeroExError.USER_HAS_NO_ASSOCIATED_ADDRESSES);
- }
-
- const signature = await this.web3Wrapper.signTransactionAsync(makerAddressIfExists, msgHashHex);
+ const signature = await this.web3Wrapper.signTransactionAsync(makerAddress, msgHashHex);
let signatureData;
const [nodeVersionNumber] = findVersions(nodeVersion);
@@ -204,7 +201,7 @@ export class ZeroEx {
r: ethUtil.bufferToHex(r),
s: ethUtil.bufferToHex(s),
};
- const isValidSignature = ZeroEx.isValidSignature(orderHashHex, ecSignature, makerAddressIfExists);
+ const isValidSignature = ZeroEx.isValidSignature(orderHashHex, ecSignature, makerAddress);
if (!isValidSignature) {
throw new Error(ZeroExError.INVALID_SIGNATURE);
}