diff --git a/scripts/controllers/addressInfoController.js b/scripts/controllers/addressInfoController.js index 9c1ebc2..ae6181a 100644 --- a/scripts/controllers/addressInfoController.js +++ b/scripts/controllers/addressInfoController.js @@ -125,11 +125,27 @@ angular.module('ethExplorer') $('#dialog-unwrap-wjoule').modal('show'); } + $scope.wjUnwrapToConfirm = function () { + const amt = $('#wj-unwrap-amount')[0].value; + const to = $('#wj-unwrap-to')[0].value; + const save_info = $('#wj-unwrap-save-info')[0].checked; + console.log('wjUnwrapTo', amt, to, save_info); + + $('#confirm-unwrap-wj-from').text($scope.addressId); + $('#confirm-unwrap-wj-amount').text(amt ? amt : '0'); + $('#confirm-unwrap-wj-amount2').text(amt ? amt : '0'); + $('#confirm-unwrap-wj-to').text(to ? to : $scope.addressId); + + $('#dialog-unwrap-wjoule-confirm').modal({keyboard:false, backdrop:'static'}); + $('#dialog-unwrap-wjoule-confirm').modal('show'); + } + $scope.wjUnwrapTo = function () { const DIALOG_TITLE = 'Unwrap wJ'; const amt = $('#wj-unwrap-amount')[0].value; const to = $('#wj-unwrap-to')[0].value; - console.log('wjUnwrapTo', amt, to); + const save_info = $('#wj-unwrap-save-info')[0].checked; + console.log('wjUnwrapTo', amt, to, save_info); if (amt && !isNaN(amt)) { // isNaN works, nice. if (!(amt > 0)) { @@ -148,6 +164,11 @@ angular.module('ethExplorer') wj_contract.methods.withdraw(e) .send({from: connectedAccount}, handlerShowTx(DIALOG_TITLE)) .then(handlerShowRct(DIALOG_TITLE)); + + if (!save_info) { + $('#wj-unwrap-amount')[0].value = ''; + $('#wj-unwrap-to')[0].value = ''; + } } else { dialogShowTxt(DIALOG_TITLE, '错误:无法评估gas:' + err.message); //展示合约逻辑报错 } @@ -158,6 +179,11 @@ angular.module('ethExplorer') wj_contract.methods.withdrawTo(to, e) .send({from: connectedAccount}, handlerShowTx(DIALOG_TITLE)) .then(handlerShowRct(DIALOG_TITLE)); + + if (!save_info) { + $('#wj-unwrap-amount')[0].value = ''; + $('#wj-unwrap-to')[0].value = ''; + } } else { dialogShowTxt(DIALOG_TITLE, '错误:无法评估gas:' + err.message); //展示合约逻辑报错 } @@ -234,9 +260,11 @@ angular.module('ethExplorer') console.log('loading golden_idx.json ...'); }); - getJNSDAOV(); - getAllJNS(); - getAllJNSVote(); + // JNS -> JNSDAOV, JNSVote, etc. + getAllJNS().then(() => { + getJNSDAOV(); + getAllJNSVote(); + }); } function getAddressInfos(){ @@ -512,6 +540,8 @@ angular.module('ethExplorer') } function getAllJNS() { + var deferred = $q.defer(); + $scope.allJNS = []; var addr = $scope.addressId; var contract = new web3.eth.Contract(jns_ABI, jns_contract_address); @@ -542,6 +572,9 @@ angular.module('ethExplorer') } }); } + + if (balance > 0) + deferred.resolve(); } }); @@ -553,6 +586,9 @@ angular.module('ethExplorer') console.log('[addressInfo] chainId: ', $scope.chainId, 'account: ', $scope.account, 'jnsContractOwner: ', $scope.jnsContractOwner); $scope.$apply(); }); + + + return deferred.promise; } function getAllJNSVote() { diff --git a/views/addressInfo.html b/views/addressInfo.html index d00fc06..a7809e4 100644 --- a/views/addressInfo.html +++ b/views/addressInfo.html @@ -30,7 +30,7 @@
-
- 拆开wJ (wrapped Joule),释放其中的能量到某一地址。需输入:
- 1. 要拆开的wJ数量: wJ
- 2. 接收能量的链地址(留空则默认为当前地址):
-
+
+
+ 释放wJ (wrapped Joule)中的能量(1 wJ = 1 J)到某一地址作为gas使用。
+ 需输入:
+ 1. 要释放的Joule量: J
+
+
+ 2. 接收能量的链地址(留空则默认为当前地址):
+
+
+
+ 点击确定后不清空输入框
+
+