diff --git a/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.test.ts b/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.test.ts index a2323eb8..bce8c214 100644 --- a/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.test.ts +++ b/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.test.ts @@ -96,7 +96,13 @@ describe('useVaultDepositParams', () => { }) it('should return deposit params for custom token deposit when deposit token is presented in vault composition', () => { - const poolComposition = [{ tokenName: USDC_BASE.symbol, isDeposit: true }] + const poolComposition = [ + { + tokenName: USDC_BASE.symbol, + isDeposit: true, + tokenAddress: USDC_BASE.address, + }, + ] vi.mocked(useSendTokenInput).mockReturnValue([ USDC_BASE, ] as unknown as ReturnType) @@ -118,7 +124,13 @@ describe('useVaultDepositParams', () => { }) it('should return deposit params for custom token deposit when deposit token is not presented in vault composition', () => { - const poolComposition = [{ tokenName: WETH_BASE.symbol, isDeposit: true }] + const poolComposition = [ + { + tokenName: WETH_BASE.symbol, + isDeposit: true, + tokenAddress: WETH_BASE.address, + }, + ] vi.mocked(useSendTokenInput).mockReturnValue([ USDC_BASE, ] as unknown as ReturnType) diff --git a/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.ts b/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.ts index 420f5f25..89aa9aae 100644 --- a/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.ts +++ b/packages/trading-widget/src/core-kit/hooks/trading/deposit-v2/use-vault-deposit-params.ts @@ -27,13 +27,10 @@ const getVaultDepositTokenAddress = ( if (!availableDepositOptions.length) { return null } - const fallbackToken = availableDepositOptions.find( - ({ tokenName, tokenAddress }) => - Object.values(FALLBACK_ASSETS_MAP[chainId] ?? {}).some( - (fallbackToken) => - fallbackToken.symbol === tokenName || - isEqualAddress(fallbackToken.address, tokenAddress), - ), + const fallbackToken = availableDepositOptions.find(({ tokenAddress }) => + Object.values(FALLBACK_ASSETS_MAP[chainId] ?? {}).some((fallbackToken) => + isEqualAddress(fallbackToken.address, tokenAddress), + ), ) return fallbackToken?.tokenAddress ?? availableDepositOptions[0]?.tokenAddress @@ -80,9 +77,7 @@ export const useVaultDepositParams = (): VaultDepositParams => { } const depositTokenPresentedInVault = availableDepositOptions.find( - ({ tokenName, tokenAddress }) => - tokenName === sendToken.symbol || - isEqualAddress(tokenAddress, sendToken.address), + ({ tokenAddress }) => isEqualAddress(tokenAddress, sendToken.address), ) // Step 2: Check if the token is presented in the vault