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

#780 | Search bar (part 1) - create basic search UI with address support #799

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"nuke": "rm -rf node_modules && yarn cache clean && yarn install"
},
"dependencies": {
"@download/blockies": "^1.0.3",
"@eosrio/hyperion-stream-client": "^0.4.0-beta.5",
"@ethereumjs/tx": "^3.5.0",
"@metamask/detect-provider": "^2.0.0",
Expand Down
29 changes: 12 additions & 17 deletions src/components/AddressOverview.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<script lang="ts" setup>
import { onBeforeMount, ref } from 'vue';
import { useStore } from 'vuex';
import { useI18n } from 'vue-i18n';
import { WEI_PRECISION, formatWei } from 'src/lib/utils';
import { WEI_PRECISION } from 'src/lib/utils';
import { prettyPrintFiatBalance } from 'src/antelope/wallets/utils';
import { useChainStore } from 'src/antelope';
import { SystemBalance } from 'src/lib/balance-utils';

const $store = useStore();
const { t: $t } = useI18n();

const props = defineProps({
balance: {
type: String,
type: Object as () => SystemBalance,
required: true,
},
loadingComplete: {
Expand All @@ -21,17 +22,11 @@ const props = defineProps({

const fiatPrice = $store.getters['chain/tlosPrice'];

const tokenQty = ref('0');
const fiatValue = ref(0);

function getBalanceDisplay(quantity: string) {
return $t('pages.tlos_balance', { balance: quantity });
function getBalanceDisplay(balance: string, symbol: string) {
return $t('pages.tlos_balance', { balance, symbol });
}

onBeforeMount(() => {
tokenQty.value = formatWei(props.balance, WEI_PRECISION, 4);
fiatValue.value = parseFloat(tokenQty.value) * parseFloat(fiatPrice);
});
const systemToken = useChainStore().currentChain.settings.getSystemToken();

</script>

Expand All @@ -50,10 +45,10 @@ onBeforeMount(() => {
height="18"
width="18"
>
{{ getBalanceDisplay(tokenQty) }}
{{ getBalanceDisplay(props.balance.tokenQty, systemToken.symbol) }}
<ValueField
:value="tokenQty"
:symbol="'TLOS'"
:value="props.balance.tokenQty"
:symbol="systemToken.symbol"
:decimals="WEI_PRECISION"
/>
</div>
Expand All @@ -63,9 +58,9 @@ onBeforeMount(() => {
</q-card-section>
<q-card-section v-else>
<div class="c-overview__label">
TLOS {{ $t('pages.value') }}
{{ systemToken.symbol }} {{ $t('pages.value') }}
</div>
<div class="c-overview__balance"> {{ prettyPrintFiatBalance(fiatValue, 'us', false) }} (@ ${{ fiatPrice }}/TLOS)</div>
<div class="c-overview__balance"> {{ prettyPrintFiatBalance(props.balance.fiatValue, 'us', false) }} (@ ${{ fiatPrice }}/{{ systemToken.symbol }})</div>
</q-card-section>
</q-card>
</div>
Expand Down
Loading
Loading