From f63ada2547c991511d8d1239e3605297692211d4 Mon Sep 17 00:00:00 2001 From: Michal Vanek Date: Fri, 15 Mar 2024 10:52:01 +0100 Subject: [PATCH] fix(coinmarket): Fix fetching all contract txs for solana --- .../SendCryptoInput/SendCryptoSelect/index.tsx | 4 +++- .../SellForm/Inputs/CryptoInput/index.tsx | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/suite/src/views/wallet/coinmarket/exchange/components/ExchangeForm/Inputs/SendCryptoInput/SendCryptoSelect/index.tsx b/packages/suite/src/views/wallet/coinmarket/exchange/components/ExchangeForm/Inputs/SendCryptoInput/SendCryptoSelect/index.tsx index 41c26fb114e..7d0ad1a3a45 100644 --- a/packages/suite/src/views/wallet/coinmarket/exchange/components/ExchangeForm/Inputs/SendCryptoInput/SendCryptoSelect/index.tsx +++ b/packages/suite/src/views/wallet/coinmarket/exchange/components/ExchangeForm/Inputs/SendCryptoInput/SendCryptoSelect/index.tsx @@ -67,7 +67,9 @@ const SendCryptoSelect = () => { const tokenData = tokens?.find(t => t.symbol === invitySymbol); if (ethereumTypeNetworkSymbols.includes(token)) { setValue(CRYPTO_TOKEN, null); - // set own account for non ERC20 transaction + setValue('outputs.0.address', account.descriptor); + } else if (symbol === 'sol') { + setValue(CRYPTO_TOKEN, tokenData?.contract ?? null); setValue('outputs.0.address', account.descriptor); } else { // set the address of the token to the output diff --git a/packages/suite/src/views/wallet/coinmarket/sell/components/SellForm/Inputs/CryptoInput/index.tsx b/packages/suite/src/views/wallet/coinmarket/sell/components/SellForm/Inputs/CryptoInput/index.tsx index b6e6cb75387..b188a609cee 100644 --- a/packages/suite/src/views/wallet/coinmarket/sell/components/SellForm/Inputs/CryptoInput/index.tsx +++ b/packages/suite/src/views/wallet/coinmarket/sell/components/SellForm/Inputs/CryptoInput/index.tsx @@ -72,7 +72,7 @@ const CryptoInput = () => { cryptoSymbol, }; - const { tokens } = account; + const { symbol, tokens } = account; const cryptoInputRules = { validate: { @@ -113,18 +113,20 @@ const CryptoInput = () => { setValue(CRYPTO_INPUT, ''); setValue(FIAT_INPUT, ''); const token = selected.value; + const invitySymbol = invityApiSymbolToSymbol(token).toLowerCase(); + const tokenData = tokens?.find( + t => + t.symbol === invitySymbol && + t.contract === selected.token?.contract, + ); if (ethereumTypeNetworkSymbols.includes(token)) { setValue(CRYPTO_TOKEN, null); - // set own account for non ERC20 transaction + setValue('outputs.0.address', account.descriptor); + } else if (symbol === 'sol') { + setValue(CRYPTO_TOKEN, tokenData?.contract ?? null); setValue('outputs.0.address', account.descriptor); } else { // set the address of the token to the output - const symbol = invityApiSymbolToSymbol(token).toLowerCase(); - const tokenData = tokens?.find( - t => - t.symbol === symbol && - t.contract === selected.token?.contract, - ); setValue(CRYPTO_TOKEN, tokenData?.contract ?? null); // set token address for ERC20 transaction to estimate the fees more precisely setValue('outputs.0.address', tokenData?.contract ?? '');