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

Stop using supportedSourceTokens method #3198

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
88 changes: 0 additions & 88 deletions wormhole-connect/src/hooks/useComputeSourceTokens.ts

This file was deleted.

17 changes: 0 additions & 17 deletions wormhole-connect/src/routes/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
import '@wormhole-foundation/sdk-definitions-ntt';
import '@wormhole-foundation/sdk-evm-ntt';
import '@wormhole-foundation/sdk-solana-ntt';
import { maybeLogSdkError } from 'utils/errors';

export interface TxInfo {
route: string;
Expand Down Expand Up @@ -155,22 +154,6 @@ export default class RouteOperator {
return Array.from(supported);
}

async allSupportedSourceTokens(sourceChain?: Chain): Promise<Token[]> {
const supported: { [key: string]: Token } = {};
await this.forEach(async (_name, route) => {
try {
const sourceTokens = await route.supportedSourceTokens(sourceChain);

for (const token of sourceTokens) {
supported[token.key] = token;
}
} catch (e) {
maybeLogSdkError(e);
}
});
return Object.values(supported);
}

async allSupportedDestTokens(
sourceToken: Token | undefined,
sourceChain: Chain,
Expand Down
9 changes: 0 additions & 9 deletions wormhole-connect/src/store/transferInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export interface TransferInputState {
};
isTransactionInProgress: boolean;
receiverNativeBalance: string | undefined;
supportedSourceTokens: TokenTuple[];
}

// This is a function because config might have changed since we last cleared this store
Expand Down Expand Up @@ -122,7 +121,6 @@ function getInitialState(): TransferInputState {
},
isTransactionInProgress: false,
receiverNativeBalance: '',
supportedSourceTokens: [],
};
}

Expand Down Expand Up @@ -298,12 +296,6 @@ export const transferInputSlice = createSlice({
) => {
state.isTransactionInProgress = payload;
},
setSupportedSourceTokens: (
state: TransferInputState,
{ payload }: PayloadAction<TokenTuple[]>,
) => {
state.supportedSourceTokens = payload;
},
swapInputs: (state: TransferInputState) => {
const tmpChain = state.fromChain;
state.fromChain = state.toChain;
Expand Down Expand Up @@ -381,7 +373,6 @@ export const {
updateBalances,
clearTransfer,
setIsTransactionInProgress,
setSupportedSourceTokens,
swapInputs,
} = transferInputSlice.actions;

Expand Down
20 changes: 2 additions & 18 deletions wormhole-connect/src/views/v2/Bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Header, { Alignment } from 'components/Header';
import FooterNavBar from 'components/FooterNavBar';
import useFetchSupportedRoutes from 'hooks/useFetchSupportedRoutes';
import useComputeDestinationTokens from 'hooks/useComputeDestinationTokens';
import useComputeSourceTokens from 'hooks/useComputeSourceTokens';
import { setRoute as setAppRoute } from 'store/router';
import {
selectFromChain,
Expand Down Expand Up @@ -125,7 +124,6 @@ const Bridge = () => {
toChain: destChain,
route,
preferredRouteName,
supportedSourceTokens,
amount,
validations,
} = useSelector((state: RootState) => state.transferInput);
Expand All @@ -140,16 +138,6 @@ const Bridge = () => {
isFetching: isFetchingQuotes,
} = useSortedRoutesWithQuotes();

// Compute and set source tokens
const { isFetching: isFetchingSupportedSourceTokens } =
useComputeSourceTokens({
sourceChain,
destChain,
sourceToken,
destToken,
route: selectedRoute,
});

// Compute and set destination tokens
const { isFetching: isFetchingSupportedDestTokens, supportedDestTokens } =
useComputeDestinationTokens({
Expand Down Expand Up @@ -299,9 +287,7 @@ const Bridge = () => {
chainList={supportedSourceChains}
token={sourceToken}
tokenList={sourceTokens}
isFetching={
sourceTokens.length === 0 && isFetchingSupportedSourceTokens
}
isFetching={false}
setChain={(value: Chain) => {
selectFromChain(dispatch, value, sendingWallet);
}}
Expand All @@ -320,9 +306,7 @@ const Bridge = () => {
sourceToken,
sourceTokens,
lastTokenCacheUpdate,
supportedSourceTokens,
sendingWallet,
isFetchingSupportedSourceTokens,
]);

// Asset picker for the destination network and token
Expand Down Expand Up @@ -480,7 +464,7 @@ const Bridge = () => {
{destAssetPicker}
<AmountInput
sourceChain={sourceChain}
supportedSourceTokens={config.tokens.getList(supportedSourceTokens)}
supportedSourceTokens={sourceTokens}
tokenBalance={sourceToken ? balances[sourceToken.key]?.balance : null}
isFetchingTokenBalance={isFetchingBalances}
error={amountValidation.error}
Expand Down
Loading