Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benji/ext issue 29 calculate subtotal in SessionApprove TableInvoice #2787

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Code Improvements] [#2785](https://github.com/cosmos/lunie/pull/2785) Refactors SessionApprove to pass TableInvoice the subtotal fee and amount of the transaction. TableInvoice was refactored in PR #2785 @thebkr7
14 changes: 10 additions & 4 deletions src/components/common/SessionApprove.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
From
<Bech32 :address="senderAddress" />
</div>

<!-- <TableInvoice :fees="fees" /> -->

<TableInvoice :amount="amount" :estimated-fee="fees" />
<TmFormGroup
:error="$v.password.$error && $v.password.$invalid"
class="action-modal-group"
Expand Down Expand Up @@ -89,6 +87,11 @@ function parseTx(signMessage) {
}
}

function parseFee(message) {
thebkr7 marked this conversation as resolved.
Show resolved Hide resolved
const { fee } = JSON.parse(message)
return Number(fee.amount[0].amount)
}

export default {
name: `session-ext-approve-tran`,
components: {
Expand All @@ -110,10 +113,13 @@ export default {
return this.signRequest ? parseTx(this.signRequest.signMessage) : null
},
fees() {
return this.tx ? this.tx.tx.value.fee.amount : null
return this.signRequest ? parseFee(this.signRequest.signMessage) : null
thebkr7 marked this conversation as resolved.
Show resolved Hide resolved
},
senderAddress() {
return this.signRequest ? this.signRequest.senderAddress : null
},
amount() {
return Number(this.tx.tx.value.msg[0].value.amount[0].amount)
}
},
methods: {
Expand Down