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

Adaptation to Liquidity Hub 2.0 and fixes for quote race conditions. #1629

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4,271 changes: 3,926 additions & 345 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/styles": "^4.11.5",
"@orbs-network/liquidity-hub-sdk": "^1.0.44",
"@orbs-network/liquidity-hub-sdk": "^1.0.45",
"@orbs-network/swap-ui": "^0.0.14",
"@orbs-network/twap-sdk": "^2.0.33",
"@orderly.network/hooks": "^1.4.3",
Expand Down
4 changes: 3 additions & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@
"minimumReceivedTooltip": "This is the minimum number of tokens that may be received. NOTE: This minimum only refers to executed trades. Some trades may not be executed if the limit price is higher than the available market prices and your order may only be partially filled.",
"orbs": "Orbs",
"approveToken": "Approve {{ symbol }} spending",
"approveTokenPending": "Approving {{ symbol }} spending",
"tradeSizeWarning": "Trade size must be at least ${{ usd }}",
"minExpiryWarning": "Min. expiry is {{ value }} minutes",
"maxExpiryWarning": "Max. expiry is 30 days",
Expand All @@ -1036,5 +1037,6 @@
"create": "Create",
"networkFeeHelper": "Network fees are paid for transaction",
"dragonEggAlert": "Screenshot this and DM <alink>@QuickswapDEX on X (Twitter)</alink> for a chance to win prizes! First come, first serve.",
"cancelOrder": "Cancel Order"
"cancelOrder": "Cancel Order",
"seekingBetterPrice": "Seeking better price"
}
6 changes: 6 additions & 0 deletions src/components/ConfirmSwapModal/ConfirmSwapModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ interface ConfirmSwapModalProps {
onConfirm: () => void;
swapErrorMessage: string | undefined;
onDismiss: () => void;
swapButtonText?: string;
swapButtonDisabled?: boolean;
}

const ConfirmSwapModal: React.FC<ConfirmSwapModalProps> = ({
Expand All @@ -62,6 +64,8 @@ const ConfirmSwapModal: React.FC<ConfirmSwapModalProps> = ({
attemptingTxn,
txHash,
txPending,
swapButtonDisabled,
swapButtonText,
}) => {
const { t } = useTranslation();
const showAcceptChanges = useMemo(
Expand All @@ -86,6 +90,8 @@ const ConfirmSwapModal: React.FC<ConfirmSwapModalProps> = ({
onConfirm={onConfirm}
showAcceptChanges={showAcceptChanges}
onAcceptChanges={onAcceptChanges}
swapButtonText={swapButtonText}
swapButtonDisabled={swapButtonDisabled}
/>
) : null;
}, [
Expand Down
12 changes: 10 additions & 2 deletions src/components/ConfirmSwapModal/SwapModalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface SwapModalHeaderProps {
showAcceptChanges: boolean;
onAcceptChanges: () => void;
onConfirm: () => void;
swapButtonText?: string;
swapButtonDisabled?: boolean;
}

const SwapModalHeader: React.FC<SwapModalHeaderProps> = ({
Expand All @@ -34,6 +36,8 @@ const SwapModalHeader: React.FC<SwapModalHeaderProps> = ({
showAcceptChanges,
onAcceptChanges,
onConfirm,
swapButtonDisabled,
swapButtonText,
}) => {
const { t } = useTranslation();
const { chainId } = useActiveWeb3React();
Expand Down Expand Up @@ -151,8 +155,12 @@ const SwapModalHeader: React.FC<SwapModalHeaderProps> = ({
) : (
<></>
)}
<Button onClick={onConfirm} className='swapButton'>
{t('confirmSwap')}
<Button
disabled={swapButtonDisabled}
onClick={onConfirm}
className='swapButton'
>
{swapButtonText || t('confirmSwap')}
</Button>
</Box>
</Box>
Expand Down
Loading
Loading