Skip to content

Commit 138cc0d

Browse files
authored
Unify pricing calculation in solutions & calculator (#4468)
1 parent 84faacb commit 138cc0d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/playground/src/components/weblet_layout.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ import {
122122
import { useGrid, useProfileManager } from "../stores";
123123
import { loadBalance, updateGrid } from "../utils/grid";
124124
import { normalizeBalance } from "../utils/helpers";
125+
import { normalizePrice } from "../utils/pricing_calculator";
125126
126127
const props = defineProps({
127128
disableAlerts: {
@@ -399,8 +400,10 @@ async function loadCost(profile: { mnemonic: string }) {
399400
certified: props.selectedNode?.certificationType === "Certified",
400401
});
401402
await getIPv1Price(grid!);
402-
usd.value = props.dedicated ? dedicatedPrice : sharedPrice;
403-
tft.value = parseFloat((usd.value / (await grid!.calculator.tftPrice())).toFixed(2));
403+
const basePrice = props.dedicated ? dedicatedPrice : sharedPrice;
404+
usd.value = normalizePrice(basePrice);
405+
const tftPrice = await grid!.calculator.tftPrice();
406+
tft.value = normalizePrice(usd.value / tftPrice);
404407
costLoading.value = false;
405408
}
406409
</script>

0 commit comments

Comments
 (0)