Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4a320f9
components structure refactor
mgrabina Oct 7, 2025
a097efc
fixes
mgrabina Oct 23, 2025
b86113f
fixed latest issues and unsupported features with cow adapters
mgrabina Oct 28, 2025
7ea5ea9
permit on classic swaps and some fixes
mgrabina Oct 28, 2025
c51908f
docs
mgrabina Oct 29, 2025
a0e67d9
delete legacy code
mgrabina Oct 29, 2025
0744de1
some fixes
mgrabina Oct 30, 2025
5e2fba1
safe check for nonce reuse in permits, fix for network fee
mgrabina Oct 30, 2025
20bf4b4
nits limit orders
mgrabina Oct 30, 2025
755c7c9
debounced
mgrabina Oct 30, 2025
71e1637
try fetch permit support from onchain fallback
mgrabina Oct 30, 2025
e553039
% selector in asset input
mgrabina Oct 30, 2025
91966bb
misc fixes
mgrabina Nov 3, 2025
250bf89
Merge branch 'main' into feat/cow-swap-adapters
mgrabina Nov 4, 2025
9114bb4
fix: use release versions for cow dps
mgrabina Nov 4, 2025
d84b564
misc fixes
mgrabina Nov 4, 2025
1452502
safe checks for reserves
mgrabina Nov 4, 2025
d2e330e
tracking adapters history in local
mgrabina Nov 5, 2025
9ebbe21
misc fixes
mgrabina Nov 5, 2025
88ae066
unify cow env
mgrabina Nov 5, 2025
6871e49
i18n
mgrabina Nov 5, 2025
752f37a
misc fixes
mgrabina Nov 5, 2025
a36e15c
misc
mgrabina Nov 6, 2025
ca72563
misc
mgrabina Nov 6, 2025
8fd65d2
misc
mgrabina Nov 6, 2025
ddd0e16
showing apys in picker
mgrabina Nov 6, 2025
5eb44d6
fix repay w collateral assets showing
mgrabina Nov 6, 2025
3a2bf32
misc
mgrabina Nov 7, 2025
35bdc2d
misc
mgrabina Nov 7, 2025
82b9938
cow release versions and polygon unsupported tokens
mgrabina Nov 7, 2025
15f9e2f
nit message on cancel modal, and safe check for rate change
mgrabina Nov 7, 2025
5160716
fix: use always underlying addresses in quotes
mgrabina Nov 7, 2025
16a5492
miisc nits
mgrabina Nov 7, 2025
ed39bac
add slippage tolerance logic to quote param
mgrabina Nov 7, 2025
812b152
balance check for repay w collateral
mgrabina Nov 7, 2025
55bc7f5
misc
mgrabina Nov 10, 2025
ea5a902
fix WandS paraswap
mgrabina Nov 10, 2025
9a21671
misc
mgrabina Nov 10, 2025
9aafaf9
native limit orders info
mgrabina Nov 11, 2025
fd5fda9
fix cancel add adapter
mgrabina Nov 11, 2025
6a9d4b9
add safe check for calculated instance changed
mgrabina Nov 11, 2025
b8132ff
temporary address warning
mgrabina Nov 11, 2025
13c0e00
misc
mgrabina Nov 11, 2025
e852a87
fix usdt reset
mgrabina Nov 11, 2025
c2c0fc5
do not add network costs to limit orders amounts
mgrabina Nov 11, 2025
e0cc0d4
high costs warning
mgrabina Nov 11, 2025
8ac69f1
better management of actions blocked to account for multiple reasons
mgrabina Nov 12, 2025
bcf1a7b
inform flashloan fee in paraswap flows
mgrabina Nov 12, 2025
e048454
do not show temporary contract warning for non flashloan flow
mgrabina Nov 12, 2025
93d2369
improve mobile responsiveness for cancel button
mgrabina Nov 12, 2025
069136b
nit text
mgrabina Nov 12, 2025
3c52856
change native tokens names
mgrabina Nov 12, 2025
62cb836
fix hf check re render
mgrabina Nov 12, 2025
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ src/locales/
*.md
*.log
*.lock

src/components/transactions/Swap/backup/**/*.*
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Uncomment for CoW Preview Releases

