ordershape fixes

This commit is contained in:
tim
2024-09-23 02:44:57 -04:00
parent b82171dfb0
commit bc443172a1
9 changed files with 113 additions and 96 deletions

View File

@@ -1,4 +1,4 @@
import {routeInverted, timestamp, uuid} from "@/misc.js";
import {timestamp, uuid} from "@/misc.js";
import {MAX_FRACTION, newTranche} from "@/blockchain/orderlib.js";
import {useOrderStore, useStore} from "@/store/store.js";
import {encodeIEE754} from "@/common.js";
@@ -251,25 +251,6 @@ export function weightColors(weights, color) {
return adj.map((a) => a.string())
}
export function allocationText(weight, amount, symbol) {
const hasAmount = amount!==null && amount!==undefined && amount > 0
if (hasAmount)
amount = Number(amount)
const hasWeight = weight!==null && weight!==undefined
if (hasWeight)
weight = Number(weight)
let text = ''
if (hasWeight)
text += `${(weight * 100).toFixed(1)}%`
const hasSymbol = symbol!==null && symbol!==undefined
if (hasAmount && hasSymbol) {
if (hasWeight)
text += ' = '
text += `${amount.toPrecision(3).toLocaleString('fullwide')} ${symbol}`
}
return text
}
export function deleteBuilder(order, builder) {
order.builders = order.builders.filter((b) => b !== builder)
}