diff --git a/src/frontend/src/common.tsx b/src/frontend/src/common.tsx index 0022d53..b51cfe1 100644 --- a/src/frontend/src/common.tsx +++ b/src/frontend/src/common.tsx @@ -4,7 +4,11 @@ import { Order } from "./types"; export const Error = ({ text }: { text: string }) =>

Error: {text}

; export const paymentTokenId = () => window.data.payment_token_id.toString(); -export const paymentTokenData = () => window.tokenData[paymentTokenId()]; +export const paymentTokenData = () => { + const data = window.tokenData[paymentTokenId()]; + if (data.symbol == "ckUSDC" || data.symbol == "ckUSDT") data.symbol = "USD"; + return data; +}; export const mainnetMode = process.env.NODE_ENV == "production"; diff --git a/src/frontend/src/landing.tsx b/src/frontend/src/landing.tsx index ee0fce2..a1bceb2 100644 --- a/src/frontend/src/landing.tsx +++ b/src/frontend/src/landing.tsx @@ -91,7 +91,8 @@ export const Landing = ({}) => {
24H VOLUME - ${token(volume_day, paymentToken.decimals, false)}{" "} + {token(volume_day, paymentToken.decimals, false)}{" "} + {paymentToken.symbol}
diff --git a/src/frontend/src/order_book.tsx b/src/frontend/src/order_book.tsx index 1f14f8f..8a5ccee 100644 --- a/src/frontend/src/order_book.tsx +++ b/src/frontend/src/order_book.tsx @@ -47,7 +47,7 @@ export const OrderBook = ({ sell: sellOrders.filter(filter), }; - const tokenData = window.tokenData[tokenId]; + const { symbol, decimals } = window.tokenData[tokenId]; const paymentToken = paymentTokenData(); const userOrdersList = (orders: Order[], type: OrderType) => @@ -64,8 +64,7 @@ export const OrderBook = ({ {type.toString().toUpperCase()} - {token(order.amount, tokenData.decimals)}{" "} - {tokenData.symbol} + {token(order.amount, decimals)} {symbol} acc + order.amount, BigInt(0), ), - tokenData.decimals, + decimals, ).toLocaleString()}{" "} - {tokenData.symbol} + {symbol} )} @@ -196,10 +195,7 @@ export const OrderBook = ({ : "#cc0000", }} > - {token( - order.amount, - window.tokenData[tokenId].decimals, - )} + {token(order.amount, decimals)}
), diff --git a/src/frontend/src/token.tsx b/src/frontend/src/token.tsx index ff30bbb..833fcb0 100644 --- a/src/frontend/src/token.tsx +++ b/src/frontend/src/token.tsx @@ -22,19 +22,18 @@ export const Token = ({ tokenId }: { tokenId: string }) => { if (tokenId) loadData(tokenId); }, [tokenId]); - const metadata = window.tokenData[tokenId]; + const tokenData = window.tokenData[tokenId]; - if (!metadata) { + if (!tokenData) { return ; } - const { symbol, logo } = metadata; + const { symbol, decimals, logo } = tokenData; const callback = () => { window.refreshBackendData(); setHeartbeat(new Date()); loadData(tokenId); }; - const tokenData = window.tokenData[tokenId]; return ( <>
@@ -117,12 +116,9 @@ export const Token = ({ tokenId }: { tokenId: string }) => { - {token( - order.amount, - tokenData.decimals, - )} + {token(order.amount, decimals)} {" "} - {tokenData.symbol} + {symbol}