|
21 | 21 | <div class="form-group"> |
22 | 22 | <label>Network Fees</label> |
23 | 23 | <div v-for="(fee, asset) in totalFees" :key="asset"> |
24 | | - <strong>~ {{ fee }}</strong> <span class="text-muted">{{ asset }}</span> <span>(${{prettyFiatBalance(fee, fiatRates[asset])}})</span> |
| 24 | + <strong> |
| 25 | + <template v-if="fee">~ {{ fee }}</template> |
| 26 | + <template v-else>Unknown</template> |
| 27 | + </strong> |
| 28 | + <span class="text-muted">{{ asset }}</span> |
| 29 | + <span v-if="fee">(${{prettyFiatBalance(fee, fiatRates[asset])}})</span> |
25 | 30 | </div> |
26 | 31 | </div> |
27 | 32 | </div> |
@@ -75,19 +80,27 @@ export default { |
75 | 80 | return format(add(new Date(), { hours: 6 }), 'h:mm a') |
76 | 81 | }, |
77 | 82 | totalFees () { |
78 | | - const fees = {} |
79 | | -
|
80 | 83 | const assetChain = getChainFromAsset(this.asset) |
81 | | - const initiationFee = getTxFee(this.asset, TX_TYPES.SWAP_INITIATION, this.fee) |
82 | | - fees[assetChain] = initiationFee |
83 | | -
|
84 | 84 | const toAssetChain = getChainFromAsset(this.toAsset) |
85 | | - const claimFee = getTxFee(this.toAsset, TX_TYPES.SWAP_CLAIM, this.toFee) |
86 | | - fees[toAssetChain] = toAssetChain in fees ? fees[toAssetChain].plus(claimFee) : claimFee |
87 | 85 |
|
88 | | - if (this.sendTo) { |
89 | | - const sendFee = getTxFee(this.toAsset, TX_TYPES.SEND, this.toFee) |
90 | | - fees[toAssetChain] = toAssetChain in fees ? fees[toAssetChain].plus(sendFee) : sendFee |
| 86 | + const fees = { |
| 87 | + [assetChain]: null, |
| 88 | + [toAssetChain]: null |
| 89 | + } |
| 90 | +
|
| 91 | + if (this.fee) { |
| 92 | + const initiationFee = getTxFee(this.asset, TX_TYPES.SWAP_INITIATION, this.fee) |
| 93 | + fees[assetChain] = initiationFee |
| 94 | + } |
| 95 | +
|
| 96 | + if (this.toFee) { |
| 97 | + const claimFee = getTxFee(this.toAsset, TX_TYPES.SWAP_CLAIM, this.toFee) |
| 98 | + fees[toAssetChain] = toAssetChain in fees ? fees[toAssetChain].plus(claimFee) : claimFee |
| 99 | +
|
| 100 | + if (this.sendTo) { |
| 101 | + const sendFee = getTxFee(this.toAsset, TX_TYPES.SEND, this.toFee) |
| 102 | + fees[toAssetChain] = toAssetChain in fees ? fees[toAssetChain].plus(sendFee) : sendFee |
| 103 | + } |
91 | 104 | } |
92 | 105 |
|
93 | 106 | return fees |
|
0 commit comments