-
+
+
+
{renderChainOrAddress()}
@@ -70,7 +85,7 @@ export function FinalityProviderItem({ bsnId, bsnName, bsnLogoUrl, address, prov
{onRemove ?
onRemove(bsnId)}
- className="cursor-pointer rounded bg-accent-secondary/20 px-2 py-0.5 text-xs tracking-[0.4px] text-accent-primary"
+ className="ml-[10px] cursor-pointer rounded bg-accent-secondary/20 px-2 py-0.5 text-xs tracking-[0.4px] text-accent-primary"
>
Remove
: null}
diff --git a/packages/babylon-core-ui/src/utils/constants.ts b/packages/babylon-core-ui/src/utils/constants.ts
new file mode 100644
index 00000000..7d13aa7c
--- /dev/null
+++ b/packages/babylon-core-ui/src/utils/constants.ts
@@ -0,0 +1,2 @@
+export const BTC_DECIMAL_PLACES = 8;
+export const BBN_DECIMAL_PLACES = 5;
\ No newline at end of file
diff --git a/packages/babylon-core-ui/src/widgets/sections/AmountSubsection/AmountSubsection.tsx b/packages/babylon-core-ui/src/widgets/sections/AmountSubsection/AmountSubsection.tsx
index fac22c21..bcfe3f17 100644
--- a/packages/babylon-core-ui/src/widgets/sections/AmountSubsection/AmountSubsection.tsx
+++ b/packages/babylon-core-ui/src/widgets/sections/AmountSubsection/AmountSubsection.tsx
@@ -3,6 +3,7 @@ import { SubSection } from "@/components/SubSection";
import { useFormContext, useWatch } from "react-hook-form";
import { calculateTokenValueInCurrency, maxDecimals } from "@/utils/helpers";
+import { BTC_DECIMAL_PLACES } from "@/utils/constants";
interface BalanceDetails {
balance: number | string;
@@ -73,7 +74,7 @@ export const AmountSubsection = ({
onKeyDown={handleKeyDown}
placeholder={placeholder}
autoFocus={autoFocus}
- className="w-2/3 bg-transparent text-right text-lg outline-none"
+ className="w-2/3 bg-transparent text-right text-lg outline-none appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
/>
@@ -83,7 +84,7 @@ export const AmountSubsection = ({
Stakable:{" "}
- {maxDecimals(Number(balanceDetails.balance), balanceDetails.decimals ?? 8)}
+ {maxDecimals(Number(balanceDetails.balance), balanceDetails.decimals ?? BTC_DECIMAL_PLACES)}
{" "}
{balanceDetails.symbol}
diff --git a/packages/babylon-core-ui/src/widgets/sections/FeesSection/BBNFeeAmount.tsx b/packages/babylon-core-ui/src/widgets/sections/FeesSection/BBNFeeAmount.tsx
index d2695e87..b5c90e94 100644
--- a/packages/babylon-core-ui/src/widgets/sections/FeesSection/BBNFeeAmount.tsx
+++ b/packages/babylon-core-ui/src/widgets/sections/FeesSection/BBNFeeAmount.tsx
@@ -1,4 +1,5 @@
import { FeeItem } from "./FeeItem";
+import { BBN_DECIMAL_PLACES } from "../../../utils/constants";
interface BBNFeeAmountProps {
amount: number | string;
@@ -9,7 +10,7 @@ interface BBNFeeAmountProps {
decimals?: number;
}
-export function BBNFeeAmount({ amount, coinSymbol, hint, title, className, decimals = 5 }: BBNFeeAmountProps) {
+export function BBNFeeAmount({ amount, coinSymbol, hint, title, className, decimals = BBN_DECIMAL_PLACES }: BBNFeeAmountProps) {
const formattedAmount = typeof amount === "number" ? amount.toFixed(decimals) : amount;
return (
diff --git a/packages/babylon-core-ui/src/widgets/sections/FeesSection/BTCFeeAmount.tsx b/packages/babylon-core-ui/src/widgets/sections/FeesSection/BTCFeeAmount.tsx
index bee0a016..221fbe84 100644
--- a/packages/babylon-core-ui/src/widgets/sections/FeesSection/BTCFeeAmount.tsx
+++ b/packages/babylon-core-ui/src/widgets/sections/FeesSection/BTCFeeAmount.tsx
@@ -1,4 +1,5 @@
import { FeeItem } from "./FeeItem";
+import { BTC_DECIMAL_PLACES } from "../../../utils/constants";
interface BTCFeeAmountProps {
amount: number | string;
@@ -9,16 +10,19 @@ interface BTCFeeAmountProps {
decimals?: number;
}
-export function BTCFeeAmount({ amount, coinSymbol, hint, title, className, decimals = 8 }: BTCFeeAmountProps) {
- const formattedAmount =
- typeof amount === "number"
- ? amount === 0
- ? "0"
- : (() => {
- const str = amount.toFixed(decimals);
- return str.replace(/0+$/, "").replace(/\.$/, "");
- })()
- : amount;
+export function BTCFeeAmount({ amount, coinSymbol, hint, title, className, decimals = BTC_DECIMAL_PLACES }: BTCFeeAmountProps) {
+ let formattedAmount: string;
+
+ if (typeof amount === "number") {
+ if (amount === 0) {
+ formattedAmount = "0";
+ } else {
+ const str = amount.toFixed(decimals);
+ formattedAmount = str.replace(/0+$/, "").replace(/\.$/, "");
+ }
+ } else {
+ formattedAmount = amount;
+ }
return (
diff --git a/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeeItem.tsx b/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeeItem.tsx
index ef763f9c..b1b48681 100644
--- a/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeeItem.tsx
+++ b/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeeItem.tsx
@@ -21,11 +21,7 @@ export function FeeItem({ title, children, className, hint }: FeeItemProps) {
{title}
- {!hint ? (
-
- {children}
-
- ) : (
+ {hint ? (
{children}
@@ -34,6 +30,10 @@ export function FeeItem({ title, children, className, hint }: FeeItemProps) {
{hint}
+ ) : (
+
+ {children}
+
)}
);
diff --git a/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeesSection.tsx b/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeesSection.tsx
index 222106e7..80045e34 100644
--- a/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeesSection.tsx
+++ b/packages/babylon-core-ui/src/widgets/sections/FeesSection/FeesSection.tsx
@@ -30,7 +30,6 @@ export function FeesSection({
feeAmountHint,
total,
totalHint,
-
bbnFeeAmount,
bbnCoinSymbol,
bbnFeeAmountHint,
diff --git a/packages/babylon-core-ui/src/widgets/sections/FeesSection/Total.tsx b/packages/babylon-core-ui/src/widgets/sections/FeesSection/Total.tsx
index 8e6c591d..adf0f030 100644
--- a/packages/babylon-core-ui/src/widgets/sections/FeesSection/Total.tsx
+++ b/packages/babylon-core-ui/src/widgets/sections/FeesSection/Total.tsx
@@ -1,5 +1,6 @@
import { Text } from "../../../components/Text";
import { twMerge } from "tailwind-merge";
+import { BTC_DECIMAL_PLACES } from "../../../utils/constants";
interface TotalProps {
total: number | string;
@@ -10,16 +11,18 @@ interface TotalProps {
decimals?: number;
}
-export function Total({ total, coinSymbol, hint, title = "Total", className, decimals = 8 }: TotalProps) {
- const formattedTotal =
- typeof total === "number"
- ? total === 0
- ? "0"
- : (() => {
- const str = total.toFixed(decimals);
- return str.replace(/0+$/, "").replace(/\.$/, "");
- })()
- : total;
+export function Total({ total, coinSymbol, hint, title = "Total", className, decimals = BTC_DECIMAL_PLACES }: TotalProps) {
+ let formattedTotal;
+ if (typeof total === "number") {
+ if (total === 0) {
+ formattedTotal = "0";
+ } else {
+ const str = total.toFixed(decimals);
+ formattedTotal = str.replace(/0+$/, "").replace(/\.$/, "");
+ }
+ } else {
+ formattedTotal = total;
+ }
return (