Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/api migration #333

Merged
merged 46 commits into from
May 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7f54cca
Merge branch 'develop' of phuc-varmeta:gnoswap-labs/gnoswap-interface…
phucvarmeta Apr 19, 2024
2e3780b
fix: add position form state issue
phucvarmeta Apr 21, 2024
e6b20d9
Merge branch 'develop' of phuc-varmeta:gnoswap-labs/gnoswap-interface…
phucvarmeta Apr 24, 2024
1d01663
resolve conflict
phucvarmeta Apr 26, 2024
ab16804
Merge branch 'develop' of phuc-varmeta:gnoswap-labs/gnoswap-interface…
phucvarmeta Apr 28, 2024
1ef9c0a
Merge branch 'develop' of phuc-varmeta:gnoswap-labs/gnoswap-interface…
phucvarmeta May 2, 2024
9cfbd84
refactor: api migration
phucvarmeta May 6, 2024
391b3e6
fix: TokenModel priceId -> priceID
phucvarmeta May 7, 2024
949d06a
fix: position model field type changed
phucvarmeta May 7, 2024
3e22b82
resolve conflict
phucvarmeta May 7, 2024
c652796
resolve conflict
phucvarmeta May 7, 2024
5b975c3
fix: compile error
phucvarmeta May 7, 2024
6ed4e9b
fix: earn add form data not load
phucvarmeta May 7, 2024
189d0d1
refactor: api migration
phucvarmeta May 8, 2024
5c322c8
refactor: api migration
phucvarmeta May 8, 2024
bd6cbc4
refactor: api migration
phucvarmeta May 9, 2024
2d0feeb
fix: compile error
phucvarmeta May 9, 2024
3cc6041
fix: tvl graph ui issue
phucvarmeta May 9, 2024
0b01327
fix: exchange rate graph ui issue
phucvarmeta May 9, 2024
2727a6b
refactor: api migration
phucvarmeta May 10, 2024
a1acce5
refactor: api migration & bug fixes
phucvarmeta May 10, 2024
2fa8da4
refactor: api migration & bug fixes
phucvarmeta May 10, 2024
1489407
refactor: api migration & bug fixes
phucvarmeta May 10, 2024
25e5d2e
refactor: api migration & bug fixes
phucvarmeta May 10, 2024
106efe1
fix: ui issue
phucvarmeta May 13, 2024
7b86135
fix: ui issue
phucvarmeta May 13, 2024
61ef587
fix: ui issue
phucvarmeta May 13, 2024
559e509
fix: ui issue
phucvarmeta May 13, 2024
128cb64
fix: ui issue
phucvarmeta May 13, 2024
0c38d9e
fix: ui issue
phucvarmeta May 13, 2024
6988066
fix: compile error
phucvarmeta May 13, 2024
8825caa
refactor: api migration & bug fixes
phucvarmeta May 14, 2024
939eaca
refactor: api migration & bug fixes
phucvarmeta May 14, 2024
cacbc8f
fix: compile error
phucvarmeta May 14, 2024
7cee098
fix: ui issue
phucvarmeta May 14, 2024
68dd189
fix: ui issue
phucvarmeta May 14, 2024
74eb680
fix: ui issue
phucvarmeta May 14, 2024
8c38dea
fix: ui issue
phucvarmeta May 14, 2024
6bbe8e7
fix: ui issue
phucvarmeta May 14, 2024
958bb5d
fix: ui issue
phucvarmeta May 15, 2024
b509565
chore: remove log
phucvarmeta May 15, 2024
4412d23
Merge branch 'develop' of phuc-varmeta:gnoswap-labs/gnoswap-interface…
phucvarmeta May 15, 2024
b1cd241
resolve conflict
phucvarmeta May 15, 2024
71f4881
fix: ci fix
phucvarmeta May 15, 2024
abbf68f
resolve git comment
phucvarmeta May 15, 2024
b825f1e
resolve git comment
phucvarmeta May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: api migration & bug fixes
phucvarmeta committed May 14, 2024
commit 939eacafaec507177c73dea39cc9d7ebfa6bf52c
Original file line number Diff line number Diff line change
@@ -388,7 +388,7 @@ const SelectPriceRangeCustom = forwardRef<SelectPriceRangeCustomHandle, SelectPr
setMinPrice={(tick) => adjustRangeManually(() => selectPool.setMinPosition(tick))}
setMaxPrice={(tick) => adjustRangeManually(() => selectPool.setMaxPosition(tick))}
liquidityOfTickPoints={selectPool.liquidityOfTickPoints}
currentPrice={selectPool.currentPrice}
currentPrice={selectPool.currentPrice ? Number(selectPool.currentPrice) : null}
focusPosition={selectPool.focusPosition}
width={GRAPH_WIDTH}
height={GRAPH_HEIGHT}
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ const SimpleLineGraph: React.FC<SimpleLineGraphProps> = ({
value: `${data}`
}));
}, [datas]);
console.log("🚀 ~ getChartDatas ~ getChartDatas:", getChartDatas());

const getStatus = useCallback((): "UP" | "DOWN" => {
if (datas.length < 2) {
2 changes: 0 additions & 2 deletions packages/web/src/components/home/token-info/TokenInfo.tsx
Original file line number Diff line number Diff line change
@@ -60,8 +60,6 @@ const TokenInfo: React.FC<TokenInfoProps> = ({ item, idx }) => {
mostLiquidPool,
last7days,
} = item;
token.name === "Gnoswap" && console.log("🚀 ~ last7days:", last7days)
token.name === "Gnoswap" && console.log("🚀 ~ last7days:", token.name)
const router = useRouter();

const onClickItem = (path: string) => {
Original file line number Diff line number Diff line change
@@ -20,9 +20,6 @@ export function ExchangeRateGraphContent({
selectedScope,
isReversed,
}: ExchangeRateGraphContentProps) {
console.log("🚀 ~ poolData:", poolData.priceRatio);


const theme = useTheme();
const [componentRef, size] = useComponentSize();
const { breakpoint } = useWindowSize();
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ const MyLiquidityContent: React.FC<MyLiquidityContentProps> = ({
loadngTransactionClaim,
isOtherPosition,
}) => {
console.log("🚀 ~ positions:", positions);
const { tokenPrices } = useTokenData();
const { getGnotPath } = useGnotToGnot();

Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ const PoolPairInfoContent: React.FC<PoolPairInfoContentProps> = ({
}, [pool.totalApr]);

const liquidityChangedStr = useMemo((): string => {
return `${pool.tvlChange}%`;
return `${numberToFormat(pool.tvlChange, 2)}%`;
}, [pool.tvlChange]);

const volumeChangedStr = useMemo((): string => {
Original file line number Diff line number Diff line change
@@ -195,6 +195,8 @@ const EarnAddLiquidityContainer: React.FC = () => {
startPrice: existPool ? null : prev.startPrice
}));

if (initializedFeeTier.current) { return }

if (existPool) {
setPriceRange(priceRanges.find(range => range.type === "Passive") || null);
} else {
Original file line number Diff line number Diff line change
@@ -35,8 +35,7 @@ const MyLiquidityContainer: React.FC<MyLiquidityContainerProps> = ({
const { connected: connectedWallet, isSwitchNetwork, account } = useWallet();
const [currentIndex, setCurrentIndex] = useState(1);
const [positions, setPositions] = useState<PoolPositionModel[]>([]);
const { getPositionsByPoolId, loading, positions: allPosition } = usePositionData(address);
console.log("🚀 ~ allPosition:", allPosition);
const { getPositionsByPoolId, loading } = usePositionData(address);
const { isLoadingCommon } = useLoading();
const { claimAll } = usePosition(positions);
const [loadngTransactionClaim, setLoadingTransactionClaim] = useState(false);
2 changes: 1 addition & 1 deletion packages/web/src/hooks/pool/use-select-pool.tsx
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ export const useSelectPool = ({
}
: {
...poolRes,
price: 1 / poolResFromDb.price,
price: poolResFromDb.price === 0 ? 0 : 1 / poolResFromDb.price,
ticks: Object.keys(poolRes.ticks).map(
tick => Number(tick) * -1,
),
1 change: 0 additions & 1 deletion packages/web/src/hooks/swap/use-swap-handler.tsx
Original file line number Diff line number Diff line change
@@ -891,7 +891,6 @@ export const useSwapHandler = () => {
estimateSwapRoute(changedAmount).then(result => {
const isError = result === null;
const expectedAmount = isError ? "" : result.amount;
console.log("🚀 ~ estimateSwapRoute ~ expectedAmount:", expectedAmount);
if (isError) {
if (isExactIn) {
setTokenBAmount("0");
2 changes: 0 additions & 2 deletions packages/web/src/hooks/swap/use-swap.tsx
Original file line number Diff line number Diff line change
@@ -59,7 +59,6 @@ export const useSwap = ({
}, [direction, estimatedAmount, slippage, tokenA]);

const estimateSwapRoute = async (amount: string) => {
console.log("🚀 ~ estimateSwapRoute ~ amount:", amount);
if (!selectedTokenPair) {
setSwapState("NONE");
return null;
@@ -83,7 +82,6 @@ export const useSwap = ({
exactType: direction,
tokenAmount: Number(amount)
}).then(response => {
console.log("🚀 ~ estimateSwapRoute ~ response:", response);
if (response.amount === "0" || response.amount === "") {
setSwapState("NO_LIQUIDITY");
setEstimatedRoutes([]);
2 changes: 2 additions & 0 deletions packages/web/src/models/pool/mapper/pool-mapper.ts
Original file line number Diff line number Diff line change
@@ -120,6 +120,7 @@ export class PoolMapper {
bins40: pool.bins40,
liquidity: pool.liquidity,
allTimeVolumeUsd: pool.allTimeVolumeUsd,
price: Number(pool.price),
};
}

@@ -134,6 +135,7 @@ export class PoolMapper {
apr: !pool.apr ? Number(pool.apr) : null,
totalApr: !pool.totalApr ? Number(pool.totalApr) : null,
allTimeVolumeUsd: Number(pool.allTimeVolumeUsd),
price: Number(pool.price)
};
}
}
1 change: 0 additions & 1 deletion packages/web/src/models/position/mapper/position-mapper.ts
Original file line number Diff line number Diff line change
@@ -72,7 +72,6 @@ export class PositionMapper {
}

public static fromList(positions: PositionListResponse): PositionModel[] {
console.log("🚀 ~ PositionMapper ~ fromList ~ positions:", positions);
return positions.map(PositionMapper.from);
}

1 change: 0 additions & 1 deletion packages/web/src/react-query/positions/queries.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ export const useGetPositionsByAddress = (
queryKey: [QUERY_KEY.positions, address],
queryFn: async () => {
const data = await positionRepository.getPositionsByAddress(address);
console.log("🚀 ~ queryFn: ~ data:", data);
return data;
},
...options,