Skip to content

Commit fd5fda9

Browse files
committed
fix cancel add adapter
1 parent 9aafaf9 commit fd5fda9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/transactions/CancelCowOrder/CancelCowOrderActions.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OrderBookApi, OrderSigningUtils } from '@cowprotocol/cow-sdk';
1+
import { AdapterContext, OrderBookApi, OrderSigningUtils } from '@cowprotocol/cow-sdk';
22
import { Trans } from '@lingui/macro';
33
import { useQueryClient } from '@tanstack/react-query';
44
import { useIsWrongNetwork } from 'src/hooks/useIsWrongNetwork';
@@ -8,7 +8,7 @@ import { getErrorTextFromError, TxAction } from 'src/ui-config/errorMapping';
88
import { wagmiConfig } from 'src/ui-config/wagmiConfig';
99
import { getWalletClient } from 'wagmi/actions';
1010

11-
import { COW_ENV } from '../Swap/helpers/cow';
11+
import { COW_ENV, getCowAdapter } from '../Swap/helpers/cow';
1212
import { TxActionsWrapper } from '../TxActionsWrapper';
1313

1414
// TODO: check with cow if we can cancel adapters orders
@@ -25,8 +25,12 @@ export const CancelCowOrderActions = ({ cowOrder, blocked }: CancelCowOrderActio
2525
const action = async () => {
2626
try {
2727
setMainTxState({ ...mainTxState, loading: true });
28+
29+
const adapter = await getCowAdapter(cowOrder.chainId);
30+
AdapterContext.getInstance().setAdapter(adapter);
2831
const orderBookApi = new OrderBookApi({ chainId: cowOrder.chainId, env: COW_ENV });
2932
const walletClient = await getWalletClient(wagmiConfig, { chainId: cowOrder.chainId });
33+
3034
if (!walletClient || !walletClient.account) {
3135
throw new Error('Wallet not connected for signing');
3236
}

src/components/transactions/Swap/helpers/cow/orders.helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
import { OrderType, SwapType } from '../../types';
3131
import { getCowTradingSdkByChainIdAndAppCode } from './env.helpers';
3232

33-
export const COW_ENV: CowEnv = 'staging';
33+
export const COW_ENV: CowEnv = 'prod';
3434

3535
const EIP_2612_PERMIT_ABI = [
3636
{

0 commit comments

Comments
 (0)