OSDN Git Service

update v1 api to v2 api. 2.1.3
authorZhiting Lin <zlin035@uottawa.ca>
Thu, 14 Nov 2019 01:40:35 +0000 (09:40 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Thu, 14 Nov 2019 01:40:35 +0000 (09:40 +0800)
13 files changed:
package.json
src/manifest.js
src/models/bytom.js
src/views/assetList.vue
src/views/home.vue
src/views/sendTransaction/crossChainTransaction.vue
src/views/sideMenu/menuCreation.vue
src/views/sideMenu/menuSettings.vue
src/views/vote/veto.vue
src/views/vote/vote.vue
src/views/vote/voteConfirm.vue
src/views/welcome/creation.vue
updates.xml

index 8c072c9..cd4c0b8 100644 (file)
@@ -1,7 +1,7 @@
 {
     "name": "Byone",
     "description": "Bytom Chrome Extension Wallet",
-    "version": "2.1.2",
+    "version": "2.1.3",
     "author": "zhiting.fly@8btc.com",
     "license": "MIT",
     "private": true,
index b6f9be8..e041931 100644 (file)
@@ -2,7 +2,7 @@ module.exports = {
   manifest_version: 2,
   name: 'Byone',
   description: 'Bytom Wallet Chrome extension, Bystore officially changed to Byone.',
-  version: '2.1.2',
+  version: '2.1.3',
   author: 'Bytom frontend, zhitinglin',
   web_accessible_resources: ['js/inject.js', 'wasm/main.wasm'],
   browser_action: {
index 1840b15..db24024 100644 (file)
@@ -1,10 +1,8 @@
 import Bytom from 'bytom-js-sdk'
 
 var networks = {
-  testnetvapor: 'http://app.bycoin.io:3020/api/v1/vapor/',
-  testnet: 'http://app.bycoin.io:3020/api/v1/btm/',
-  mainnet: 'https://bcapi.bystack.com/api/v1/btm/',
-  mainnetvapor: 'https://bcapi.bystack.com/api/v1/vapor/'
+  mainnet: 'https://bcapi.bystack.com/api/v2/btm/',
+  mainnetvapor: 'https://bcapi.bystack.com/api/v2/vapor/'
 }
 
 var bytom = new Bytom(networks, chrome.runtime.getURL('wasm/main.wasm'))
index 355fbc9..0099f29 100644 (file)
@@ -85,7 +85,7 @@
             </div>
             <div class="topbar-middle">
               <div v-if="currentAsset!=undefined" class="amount color-white">
-                <div v-if="currentAsset.symbol!=='-'">
+                <div v-if="currentAsset.symbol!=='Asset'">
                   <div class="symbol">
                     {{currentAsset.symbol}}
                   </div>
@@ -308,11 +308,11 @@ export default {
                 if (Number(balanceObject[0].amount) > 0) {
                     transaction.direct = "+";
                     const resultAddr = inputAddresses.pop()
-                    transaction.address = resultAddr.includes(' ')?resultAddr:address.short(resultAddr);
+                    transaction.address = (resultAddr && resultAddr.includes(' '))?resultAddr:address.short(resultAddr);
                 } else {
                     transaction.direct = "-";
                     const resultAddr = outputAddresses.pop()
-                    transaction.address = resultAddr.includes(' ')?resultAddr:address.short(resultAddr);
+                    transaction.address = (resultAddr && resultAddr.includes(' '))?resultAddr:address.short(resultAddr);
                 }
 
                 transaction.val =  Num.formatNue(val, this.currentAsset.decimals) ;
index a5346b7..a4c616b 100644 (file)
                 <div class="value">{{ itemBalance(asset) }}</div>
                 <div class="addr color-grey">{{ formatCurrency(asset[ currency ]) }}</div>
               </div>
-              <div v-if="asset.symbol!== '-'">
+              <div v-if="asset.symbol!== 'Asset'">
                 <div class="uppercase">
                   {{asset.symbol}}
                 </div>
                   Asset
                 </div>
 
-                <div class="addr color-grey uppercase">{{shortAddress(asset.asset)}}</div>
+                <div class="addr color-grey uppercase">{{ shortAddress(asset.asset) }}</div>
               </div>
 
             </li>
                   <div class="value">{{ itemBalance(asset) }}</div>
                   <div class="addr color-grey">{{ formatCurrency(asset[ currency ]) }}</div>
                 </div>
-                <div v-if="asset.symbol!== '-'">
+                <div v-if="asset.symbol!== 'Asset'">
                   <div class="uppercase">
                     {{asset.symbol}}
                   </div>
index 9f786f7..4712d6d 100644 (file)
@@ -362,7 +362,9 @@ export default {
                 this.transaction.to = address
                 transaction.build(this.account.guid, address, this.transaction.asset, Num.convertToNue(this.transaction.amount,this.selectAsset.decimals), this.transaction.confirmations).then(result => {
                   loader.hide();
-                  this.transaction.fee = Number(result.fee / 100000000);
+                  if(!this.transaction.fee){
+                    this.transaction.fee = Number( _.sumBy(result, 'fee') / 100000000);
+                  }
                   this.$router.push({ name: 'transfer-confirm', params: { account: this.account, transaction: this.transaction, rawData: result,assetAlias: this.selectAsset.symbol, type: this.$route.query.type } })
                 }).catch(error => {
                   loader.hide();
@@ -380,7 +382,9 @@ export default {
               this.transaction.to = address
               transaction.buildCrossChain(this.account.guid, address, this.transaction.asset,  Num.convertToNue(this.transaction.amount,this.selectAsset.decimals), this.transaction.confirmations).then(result => {
                   loader.hide();
-                this.transaction.fee = Number(result.fee / 100000000);
+                if(!this.transaction.fee){
+                  this.transaction.fee = Number( _.sumBy(result, 'fee') / 100000000);
+                }
                 this.$router.push({ name: 'transfer-confirm', params: { account: this.account, transaction: this.transaction, rawData: result, assetAlias: this.selectAsset.symbol, type: this.$route.query.type } })
               }).catch(error => {
                   loader.hide();
index 9ea748f..299d7db 100644 (file)
@@ -106,8 +106,8 @@ export default {
                 onCancel: this.onCancel
             });
 
+            account.setupNet(`${this.net}`);
             if(this.netType === 'vapor'){
-              account.setupNet(`${this.net}`);
               account.create(this.formItem.accAlias, null, this.formItem.passwd1).then((resp) => {
                 account.setupNet(`${this.net}vapor`);
                 return account.copy(resp.guid).then((currentRespAccount)=>{
index 5dcb3d2..66fc54d 100644 (file)
@@ -78,7 +78,6 @@ export default {
             ],
             networks: [
               { label: this.$t('main.mainNet'), value: "mainnet" },
-              { label: this.$t('main.testNet'), value: "testnet" },
             ],
             selected: { label: "中文", value: "cn" },
             hashVersion: "",
@@ -181,9 +180,6 @@ export default {
               case 'mainnet':
                 network = this.networks[0]
                 break;
-              case 'testnet':
-                network = this.networks[1]
-                break;
             }
             this.setupNetwork(network);
           }
index 45cbda2..333cd87 100644 (file)
@@ -181,7 +181,9 @@ export default {
             this.transaction.to = vote
             transaction.buildVeto(this.currentAccount.guid, vote,  Num.convertToNue(this.transaction.amount,8), this.transaction.confirmations).then(result => {
                 loader.hide();
-                this.transaction.fee = Number(result.fee / 100000000);
+                if(!this.transaction.fee){
+                  this.transaction.fee = Number( _.sumBy(result, 'fee') / 100000000);
+                }
                 this.$router.push({ name: 'vote-confirm', params: { account: this.currentAccount, transaction: this.transaction, assetAlias: 'BTM',rawData: result} })
             }).catch(error => {
                 loader.hide();
index f3e4adb..b2b53d3 100644 (file)
@@ -192,7 +192,9 @@ export default {
             this.transaction.to = vote
             transaction.buildVote(this.currentAccount.guid, vote,  Num.convertToNue(this.transaction.amount,8), this.transaction.confirmations).then(result => {
                 loader.hide();
-                this.transaction.fee = Number(result.fee / 100000000);
+              if(!this.transaction.fee){
+                this.transaction.fee = Number( _.sumBy(result, 'fee') / 100000000);
+              }
                 this.$router.push({ name: 'vote-confirm', params: { account: this.currentAccount,  transaction: this.transaction,assetAlias: 'BTM', rawData: result} })
             }).catch(error => {
                 loader.hide();
index 8b85f0c..5271cc3 100644 (file)
@@ -239,29 +239,28 @@ export default {
                 onCancel: this.onCancel
             });
 
-            // rawData, password
-            transaction.transfer(this.account.guid, this.rawData, this.password)
-                .then(ret => {
-                    loader.hide();
-                    if(this.$route.params.type == 'popup'){
-                      LocalStream.send({method:'transfer',action:'success', message:ret});
-                      window.close();
-                    }
-                    this.$dialog.show({
-                      type: 'success',
-                      body: this.$t("transfer.success")
-                    });
-                    this.$router.push('/')
-                    if(this.transaction.type === 'toVapor'){
-                      account.setupNet(`${this.net}vapor`)
-                    }
-                })
-                .catch(error => {
-                    loader.hide();
-                    this.$dialog.show({
-                        body: getLang(error.message, this.language)
-                    });
-                });
+          Promise.all(this.rawData.map( (rawdata) => transaction.transfer(this.account.guid, rawdata, this.password)))
+            .then(ret => {
+              loader.hide();
+              if(this.$route.params.type == 'popup'){
+                LocalStream.send({method:'transfer',action:'success', message:ret[ret.length-1]});
+                window.close();
+              }
+              this.$dialog.show({
+                type: 'success',
+                body: this.$t("transfer.success")
+              });
+              this.$router.push('/')
+              if(this.transaction.type === 'toVapor'){
+                account.setupNet(`${this.net}vapor`)
+              }
+            })
+            .catch(error => {
+              loader.hide();
+              this.$dialog.show({
+                body: getLang(error.message, this.language)
+              });
+            });
         }
     }, mounted() {
         let params = this.$route.params;
index c9479ad..2920562 100644 (file)
@@ -196,7 +196,6 @@ import { mapActions, mapGetters, mapState } from 'vuex'
 import * as Actions from '@/store/constants';
 
 let mainNet = null;
-let testNet = null;
 export default {
     name: "",
     data() {
@@ -331,18 +330,15 @@ export default {
     },
     mounted() {
         mainNet = { label: this.$t('main.mainNet'), value: "mainnet" };
-        testNet = { label: this.$t('main.testNet'), value: "testnet" };
-        this.nets = [mainNet, testNet];
+        this.nets = [mainNet];
         if (this.net != undefined) {
             if (this.net == "mainnet") {
                 this.selected = mainNet;
-            } else if (this.net == "testnet") {
-                this.selected = testNet;
             }
         } else {
             this.selected = mainNet;
         }
-        account.setupNet(`${this.selected}`);
+        account.setupNet(`${this.selected.value}`);
         this.i18n = getLanguage(this.language);
     }
 };
index afa7415..7c29326 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
   <app appid='gnooapainaenaagmljnopepbheiaaaok'>
-    <updatecheck codebase='http://localhost:8000/chrome-ext.crx' version='2.1.2' />
+    <updatecheck codebase='http://localhost:8000/chrome-ext.crx' version='2.1.3' />
   </app>
 </gupdate>
\ No newline at end of file