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

Commit

Permalink
push live 3.0.6 // Merge branch 'mercury' of https://github.com/kvhnu…
Browse files Browse the repository at this point in the history
…ke/etherwallet into mercury
  • Loading branch information
tayvano committed Sep 16, 2016
2 parents ddb04e4 + 6348de2 commit d689dc7
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/includes/deployContract.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<!-- Data -->
<div class="form-group">
<h4> Byte Code: </h4>
<textarea class="form-control" ng-model="tx.data" rows="8"></textarea>
<textarea class="form-control" ng-model="tx.data" rows="8" ng-class="Validator.isValidHex(tx.data)&&tx.data!='' ? 'is-valid' : 'is-invalid'"></textarea>
</div>

<!-- Gas -->
<div class="form-group">
<h4 translate="TRANS_gas"> Gas: </h4>
<input class="form-control" type="text" placeholder="300000" ng-model="tx.gasLimit"/>
<input class="form-control" type="text" placeholder="300000" ng-model="tx.gasLimit" ng-class="Validator.isPositiveNumber(tx.gasLimit) ? 'is-valid' : 'is-invalid'"/>
</div>

<!-- Wallet Decrypt -->
Expand Down
19 changes: 19 additions & 0 deletions app/scripts/controllers/deployContractCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var deployContractCtrl = function($scope, $sce, walletService) {
nonce: null,
gasPrice: null
}
$scope.Validator = Validator;
$scope.showRaw = false;
$scope.$watch(function() {
if (walletService.wallet == null) return null;
Expand All @@ -21,6 +22,24 @@ var deployContractCtrl = function($scope, $sce, walletService) {
$scope.$watch('tx', function(newValue, oldValue) {
$scope.showRaw = false;
}, true);
$scope.$watch('[tx.data]', function () {
if($scope.Validator.isValidHex($scope.tx.data)&&$scope.tx.data!=''){
if($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function(){
$scope.estimateGasLimit();
},500);
}
}, true);
$scope.estimateGasLimit = function(){
var estObj = {
from: globalFuncs.donateAddress,
value: '0x00',
data: ethFuncs.sanitizeHex($scope.tx.data)
}
ethFuncs.estimateGas(estObj,false,function(data){
if(!data.error) $scope.tx.gasLimit = data.data;
});
}
$scope.generateTx = function() {
try {
if ($scope.wallet == null) throw globalFuncs.errorMsgs[3];
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/sendTxCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var sendTxCtrl = function($scope, $sce, walletService) {
});
$scope.$watch('[tx.to,tx.value,tx.data,tx.sendMode]', function () {
if($scope.Validator.isValidAddress($scope.tx.to)&&$scope.Validator.isPositiveNumber($scope.tx.value)&&$scope.Validator.isValidHex($scope.tx.data)){
if(!$scope.estimateTimer) clearTimeout($scope.estimateTimer);
if($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function(){
$scope.estimateGasLimit();
},500);
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/tokenCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var tokenCtrl = function($scope, $sce, walletService) {
}
$scope.$watch('[tokenTx.to,tokenTx.value,tokenTx.id]', function () {
if($scope.tokenObjs !== undefined && $scope.tokenObjs[$scope.tokenTx.id]!== undefined && $scope.Validator.isValidAddress($scope.tokenTx.to)&&$scope.Validator.isPositiveNumber($scope.tokenTx.value)){
if(!$scope.estimateTimer) clearTimeout($scope.estimateTimer);
if($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function(){
$scope.estimateGasLimit();
},500);
Expand Down
7 changes: 4 additions & 3 deletions app/scripts/ethFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ ethFuncs.estimateGas = function(dataObj, isClassic, callback) {
var gasAssigned = new BigNumber(0);
var maxGas = new BigNumber(50000000);
for (var i = 0; i < calls.length; i++) {
if(calls[i].result.failedCall !== undefined) {
gasAssigned = new BigNumber(0);
if(calls[i].result.failedCall !== undefined || calls[i].result.failedCreate !== undefined) {
gasAssigned = new BigNumber(-1);
break;
}
var gas = new BigNumber(calls[i].action.call.gas).sub(new BigNumber(calls[i].result.call.gasUsed));
var cType = calls[i].action.create !== undefined ? 'create' : 'call';
var gas = new BigNumber(calls[i].action[cType].gas).sub(new BigNumber(calls[i].result[cType].gasUsed));
if (maxGas.sub(gas).gt(gasAssigned) && gas.gt(100000)) gasAssigned = maxGas.sub(gas);
}
callback({
Expand Down
Binary file modified chrome-extension-releases/chrome-extension-v0.3.0.6.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions chrome-extension/cx-wallet.html
Original file line number Diff line number Diff line change
Expand Up @@ -1545,13 +1545,13 @@ <h2 translate="NAV_DeployContract"> Deploy Contract </h2>
<!-- Data -->
<div class="form-group">
<h4> Byte Code: </h4>
<textarea class="form-control" ng-model="tx.data" rows="8"></textarea>
<textarea class="form-control" ng-model="tx.data" rows="8" ng-class="Validator.isValidHex(tx.data)&&tx.data!='' ? 'is-valid' : 'is-invalid'"></textarea>
</div>

<!-- Gas -->
<div class="form-group">
<h4 translate="TRANS_gas"> Gas: </h4>
<input class="form-control" type="text" placeholder="300000" ng-model="tx.gasLimit"/>
<input class="form-control" type="text" placeholder="300000" ng-model="tx.gasLimit" ng-class="Validator.isPositiveNumber(tx.gasLimit) ? 'is-valid' : 'is-invalid'"/>
</div>

<!-- Wallet Decrypt -->
Expand Down
30 changes: 25 additions & 5 deletions chrome-extension/js/etherwallet-master.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@
nonce: null,
gasPrice: null
};
$scope.Validator = Validator;
$scope.showRaw = false;
$scope.$watch(function () {
if (walletService.wallet == null) return null;
Expand All @@ -701,6 +702,24 @@
$scope.$watch('tx', function (newValue, oldValue) {
$scope.showRaw = false;
}, true);
$scope.$watch('[tx.data]', function () {
if ($scope.Validator.isValidHex($scope.tx.data) && $scope.tx.data != '') {
if ($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function () {
$scope.estimateGasLimit();
}, 500);
}
}, true);
$scope.estimateGasLimit = function () {
var estObj = {
from: globalFuncs.donateAddress,
value: '0x00',
data: ethFuncs.sanitizeHex($scope.tx.data)
};
ethFuncs.estimateGas(estObj, false, function (data) {
if (!data.error) $scope.tx.gasLimit = data.data;
});
};
$scope.generateTx = function () {
try {
if ($scope.wallet == null) throw globalFuncs.errorMsgs[3];else if (!ethFuncs.validateHexString($scope.tx.data)) throw globalFuncs.errorMsgs[9];else if (!globalFuncs.isNumeric($scope.tx.gasLimit) || parseFloat($scope.tx.gasLimit) <= 0) throw globalFuncs.errorMsgs[8];
Expand Down Expand Up @@ -1004,7 +1023,7 @@
});
$scope.$watch('[tx.to,tx.value,tx.data,tx.sendMode]', function () {
if ($scope.Validator.isValidAddress($scope.tx.to) && $scope.Validator.isPositiveNumber($scope.tx.value) && $scope.Validator.isValidHex($scope.tx.data)) {
if (!$scope.estimateTimer) clearTimeout($scope.estimateTimer);
if ($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function () {
$scope.estimateGasLimit();
}, 500);
Expand Down Expand Up @@ -1433,7 +1452,7 @@
};
$scope.$watch('[tokenTx.to,tokenTx.value,tokenTx.id]', function () {
if ($scope.tokenObjs !== undefined && $scope.tokenObjs[$scope.tokenTx.id] !== undefined && $scope.Validator.isValidAddress($scope.tokenTx.to) && $scope.Validator.isPositiveNumber($scope.tokenTx.value)) {
if (!$scope.estimateTimer) clearTimeout($scope.estimateTimer);
if ($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function () {
$scope.estimateGasLimit();
}, 500);
Expand Down Expand Up @@ -1975,11 +1994,12 @@
var gasAssigned = new BigNumber(0);
var maxGas = new BigNumber(50000000);
for (var i = 0; i < calls.length; i++) {
if (calls[i].result.failedCall !== undefined) {
gasAssigned = new BigNumber(0);
if (calls[i].result.failedCall !== undefined || calls[i].result.failedCreate !== undefined) {
gasAssigned = new BigNumber(-1);
break;
}
var gas = new BigNumber(calls[i].action.call.gas).sub(new BigNumber(calls[i].result.call.gasUsed));
var cType = calls[i].action.create !== undefined ? 'create' : 'call';
var gas = new BigNumber(calls[i].action[cType].gas).sub(new BigNumber(calls[i].result[cType].gasUsed));
if (maxGas.sub(gas).gt(gasAssigned) && gas.gt(100000)) gasAssigned = maxGas.sub(gas);
}
callback({
Expand Down
4 changes: 2 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1342,13 +1342,13 @@ <h2 translate="NAV_DeployContract"> Deploy Contract </h2>
<!-- Data -->
<div class="form-group">
<h4> Byte Code: </h4>
<textarea class="form-control" ng-model="tx.data" rows="8"></textarea>
<textarea class="form-control" ng-model="tx.data" rows="8" ng-class="Validator.isValidHex(tx.data)&&tx.data!='' ? 'is-valid' : 'is-invalid'"></textarea>
</div>

<!-- Gas -->
<div class="form-group">
<h4 translate="TRANS_gas"> Gas: </h4>
<input class="form-control" type="text" placeholder="300000" ng-model="tx.gasLimit"/>
<input class="form-control" type="text" placeholder="300000" ng-model="tx.gasLimit" ng-class="Validator.isPositiveNumber(tx.gasLimit) ? 'is-valid' : 'is-invalid'"/>
</div>

<!-- Wallet Decrypt -->
Expand Down
30 changes: 25 additions & 5 deletions dist/js/etherwallet-master.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@
nonce: null,
gasPrice: null
};
$scope.Validator = Validator;
$scope.showRaw = false;
$scope.$watch(function () {
if (walletService.wallet == null) return null;
Expand All @@ -701,6 +702,24 @@
$scope.$watch('tx', function (newValue, oldValue) {
$scope.showRaw = false;
}, true);
$scope.$watch('[tx.data]', function () {
if ($scope.Validator.isValidHex($scope.tx.data) && $scope.tx.data != '') {
if ($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function () {
$scope.estimateGasLimit();
}, 500);
}
}, true);
$scope.estimateGasLimit = function () {
var estObj = {
from: globalFuncs.donateAddress,
value: '0x00',
data: ethFuncs.sanitizeHex($scope.tx.data)
};
ethFuncs.estimateGas(estObj, false, function (data) {
if (!data.error) $scope.tx.gasLimit = data.data;
});
};
$scope.generateTx = function () {
try {
if ($scope.wallet == null) throw globalFuncs.errorMsgs[3];else if (!ethFuncs.validateHexString($scope.tx.data)) throw globalFuncs.errorMsgs[9];else if (!globalFuncs.isNumeric($scope.tx.gasLimit) || parseFloat($scope.tx.gasLimit) <= 0) throw globalFuncs.errorMsgs[8];
Expand Down Expand Up @@ -1004,7 +1023,7 @@
});
$scope.$watch('[tx.to,tx.value,tx.data,tx.sendMode]', function () {
if ($scope.Validator.isValidAddress($scope.tx.to) && $scope.Validator.isPositiveNumber($scope.tx.value) && $scope.Validator.isValidHex($scope.tx.data)) {
if (!$scope.estimateTimer) clearTimeout($scope.estimateTimer);
if ($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function () {
$scope.estimateGasLimit();
}, 500);
Expand Down Expand Up @@ -1433,7 +1452,7 @@
};
$scope.$watch('[tokenTx.to,tokenTx.value,tokenTx.id]', function () {
if ($scope.tokenObjs !== undefined && $scope.tokenObjs[$scope.tokenTx.id] !== undefined && $scope.Validator.isValidAddress($scope.tokenTx.to) && $scope.Validator.isPositiveNumber($scope.tokenTx.value)) {
if (!$scope.estimateTimer) clearTimeout($scope.estimateTimer);
if ($scope.estimateTimer) clearTimeout($scope.estimateTimer);
$scope.estimateTimer = setTimeout(function () {
$scope.estimateGasLimit();
}, 500);
Expand Down Expand Up @@ -1975,11 +1994,12 @@
var gasAssigned = new BigNumber(0);
var maxGas = new BigNumber(50000000);
for (var i = 0; i < calls.length; i++) {
if (calls[i].result.failedCall !== undefined) {
gasAssigned = new BigNumber(0);
if (calls[i].result.failedCall !== undefined || calls[i].result.failedCreate !== undefined) {
gasAssigned = new BigNumber(-1);
break;
}
var gas = new BigNumber(calls[i].action.call.gas).sub(new BigNumber(calls[i].result.call.gasUsed));
var cType = calls[i].action.create !== undefined ? 'create' : 'call';
var gas = new BigNumber(calls[i].action[cType].gas).sub(new BigNumber(calls[i].result[cType].gasUsed));
if (maxGas.sub(gas).gt(gasAssigned) && gas.gt(100000)) gasAssigned = maxGas.sub(gas);
}
callback({
Expand Down

0 comments on commit d689dc7

Please sign in to comment.