limit price display fix
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
import {usePrefStore, useStore} from "@/store/store";
|
||||
import {computed} from "vue";
|
||||
import {getToken} from "@/blockchain/token.js";
|
||||
import {flipInversionPreference, inversionPreference, pairPrice} from "@/misc.js";
|
||||
import {flipInversionPreference, inversionPreference} from "@/misc.js";
|
||||
|
||||
const props = defineProps(['value', 'base', 'quote', 'showBtn'])
|
||||
|
||||
@@ -35,6 +35,23 @@ const pair = computed(() => {
|
||||
})
|
||||
|
||||
|
||||
function pairPrice(chainId, baseToken, quoteToken, price) {
|
||||
if (price === null || price === undefined)
|
||||
return null
|
||||
const decimals = baseToken.d - quoteToken.d
|
||||
// console.log('pairPrice', chainId, baseToken, quoteToken, price, decimals)
|
||||
// console.log('adjusted pairPrice', price)
|
||||
if (decimals >= 0)
|
||||
price /= 10 ** decimals
|
||||
else
|
||||
price *= 10 ** -decimals
|
||||
if (inversionPreference(chainId, baseToken, quoteToken))
|
||||
price = 1 / price
|
||||
// console.log('inverted?', price)
|
||||
return price
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user