diff --git a/public/POL.png b/public/POL.png index d88f63e72..51683f71d 100644 Binary files a/public/POL.png and b/public/POL.png differ diff --git a/public/bridge/polygon.svg b/public/bridge/polygon.svg index 135273b19..d98ba85dd 100644 --- a/public/bridge/polygon.svg +++ b/public/bridge/polygon.svg @@ -1,6 +1,562 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/bridge/polygon_cover_img.webp b/public/bridge/polygon_cover_img.webp index ea4c77654..3df3ab4eb 100644 Binary files a/public/bridge/polygon_cover_img.webp and b/public/bridge/polygon_cover_img.webp differ diff --git a/public/polygon/polygon_new.webp b/public/polygon/polygon_new.webp new file mode 100644 index 000000000..fa50f0ead Binary files /dev/null and b/public/polygon/polygon_new.webp differ diff --git a/src/assets/images/bridge/polygon.svg b/src/assets/images/bridge/polygon.svg index 135273b19..d98ba85dd 100644 --- a/src/assets/images/bridge/polygon.svg +++ b/src/assets/images/bridge/polygon.svg @@ -1,6 +1,562 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/AvailableChainList/AvailableChain.tsx b/src/components/AvailableChainList/AvailableChain.tsx index cf43bbbbe..2af00fe62 100644 --- a/src/components/AvailableChainList/AvailableChain.tsx +++ b/src/components/AvailableChainList/AvailableChain.tsx @@ -16,7 +16,7 @@ const AvailableChain: React.FC = ({ network Image {networkName} diff --git a/src/components/Bridge/BridgeBlockItem.tsx b/src/components/Bridge/BridgeBlockItem.tsx index a0e72ef01..595a5e13b 100644 --- a/src/components/Bridge/BridgeBlockItem.tsx +++ b/src/components/Bridge/BridgeBlockItem.tsx @@ -51,7 +51,7 @@ const BridgeBlockItem: React.FC = ({ alt='item' width={16} height={16} - style={{ marginLeft: '-2px' }} + style={{ marginLeft: '-2px', borderRadius: '8px' }} /> ); })} diff --git a/src/components/Swap/SwapBestTrade.tsx b/src/components/Swap/SwapBestTrade.tsx index 03b2783cd..c626d5461 100644 --- a/src/components/Swap/SwapBestTrade.tsx +++ b/src/components/Swap/SwapBestTrade.tsx @@ -1051,7 +1051,10 @@ const SwapBestTrade: React.FC<{ const betterPriceFound = await getBetterPrice({ dexOutAmount: optimalRate?.destAmount, allowedSlippage, - skip: liquidityHubDisabled, + skip: + liquidityHubDisabled || + wrapType === WrapType.WRAP || + wrapType === WrapType.UNWRAP, }); if (betterPriceFound) { @@ -1067,6 +1070,7 @@ const SwapBestTrade: React.FC<{ getBetterPrice, isLhPureAggregationMode, onPureAggregationSubmit, + wrapType, ]); const paraRate = optimalRate diff --git a/src/components/Swap/orbs/LiquidityHub/LiquidityHubSwapConfirmation.tsx b/src/components/Swap/orbs/LiquidityHub/LiquidityHubSwapConfirmation.tsx index a9a094a7e..12bc0b69a 100644 --- a/src/components/Swap/orbs/LiquidityHub/LiquidityHubSwapConfirmation.tsx +++ b/src/components/Swap/orbs/LiquidityHub/LiquidityHubSwapConfirmation.tsx @@ -124,7 +124,11 @@ const useLiquidityHubConfirmationContext = () => React.useContext(Context); const useLiquidityHubApproval = () => { const { inCurrency, inAmount } = useLiquidityHubConfirmationContext(); - return useApproval(permit2Address, inCurrency, inAmount); + return useApproval( + permit2Address, + inCurrency, + fromRawAmount(inCurrency, inAmount)?.toExact(), + ); }; const useAmounts = () => { @@ -390,6 +394,7 @@ const useLiquidityHubSwapCallback = () => { outCurrency, getLatestQuote, onLiquidityHubSwapInProgress, + quote, } = useLiquidityHubConfirmationContext(); const { mutateAsync: signCallback } = useSignEIP712Callback(); const getSteps = useGetStepsCallback(); @@ -431,17 +436,15 @@ const useLiquidityHubSwapCallback = () => { await approvalCallback(); } - const acceptedQuote = getLatestQuote(); + const acceptedQuote = getLatestQuote() || quote; if (!acceptedQuote) { - throw new Error('Failed to fetch quote'); + throw new Error('missing quote'); } + onAcceptQuote(acceptedQuote); updateStore({ currentStep: Steps.SWAP }); - const signature = await promiseWithTimeout( - signCallback(acceptedQuote.permitData), - SIGNATURE_TIMEOUT, - ); + const signature = await signCallback(acceptedQuote.permitData); onSignature(signature); const txHash = await swapCallback({ diff --git a/src/components/Swap/orbs/LiquidityHub/hooks.ts b/src/components/Swap/orbs/LiquidityHub/hooks.ts index 524b8c32c..45c3099f6 100644 --- a/src/components/Swap/orbs/LiquidityHub/hooks.ts +++ b/src/components/Swap/orbs/LiquidityHub/hooks.ts @@ -1,6 +1,6 @@ import { ChainId, Currency } from '@uniswap/sdk'; import { useActiveWeb3React } from 'hooks'; -import { useMemo, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { getConfig } from 'config'; import { wrappedCurrency } from 'utils/wrappedCurrency'; import { @@ -134,37 +134,36 @@ export const useGetBetterPrice = ( ) => { const [seekingBetterPrice, setSeekingBestPrice] = useState(false); - const mutation = useMutation({ - mutationFn: async ({ - dexOutAmount = '', - allowedSlippage = 0, + const getBetterPrice = useCallback( + async ({ skip, + allowedSlippage = 0, + dexOutAmount = '', }: { - dexOutAmount?: string; + skip: boolean; allowedSlippage?: number; - skip?: boolean; + dexOutAmount?: string; }) => { - if (skip) return false; - setSeekingBestPrice(true); - const quote = await promiseWithTimeout(fetchLiquidityHubQuote(), 5_000); - const dexMinAmountOut = - subtractSlippage(allowedSlippage, dexOutAmount) || 0; - return BN(quote?.userMinOutAmountWithGas || 0).gt(dexMinAmountOut); - }, - onError: (error) => { - console.error('useSeekingBetterPrice', error); - }, - onSettled: () => { - setTimeout(() => { - setSeekingBestPrice(false); - }, 50); + try { + if (skip) return false; + setSeekingBestPrice(true); + const quote = await promiseWithTimeout(fetchLiquidityHubQuote(), 5_000); + const dexMinAmountOut = + subtractSlippage(allowedSlippage, dexOutAmount) || 0; + return BN(quote?.userMinOutAmountWithGas || 0).gt(dexMinAmountOut); + } catch (error) { + console.error('useSeekingBetterPrice', error); + } finally { + setTimeout(() => { + setSeekingBestPrice(false); + }, 50); + } }, - }); + [fetchLiquidityHubQuote], + ); return { seekingBetterPrice, - quote: mutation.data, - error: mutation.error, - getBetterPrice: mutation.mutateAsync, + getBetterPrice, }; }; diff --git a/src/components/Swap/orbs/Twap/Components/Components.tsx b/src/components/Swap/orbs/Twap/Components/Components.tsx index 7a5f6fc74..341d2cb9a 100644 --- a/src/components/Swap/orbs/Twap/Components/Components.tsx +++ b/src/components/Swap/orbs/Twap/Components/Components.tsx @@ -156,7 +156,7 @@ export const LimitInputPanel = () => { - + { alt='item' width={16} height={16} - style={{ marginLeft: '-2px' }} + style={{ marginLeft: '-2px', borderRadius: '8px' }} /> ); }, diff --git a/src/pages/styles/landing.scss b/src/pages/styles/landing.scss index dcd7462c8..2a8cba17a 100644 --- a/src/pages/styles/landing.scss +++ b/src/pages/styles/landing.scss @@ -172,6 +172,8 @@ background-color: #9b9b9b0f; img { margin: 0 auto; + width: 40px; + border-radius: 24px; } @media screen and (max-width: '900px') { width: 100%;