- Fix balance display

- Fix parsing of Ethereum amount
- Add more Ethereum Nodes [skip ci]
This commit is contained in:
OmarHatem 2023-04-14 14:05:24 +02:00
parent 1ab575a325
commit c6a26cac16
5 changed files with 28 additions and 8 deletions

View file

@ -1,2 +1,12 @@
-
uri: ethereum.publicnode.com
-
uri: eth.llamarpc.com
-
uri: rpc.ankr.com/eth
-
uri: rpc.flashbots.net
-
uri: eth-mainnet.public.blastapi.io
-
uri: ethereum.publicnode.com

View file

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:math';
import 'package:cw_core/balance.dart';
import 'package:web3dart/web3dart.dart';
@ -11,10 +12,16 @@ class EthereumBalance extends Balance {
final EtherAmount balance;
@override
String get formattedAdditionalBalance => balance.getValueInUnit(EtherUnit.ether).toString();
String get formattedAdditionalBalance {
final String formattedBalance = balance.getValueInUnit(EtherUnit.ether).toString();
return formattedBalance.substring(0, min(12, formattedBalance.length));
}
@override
String get formattedAvailableBalance => balance.getValueInUnit(EtherUnit.ether).toString();
String get formattedAvailableBalance {
final String formattedBalance = balance.getValueInUnit(EtherUnit.ether).toString();
return formattedBalance.substring(0, min(12, formattedBalance.length));
}
String toJSON() => json.encode({'balanceInWei': balance.getInWei.toString()});

View file

@ -1,6 +1,6 @@
import 'package:web3dart/web3dart.dart';
import 'dart:math';
class EthereumFormatter {
static int parseEthereumAmount(String amount) =>
EtherAmount.fromUnitAndValue(EtherUnit.ether, amount).getInWei.toInt();
}
BigInt.from(double.parse(amount) * (pow(10, 18))).toInt();
}

View file

@ -115,6 +115,8 @@ PODS:
- Flutter
- flutter_secure_storage (3.3.1):
- Flutter
- in_app_review (0.2.0):
- Flutter
- local_auth_ios (0.0.1):
- Flutter
- MTBBarcodeScanner (5.0.11)
@ -163,6 +165,7 @@ DEPENDENCIES:
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_mailer (from `.symlinks/plugins/flutter_mailer/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
@ -217,6 +220,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_mailer/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
local_auth_ios:
:path: ".symlinks/plugins/local_auth_ios/ios"
package_info:
@ -255,6 +260,7 @@ SPEC CHECKSUMS:
flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c

View file

@ -1,10 +1,7 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cake_wallet/src/widgets/introducing_card.dart';