Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #58 from MXCzkEVM/pre_main_qa
Browse files Browse the repository at this point in the history
fix: Token transfer & pending info
  • Loading branch information
reasje authored Sep 18, 2023
2 parents 58f9339 + 3c2be9c commit 3e2d1ce
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 11 deletions.
14 changes: 14 additions & 0 deletions lib/common/components/recent_transactions/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 8 additions & 7 deletions lib/features/common/contract/token_contract_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> getChainId(String rpcUrl) async {
return await _repository.tokenContract.getChainId(rpcUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ class SendCryptoPresenter extends CompletePresenter<SendCryptoState> {
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) {
Expand Down
24 changes: 24 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3e2d1ce

Please sign in to comment.