Skip to content

Commit 4703522

Browse files
artursapekkev1n-peters
authored andcommittedFeb 28, 2025
stop using supportedSourceTokens method
1 parent fe6c771 commit 4703522

File tree

4 files changed

+2
-132
lines changed

4 files changed

+2
-132
lines changed
 

‎wormhole-connect/src/hooks/useComputeSourceTokens.ts

-88
This file was deleted.

‎wormhole-connect/src/routes/operator.ts

-17
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
import '@wormhole-foundation/sdk-definitions-ntt';
2121
import '@wormhole-foundation/sdk-evm-ntt';
2222
import '@wormhole-foundation/sdk-solana-ntt';
23-
import { maybeLogSdkError } from 'utils/errors';
2423

2524
export interface TxInfo {
2625
route: string;
@@ -155,22 +154,6 @@ export default class RouteOperator {
155154
return Array.from(supported);
156155
}
157156

158-
async allSupportedSourceTokens(sourceChain?: Chain): Promise<Token[]> {
159-
const supported: { [key: string]: Token } = {};
160-
await this.forEach(async (_name, route) => {
161-
try {
162-
const sourceTokens = await route.supportedSourceTokens(sourceChain);
163-
164-
for (const token of sourceTokens) {
165-
supported[token.key] = token;
166-
}
167-
} catch (e) {
168-
maybeLogSdkError(e);
169-
}
170-
});
171-
return Object.values(supported);
172-
}
173-
174157
async allSupportedDestTokens(
175158
sourceToken: Token | undefined,
176159
sourceChain: Chain,

‎wormhole-connect/src/store/transferInput.ts

-9
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ export interface TransferInputState {
8181
};
8282
isTransactionInProgress: boolean;
8383
receiverNativeBalance: string | undefined;
84-
supportedSourceTokens: TokenTuple[];
8584
}
8685

8786
// This is a function because config might have changed since we last cleared this store
@@ -127,7 +126,6 @@ function getInitialState(): TransferInputState {
127126
},
128127
isTransactionInProgress: false,
129128
receiverNativeBalance: '',
130-
supportedSourceTokens: [],
131129
};
132130
}
133131

@@ -303,12 +301,6 @@ export const transferInputSlice = createSlice({
303301
) => {
304302
state.isTransactionInProgress = payload;
305303
},
306-
setSupportedSourceTokens: (
307-
state: TransferInputState,
308-
{ payload }: PayloadAction<TokenTuple[]>,
309-
) => {
310-
state.supportedSourceTokens = payload;
311-
},
312304
swapInputs: (state: TransferInputState) => {
313305
const tmpChain = state.fromChain;
314306
state.fromChain = state.toChain;
@@ -386,7 +378,6 @@ export const {
386378
updateBalances,
387379
clearTransfer,
388380
setIsTransactionInProgress,
389-
setSupportedSourceTokens,
390381
swapInputs,
391382
} = transferInputSlice.actions;
392383

‎wormhole-connect/src/views/v2/Bridge/index.tsx

+2-18
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Button from 'components/v2/Button';
2121
import config from 'config';
2222
import useFetchSupportedRoutes from 'hooks/useFetchSupportedRoutes';
2323
import useComputeDestinationTokens from 'hooks/useComputeDestinationTokens';
24-
import useComputeSourceTokens from 'hooks/useComputeSourceTokens';
2524
import { useSortedRoutesWithQuotes } from 'hooks/useSortedRoutesWithQuotes';
2625
import { useAmountValidation } from 'hooks/useAmountValidation';
2726
import useConfirmTransaction from 'hooks/useConfirmTransaction';
@@ -128,7 +127,6 @@ const Bridge = () => {
128127
toChain: destChain,
129128
route,
130129
preferredRouteName,
131-
supportedSourceTokens,
132130
amount,
133131
validations,
134132
isTransactionInProgress,
@@ -144,16 +142,6 @@ const Bridge = () => {
144142
isFetching: isFetchingQuotes,
145143
} = useSortedRoutesWithQuotes();
146144

147-
// Compute and set source tokens
148-
const { isFetching: isFetchingSupportedSourceTokens } =
149-
useComputeSourceTokens({
150-
sourceChain,
151-
destChain,
152-
sourceToken,
153-
destToken,
154-
route,
155-
});
156-
157145
// Compute and set destination tokens
158146
const { isFetching: isFetchingSupportedDestTokens, supportedDestTokens } =
159147
useComputeDestinationTokens({
@@ -311,9 +299,7 @@ const Bridge = () => {
311299
chainList={supportedSourceChains}
312300
token={sourceToken}
313301
tokenList={sourceTokens}
314-
isFetching={
315-
sourceTokens.length === 0 && isFetchingSupportedSourceTokens
316-
}
302+
isFetching={false}
317303
setChain={(value: Chain) => {
318304
selectFromChain(dispatch, value, sendingWallet);
319305
}}
@@ -335,8 +321,6 @@ const Bridge = () => {
335321
sourceToken,
336322
sourceTokens,
337323
lastTokenCacheUpdate,
338-
supportedSourceTokens,
339-
isFetchingSupportedSourceTokens,
340324
isTransactionInProgress,
341325
sendingWallet,
342326
dispatch,
@@ -594,7 +578,7 @@ const Bridge = () => {
594578
{destAssetPicker}
595579
<AmountInput
596580
sourceChain={sourceChain}
597-
supportedSourceTokens={config.tokens.getList(supportedSourceTokens)}
581+
supportedSourceTokens={sourceTokens}
598582
tokenBalance={sourceToken ? balances[sourceToken.key]?.balance : null}
599583
isFetchingTokenBalance={isFetchingBalances}
600584
error={amountValidation.error}

0 commit comments

Comments
 (0)