Skip to content

Commit

Permalink
Merge pull request #2785 from luniehq/Benji/Ext-Issue-28-TableInvoice…
Browse files Browse the repository at this point in the history
…-receive-final-amount

Refactors so TableInvoice takes the total fee
  • Loading branch information
faboweb authored Jul 4, 2019
2 parents aed4553 + ced1e23 commit 0be13cc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Code Improvements] [#ext-28](https://github.com/cosmos/lunie/issues/ext-28) Refactors so TableInvoice takes the total fee rather than taking two numbers as props and calculating it there. @thebkr7
9 changes: 4 additions & 5 deletions src/ActionModal/components/ActionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@
type="between"
/>
</TmFormGroup>
<TableInvoice
:amount="Number(amount)"
:gas-estimate="Number(gasEstimate)"
:gas-price="Number(gasPrice)"
/>
<TableInvoice :amount="Number(amount)" :estimated-fee="estimatedFee" />
<TmFormMsg
v-if="$v.invoiceTotal.$invalid"
name="Total"
Expand Down Expand Up @@ -313,6 +309,9 @@ export default {
balanceInAtoms() {
return atoms(this.liquidAtoms)
},
estimatedFee() {
return Number(this.gasPrice) * Number(this.gasEstimate) // already in atoms
},
invoiceTotal() {
return (
Number(this.amount) + Number(this.gasPrice) * Number(this.gasEstimate)
Expand Down
9 changes: 1 addition & 8 deletions src/ActionModal/components/TableInvoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,16 @@ export default {
type: Number,
required: true
},
gasEstimate: {
estimatedFee: {
type: Number,
required: true
},
gasPrice: {
type: Number,
default: 2.5e-8 // 0.025 uatoms
}
},
data: () => ({
info: `Estimated network fees based on simulation.`
}),
computed: {
...mapGetters([`bondDenom`]),
estimatedFee() {
return Number(this.gasPrice) * Number(this.gasEstimate) // already in atoms
},
subTotal() {
return Number(this.amount) // already in atoms
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ describe(`TableInvoice`, () => {
mocks: { $store },
propsData: {
amount: 1,
gasEstimate: 1234567,
gasPrice: 2.5e-8
estimatedFee: 0.00030864
}
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ exports[`ActionModal should show the action modal when user has logged in with e
<tableinvoice-stub
amount="0"
gasestimate="0"
gasprice="2.5e-8"
estimatedfee="0"
/>
<!---->
Expand Down Expand Up @@ -400,8 +399,7 @@ exports[`ActionModal should show the action modal when user has logged in with e
<tableinvoice-stub
amount="0"
gasestimate="0"
gasprice="2.5e-8"
estimatedfee="0"
/>
<!---->
Expand Down Expand Up @@ -744,8 +742,7 @@ exports[`ActionModal should show the action modal when user has logged in with l
<tableinvoice-stub
amount="0"
gasestimate="0"
gasprice="2.5e-8"
estimatedfee="0"
/>
<!---->
Expand Down Expand Up @@ -1015,8 +1012,7 @@ exports[`ActionModal should show the action modal when user has logged in with l
<tableinvoice-stub
amount="0"
gasestimate="0"
gasprice="2.5e-8"
estimatedfee="0"
/>
<!---->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports[`TableInvoice should show the transaction invoice summary 1`] = `
<span>
0.030864
0.000308
STAKE
</span>
Expand All @@ -36,7 +36,7 @@ exports[`TableInvoice should show the transaction invoice summary 1`] = `
</span>
<span>
1.030864 STAKE
1.000308 STAKE
</span>
</li>
</ul>
Expand Down

0 comments on commit 0be13cc

Please sign in to comment.