Bytom Wallet for Chrome
Revision | 89c671ba283a511f0b5b7c8a8df49afaab6adc92 (tree) |
---|---|
Zeit | 2021-11-18 10:27:20 |
Autor | xietao <nanshuo_xt@163....> |
Commiter | xietao |
fix: transition logic
@@ -249,20 +249,12 @@ | ||
249 | 249 | v-if="prompt.domain && domainsMeta[prompt.domain] && domainsMeta[prompt.domain].title ">{{domainsMeta[prompt.domain].title }}</span> |
250 | 250 | <span class="color-black" v-else-if="prompt.domain ">{{prompt.domain }}</span> |
251 | 251 | |
252 | - <!-- <div v-if="transaction.to">{{short(transaction.to)}}</div> --> | |
253 | 252 | <div v-if="transaction.to && typeof transaction.to === 'string'">{{short(transaction.to)}}</div> |
254 | 253 | </div> |
255 | 254 | </div> |
256 | 255 | </div> |
257 | 256 | |
258 | 257 | <div class="transfer-items"> |
259 | - <!--transaction types--> | |
260 | - <!-- TODO: transfer type --> | |
261 | - <!-- <div v-if="prompt.data && prompt.data.type ==='signTransaction'" class="amount-list"> | |
262 | - <div >{{ $t('transfer.types') }}</div> | |
263 | - <div class="color-black font-bold">{{transaction.types}}</div> | |
264 | - </div> --> | |
265 | - | |
266 | 258 | <!--sign message--> |
267 | 259 | <div v-if="prompt.data && prompt.data.type ==='message'" class="amount-list"> |
268 | 260 | <div style="min-width: 78px;" >{{ $t('signMessage.message') }}</div> |
@@ -270,7 +262,6 @@ | ||
270 | 262 | </div> |
271 | 263 | |
272 | 264 | <!--amounts--> |
273 | - <!-- <div v-if="prompt.data && prompt.data.type ==='transfer'" class="amount-list"> --> | |
274 | 265 | <div v-if="prompt.data && (prompt.data.type ==='transfer' || prompt.data.type ==='signTransaction') " class="amount-list"> |
275 | 266 | <div>{{ $t('transfer.amount') }}</div> |
276 | 267 | <div class="color-black font-bold"> |
@@ -288,7 +279,10 @@ | ||
288 | 279 | <!--fee--> |
289 | 280 | <div v-if="transaction.fee" class="amount-list"> |
290 | 281 | <div>{{ $t('transfer.fee') }}</div> |
291 | - <div class="color-black font-bold">{{transaction.fee}}<span class="uint">BTM</span></div> | |
282 | + <div class="color-black font-bold"> | |
283 | + <span>{{transaction.fee}}</span> | |
284 | + <span class="uint">{{ transaction.feeSymbol || 'BTM'}}</span> | |
285 | + </div> | |
292 | 286 | </div> |
293 | 287 | |
294 | 288 | <!-- multi address --> |
@@ -676,6 +670,10 @@ | ||
676 | 670 | } |
677 | 671 | case "signTransaction":{ |
678 | 672 | const param = data[0] || data |
673 | + console.log('param',param) | |
674 | + | |
675 | + this.transaction.feeSymbol = param.feeSymbol | |
676 | + | |
679 | 677 | const _tx = camelize(param) |
680 | 678 | const rawTransaction = _tx.rawTransaction |
681 | 679 |
@@ -685,21 +683,25 @@ | ||
685 | 683 | |
686 | 684 | if(_tx.tx){ |
687 | 685 | tx = _tx.tx |
688 | - this.transaction.fee = tx.fee | |
686 | + this.transaction.fee = param.fee || tx.fee | |
689 | 687 | |
690 | 688 | }else { |
691 | 689 | // 闪兑获取tx逻辑 |
692 | 690 | tx = this.netType === 'vapor'? |
693 | 691 | bytomjslib.vapor.Transaction.decodeRawTransaction(rawTransaction): |
694 | 692 | bytomjslib.bytom.Transaction.decodeRawTransaction(rawTransaction) |
695 | - this.transaction.fee = new BigNumber(tx.fee / 100000000).toString() | |
693 | + this.transaction.fee = new BigNumber((param.fee || tx.fee) / 100000000).toString() | |
696 | 694 | } |
697 | 695 | |
696 | + console.log('tx', tx); | |
697 | + | |
698 | + | |
698 | 699 | if(tx.inputs[0] && tx.inputs[0].assetID){ |
699 | 700 | isFlash = true |
700 | 701 | } |
701 | 702 | this.transaction.input = tx.inputs |
702 | 703 | this.transaction.output = tx.outputs |
704 | + this.transaction.balances = tx.balances | |
703 | 705 | |
704 | 706 | const inputs = tx.inputs.filter(i => i.address === this.address) |
705 | 707 | const outputs = tx.outputs.filter(i => i.address === this.address) |
@@ -766,8 +768,9 @@ | ||
766 | 768 | console.log('promise success') |
767 | 769 | that.transaction.amounts = output |
768 | 770 | |
769 | - that.transaction.amount = output[0].amount | |
770 | - that.unit = output[0].alias | |
771 | + that.transaction.amount = param.amount || output[0].amount | |
772 | + // ofmf or flash | |
773 | + that.unit = tx.balances ? tx.balances[0].asset.symbol : output[0].alias | |
771 | 774 | that.transaction.asset = output[0].asset |
772 | 775 | |
773 | 776 | that.dataReady = true |