aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-30 21:19:58 +0800
committerFabio Berger <me@fabioberger.com>2018-01-30 21:19:58 +0800
commit8d30058a6dade197efbfa24380a479d7b72a882a (patch)
treef5041e33887a42035c934530b0394b8d9c80af42 /packages/website/ts/blockchain.ts
parent69151c06e42fd588506db3aa62b95df5b4399607 (diff)
downloaddexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.tar
dexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.tar.gz
dexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.tar.bz2
dexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.tar.lz
dexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.tar.xz
dexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.tar.zst
dexon-sol-tools-8d30058a6dade197efbfa24380a479d7b72a882a.zip
Pass in whether we want the personal message prefix appended and never append it for Ledger. This fixes signing when Ledger is used and the backing node is not Parity
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index d310464ed..d7c23205d 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -421,8 +421,21 @@ export class Blockchain {
if (_.isUndefined(makerAddress)) {
throw new Error('Tried to send a sign request but user has no associated addresses');
}
+
this._showFlashMessageIfLedger();
- const ecSignature = await this._zeroEx.signOrderHashAsync(orderHash, makerAddress);
+ const nodeVersion = await this._web3Wrapper.getNodeVersionAsync();
+ const isParityNode = utils.isParityNode(nodeVersion);
+ const isTestRpc = utils.isTestRpc(nodeVersion);
+ const isLedgerSigner = !_.isUndefined(this._ledgerSubprovider);
+ let shouldAddPersonalMessagePrefix = true;
+ if ((isParityNode && !isLedgerSigner) || isTestRpc || isLedgerSigner) {
+ shouldAddPersonalMessagePrefix = false;
+ }
+ const ecSignature = await this._zeroEx.signOrderHashAsync(
+ orderHash,
+ makerAddress,
+ shouldAddPersonalMessagePrefix,
+ );
const signatureData = _.extend({}, ecSignature, {
hash: orderHash,
});