OSDN Git Service

update teh cross chain transaction
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 10 Sep 2019 01:42:02 +0000 (09:42 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 10 Sep 2019 01:42:02 +0000 (09:42 +0800)
src/manifest.js
src/models/bytom.js
src/store/actions.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/welcome/creation.vue

index baa2ef3..3b8c8bf 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.0.1',
+  version: '2.1.0',
   author: 'Bytom frontend, zhitinglin',
   web_accessible_resources: ['js/inject.js', 'wasm/main.wasm'],
   browser_action: {
index bac71ce..fee8297 100644 (file)
@@ -2,9 +2,9 @@ import Bytom from 'bytom-js-sdk'
 
 var networks = {
   testnetvapor: 'http://52.82.55.145:3000/api/v1/vapor/',
-  testnetbytom: 'http://52.82.55.145:3000/api/v1/btm/',
-  solonetbytom: 'http://app.bycoin.io:3060/api/v1/btm/',
-  mainnetbytom: 'https://api.bycoin.im:8000/api/v1/btm/',
+  testnet: 'http://52.82.55.145:3000/api/v1/btm/',
+  solonet: 'http://app.bycoin.io:3060/api/v1/btm/',
+  mainnet: 'https://api.bycoin.im:8000/api/v1/btm/',
   mainnetvapor: 'https://api.bycoin.im:8000/api/v1/vapor/'
 }
 
index d5c4d9f..675f0c7 100644 (file)
@@ -33,7 +33,7 @@ export const actions = {
         return new Promise(async (resolve, reject) => {
             const bytom = Bytom.fromJson(state.bytom);
             bytom.settings.network = 'mainnet';
-            account.setupNet('mainnetbytom')
+            account.setupNet('mainnet')
             account.list().then(accounts => {
                 bytom.accountList = accounts;
                 if (accounts.length > 0) {
@@ -43,8 +43,9 @@ export const actions = {
                 }
 
                 bytom.settings.login = true
-              bytom.settings.netType = 'bytom'
-              dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
+                bytom.settings.currency = "in_cny"
+                bytom.settings.netType = ''
+                dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
                     dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom));
                     resolve();
                 })
@@ -57,7 +58,7 @@ export const actions = {
         return new Promise(async (resolve, reject) => {
             const bytom = Bytom.fromJson(state.bytom);
             bytom.settings.network = network;
-            account.setupNet(`${network}bytom`)
+            account.setupNet(`${network}`)
             account.list().then(accounts => {
               bytom.accountList = accounts;
               if (accounts.length > 0) {
@@ -65,7 +66,8 @@ export const actions = {
               }
 
               bytom.settings.login = true
-              bytom.settings.netType = 'bytom'
+              bytom.settings.currency = "in_cny"
+              bytom.settings.netType = ''
               dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
                   dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom));
                   resolve();
index eef3dd1..1db2416 100644 (file)
@@ -282,6 +282,8 @@ export default {
               transaction.type = 'vote'
             }else if(_.find(transaction.outputs, function(o) { return o.type =='crosschain_output'; })){
               transaction.type = 'crossChain'
+            }else if(_.find(transaction.inputs, function(o) { return o.type =='crosschain_input'; })){
+              transaction.type = 'crossChain'
             }
 
             if(balanceObject.length ===1 ){
index 2842d73..13f18ec 100644 (file)
                     </a>
                 </div>
                 <div class="topbar-middle bg-secondary">
-                    <select class="network-select" :value="netType" @change="netTypeToggle">
+                    <select class="network-select" :value="netType||'bytom'" @change="netTypeToggle">
                         <option value="bytom">{{ $t('main.bytom') }} {{net}}</option>
                         <option value="vapor">{{ $t('main.vapor') }} {{net}}</option>
                     </select>
           </ul>
         </div>
           <div v-else>
-            <div class="bg-emptytx"></div>
-            <div>
-              <span class="color-lightgrey center-text no-record">{{$t('main.noAssetRecord')}}</span>
-            </div>
+            <ul class="list">
+              <li class="list-item" v-for="(asset, index) in defaultBalances" :key="index" @click="assetOpen(asset)">
+                <div class="float-right text-align-right">
+                  <div class="value">{{ itemBalance(asset) }}</div>
+                  <div class="addr color-grey">{{ formatCurrency(asset[ currency ]) }}</div>
+                </div>
+                <div v-if="asset.symbol">
+                  <div class="uppercase">
+                    {{asset.symbol}}
+                  </div>
+
+                  <div class="addr color-grey">{{asset.name}}</div>
+                </div>
+                <div v-else>
+                  <div>
+                    Asset
+                  </div>
+
+                  <div class="addr color-grey uppercase">{{shortAddress(asset.asset)}}</div>
+                </div>
+
+              </li>
+            </ul>
           </div>
         </div>
         <div v-else>
@@ -277,6 +296,19 @@ export default {
             limit: 10,
             enterActive: EnterActive,
             leaveActive: LeaveActive,
+            defaultBalances: [
+              {
+                alias: "btm",
+                asset: BTM,
+                name: "Bytom",
+                symbol: "BTM",
+                balance: 0,
+                decimals: 8,
+                in_btc: "0",
+                in_cny: "0",
+                in_usd: "0"
+              }
+            ],
         };
     },
     watch: {
@@ -370,7 +402,7 @@ export default {
             account.setupNet(`${this.net}${this.netType}`);
         },
         netTypeToggle: function (event) {
-            const newNetType = event.target.value
+            const newNetType = event.target.value  ==='bytom'? '' :event.target.value;
             if( newNetType !== this.netType){
               const bytom = this.bytom.clone();
 
index c584210..5e5ef49 100644 (file)
@@ -339,7 +339,7 @@ export default {
             if(this.transaction.type === 'toVapor'){
               transaction.chainStatus().then((resp)=>{
                 const address = resp.federation_address
-                account.setupNet(`${this.net}bytom`)
+                account.setupNet(`${this.net}`)
                 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();
index 7945b6a..9ea748f 100644 (file)
@@ -106,22 +106,8 @@ export default {
                 onCancel: this.onCancel
             });
 
-            if(this.netType === 'bytom'){
-              account.create(this.formItem.accAlias, null, this.formItem.passwd1).then(account => {
-                this[Actions.CREATE_NEW_BYTOM_ACCOUNT](account).then(()=>{
-                  loader.hide();
-                  this.$router.push('/');
-                })
-
-              }).catch(err => {
-                  console.log(err);
-                  loader.hide();
-                  this.$dialog.show({
-                      body: err.message
-                  });
-              });
-            }else if(this.netType === 'vapor'){
-              account.setupNet(`${this.net}bytom`);
+            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)=>{
@@ -137,6 +123,20 @@ export default {
                   body: err.message
                 });
               });
+            }else{
+              account.create(this.formItem.accAlias, null, this.formItem.passwd1).then(account => {
+                this[Actions.CREATE_NEW_BYTOM_ACCOUNT](account).then(()=>{
+                  loader.hide();
+                  this.$router.push('/');
+                })
+
+              }).catch(err => {
+                console.log(err);
+                loader.hide();
+                this.$dialog.show({
+                  body: err.message
+                });
+              });
             }
         },
         ...mapActions([
index cff2a1e..4a3173b 100644 (file)
@@ -119,7 +119,7 @@ export default {
           if (bytom.settings.network != val.value) {
             bytom.settings.network = val.value;
             this.network = val;
-            account.setupNet(`${val.value}bytom`);
+            account.setupNet(`${val.value}`);
 
             bytom.currentAccount = {}
             account.list()
index 80ec84b..953df2b 100644 (file)
@@ -328,7 +328,7 @@ export default {
     },
     watch: {
         selected: function (value) {
-            account.setupNet(`${value.value}bytom`);
+            account.setupNet(`${value.value}`);
         }
     },
     mounted() {
@@ -352,7 +352,7 @@ export default {
         } else {
             this.selected = mainNet;
         }
-        account.setupNet(`${this.selected}bytom`);
+        account.setupNet(`${this.selected}`);
         this.i18n = getLanguage(this.language);
     }
 };