Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4064408
feat: make the SDK backend URL configurable
grothem Nov 16, 2026
429a4fd
Merge branch 'main' into feat/configurable-backend-url
grothem Nov 23, 2026
62e47a3
Merge branch 'main' into feat/configurable-backend-url
grothem Nov 25, 2026
c928127
refactor(swap): read wrapped native addresses from the address book
mgrabina Nov 25, 2026
48bc087
feat(swap): place token market swaps through the backend orders API
mgrabina Nov 25, 2026
80ac0d3
feat(swap): place token limit orders through the backend orders API
mgrabina Nov 25, 2026
5f3dbd1
fix(swap): price backend quote fees in the sell token
mgrabina Nov 25, 2026
3ae62c8
feat(swap): place collateral swaps and withdraw and swap through the …
mgrabina Nov 25, 2026
30c9fa1
feat(swap): place debt swaps and repays with collateral through the b…
mgrabina Nov 25, 2026
78fcbb5
fix(swap): address review findings on the backend order flows
mgrabina Nov 25, 2026
f63e8f3
fix(swap): re-quote on every slippage change for backend market orders
mgrabina Nov 25, 2026
43bf62b
fix(swap): show backend quote and order refusals instead of an unknow…
mgrabina Nov 27, 2026
fdb0723
feat(swap): leverage a supplied position through the backend
mgrabina Nov 27, 2026
58fa06e
fix(swap): hide the backend's own leverage quote until a multiplier i…
mgrabina Nov 27, 2026
2e34de6
fix(swap): settle fulfilled leverage orders and check leverage caps
mgrabina Nov 27, 2026
f1b2f58
fix(swap): block backend market orders until the quote matches the ed…
mgrabina Nov 27, 2026
3054e01
Merge branch 'main' into feat/configurable-backend-url
grothem Nov 30, 2026
4e2f2d6
Merge feat/configurable-backend-url into swaps-via-backend
mgrabina Nov 30, 2026
48cd870
feat(history): show backend swap activities once
mgrabina Dec 2, 2026
93def1b
fix(swap): key backend quotes by operation and honor the approval pre…
mgrabina Dec 2, 2026
e284152
Merge main into swaps-via-backend
mgrabina Dec 2, 2026
4de90d8
fix(swap): re-quote when the backend reports an expired quote
mgrabina Dec 2, 2026
c1ef79d
chore(deps): pin the v3 SDK preview that has the order hooks
mgrabina Dec 2, 2026
fc8a7c7
Merge remote-tracking branch 'origin/main' into swaps-via-backend
mgrabina Dec 2, 2026
48ef87f
fix(swap): label leverage in history and show what it drew and returned
mgrabina Dec 2, 2026
83fb3da
fix(swap): leverage picks its assets, then the multiplier, with amoun…
mgrabina Dec 2, 2026
550c130
fix(theme): keep MUI's var-composed colors out of the Display-P3 layer
mgrabina Dec 2, 2026
f6d90d2
fix(swap): leverage assets in one box, the current multiplier alone u…
mgrabina Dec 2, 2026
25980ef
fix(swap): costs and fees last in every swap preview, more room above…
mgrabina Dec 2, 2026
f0c07c3
fix(swap): compact slippage row under the modal title
mgrabina Dec 2, 2026
7b165aa
Merge branch 'main' of github.com:aave/interface into swaps-via-backend
mgrabina Dec 2, 2026
1af3ab4
fix(swap): price the backend partner fee in the sell token in the hig…
mgrabina Dec 3, 2026
5b32065
fix(swap): compare repay amount and debt numerically in repay with co…
mgrabina Dec 3, 2026
d1301b9
feat(swap): show the leverage selector disabled until the first quote
mgrabina Dec 3, 2026
433a3ec
feat(history): cancel open backend position orders
mgrabina Dec 3, 2026
7e702d5
fix(swap): leave out collateral-swap targets the backend refuses
mgrabina Dec 3, 2026
618d8fe
fix(swap): drop the placeholder value from the pending leverage selector
mgrabina Dec 3, 2026
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
6 changes: 4 additions & 2 deletions cypress/support/steps/main.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ export const withdraw = (
it(`Open ${_shortName} Withdraw popup view`, () => {
cy.doSwitchToDashboardSupplyView();
cy.getDashBoardSuppliedRow(_shortName, isCollateral)
.find(`button:contains("Withdraw")`)
.find(`[data-cy=suppliedExtraActionsButton]`)
.click();
cy.get(`[data-cy=withdrawButton]`).click();
cy.get(`[data-cy=Modal] h2:contains("Withdraw ${_shortName}")`).should('be.visible');
});
it(`Choose ${forWrapped ? 'usual token' : 'wrapped token'}`, () => {
Expand Down Expand Up @@ -390,8 +391,9 @@ export const withdrawAndSwitch = (
it(`Open Withdraw and Switch modal for ${_shortNameFrom}`, () => {
cy.doSwitchToDashboardSupplyView();
cy.getDashBoardSuppliedRow(_shortNameFrom, isCollateralFromAsset)
.find(`button:contains("Withdraw")`)
.find(`[data-cy=suppliedExtraActionsButton]`)
.click();
cy.get(`[data-cy=withdrawButton]`).click();

cy.get(`[data-cy=Modal] h2:contains("Withdraw ${_shortNameFrom}")`).should('be.visible');

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"dependencies": {
"@aave-dao/aave-address-book": "^4.55.6",
"@aave/contract-helpers": "1.38.0",
"@aave/graphql": "0.14.0",
"@aave/graphql": "0.0.0-preview-20261202161753",
"@aave/math-utils": "1.38.0",
"@aave/react": "0.11.0",
"@aave/react": "0.0.0-preview-20261202161753",
"@amplitude/analytics-browser": "^2.13.0",
"@cowprotocol/cow-sdk": "9.2.7",
"@cowprotocol/sdk-ethers-v5-adapter": "0.4.11",
Expand Down
7 changes: 7 additions & 0 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ const CollateralSwapModal = dynamic(() =>
)
);

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

const DebtSwapModal = dynamic(() =>
import('src/components/transactions/Swap/modals/DebtSwapModal').then(
(module) => module.DebtSwapModal
Expand Down Expand Up @@ -195,6 +201,7 @@ export default function MyApp(props: MyAppProps) {
{/* Swap Modals */}
<SwapModal />
<CollateralSwapModal />
<LeverageModal />
<DebtSwapModal />
<CancelCowOrderModal />
<CowOrderToast />
Expand Down
71 changes: 36 additions & 35 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/components/transactions/AmountInputRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ interface AmountInputRowProps {
maxValue?: string;
onChange?: (value: string) => void;
onClear?: () => void;
/** Shown in place of the amount field, for a row that only picks a token. */
label?: ReactNode;
children: ReactNode;
}

Expand All @@ -80,10 +82,13 @@ export const AmountInputRow = ({
maxValue,
onChange,
onClear,
label,
children,
}: AmountInputRowProps) => (
<Box sx={{ display: 'flex', alignItems: 'center', gap: '0.75rem' }}>
{loading ? (
{label !== undefined ? (
<Box sx={{ flex: 1, minWidth: 0 }}>{label}</Box>
) : loading ? (
<Box sx={amountLoadingSx}>
<CircularProgress color="inherit" size="16px" />
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { sendTransactionAndWait } from '@aave/client/viem';
import { CannotCancelOrderError, OrderId, UnexpectedError, useCancelOrder } from '@aave/react';
import { OrderStatus } from '@cowprotocol/cow-sdk';
import { Trans } from '@lingui/macro';
import { useQueryClient } from '@tanstack/react-query';
import { errAsync } from 'neverthrow';
import { useRef } from 'react';
import { useIsWrongNetwork } from 'src/hooks/useIsWrongNetwork';
import { useModalContext } from 'src/hooks/useModal';
import { useSwapOrdersTracking } from 'src/hooks/useSwapOrdersTracking';
import { useRootStore } from 'src/store/root';
import { getErrorTextFromError, TxAction } from 'src/ui-config/errorMapping';
import { queryKeysFactory } from 'src/ui-config/queries';
import { updateCowOrderStatus } from 'src/utils/swapAdapterHistory';
import { useWalletClient } from 'wagmi';
import { useShallow } from 'zustand/shallow';

import { signTypedDataWith } from '../Swap/actions/SwapActions/SwapActionsViaBackend';
import { invalidateAppStateForSwap } from '../Swap/helpers/shared';
import { SwapType } from '../Swap/types';
import { TxActionsWrapper } from '../TxActionsWrapper';

interface CancelBackendOrderActionsProps {
orderId: string;
chainId: number;
blocked: boolean;
}

/**
* Cancels an order placed through the Aave backend: the backend decides between a signed
* cancellation and an on-chain one (an eth-flow order refunds its ETH that way).
*/
export const CancelBackendOrderActions = ({
orderId,
chainId,
blocked,
}: CancelBackendOrderActionsProps) => {
const { isWrongNetwork } = useIsWrongNetwork(chainId);
const { mainTxState, loadingTxns, setMainTxState, setTxError } = useModalContext();
const { data: walletClient } = useWalletClient({ chainId });
const { stopTracking } = useSwapOrdersTracking();
const queryClient = useQueryClient();
const [account, currentMarketData] = useRootStore(
useShallow((state) => [state.account, state.currentMarketData])
);
const cancelTxHash = useRef<string>();

const [cancel] = useCancelOrder((plan) => {
if (!walletClient) return errAsync(UnexpectedError.from('Wallet not connected'));
switch (plan.__typename) {
case 'OrderTypedData':
return signTypedDataWith(walletClient, plan);
case 'TransactionRequest':
return sendTransactionAndWait(walletClient, plan).map((result) => {
cancelTxHash.current = result.txHash;
return result;
});
}
});

const action = async () => {
setMainTxState({ ...mainTxState, loading: true });
cancelTxHash.current = undefined;
const result = await cancel({ id: orderId as OrderId });
if (result.isErr()) {
console.error('Backend order cancel error', result.error);
setTxError(
result.error instanceof CannotCancelOrderError
? {
blocking: true,
actionBlocked: true,
rawError: result.error,
error: <Trans>This order was already filled or expired.</Trans>,
txAction: TxAction.MAIN_ACTION,
}
: getErrorTextFromError(result.error, TxAction.MAIN_ACTION, false)
);
setMainTxState({ txHash: undefined, loading: false });
return;
}

// The tracker would otherwise report the cancelled order as a failed swap.
stopTracking(orderId);
if (account) {
updateCowOrderStatus(chainId, account, orderId, OrderStatus.CANCELLED);
// An on-chain cancel refunds the order's funds to the wallet.
invalidateAppStateForSwap({ swapType: SwapType.Swap, chainId, account, queryClient });
}
queryClient.invalidateQueries({
queryKey: queryKeysFactory.transactionHistory(account, currentMarketData),
});
setMainTxState({ txHash: cancelTxHash.current, loading: false, success: true });
};

return (
<TxActionsWrapper
isWrongNetwork={isWrongNetwork}
handleAction={action}
actionText={<Trans>Cancel order</Trans>}
actionInProgressText={<Trans>Cancelling order...</Trans>}
blocked={blocked}
mainTxState={mainTxState}
requiresApproval={false}
preparingTransactions={loadingTxns}
/>
);
};
Loading
Loading