diff --git a/components/common/Footer/index.tsx b/components/common/Footer/index.tsx index 1b9581f..170748d 100644 --- a/components/common/Footer/index.tsx +++ b/components/common/Footer/index.tsx @@ -72,7 +72,7 @@ function Footer() { - Copyright © 2023 Rango Exchange. All rights reserved. + Copyright © 2024 Rango Exchange. All rights reserved. ); diff --git a/components/common/SearchBox/SearchInput.tsx b/components/common/SearchBox/SearchInput.tsx index 9d2f447..5a75a0a 100644 --- a/components/common/SearchBox/SearchInput.tsx +++ b/components/common/SearchBox/SearchInput.tsx @@ -26,7 +26,7 @@ function SearchInput() { setQuery(e.target.value)} /> diff --git a/components/common/Table/Table.helper.ts b/components/common/Table/Table.helper.ts index 3444c6a..889e756 100644 --- a/components/common/Table/Table.helper.ts +++ b/components/common/Table/Table.helper.ts @@ -12,13 +12,13 @@ export const columns: ColumnType[] = [ }, { id: 2, - title: 'Source Transaction', + title: 'Source Token', tokenType: 'source', component: TokenCell, }, { id: 3, - title: 'Destination Transaction', + title: 'Destination Token', tokenType: 'destination', component: TokenCell, }, diff --git a/components/common/Table/cells/StatusCell.tsx b/components/common/Table/cells/StatusCell.tsx index 372dfde..c29940b 100644 --- a/components/common/Table/cells/StatusCell.tsx +++ b/components/common/Table/cells/StatusCell.tsx @@ -1,6 +1,7 @@ import { StepsIcon } from 'components/icons'; import { CellProps } from '../Table.type'; import IconStatus from 'components/common/IconStatus'; +import Tooltip from 'components/common/Tooltip'; function StatusCell(props: CellProps) { const { swapItem, column } = props; @@ -9,6 +10,12 @@ function StatusCell(props: CellProps) { (item) => item.status === 'success', ).length; + const currentStep = + stepsSummary.find((step) => step.status === 'running') || + stepsSummary[stepsSummary.length - 1]; + + const swapper = currentStep?.swapper; + return (
@@ -21,6 +28,17 @@ function StatusCell(props: CellProps) {
{`${successStep}/${stepsSummary.length}`} +    + {swapper && ( + + {swapper?.swapperTitle} + + )}
)}
diff --git a/components/detail/SwapSteps/SwapStepChainAmount.tsx b/components/detail/SwapSteps/SwapStepChainAmount.tsx index 1a86ed0..596786a 100644 --- a/components/detail/SwapSteps/SwapStepChainAmount.tsx +++ b/components/detail/SwapSteps/SwapStepChainAmount.tsx @@ -3,19 +3,22 @@ import React from 'react'; import { SwapStepChainLogoProps } from './SwapSteps.type'; function SwapStepChainAmount(props: SwapStepChainLogoProps) { - const { token, firstStep } = props; - const { symbol, name, realAmount, expectedAmount } = token; + const { token, refundedToken, firstStep } = props; + const resultToken = refundedToken ? refundedToken : token; + return ( <> - {firstStep && `${realAmount.toFixed(2)} ${symbol}`} + {firstStep && `${token.realAmount.toFixed(2)} ${token.symbol}`} {!firstStep && ( <> - {isNaN(realAmount) - ? `Est. ~${expectedAmount.toFixed(2)} ${symbol || name}` - : `${realAmount.toFixed( - 2, - )} ${symbol} (Est. ~${expectedAmount.toFixed(2)} ${ - symbol || name + {isNaN(token.realAmount) + ? `Est. ~${token.expectedAmount.toFixed(2)} ${ + token.symbol || token.name + }` + : `${resultToken.realAmount.toFixed(2)} ${ + resultToken.symbol + } (Est. ~${token.expectedAmount.toFixed(2)} ${ + token.symbol || token.name })`} )} diff --git a/components/detail/SwapSteps/SwapStepItem.tsx b/components/detail/SwapSteps/SwapStepItem.tsx index 99a3c21..6b36e44 100644 --- a/components/detail/SwapSteps/SwapStepItem.tsx +++ b/components/detail/SwapSteps/SwapStepItem.tsx @@ -10,7 +10,7 @@ import SwapStepSwapper from './SwapStepSwapper'; function SwapStepItem(props: SwapStepItemProps) { const { step, firstStep, lastStep } = props; - const { from, to, status, explorerUrls } = step; + const { from, to, status, explorerUrls, outputToken } = step; const [isOpen, setIsOpen] = useState(false); const borderColor = BorderColor[status]; @@ -44,7 +44,7 @@ function SwapStepItem(props: SwapStepItemProps) {
- +
@@ -56,7 +56,7 @@ function SwapStepItem(props: SwapStepItemProps) { - + diff --git a/components/detail/SwapSteps/SwapStepValue.tsx b/components/detail/SwapSteps/SwapStepValue.tsx index c7e655e..152f9de 100644 --- a/components/detail/SwapSteps/SwapStepValue.tsx +++ b/components/detail/SwapSteps/SwapStepValue.tsx @@ -13,16 +13,21 @@ function SwapStepValue(props: SwapStepItemValueProps) { estimatedTimeInSeconds, executionTimeInSeconds, startTime, + outputToken, } = step; + const resultToken = outputToken ? outputToken : to; + return (
{column.title === 'Output Amount' && - (isNaN(to?.realAmount) ? ( + (isNaN(resultToken?.realAmount) ? ( {`Est. ~${to.expectedAmount} ${to?.symbol}`} ) : ( <> - {`${to.realAmount} ${to?.symbol}`} + + {`${resultToken.realAmount} ${resultToken?.symbol}`} + {`(Est. ~${to.expectedAmount} ${to?.symbol})`} ))} diff --git a/components/detail/SwapSteps/SwapSteps.type.ts b/components/detail/SwapSteps/SwapSteps.type.ts index 9afdf3b..b1d552f 100644 --- a/components/detail/SwapSteps/SwapSteps.type.ts +++ b/components/detail/SwapSteps/SwapSteps.type.ts @@ -12,6 +12,7 @@ export interface SwapStepItemProps { export interface SwapStepChainLogoProps { token: AssetType; + refundedToken?: AssetType; firstStep?: boolean; } diff --git a/components/home/ChartBox/Chart.tsx b/components/home/ChartBox/Chart.tsx index 8ccfee9..cc68c7c 100644 --- a/components/home/ChartBox/Chart.tsx +++ b/components/home/ChartBox/Chart.tsx @@ -1,4 +1,4 @@ -import { curveCardinal } from '@visx/curve'; +import { curveMonotoneX } from '@visx/curve'; import { AnimatedAxis, AnimatedGrid, @@ -13,10 +13,11 @@ import { ChartProps } from './Chart.type'; import isMobile from 'is-mobile'; import { LinearGradient } from '@visx/gradient'; +import { AmountConverter } from 'utils/amountConverter'; const Chart = (props: ChartProps) => { const IsMobile = isMobile({ tablet: true }); - const { data, days } = props; + const { data, days, label } = props; const currentFilter = daysFilter.find((item) => item.days === days); const currentPeriod = currentFilter?.hasPrevious ? data.slice(days * -1).map((item) => ({ ...item })) @@ -70,7 +71,7 @@ const Chart = (props: ChartProps) => { data={data} xAccessor={(d) => d.date} yAccessor={(d) => d.count} - curve={curveCardinal} + curve={curveMonotoneX} strokeWidth={1} stroke="url(#area-gradient)" fill="url(#area-gradient)" @@ -89,7 +90,7 @@ const Chart = (props: ChartProps) => { <> {/* previous chart only for week and month */} { data={currentPeriod} xAccessor={(d) => d.date} yAccessor={(d) => d.count} - curve={curveCardinal} + curve={curveMonotoneX} strokeWidth={1} stroke="url(#area-gradient)" fill="url(#area-gradient)" @@ -130,7 +131,8 @@ const Chart = (props: ChartProps) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any renderTooltip={({ tooltipData }: any) => (
- {tooltipData.nearestDatum.datum.count} + {label &&

{label}

} + {AmountConverter(tooltipData.nearestDatum.datum.count)}
)} /> diff --git a/components/home/ChartBox/Chart.type.ts b/components/home/ChartBox/Chart.type.ts index 1df90f3..5d69028 100644 --- a/components/home/ChartBox/Chart.type.ts +++ b/components/home/ChartBox/Chart.type.ts @@ -8,6 +8,7 @@ export interface PropsType { export interface ChartProps { data: DailyIntervalType[]; days: number; + label: string; } export type ValidDaysFilter = 7 | 30 | 90; diff --git a/components/home/ChartBox/index.tsx b/components/home/ChartBox/index.tsx index d59d43b..f8058c5 100644 --- a/components/home/ChartBox/index.tsx +++ b/components/home/ChartBox/index.tsx @@ -57,7 +57,11 @@ function ChartBox(props: PropsType) { })}
- +
); diff --git a/public/img/notfound.svg b/public/img/notfound.svg deleted file mode 100644 index 5bd124e..0000000 --- a/public/img/notfound.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/services/index.ts b/services/index.ts index a21da1c..438ac7a 100644 --- a/services/index.ts +++ b/services/index.ts @@ -4,7 +4,7 @@ import { API_URL, SEARCH_RESULT_OFFSET } from '../constant'; export const getLastSwaps = async () => await fetch( - `${API_URL}/tx/latest?count=20&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, + `${API_URL}/scanner/tx/latest?count=20&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, ) .then(async (res) => await res.json()) .then((data) => data?.transactions || data) @@ -14,7 +14,9 @@ export const getLastSwaps = async () => }); export const getSummary = async () => - await fetch(`${API_URL}/summary?apiKey=${process.env.NEXT_PUBLIC_API_KEY}`) + await fetch( + `${API_URL}/scanner/summary?apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, + ) .then(async (res) => await res.json()) .then((data) => data) .catch((error) => { @@ -24,7 +26,7 @@ export const getSummary = async () => export const getSearchResult = async (query: string) => await fetch( - `${API_URL}/tx/search?query=${query}&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, + `${API_URL}/scanner/tx/search?query=${query}&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, ) .then(async (res) => await res.json()) .then((data) => data?.searchResult || data) @@ -35,7 +37,7 @@ export const getSearchResult = async (query: string) => export const getWalletSwaps = async (address: string, page?: number) => await fetch( - `${API_URL}/tx/wallet?walletAddress=${address}&offset=${SEARCH_RESULT_OFFSET}&page=${ + `${API_URL}/scanner/tx/wallet?walletAddress=${address}&offset=${SEARCH_RESULT_OFFSET}&page=${ page || 0 }&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, ) @@ -47,7 +49,7 @@ export const getWalletSwaps = async (address: string, page?: number) => export const getTxDetails = async (requestId: string) => await fetch( - `${API_URL}/tx/detail?requestId=${requestId}&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, + `${API_URL}/scanner/tx/detail?requestId=${requestId}&apiKey=${process.env.NEXT_PUBLIC_API_KEY}`, ) .then(async (res) => await res.json()) .then((data) => data?.detailedTransaction || data) diff --git a/tailwind.config.js b/tailwind.config.js index e644010..45d7374 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -15,10 +15,10 @@ module.exports = { heading: ['Roboto'], }, screens: { - 'xs': '330px', - 'sm': '640px', - 'md': '1024px', - 'lg': '1280px', + xs: '330px', + sm: '640px', + md: '1024px', + lg: '1280px', }, container: { screens: { diff --git a/types/transations.ts b/types/transations.ts index d76355b..0ae7526 100644 --- a/types/transations.ts +++ b/types/transations.ts @@ -25,6 +25,7 @@ export interface StepSummary { stepNumber: number; fromToken: RouteType; toToken: RouteType; + swapper?: SwapperType; } export interface SwapType { requestId: string; @@ -84,6 +85,9 @@ export interface StepType { sourceWallet: WalletType; destinationWallet: WalletType; startTime: number; + failureType?: string; + failureReason?: string; + outputToken?: AssetType; } export interface DetailsType {