From 737a90c03cf47292e84b66103c0ea74ca4040cd3 Mon Sep 17 00:00:00 2001 From: PsChina Date: Wed, 14 Oct 2020 19:47:03 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcdp=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/wallet/baas-api.js | 28 ++++----- src/backend/wallet/index.js | 34 +++++------ .../account/components/wiccs-history.vue | 55 ++++++++++------- src/popup/account/token/wiccRecord.vue | 60 ++++++++++++------- 4 files changed, 102 insertions(+), 75 deletions(-) diff --git a/src/backend/wallet/baas-api.js b/src/backend/wallet/baas-api.js index ec4d7b3..69650a4 100755 --- a/src/backend/wallet/baas-api.js +++ b/src/backend/wallet/baas-api.js @@ -19,12 +19,12 @@ const handleError = (error) => { export default class { constructor(network) { this.network = network || 'testnet' - if (localStorage.getItem('myselfNetWork')){ + if (localStorage.getItem('myselfNetWork')) { this.host = JSON.parse(localStorage.getItem('myselfNetWork')).url - }else{ + } else { if (this.network === 'mainnet') { this.host = BAAS_MAINNET - }else if (this.network === 'testnet') { + } else if (this.network === 'testnet') { this.host = BAAS_TESTNET } } @@ -39,7 +39,7 @@ export default class { } getAccountInfo(address) { - return axios.post(this.host + '/account/getaccountinfo',{'address':address}).then(handleResponse, handleError) + return axios.post(this.host + '/account/getaccountinfo', { 'address': address }).then(handleResponse, handleError) } getTxDetail(tx) { @@ -52,7 +52,7 @@ export default class { ///查询ERC20代币详情 getTokenInfo(regId, address) { // alert(this.host + '/contract/getcontractaccountinfo'+address+regId) - return axios.post(this.host + '/contract/getcontractaccountinfo',{ + return axios.post(this.host + '/contract/getcontractaccountinfo', { 'address': address, 'contractregid': regId.trim() }) @@ -72,22 +72,22 @@ export default class { getTransHistory(info) { if (!info.address) throw new Error('address is required.') return axios.post(this.host + '/transaction/gettranscationsbyaddressplus', { - "address": info.address, - "currentpage": info.currentpage, - "pagesize": info.pagesize, - "startheight": 1, - "trandirection": 0, - "txtype": "", - "coinsymbol":info.coinsymbol, + "address": info.address, + "currentpage": info.currentpage, + "pagesize": info.pagesize, + "startheight": 1, + "trandirection": 0, + "txtype": "", + "coinsymbol": info.coinsymbol, }).then(handleResponse, handleError) } ///获取 - getDetailInfo(info){ + getDetailInfo(info) { return axios.post(this.host + '/transaction/gettxdetailplus', info).then(handleResponse, handleError) } ///根据代号查询发型资产详情 - getAssetInfo(info){ + getAssetInfo(info) { return axios.post(this.host + '/asset/getasset', info).then(handleResponse, handleError) } //获取插件钱包最新版本号 diff --git a/src/backend/wallet/index.js b/src/backend/wallet/index.js index 0ede227..21dc183 100755 --- a/src/backend/wallet/index.js +++ b/src/backend/wallet/index.js @@ -29,7 +29,7 @@ const getSignInfo = (network, address) => { let srcRegId = "" const localRegid = localStorage.getItem('srcRegID') srcRegId = localRegid ? localRegid : "" - if (srcRegId!="") { + if (srcRegId != "") { return baasApi.getblockcount().then((data) => { const height = data const privateKey = vaultStorage.getPrivateKey(address) @@ -42,7 +42,7 @@ const getSignInfo = (network, address) => { } return baasApi.getAccountInfo(address).then((data) => { srcRegId = data.regid ? data.regid : "" - localStorage.setItem('srcRegID',srcRegId) + localStorage.setItem('srcRegID', srcRegId) return baasApi.getblockcount() }).then((data) => { const height = data @@ -341,7 +341,7 @@ export default { return { network, address: activeAddress, - regid:localRegid?localRegid:"", + regid: localRegid ? localRegid : "", } }, getTransHistory({ @@ -862,7 +862,7 @@ export default { throw new Error('INVALID_VALUE') } let hex = wiccApi.createVariousCoinsTx(privateKey, height, srcRegId, info.destAddr, info.value, info.fees, info.coinType, info.feeSymbol, localNetWork, info.memo) - return {rawtx:hex} + return { rawtx: hex } }) }, @@ -914,13 +914,13 @@ export default { feesName: info.feesName, }; - - if (srcRegId){ + + if (srcRegId) { let hex = wiccApi.assetsPub(assestInfo) return new BaasAPI(localNetWork).submitOfflineTrans(hex) - }else{ + } else { return new Promise((resolve, reject) => { - reject("qianbaoweijihuo") + reject("qianbaoweijihuo") }) } }) @@ -952,12 +952,12 @@ export default { feesName: info.feesName, }; - if (srcRegId){ + if (srcRegId) { let hex = wiccApi.assetsUpdate(assestInfo) return new BaasAPI(localNetWork).submitOfflineTrans(hex) - }else{ + } else { return new Promise((resolve, reject) => { - reject("qianbaoweijihuo") + reject("qianbaoweijihuo") }) } }) @@ -991,14 +991,14 @@ export default { if (isNaN(parseFloat(info.amount))) { throw new Error('INVALID_VALUE') } - let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol,info.fees, info.feesName, info.contract, localNetWork, info.memo) + let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol, info.fees, info.feesName, info.contract, localNetWork, info.memo) return new BaasAPI(localNetWork).submitOfflineTrans(hex) }) }, - /** - * 多币种合约调用(仅仅签名) - */ + /** + * 多币种合约调用(仅仅签名) + */ variousCoinsContractRaw({ info }) { const localNetWork = localStorage.getItem('network') const wiccApi = getWiccApi(localNetWork) @@ -1010,8 +1010,8 @@ export default { if (isNaN(parseFloat(info.amount))) { throw new Error('INVALID_VALUE') } - let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol,info.fees, info.feesName, info.contract, localNetWork, info.memo) - return {rawtx:hex} + let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol, info.fees, info.feesName, info.contract, localNetWork, info.memo) + return { rawtx: hex } }) }, diff --git a/src/popup/account/components/wiccs-history.vue b/src/popup/account/components/wiccs-history.vue index 49af830..438c8a4 100755 --- a/src/popup/account/components/wiccs-history.vue +++ b/src/popup/account/components/wiccs-history.vue @@ -1,7 +1,13 @@