Skip to content

#1749 Fixing transfer and teleport #1750

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

Merged
merged 6 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 5 additions & 5 deletions pages/teleport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="info">
<p class="title is-size-3">Teleport {{ unit }}</p>
<span class="info--currentPrice" title="Current price"
>${{ $store.getters.getCurrentKSMValue }}
>${{ $store.getters['fiat/getCurrentKSMValue'] }}
</span>
</div>

Expand Down Expand Up @@ -188,15 +188,15 @@ export default class Transfer extends mixins(
}

protected created() {
this.$store.dispatch('fetchFiatPrice')
this.$store.dispatch('fiat/fetchFiatPrice')
this.checkQueryParams()
}

protected onAmountFieldChange() {
/* calculating usd value on the basis of price entered */
if (this.price) {
this.usdValue = calculateUsdFromKsm(
this.$store.getters.getCurrentKSMValue,
this.$store.getters['fiat/getCurrentKSMValue'],
this.price
)
} else {
Expand All @@ -208,7 +208,7 @@ export default class Transfer extends mixins(
/* calculating price value on the basis of usd entered */
if (this.usdValue) {
this.price = calculateKsmFromUsd(
this.$store.getters.getCurrentKSMValue,
this.$store.getters['fiat/getCurrentKSMValue'],
this.usdValue
)
} else {
Expand Down Expand Up @@ -236,7 +236,7 @@ export default class Transfer extends mixins(
this.usdValue = Number(query.usdamount)
// getting ksm value from the usd value
this.price = calculateKsmFromUsd(
this.$store.getters.getCurrentKSMValue,
this.$store.getters['fiat/getCurrentKSMValue'],
this.usdValue
)
}
Expand Down
15 changes: 7 additions & 8 deletions pages/transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<span
class="info--currentPrice"
title="Current price"
>${{ $store.getters.getCurrentKSMValue }} </span>
>${{ $store.getters['fiat/getCurrentKSMValue'] }} </span>
</div>

<b-field>
Expand Down Expand Up @@ -198,14 +198,14 @@ export default class Transfer extends mixins(
}

protected created() {
this.$store.dispatch('fetchFiatPrice')
this.$store.dispatch('fiat/fetchFiatPrice')
this.checkQueryParams()
}

protected onAmountFieldChange() {
/* calculating usd value on the basis of price entered */
if (this.price) {
this.usdValue = calculateUsdFromKsm(this.$store.getters.getCurrentKSMValue, this.price)
this.usdValue = calculateUsdFromKsm(this.$store.getters['fiat/getCurrentKSMValue'], this.price)
} else {
this.usdValue = 0
}
Expand All @@ -214,15 +214,14 @@ export default class Transfer extends mixins(
protected onUSDFieldChange() {
/* calculating price value on the basis of usd entered */
if (this.usdValue) {
this.price = calculateKsmFromUsd(this.$store.getters.getCurrentKSMValue, this.usdValue)
this.price = calculateKsmFromUsd(this.$store.getters['fiat/getCurrentKSMValue'], this.usdValue)
} else {
this.price = 0
}
}

protected checkQueryParams() {
const { query } = this.$route

if (query.target) {
const hasAddress = isAddress(query.target as string)
if (hasAddress) {
Expand All @@ -239,7 +238,7 @@ export default class Transfer extends mixins(
if (query.usdamount) {
this.usdValue = Number(query.usdamount)
// getting ksm value from the usd value
this.price = calculateKsmFromUsd(this.$store.getters.getCurrentKSMValue, this.usdValue)
this.price = calculateKsmFromUsd(this.$store.getters['fiat/getCurrentKSMValue'], this.usdValue)
}
}

Expand Down Expand Up @@ -347,7 +346,7 @@ export default class Transfer extends mixins(
this.$router.replace({
path: String(this.$route.path),
query: queryValue,
})
}).catch((e)=>{console.warn('Navigation error', e)})
}

@Watch('usdValue')
Expand All @@ -362,7 +361,7 @@ export default class Transfer extends mixins(
this.$router.replace({
path: String(this.$route.path),
query: queryValue,
})
}).catch((e)=>{console.warn('Navigation error', e)})
}

async loadBalance() {
Expand Down