diff --git a/lib/common/components/recent_transactions/utils.dart b/lib/common/components/recent_transactions/utils.dart index 51bd7549..2be06817 100644 --- a/lib/common/components/recent_transactions/utils.dart +++ b/lib/common/components/recent_transactions/utils.dart @@ -104,6 +104,20 @@ class RecentTransactionsUtils { currentTx.value ?? '0', Config.ethDecimals); logoUrl = Config.mxcLogoUri; symbol = Config.mxcName; + + if (currentTx.decodedInput != null) { + if (currentTx.to?.hash != null) { + final tokenIndex = tokensList + .indexWhere((element) => element.address == currentTx.to!.hash); + if (tokenIndex != -1) { + logoUrl = tokensList[tokenIndex].logoUri!; + } + symbol = currentTx.to!.name!; + amount = Formatter.convertWeiToEth( + currentTx.decodedInput?.parameters?[1].value ?? '0', + Config.ethDecimals); + } + } } else if (currentTx.txTypes != null && currentTx.txTypes!.contains('coin_transfer')) { logoUrl = Config.mxcLogoUri; diff --git a/lib/features/common/contract/token_contract_use_case.dart b/lib/features/common/contract/token_contract_use_case.dart index d1c18ccc..f12f8420 100644 --- a/lib/features/common/contract/token_contract_use_case.dart +++ b/lib/features/common/contract/token_contract_use_case.dart @@ -152,15 +152,16 @@ class TokenContractUseCase extends ReactiveUseCase { required EtherAmount amount, EstimatedGasFee? estimatedGasFee, Uint8List? data, + String? tokenAddress, }) async => await _repository.tokenContract.sendTransaction( - privateKey: privateKey, - to: to, - from: from, - amount: amount, - estimatedGasFee: estimatedGasFee, - data: data, - ); + privateKey: privateKey, + to: to, + from: from, + amount: amount, + estimatedGasFee: estimatedGasFee, + data: data, + tokenAddress: tokenAddress); Future getChainId(String rpcUrl) async { return await _repository.tokenContract.getChainId(rpcUrl); diff --git a/lib/features/portfolio/subfeatures/token/send_token/send_crypto/send_crypto_presenter.dart b/lib/features/portfolio/subfeatures/token/send_token/send_crypto/send_crypto_presenter.dart index 6678cb39..c5844e3f 100644 --- a/lib/features/portfolio/subfeatures/token/send_token/send_crypto/send_crypto_presenter.dart +++ b/lib/features/portfolio/subfeatures/token/send_token/send_crypto/send_crypto_presenter.dart @@ -168,10 +168,10 @@ class SendCryptoPresenter extends CompletePresenter { String recipientAddress = await getAddress(recipient); final res = await _tokenContractUseCase.sendTransaction( - privateKey: state.account!.privateKey, - to: recipientAddress, - amount: amount, - ); + privateKey: state.account!.privateKey, + to: recipientAddress, + amount: amount, + tokenAddress: token.address); return res; } catch (e, s) { diff --git a/pubspec.lock b/pubspec.lock index 7eeb104a..318e3e42 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -705,6 +705,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.1+4" + location: + dependency: "direct main" + description: + name: location + sha256: "9051959f6f2ccadd887b28b66e9cbbcc25b6838e37cf9e894c421ccc0ebf80b5" + url: "https://pub.dev" + source: hosted + version: "4.4.0" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "62eeaf1658e92e4459b727f55a3c328eccbac8ba043fa6d262ac5286ad48384c" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + location_web: + dependency: transitive + description: + name: location_web + sha256: "6c08c408a040534c0269c4ff9fe17eebb5a36dea16512fbaf116b9c8bc21545b" + url: "https://pub.dev" + source: hosted + version: "3.1.1" logging: dependency: transitive description: