orderspec refactor for server and web

This commit is contained in:
Tim Olson
2023-12-07 18:37:11 -04:00
parent 545583586c
commit 83619ea248
12 changed files with 306 additions and 110 deletions

View File

@@ -0,0 +1,27 @@
<template>
<span>{{fmtAmount}} {{ token.symbol || '' }}</span>
</template>
<script setup>
import {useStore} from "@/store/store";
import {getToken} from "@/blockchain/token.js";
import {FixedNumber} from "ethers";
import {computed, ref} from "vue";
const s = useStore()
const props = defineProps(['addr', 'amount'])
const token = await getToken(props.addr)
const fmtAmount = computed(() => {
if( props.amount === null || props.amount === undefined )
return ''
return FixedNumber.fromValue(props.amount, token.decimals, {
width: 256,
decimals: token.decimals
}).toUnsafeFloat().toPrecision(5) // todo precision
})
</script>
<style scoped lang="scss">
@use "src/styles/vars" as *;
</style>