# @cowprotocol:registry=https://npm.pkg.github.com
# always-auth=true
# # registry=https://registry.npmjs.org/
# //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
"@aave/math-utils": "1.36.1",
"@aave/react": "0.6.1",
"@amplitude/analytics-browser": "^2.13.0",
"@cowprotocol/sdk-app-data": "4.1.6",
"@cowprotocol/cow-sdk": "7.1.1",
"@cowprotocol/sdk-flash-loans": "1.3.0",
"@cowprotocol/sdk-viem-adapter": "0.2.0",
"@bgd-labs/aave-address-book": "^4.36.0",
"@cowprotocol/app-data": "^3.1.0",
"@cowprotocol/cow-sdk": "6.3.3",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
"@emotion/server": "latest",
Expand Down Expand Up @@ -157,4 +159,4 @@
"budgetPercentIncreaseRed": 20,
"showDetails": true
}
}
}
41 changes: 19 additions & 22 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { AddressBlocked } from 'src/components/AddressBlocked';
import { Meta } from 'src/components/Meta';
import { TransactionEventHandler } from 'src/components/TransactionEventHandler';
import { GasStationProvider } from 'src/components/transactions/GasStation/GasStationProvider';
import { CowOrderToast } from 'src/components/transactions/Switch/cowprotocol/CowOrderToast';
import { CowOrderToast } from 'src/components/transactions/Swap/modals/result/CowOrderToast';
import { AppDataProvider } from 'src/hooks/app-data-provider/useAppDataProvider';
import { CowOrderToastProvider } from 'src/hooks/useCowOrderToast';
import { ModalContextProvider } from 'src/hooks/useModal';
import { SwapOrdersTrackingProvider } from 'src/hooks/useSwapOrdersTracking';
import { Web3ContextProvider } from 'src/libs/web3-data-provider/Web3Provider';
import { useRootStore } from 'src/store/root';
import { SharedDependenciesProvider } from 'src/ui-config/SharedDependenciesProvider';
Expand All @@ -31,16 +31,22 @@ import createEmotionCache from '../src/createEmotionCache';
import { AppGlobalStyles } from '../src/layouts/AppGlobalStyles';
import { LanguageProvider } from '../src/libs/LanguageProvider';

