Bytom Wallet for Chrome
Revision | 3170b2a15d8454f77fabfe3799156517a7f20aee (tree) |
---|---|
Time | 2020-09-25 15:40:50 |
Author | Zhiting Lin <zhiting.fly@gmai...> |
Commiter | GitHub |
Merge pull request #15 from movnetwork/dev
Dev
@@ -1,6 +1,6 @@ | ||
1 | 1 | { |
2 | 2 | "name": "Byone", |
3 | - "version": "3.0.1", | |
3 | + "version": "3.0.2", | |
4 | 4 | "lockfileVersion": 1, |
5 | 5 | "requires": true, |
6 | 6 | "dependencies": { |
@@ -10423,9 +10423,9 @@ | ||
10423 | 10423 | "integrity": "sha512-GAAG8QAFVp7BFeQlNaThpTbimq3+HypBPNwdkCkHZZeVaD5zmXXfhp357dcUJXHXTZjSln0PvP6wiwLZXkFTwg==" |
10424 | 10424 | }, |
10425 | 10425 | "vuescroll": { |
10426 | - "version": "4.14.0", | |
10427 | - "resolved": "https://registry.npmjs.org/vuescroll/-/vuescroll-4.14.0.tgz", | |
10428 | - "integrity": "sha512-BQQcU0u9uRpmBTPoqgGcRD//g7/XUJzPxdEXupX4XSW0J+GZyUThjN0+cvvJlQyl/FmduMF6qF3JvKEfpNClQA==" | |
10426 | + "version": "4.16.1", | |
10427 | + "resolved": "https://registry.npmjs.org/vuescroll/-/vuescroll-4.16.1.tgz", | |
10428 | + "integrity": "sha512-7fRsG2Yw5Z07LUz/IIu9barpmYiN9q+ZTC+CrVamvCbmsxyhz8mU1OuYFbfORysaUskioNMxTGDo+HOzeDfSyQ==" | |
10429 | 10429 | }, |
10430 | 10430 | "vuex": { |
10431 | 10431 | "version": "3.1.1", |
@@ -1,7 +1,7 @@ | ||
1 | 1 | { |
2 | 2 | "name": "Byone", |
3 | 3 | "description": "Bytom Chrome Extension Wallet", |
4 | - "version": "3.0.2", | |
4 | + "version": "3.0.3", | |
5 | 5 | "author": "zhiting.fly@8btc.com", |
6 | 6 | "license": "MIT", |
7 | 7 | "private": true, |
@@ -34,7 +34,7 @@ | ||
34 | 34 | "vue-loading-overlay": "^3.0.1", |
35 | 35 | "vue-router": "^3.0.2", |
36 | 36 | "vuelidate": "^0.7.5", |
37 | - "vuescroll": "^4.14.0", | |
37 | + "vuescroll": "^4.16.1", | |
38 | 38 | "vuex": "^3.1.1" |
39 | 39 | }, |
40 | 40 | "browserslist": [ |
@@ -2,7 +2,7 @@ module.exports = { | ||
2 | 2 | manifest_version: 2, |
3 | 3 | name: 'Byone', |
4 | 4 | description: 'Bytom Wallet Chrome extension.', |
5 | - version: '3.0.2', | |
5 | + version: '3.0.3', | |
6 | 6 | author: 'Bytom frontend, zhitinglin', |
7 | 7 | web_accessible_resources: ['js/inject.js'], |
8 | 8 | browser_action: { |
@@ -138,8 +138,9 @@ transaction.transfer = function(transaction, password, address, context) { | ||
138 | 138 | let retPromise = new Promise((resolve, reject) => { |
139 | 139 | |
140 | 140 | const {to, asset, amount, confirmations} = transaction |
141 | + const _to = to.trim() | |
141 | 142 | bytom.transaction |
142 | - .buildPayment(address, to, asset, amount.toString(), confirmations) | |
143 | + .buildPayment(address, _to, asset, amount.toString(), confirmations) | |
143 | 144 | .then(result => { |
144 | 145 | return Promise.all(result.map( (data) => |
145 | 146 | signSubmit( data, password, address, context))) |
@@ -5,7 +5,8 @@ | ||
5 | 5 | |
6 | 6 | .transactions { |
7 | 7 | font-size: 15px; |
8 | - height: 340px; | |
8 | + height: 345px; | |
9 | + overflow: hidden; | |
9 | 10 | } |
10 | 11 | |
11 | 12 | .value{ |
@@ -16,7 +17,6 @@ font-size: 15px; | ||
16 | 17 | color: rgba(0, 0, 0, 0.36); |
17 | 18 | } |
18 | 19 | |
19 | - | |
20 | 20 | .no-record{ |
21 | 21 | display: block; |
22 | 22 | } |
@@ -117,37 +117,37 @@ font-size: 15px; | ||
117 | 117 | <div :class="{'color-black': (type==='transfer_out') }" @click="changeType('transfer_out')" >{{ $t('common.transfer_out') }}</div> |
118 | 118 | </section> |
119 | 119 | |
120 | - <section class="transactions"> | |
121 | - <div class="transactions" v-if="transactions.length != 0"> | |
120 | + <section> | |
121 | + <section class="transactions" v-if="transactions.length != 0"> | |
122 | 122 | <vue-scroll ref="vs" @handle-scroll="handleScroll"> |
123 | - <ul class="list"> | |
124 | - <li class="list-item" v-for="(transaction, index) in transactions" :key="index" > | |
125 | - <a :href="blockmeta(transaction.hash)" target="_blank"> | |
126 | - <div> | |
127 | - <div class="font-bold"> | |
128 | - {{transaction.type}} | |
129 | - </div> | |
130 | - <div class="addr color-grey" >{{transaction.address}}</div> | |
123 | + <ul class="list"> | |
124 | + <li class="list-item" v-for="(transaction, index) in transactions" :key="index" > | |
125 | + <a :href="blockmeta(transaction.hash)" target="_blank"> | |
126 | + <div> | |
127 | + <div class="font-bold"> | |
128 | + {{transaction.type}} | |
129 | + </div> | |
130 | + <div class="addr color-grey" >{{transaction.address}}</div> | |
131 | 131 | |
132 | - </div> | |
133 | - <div class="text-align-right"> | |
134 | - <div class="value">{{transaction.direct}}{{transaction.val}} {{currentAsset.asset.symbol}}</div> | |
135 | - | |
136 | - <div class="addr color-red" v-if="!transaction.status"> | |
137 | - {{ $t('listAsset.fail') }} | |
138 | - </div> | |
139 | - <div class="addr color-grey" v-else-if="transaction.hasOwnProperty('blockTimestamp')"> | |
140 | - {{transaction.submissionTimestamp | moment}} | |
141 | 132 | </div> |
142 | - <div class="addr color-grey" v-else> | |
143 | - {{ $t('main.unconfirmed') }} | |
133 | + <div class="text-align-right"> | |
134 | + <div class="value">{{transaction.direct}}{{transaction.val}} {{currentAsset.asset.symbol}}</div> | |
135 | + | |
136 | + <div class="addr color-red" v-if="!transaction.status"> | |
137 | + {{ $t('listAsset.fail') }} | |
138 | + </div> | |
139 | + <div class="addr color-grey" v-else-if="transaction.hasOwnProperty('blockTimestamp')"> | |
140 | + {{transaction.submissionTimestamp | moment}} | |
141 | + </div> | |
142 | + <div class="addr color-grey" v-else> | |
143 | + {{ $t('main.unconfirmed') }} | |
144 | + </div> | |
144 | 145 | </div> |
145 | - </div> | |
146 | - </a> | |
147 | - </li> | |
148 | - </ul> | |
146 | + </a> | |
147 | + </li> | |
148 | + </ul> | |
149 | 149 | </vue-scroll> |
150 | - </div> | |
150 | + </section> | |
151 | 151 | <div v-else> |
152 | 152 | <div class="bg-emptytx"></div> |
153 | 153 | <div> |
@@ -199,21 +199,21 @@ export default { | ||
199 | 199 | this.enterActive = EnterActive |
200 | 200 | this.leaveActive = LeaveActive |
201 | 201 | }, |
202 | - 'currentAccount.balances'() { | |
203 | - if(this.$refs['vs']){ | |
204 | - this.$refs['vs'].scrollTo( | |
205 | - { | |
206 | - y: 0 | |
207 | - }, | |
208 | - 500, | |
209 | - 'easeInQuad' | |
210 | - ); | |
211 | - } | |
212 | - this.start = 0 | |
213 | - this.refreshTransactions( this.start, limit, this.type).then(transactions => { | |
214 | - this.transactions = transactions | |
215 | - }); | |
216 | - }, | |
202 | + // 'currentAccount.balances'() { | |
203 | + // if(this.$refs['vs']){ | |
204 | + // this.$refs['vs'].scrollTo( | |
205 | + // { | |
206 | + // y: 0 | |
207 | + // }, | |
208 | + // 500, | |
209 | + // 'easeInQuad' | |
210 | + // ); | |
211 | + // } | |
212 | + // this.start = 0 | |
213 | + // this.refreshTransactions( this.start, limit, this.type).then(transactions => { | |
214 | + // this.transactions = transactions | |
215 | + // }); | |
216 | + // }, | |
217 | 217 | type(newVale){ |
218 | 218 | if(this.$refs['vs']){ |
219 | 219 | this.$refs['vs'].scrollTo( |
@@ -244,6 +244,7 @@ export default { | ||
244 | 244 | 'listVote' |
245 | 245 | ]), |
246 | 246 | ...mapGetters([ |
247 | + 'language', | |
247 | 248 | 'currentAccount', |
248 | 249 | 'currency', |
249 | 250 | 'netType' |
@@ -300,8 +301,8 @@ export default { | ||
300 | 301 | return; |
301 | 302 | } |
302 | 303 | |
303 | - if ( (vertical.process == 1) && (this.transactions.length == (this.start+1)*limit) ) { | |
304 | - this.start += limit; | |
304 | + if ( (vertical.process == 1) && (this.transactions.length == (this.start+limit)) ) { | |
305 | + this.start = this.start + limit; | |
305 | 306 | this.refreshTransactions( this.start, limit, this.type).then(transactions => { |
306 | 307 | transactions.forEach(transaction => { |
307 | 308 | this.transactions.push(transaction); |
@@ -376,6 +377,16 @@ export default { | ||
376 | 377 | |
377 | 378 | if(transaction.types.includes('in_crosschain')){ |
378 | 379 | transaction.address = `${this.currentAsset.asset.symbol} ${this.$t("listAsset.main")}` |
380 | + }else if(transaction.types.includes('vote')){ | |
381 | + const pubKey = transaction.outputs.find( i => i.type ==='vote').vote | |
382 | + const item = this.listVote[pubKey] | |
383 | + transaction.address = item? (((this.language ==='zh' || this.language ==='cn')? (item.name ==='-'? null: item.name):item.nameEn)||address.short(item.pubKey)):'-' | |
384 | + transaction.type = this.$t("common.vote") | |
385 | + }else if(transaction.types.includes('veto')){ | |
386 | + const pubKey = transaction.inputs.find( i => i.type ==='veto').vote | |
387 | + const item = this.listVote[pubKey] | |
388 | + transaction.address = item? (((this.language ==='zh' || this.language ==='cn')? (item.name ==='-'? null: item.name):item.nameEn)||address.short(item.pubKey)):'-' | |
389 | + transaction.type = this.$t("common.veto") | |
379 | 390 | } |
380 | 391 | transaction.val = val ; |
381 | 392 |
@@ -401,12 +412,12 @@ export default { | ||
401 | 412 | this.refreshTransactions( this.start, limit, this.type).then(transactions => { |
402 | 413 | this.transactions = transactions |
403 | 414 | }); |
404 | - if(this.listVote.length == 0 && this.netType === 'vapor'){ | |
415 | + if(Object.keys(this.listVote).length == 0 && this.netType === 'vapor'){ | |
405 | 416 | query.chainStatus().then(resp => { |
406 | 417 | if(resp){ |
407 | - const votes = resp.consensusNodes.map( (item, index) => { | |
408 | - item.rank = index+1; | |
409 | - return item | |
418 | + const votes = {} | |
419 | + resp.consensusNodes.map( (item) => { | |
420 | + votes[item.pubKey] = item | |
410 | 421 | }); |
411 | 422 | this[Actions.SET_LIST_VOTE](votes) |
412 | 423 | } |
@@ -37,7 +37,7 @@ | ||
37 | 37 | <div class="title">{{bapp.title}}</div> |
38 | 38 | <div class="description">{{bapp.description}}</div> |
39 | 39 | </div> |
40 | - <img :src="require(`@/assets/img/bapp/${bapp.icon}`)" :alt="bapp.icon" v-on:error="onImgError($event, bapp.icon)"/> | |
40 | + <img :src="src(bapp.icon)" :alt="bapp.icon" v-on:error="onImgError($event, bapp.icon)"/> | |
41 | 41 | |
42 | 42 | </a> |
43 | 43 |
@@ -68,17 +68,24 @@ export default { | ||
68 | 68 | }else{ |
69 | 69 | list = list.map((l , index)=> Object.assign(l, this.jsonData['en'][index])) |
70 | 70 | } |
71 | - | |
72 | 71 | return list; |
73 | 72 | }, |
74 | 73 | }, |
75 | 74 | methods: { |
75 | + src: function(name){ | |
76 | + try { | |
77 | + const src = require(`@/assets/img/bapp/${name}`) | |
78 | + return src | |
79 | + } catch (ex) { | |
80 | + return `${bappImgUrl}${name}` | |
81 | + } | |
82 | + }, | |
76 | 83 | onImgError: function(event, name) { |
77 | 84 | event.target.src = `${bappImgUrl}${name}` |
78 | 85 | } |
79 | 86 | }, |
80 | 87 | mounted() { |
81 | - // Todo: update to production before publish | |
88 | + // Todo: update to production before publish | |
82 | 89 | fetch(bappRequestUrl) |
83 | 90 | .then(response => response.json()) |
84 | 91 | .then(json => { |
@@ -74,7 +74,7 @@ | ||
74 | 74 | padding: 12px 0 16px 0px; |
75 | 75 | font-weight: 600; |
76 | 76 | } |
77 | -.transactions { | |
77 | +.assets { | |
78 | 78 | font-size: 15px; |
79 | 79 | overflow: auto; |
80 | 80 | flex-grow: 1; |
@@ -302,7 +302,7 @@ input:checked + .slider:before { | ||
302 | 302 | <section v-if="address!=undefined" class="transaction-title"> |
303 | 303 | <h3 class="color-black">{{ $t('main.asset') }}</h3> |
304 | 304 | </section> |
305 | - <section class="transactions"> | |
305 | + <section class="assets"> | |
306 | 306 | <div v-if=" balances && balances.length > 0"> |
307 | 307 | <ul class="list"> |
308 | 308 | <li class="list-item" v-for="(balance, index) in balances" :key="index" @click="assetOpen(balance)"> |
@@ -634,6 +634,13 @@ | ||
634 | 634 | types = _.union(inputType, outputType, types); |
635 | 635 | |
636 | 636 | const remove = ['spend','control']; |
637 | + if(inputs[0].amount ===outputs[0].amount){ | |
638 | + const isVeto = inputs.find(o => o.type ==='veto') | |
639 | + const isVote = outputs.find(o => o.type ==='vote') | |
640 | + if(isVeto || isVote){ | |
641 | + remove.push('transfer') | |
642 | + } | |
643 | + } | |
637 | 644 | types = removeFromArray(types, remove); |
638 | 645 | types = types.map(ty => this.$t(`common.${ty}`)).join(', '); |
639 | 646 |
@@ -428,6 +428,7 @@ export default { | ||
428 | 428 | }); |
429 | 429 | |
430 | 430 | this.transaction.asset = this.selectAsset.assetId; |
431 | + this.transaction.to = this.transaction.to.trim(); | |
431 | 432 | transaction.transfer(this.transaction, password, this.address, this).then(result => { |
432 | 433 | loader.hide(); |
433 | 434 | this.$router.push('/') |
@@ -1,6 +1,6 @@ | ||
1 | 1 | <?xml version='1.0' encoding='UTF-8'?> |
2 | 2 | <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
3 | 3 | <app appid='gnooapainaenaagmljnopepbheiaaaok'> |
4 | - <updatecheck codebase='http://localhost:8000/chrome-ext.crx' version='3.0.2' prodversionmin='64.0.3242' /> | |
4 | + <updatecheck codebase='http://localhost:8000/chrome-ext.crx' version='3.0.3' prodversionmin='64.0.3242' /> | |
5 | 5 | </app> |
6 | 6 | </gupdate> |
\ No newline at end of file |