39 word-break: break-all;
63 text-overflow: ellipsis;
75 <div class="warp bg-gray">
76 <section class="header bg-header">
77 <i class="iconfont icon-back" @click="close"></i>
78 <p>{{ $t('transfer.confirmTransaction') }}</p>
81 <section class="content bg-white">
85 <td class="col label">{{ $t('transfer.from') }}</td>
86 <td class="col value">{{currentAccount.alias}}</td>
88 <div class="divider"></div>
90 <td class="col label">Input</td>
91 <td class="col value" v-bind:class="{ hide: !full }" >{{transaction.input}}</td>
94 <td class="col label">Output</td>
95 <td class="col value" v-bind:class="{ hide: !full }" >{{transaction.output}}</td>
97 <tr v-if="transaction.args" class="row">
98 <td class="col label">Args</td>
99 <td class="col value" v-bind:class="{ hide: !full }" >{{transaction.args}}</td>
102 <td colspan="2" class="center-text">
103 <a v-on:click="full = !full" class="view-link">
104 {{ full? $t('transfer.hideAll'): $t('transfer.viewAll') }} >>
109 <div class="divider"></div>
111 <tr v-for="(amountInput, index) in transaction.amounts" :key="index" class="row">
112 <td class="col label">{{index ==0 && $t('transfer.transferAmount') }}</td>
113 <td class="col value">{{amountInput.amount}}<span class="uint uppercase">{{amountInput.alias || amountInput.asset}}</span></td>
117 <td class="col label">{{ $t('transfer.fee') }}</td>
118 <td class="col value">{{transaction.fee}}<span class="uint">BTM</span></td>
124 <section class="content bg-white">
126 <div class="form-item">
127 <label class="form-item-label">{{ $t('transfer.confirmPassword') }}</label>
128 <div class="form-item-content">
129 <input type="password" v-model="password" autofocus>
135 <div class="row" style="margin: 20px;">
136 <div class="btn bg-green" @click="transfer">{{ $t('transfer.confirm') }}</div>
143 import transaction from "@/models/transaction";
144 import getLang from "@/assets/language/sdk";
145 import { LocalStream } from 'extension-streams';
146 import {apis} from '@/utils/BrowserApis';
147 import NotificationService from '../../services/NotificationService'
148 import { mapActions, mapGetters, mapState } from 'vuex'
149 import _ from 'lodash';
150 import account from "@/models/account";
151 import { Number as Num } from "@/utils/Number"
182 NotificationService.close();
184 transfer: function () {
185 let loader = this.$loading.show({
186 // Optional parameters
189 onCancel: this.onCancel
192 if(Array.isArray(this.prompt.data)){
193 Promise.all(this.prompt.data.map( (rawdata) => transaction.signTransaction(this.currentAccount.guid, rawdata, this.password)))
196 this.prompt.responder(result);
199 body: this.$t("transfer.success")
201 NotificationService.close();
206 body: getLang(error.message)
210 transaction.signTransaction(this.currentAccount.guid, this.prompt.data, this.password).then( (result) => {
212 this.prompt.responder(result);
215 body: this.$t("transfer.success")
217 NotificationService.close();
222 body: getLang(error.message)
228 queryAsset: function(assetID){
229 return transaction.asset(assetID)
232 this.prompt = window.data || apis.extension.getBackgroundPage().notification || null;
234 if(this.prompt.data !== undefined){
235 const param = Array.isArray(this.prompt.data)? this.prompt.data[0].tx : this.prompt.data.tx
236 if(param.inputs !== undefined){
237 this.transaction.input = param.inputs
239 if(param.outputs !== undefined){
240 this.transaction.output = param.outputs
242 if(param.fee !== undefined){
243 this.transaction.fee = param.fee
246 const array = param.inputs.filter(action => action.type ==='spend')
249 account.setupNet(`${this.net}${this.netType}`)
253 .map((objs, key) => {
254 return this.queryAsset(key).then(resp =>{
258 'amount':Num.formatNue( _.sumBy(objs, 'amount'), resp.decimals)
264 Promise.all(promise).then(function(output) {
265 that.transaction.amounts = output