Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit 44f1edf

Browse files
authored
Merge pull request #2148 from SteveMieskoski/mercury
Fix send of null and browser check issues
2 parents 719be58 + 4852dc2 commit 44f1edf

File tree

9 files changed

+203983
-205080
lines changed

9 files changed

+203983
-205080
lines changed

app/scripts/controllers/decryptWalletCtrl.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -627,28 +627,22 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
627627
globalFuncs.MEWconnectStatus.update(0);
628628
var app = new MewConnectEth();
629629

630-
$scope.mewConnect = MewConnect.init();
631-
632-
Reflect.defineProperty(MewConnect, "instance", {
633-
value: $scope.mewConnect
634-
});
630+
globalFuncs.MEWconnectStatus.MEWconnect = MewConnect.init();
635631

636632
$scope.$on("$destroy", function() {
637633
globalFuncs.MEWconnectStatus.newTabOpenedTrigger(false);
638634
globalFuncs.MEWconnectStatus.update(0);
639-
$scope.mewConnect.disconnectRTC();
640-
if (MewConnect.instance) {
641-
Reflect.deleteProperty(MewConnect, "instance");
642-
}
635+
globalFuncs.MEWconnectStatus.MEWconnect.disconnectRTC();
636+
globalFuncs.MEWconnectStatus.MEWconnect = null;
643637
});
644638

645-
$scope.mewConnect.on("codeDisplay", codeDisplay);
646-
$scope.mewConnect.on("RtcConnectedEvent", rtcConnected);
647-
$scope.mewConnect.on("RtcClosedEvent", rtcClosed);
648-
$scope.mewConnect.on("RtcDisconnectEvent", rtcDisconnected);
649-
$scope.mewConnect.on("address", makeWallet);
639+
globalFuncs.MEWconnectStatus.MEWconnect.on("codeDisplay", codeDisplay);
640+
globalFuncs.MEWconnectStatus.MEWconnect.on("RtcConnectedEvent", rtcConnected);
641+
globalFuncs.MEWconnectStatus.MEWconnect.on("RtcClosedEvent", rtcClosed);
642+
globalFuncs.MEWconnectStatus.MEWconnect.on("RtcDisconnectEvent", rtcDisconnected);
643+
globalFuncs.MEWconnectStatus.MEWconnect.on("address", makeWallet);
650644

651-
app.setMewConnect($scope.mewConnect);
645+
app.setMewConnect(globalFuncs.MEWconnectStatus.MEWconnect);
652646
app.signalerConnect();
653647

654648
$scope.connectionCodeTimeout = null;
@@ -661,7 +655,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
661655
if ($scope.mewConnectionStatus !== 2) {
662656
$scope.connectionCodeTimeout = null;
663657
uiFuncs.notifier.info("Connected Via MEWconnect");
664-
$scope.mewConnect.sendRtcMessage("address", "");
658+
globalFuncs.MEWconnectStatus.MEWconnect.sendRtcMessage("address", "");
665659
$scope.mewConnectionStatus = 2;
666660
}
667661
}
@@ -709,7 +703,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
709703
};
710704

711705
$scope.mewConnectDisconnect = function() {
712-
$scope.mewConnect.disconnectRTC();
706+
globalFuncs.MEWconnectStatus.MEWconnect.disconnectRTC();
713707
};
714708
//= ================ Mew Connect (end)==============================
715709
$scope.getLedgerPath = function() {

app/scripts/controllers/signMsgCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var signMsgCtrl = function($scope, $sce, walletService) {
202202
//TODO reset ui when rtc disconnects
203203
// var msg = Buffer.from(thisMessage).toString("hex");
204204
var connectApp = new MewConnectEth();
205-
var mewConnect = MewConnect.instance;
205+
var mewConnect =globalFuncs.MEWconnectStatus.MEWconnect;
206206
connectApp.setMewConnect(mewConnect);
207207
mewConnect.on("signMessage", function(data) {
208208
$scope.signMsg.signedMsg = JSON.stringify(

app/scripts/globalFuncs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ globalFuncs.localStorage = {
394394
};
395395

396396
globalFuncs.MEWconnectStatus = {
397+
MEWconnect: null,
397398
decryptOpenTriggers: [],
398399
mewConnectListener: function() {},
399400
register: function(listener) {

app/scripts/kyber.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ kyberFuncs.prototype.getTradeData = function (swapOrder, minRate) {
420420
var funcABI = _this.kyberNetworkABI.trade
421421
var srcTokenAddress = _this.getTokenAddress(swapOrder.fromCoin)
422422
var destTokenAddress = _this.getTokenAddress(swapOrder.toCoin)
423-
let walletId = '0xDECAF9CD2367cdbb726E904cD6397eDFcAe6068D'
423+
let walletId = '0x4247951c2eb6d0bA38d233fe7d542c8c80c9d46A'
424424
let minConversionRate = _this.convertToTokenWei(minRate, 'ETH') // Uses slippagePrice with fallback to MarketRate. 1 => Market Rate, but we could also set this as the quoted rate
425425
let srcAmount = _this.convertToTokenWei(swapOrder.fromVal, swapOrder.fromCoin) //etherUnits.toWei(swapOrder.fromVal, "ether");
426426
let maxDestAmount = 2 ** 200 //100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; // Really big number (like a googol)

app/scripts/staticJS/mewConnectEth.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class MewConnectEth {
118118

119119
static checkBrowser() {
120120
const browser = window.browser;
121-
const version = browser.version.split(0, 1)[0]
121+
const version = browser.version.split('.')[0];
122122
/*
123123
* Chrome > 23
124124
* Firefox > 22
@@ -134,7 +134,7 @@ class MewConnectEth {
134134
// if (+version >= 12) {
135135
// return MewConnectEth.buildBrowserResult(false, '', '');
136136
// } else if (+version === 11) {
137-
return MewConnectEth.buildBrowserResult(true, 'Safari', 'version: ' + browser.version);
137+
return MewConnectEth.buildBrowserResult(true, 'Safari', 'version: ' + browser.version);
138138
// }
139139
} else if (browser.name === 'ie') {
140140
return MewConnectEth.buildBrowserResult(true, 'Internet Explorer', '', true);
@@ -163,8 +163,8 @@ class MewConnectEth {
163163
} else {
164164
return MewConnectEth.buildBrowserResult(false, '', '');
165165
}
166-
} catch(e) {
167-
console.error(e)
166+
} catch (e) {
167+
console.error(e);
168168
}
169169
}
170170
}

app/scripts/uiFuncs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ uiFuncs.signTxMewConnect = function (eTx, rawTx, txData, callback) {
143143
// uiFuncs.notifier.info("Tap a touch button on your device to confirm signing.");
144144

145145
var app = new MewConnectEth()
146-
var mewConnect = MewConnect.instance
147-
146+
// var mewConnect = MewConnect.instance
147+
var mewConnect = globalFuncs.MEWconnectStatus.MEWconnect;
148148
app.setMewConnect(mewConnect)
149149
mewConnect.once('signTx', function(data) {
150150
uiFuncs.notifier.info("The transaction was signed but not sent. Click the blue 'Send Transaction' button to continue.")

0 commit comments

Comments
 (0)