Skip to content

Commit dd6f3a2

Browse files
committed
Implement new endpoints for tx fetching
1 parent 08cc420 commit dd6f3a2

File tree

16 files changed

+2390
-2327
lines changed

16 files changed

+2390
-2327
lines changed

app/src/components/private-layout/topbar/no-wallet-actions.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}"
1515
>
1616

17-
≈ ${{total_usd}} (${{ token_price }}/{{ globalData.kichain.token }})
17+
≈ ${{total_usd}} (${{token_price}}/{{ globalData.kichain.token }})
1818
</p>
1919

2020
</div>
@@ -86,7 +86,7 @@ export default {
8686
...mapState({
8787
loadingWallet: state => state.wallets.loading,
8888
wallets: state => state.wallets.list,
89-
token_price: state => state.price,
89+
token_price_raw: state => state.price,
9090
}),
9191
},
9292
data() {
@@ -98,7 +98,6 @@ export default {
9898
token: '',
9999
total:0,
100100
total_usd:0,
101-
// token_price:0.06
102101
};
103102
},
104103
mounted() {
@@ -230,8 +229,9 @@ export default {
230229
}
231230
}
232231
}
233-
this.total_usd = tokenUtil.formatShort(total * this.token_price);
232+
this.total_usd = tokenUtil.formatShort(total * this.token_price_raw);
234233
this.total = tokenUtil.formatShort(total)
234+
this.token_price = tokenUtil.formatPrice(this.token_price_raw);
235235
}
236236
},
237237
};
Lines changed: 157 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,157 @@
1-
<template>
2-
<div class="d-flex w-100 h-100 justify-content-between align-items-center">
3-
<div class="d-flex flex-row">
4-
<div class="d-flex justify-content-center align-items-center">
5-
<a v-b-modal="'info-modal'" class="d-flex flex-column align-items-center justify-content-center">
6-
<b-avatar badge-offset="-2px" class="d-flex justify-content-center align-items-center" size="3.5rem" variant="light" :style="{
7-
color: 'white',
8-
backgroundImage: currentWallet.bgImageStyle,
9-
}" :text="currentWallet.account[0].toUpperCase()" >
10-
<template #badge><div style="color:white;font-weight:400;font-size:10px">+</div></template>
11-
</b-avatar>
12-
</a>
13-
</div>
14-
<div class="d-flex justify-content-center flex-column ml-3">
15-
<h5 >{{ currentWallet.account }}</h5>
16-
<h6 class="mt-1" style=" display: inline; font-weight:400; cursor: pointer;">
17-
<span id="popover-target-copy" v-clipboard:copy="currentWallet.address" @click="copy_text='Copied'"> {{ currentWallet.address }} </span>
18-
<b-popover target="popover-target-copy" triggers="hover" placement="right" @hidden="onHidden">
19-
{{copy_text}}
20-
</b-popover>
21-
</h6>
22-
<h4 class="mt-1">
23-
<span :style="{ fontSize:'1.4rem', fontWeight: '800' }">{{ total_available }} </span>
24-
<span :style="{ fontWeight: '400' }">{{ globalData.kichain.token }}</span>
25-
<span :style="{
26-
color: 'var(--secondary)',
27-
fontSize: '0.9rem',
28-
fontWeight: '600'
29-
}">
30-
31-
≈ ${{total_usd}} (${{ token_price }}/{{ globalData.kichain.token }})
32-
</span>
33-
</h4>
34-
</div>
35-
</div>
36-
37-
38-
<div class="d-flex flex-row">
39-
<div class="pr-4">
40-
<a role="button" data-toggle="modal" data-target="#add-form-topbar" class="d-flex flex-column align-items-center justify-content-center" @click="handleRefresh">
41-
<unicon name="sync" :class="[refreshing ? 'rotating' : '']" :fill="colors.secondary" />
42-
<span class="mt-2" :style="{ fontWeight: '500' }">Refresh</span>
43-
</a>
44-
</div>
45-
<div class="border-left pl-4">
46-
<a v-b-modal="'transfer-modal'" class="d-flex flex-column align-items-center justify-content-center">
47-
<unicon name="exchange" :fill="colors.secondary" />
48-
<span class="mt-2" :style="{ fontWeight: '500' }">Transfer</span>
49-
</a>
50-
</div>
51-
</div>
52-
<TransferModal />
53-
<InfoModal />
54-
<ErrorModal />
55-
</div>
56-
</template>
57-
58-
<script>
59-
import TransferModal from '@cmp/transfer/modals/index';
60-
import InfoModal from '@cmp/info/modals/index';
61-
import ErrorModal from '@cmp/error/modals/index';
62-
import {
63-
BAvatar,
64-
BTooltip,
65-
BPopover
66-
} from 'bootstrap-vue';
67-
import {
68-
mapGetters,
69-
mapState,
70-
mapActions
71-
} from 'vuex';
72-
import {
73-
GET_CURRENT_WALLET_BALANCES_AMOUNT,
74-
GET_CURRENT_WALLET_BALANCES_DENOM,
75-
HYDRATE_CURRENT_WALLET,
76-
FETCH_WALLET_REWARDS
77-
} from '@store/wallets';
78-
import {
79-
FETCH_VALIDATORS_LIST
80-
} from '@store/validators';
81-
import { tokenUtil } from '@static/js/token';
82-
import * as numeral from 'numeral';
83-
84-
export default {
85-
components: {
86-
TransferModal,
87-
BAvatar,
88-
InfoModal,
89-
ErrorModal,
90-
BPopover
91-
},
92-
data() {
93-
return {
94-
tooltipShow: false,
95-
refreshing: false,
96-
invalidWallet: false,
97-
total_usd:0,
98-
total_available:0,
99-
show_add: false,
100-
copy_text: "Click to copy"
101-
};
102-
},
103-
computed: {
104-
...mapGetters({
105-
currentWalletBalancesAmount: GET_CURRENT_WALLET_BALANCES_AMOUNT,
106-
currentWalletBalancesDenom: GET_CURRENT_WALLET_BALANCES_DENOM,
107-
}),
108-
...mapState({
109-
currentWallet: state => state.wallets.current,
110-
token_price: state => state.price,
111-
}),
112-
},
113-
mounted() {
114-
this.invalidWallet = this.currentWallet.invalid
115-
116-
if (this.invalidWallet) {
117-
this.$bvModal.show("error-modal")
118-
}
119-
this.total_available = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6));
120-
this.total_usd = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6) * this.token_price);
121-
},
122-
methods: {
123-
...mapActions({
124-
hydrateCurrentWallet: HYDRATE_CURRENT_WALLET,
125-
fetchAllValidators: FETCH_VALIDATORS_LIST,
126-
fetchWalletRewards: FETCH_WALLET_REWARDS,
127-
}),
128-
async handleRefresh() {
129-
this.refreshing = true;
130-
await this.hydrateCurrentWallet(this.currentWallet);
131-
await this.fetchAllValidators();
132-
await this.fetchWalletRewards();
133-
this.total_available = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6));
134-
this.total_usd = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6) * this.token_price);
135-
this.refreshing = false;
136-
},
137-
toggleCopiedTooltip() {},
138-
onHidden(){
139-
this.copy_text= "Click to copy"
140-
}
141-
},
142-
};
143-
</script>
144-
145-
<style scoped>
146-
* {
147-
color: var(--textColor);
148-
}
149-
.copy {
150-
opacity: 0.2
151-
}
152-
153-
.copy:hover {
154-
opacity: 0.5
155-
}
156-
</style>
1+
<template>
2+
<div class="d-flex w-100 h-100 justify-content-between align-items-center">
3+
<div class="d-flex flex-row">
4+
<div class="d-flex justify-content-center align-items-center">
5+
<a v-b-modal="'info-modal'" class="d-flex flex-column align-items-center justify-content-center">
6+
<b-avatar badge-offset="-2px" class="d-flex justify-content-center align-items-center" size="3.5rem" variant="light" :style="{
7+
color: 'white',
8+
backgroundImage: currentWallet.bgImageStyle,
9+
}" :text="currentWallet.account[0].toUpperCase()" >
10+
<template #badge><div style="color:white;font-weight:400;font-size:10px">+</div></template>
11+
</b-avatar>
12+
</a>
13+
</div>
14+
<div class="d-flex justify-content-center flex-column ml-3">
15+
<h5 >{{ currentWallet.account }}</h5>
16+
<h6 class="mt-1" style=" display: inline; font-weight:400; cursor: pointer;">
17+
<span id="popover-target-copy" v-clipboard:copy="currentWallet.address" @click="copy_text='Copied'"> {{ currentWallet.address }} </span>
18+
<b-popover target="popover-target-copy" triggers="hover" placement="right" @hidden="onHidden">
19+
{{copy_text}}
20+
</b-popover>
21+
</h6>
22+
<h4 class="mt-1">
23+
<span :style="{ fontSize:'1.4rem', fontWeight: '800' }">{{ total_available }} </span>
24+
<span :style="{ fontWeight: '400' }">{{ globalData.kichain.token }}</span>
25+
<span :style="{
26+
color: 'var(--secondary)',
27+
fontSize: '0.9rem',
28+
fontWeight: '600'
29+
}">
30+
31+
≈ ${{total_usd}} (${{ token_price }}/{{ globalData.kichain.token }})
32+
</span>
33+
</h4>
34+
</div>
35+
</div>
36+
37+
38+
<div class="d-flex flex-row">
39+
<div class="pr-4">
40+
<a role="button" data-toggle="modal" data-target="#add-form-topbar" class="d-flex flex-column align-items-center justify-content-center" @click="handleRefresh">
41+
<unicon name="sync" :class="[refreshing ? 'rotating' : '']" :fill="colors.secondary" />
42+
<span class="mt-2" :style="{ fontWeight: '500' }">Refresh</span>
43+
</a>
44+
</div>
45+
<div class="border-left pl-4">
46+
<a v-b-modal="'transfer-modal'" class="d-flex flex-column align-items-center justify-content-center">
47+
<unicon name="exchange" :fill="colors.secondary" />
48+
<span class="mt-2" :style="{ fontWeight: '500' }">Transfer</span>
49+
</a>
50+
</div>
51+
</div>
52+
<TransferModal />
53+
<InfoModal />
54+
<ErrorModal />
55+
</div>
56+
</template>
57+
58+
<script>
59+
import TransferModal from '@cmp/transfer/modals/index';
60+
import InfoModal from '@cmp/info/modals/index';
61+
import ErrorModal from '@cmp/error/modals/index';
62+
import {
63+
BAvatar,
64+
BTooltip,
65+
BPopover
66+
} from 'bootstrap-vue';
67+
import {
68+
mapGetters,
69+
mapState,
70+
mapActions
71+
} from 'vuex';
72+
import {
73+
GET_CURRENT_WALLET_BALANCES_AMOUNT,
74+
GET_CURRENT_WALLET_BALANCES_DENOM,
75+
HYDRATE_CURRENT_WALLET,
76+
FETCH_WALLET_REWARDS
77+
} from '@store/wallets';
78+
import {
79+
FETCH_VALIDATORS_LIST
80+
} from '@store/validators';
81+
import { tokenUtil } from '@static/js/token';
82+
import * as numeral from 'numeral';
83+
84+
export default {
85+
components: {
86+
TransferModal,
87+
BAvatar,
88+
InfoModal,
89+
ErrorModal,
90+
BPopover
91+
},
92+
data() {
93+
return {
94+
tooltipShow: false,
95+
refreshing: false,
96+
invalidWallet: false,
97+
total_usd:0,
98+
total_available:0,
99+
show_add: false,
100+
copy_text: "Click to copy"
101+
};
102+
},
103+
computed: {
104+
...mapGetters({
105+
currentWalletBalancesAmount: GET_CURRENT_WALLET_BALANCES_AMOUNT,
106+
currentWalletBalancesDenom: GET_CURRENT_WALLET_BALANCES_DENOM,
107+
}),
108+
...mapState({
109+
currentWallet: state => state.wallets.current,
110+
token_price_raw: state => state.price,
111+
}),
112+
},
113+
mounted() {
114+
this.invalidWallet = this.currentWallet.invalid
115+
116+
if (this.invalidWallet) {
117+
this.$bvModal.show("error-modal")
118+
}
119+
this.total_available = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6));
120+
this.total_usd = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6) * this.token_price_raw);
121+
this.token_price = tokenUtil.formatPrice(this.token_price_raw);
122+
},
123+
methods: {
124+
...mapActions({
125+
hydrateCurrentWallet: HYDRATE_CURRENT_WALLET,
126+
fetchAllValidators: FETCH_VALIDATORS_LIST,
127+
fetchWalletRewards: FETCH_WALLET_REWARDS,
128+
}),
129+
async handleRefresh() {
130+
this.refreshing = true;
131+
await this.hydrateCurrentWallet(this.currentWallet);
132+
await this.fetchAllValidators();
133+
await this.fetchWalletRewards();
134+
this.total_available = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6));
135+
this.total_usd = tokenUtil.formatShort(numeral(this.currentWalletBalancesAmount.available).value() * Math.pow(10,6) * this.token_price_raw);
136+
this.refreshing = false;
137+
},
138+
toggleCopiedTooltip() {},
139+
onHidden(){
140+
this.copy_text= "Click to copy"
141+
}
142+
},
143+
};
144+
</script>
145+
146+
<style scoped>
147+
* {
148+
color: var(--textColor);
149+
}
150+
.copy {
151+
opacity: 0.2
152+
}
153+
154+
.copy:hover {
155+
opacity: 0.5
156+
}
157+
</style>

0 commit comments

Comments
 (0)