const SwitchModal = dynamic(() =>
import('src/components/transactions/Switch/SwitchModal').then((module) => module.SwitchModal)
const SwapModal = dynamic(() =>
import('src/components/transactions/Swap/modals/SwapModal').then((module) => module.SwapModal)
);

const CollateralSwapModal = dynamic(() =>
import('src/components/transactions/Switch/CollateralSwap/CollateralSwapModal').then(
import('src/components/transactions/Swap/modals/CollateralSwapModal').then(
(module) => module.CollateralSwapModal
)
);

const DebtSwapModal = dynamic(() =>
import('src/components/transactions/Swap/modals/DebtSwapModal').then(
(module) => module.DebtSwapModal
)
);

const BridgeModal = dynamic(() =>
import('src/components/transactions/Bridge/BridgeModal').then((module) => module.BridgeModal)
);
Expand All @@ -53,16 +59,6 @@ const ClaimRewardsModal = dynamic(() =>
(module) => module.ClaimRewardsModal
)
);
const CollateralChangeModal = dynamic(() =>
import('src/components/transactions/CollateralChange/CollateralChangeModal').then(
(module) => module.CollateralChangeModal
)
);
const DebtSwitchModal = dynamic(() =>
import('src/components/transactions/DebtSwitch/DebtSwitchModal').then(
(module) => module.DebtSwitchModal
)
);
const EmodeModal = dynamic(() =>
import('src/components/transactions/Emode/EmodeModal').then((module) => module.EmodeModal)
);
Expand Down Expand Up @@ -160,7 +156,7 @@ export default function MyApp(props: MyAppProps) {
<Web3ContextProvider>
<AppGlobalStyles>
<AddressBlocked>
<CowOrderToastProvider>
<SwapOrdersTrackingProvider>
<ModalContextProvider>
<SharedDependenciesProvider>
<AppDataProvider>
Expand All @@ -170,24 +166,25 @@ export default function MyApp(props: MyAppProps) {
<WithdrawModal />
<BorrowModal />
<RepayModal />
<CollateralChangeModal />
<DebtSwitchModal />
<ClaimRewardsModal />
<EmodeModal />
<FaucetModal />
<TransactionEventHandler />
<SwitchModal />
<CollateralSwapModal />
<StakingMigrateModal />
<BridgeModal />
<ReadOnlyModal />
<CowOrderToast />

{/* Swap Modals */}
<SwapModal />
<CollateralSwapModal />
<DebtSwapModal />
<CancelCowOrderModal />
<CowOrderToast />
</GasStationProvider>
</AppDataProvider>
</SharedDependenciesProvider>
</ModalContextProvider>
</CowOrderToastProvider>
</SwapOrdersTrackingProvider>
</AddressBlocked>
</AppGlobalStyles>
</Web3ContextProvider>
Expand Down
8 changes: 7 additions & 1 deletion src/components/MarketSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ type MarketLogoProps = {
export const MarketLogo = ({ size, logo, testChainName, sx }: MarketLogoProps) => {
return (
<Box sx={{ mr: 2, width: size, height: size, position: 'relative', ...sx }}>
<img src={logo} alt="" width="100%" height="100%" />
<img
src={logo}
alt=""
width="100%"
height="100%"
style={{ display: 'block', objectFit: 'contain', objectPosition: 'center center' }}
/>

{testChainName && (
<Tooltip title={testChainName} arrow>
Expand Down
19 changes: 16 additions & 3 deletions src/components/StyledToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,31 @@ const CustomTxModalToggleButton = styled(ToggleButton)<ToggleButtonProps>(({ the
color: theme.palette.text.muted,
borderRadius: '4px',

// Selected (active) state
'&.Mui-selected, &.Mui-selected:hover': {
border: `1px solid ${theme.palette.other.standardInputLine}`,
backgroundColor: '#FFFFFF',
borderRadius: '4px !important',
},

'&.Mui-selected, &.Mui-disabled': {
color: theme.palette.background.header,
zIndex: 100,
height: '100%',
display: 'flex',
justifyContent: 'center',
},

// Disabled but NOT selected: keep readable text with slight fade
'&.Mui-disabled:not(.Mui-selected)': {
color: theme.palette.text.secondary,
opacity: 0.55,
},

// Disabled + selected: preserve the selected look
'&.Mui-disabled.Mui-selected': {
border: `1px solid ${theme.palette.other.standardInputLine}`,
backgroundColor: '#FFFFFF',
borderRadius: '4px !important',
color: theme.palette.background.header,
opacity: 1,
},
})) as typeof ToggleButton;

Expand Down
15 changes: 15 additions & 0 deletions src/components/infoTooltips/EstimatedCostsForLimitSwap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Trans } from '@lingui/macro';

import { TextWithTooltip } from '../TextWithTooltip';

export const EstimatedCostsForLimitSwapTooltip = () => {
return (
<TextWithTooltip variant="caption" text={<Trans>Estimated Costs & Fees</Trans>}>
<Trans>
These are the estimated costs associated with your limit swap, including costs and fees.
Consider these costs when setting your order amounts to help optimize execution and maximize
your chances of filling the order.
</Trans>
</TextWithTooltip>
);
};
11 changes: 11 additions & 0 deletions src/components/infoTooltips/ExecutionFeeTooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Trans } from '@lingui/macro';

import { TextWithTooltip } from '../TextWithTooltip';

export const ExecutionFeeTooltip = () => {
return (
<TextWithTooltip variant="caption" text={<Trans>Execution fee</Trans>}>
<Trans>This is the fee for executing position changes, set by governance.</Trans>
</TextWithTooltip>
);
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { OrderBookApi, OrderSigningUtils } from '@cowprotocol/cow-sdk';
import { AdapterContext, OrderBookApi, OrderSigningUtils } from '@cowprotocol/cow-sdk';
import { Trans } from '@lingui/macro';
import { useQueryClient } from '@tanstack/react-query';
import { useIsWrongNetwork } from 'src/hooks/useIsWrongNetwork';
import { useModalContext } from 'src/hooks/useModal';
import { getEthersProvider } from 'src/libs/web3-data-provider/adapters/EthersAdapter';
import { ActionFields, TransactionHistoryItem } from 'src/modules/history/types';
import { ActionName, SwapActionFields, TransactionHistoryItem } from 'src/modules/history/types';
import { getErrorTextFromError, TxAction } from 'src/ui-config/errorMapping';
import { wagmiConfig } from 'src/ui-config/wagmiConfig';
import { getWalletClient } from 'wagmi/actions';

import { COW_ENV, getCowAdapter } from '../Swap/helpers/cow';
import { TxActionsWrapper } from '../TxActionsWrapper';

// TODO: check with cow if we can cancel adapters orders
interface CancelCowOrderActionsProps {
cowOrder: TransactionHistoryItem<ActionFields['CowSwap']>;
cowOrder: TransactionHistoryItem<SwapActionFields[ActionName.Swap]>;
blocked: boolean;
}

Expand All @@ -23,13 +25,19 @@ export const CancelCowOrderActions = ({ cowOrder, blocked }: CancelCowOrderActio
const action = async () => {
try {
setMainTxState({ ...mainTxState, loading: true });
const provider = getEthersProvider(wagmiConfig, { chainId: cowOrder.chainId });
const signer = (await provider).getSigner();
const orderBookApi = new OrderBookApi({ chainId: cowOrder.chainId });

const adapter = await getCowAdapter(cowOrder.chainId);
AdapterContext.getInstance().setAdapter(adapter);
const orderBookApi = new OrderBookApi({ chainId: cowOrder.chainId, env: COW_ENV });
const walletClient = await getWalletClient(wagmiConfig, { chainId: cowOrder.chainId });

if (!walletClient || !walletClient.account) {
throw new Error('Wallet not connected for signing');
}
const { signature, signingScheme } = await OrderSigningUtils.signOrderCancellation(
cowOrder.id,
cowOrder.chainId,
signer
walletClient
);
await orderBookApi.sendSignedOrderCancellations({
orderUids: [cowOrder.id],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BasicModal } from 'src/components/primitives/BasicModal';
import { ModalContextType, ModalType, useModalContext } from 'src/hooks/useModal';
import { ActionFields, TransactionHistoryItem } from 'src/modules/history/types';
import { ActionName, SwapActionFields, TransactionHistoryItem } from 'src/modules/history/types';

import { TxModalTitle } from '../FlowCommons/TxModalTitle';
import { CancelCowOrderModalContent } from './CancelCowOrderModalContent';

export const CancelCowOrderModal = () => {
const { type, close, args } = useModalContext() as ModalContextType<{
cowOrder: TransactionHistoryItem<ActionFields['CowSwap']>;
cowOrder: TransactionHistoryItem<SwapActionFields[ActionName.Swap]>;
}>;
return (
<BasicModal open={type === ModalType.CancelCowOrder} setOpen={close}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Typography } from '@mui/material';
import { useIsWrongNetwork } from 'src/hooks/useIsWrongNetwork';
import { useModalContext } from 'src/hooks/useModal';
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
import { ActionFields, TransactionHistoryItem } from 'src/modules/history/types';
import { ActionName, SwapActionFields, TransactionHistoryItem } from 'src/modules/history/types';
import { getNetworkConfig } from 'src/utils/marketsAndNetworksConfig';
import { formatUnits } from 'viem';

Expand All @@ -14,7 +14,7 @@ import { ChangeNetworkWarning } from '../Warnings/ChangeNetworkWarning';
import { CancelCowOrderActions } from './CancelCowOrderActions';

interface CancelCowOrderModalContentProps {
cowOrder: TransactionHistoryItem<ActionFields['CowSwap']>;
cowOrder: TransactionHistoryItem<SwapActionFields[ActionName.Swap]>;
}

export const CancelCowOrderModalContent = ({ cowOrder }: CancelCowOrderModalContentProps) => {
Expand All @@ -39,6 +39,15 @@ export const CancelCowOrderModalContent = ({ cowOrder }: CancelCowOrderModalCont
<>
{showNetworkWarning && <ChangeNetworkWarning networkName={name} chainId={cowOrder.chainId} />}
<TxModalDetails showGasStation={false}>
<Typography variant="h2">
<Trans>Cancel order</Trans>
</Typography>
<Typography sx={{ mt: 2, mb: 4 }} variant="description" color="text.secondary">
<Trans>
This is an off-chain operation. Keep in mind that a solver may already have filled your
order.
</Trans>
</Typography>
<DetailsTextLine
description="Order ID"
text={cowOrder.id}
Expand Down

This file was deleted.

This file was deleted.

Loading