Cw 870 ethereum enhancements (#1951)

* fix evm balance display issues

* fix adding token

* fix tab controller issue

* Update cw_evm/lib/evm_chain_client.dart [skip ci]

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii
2025-02-17 15:12:18 +02:00
committed by GitHub
co-authored by Omar Hatem
parent f35c20203e
commit 7cc9e36016
6 changed files with 60 additions and 24 deletions
+28 -12
View File
@@ -212,15 +212,34 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
_contractAddressController.text,
);
final actionCall = () async {
await widget.homeSettingsViewModel.addToken(
token: CryptoCurrency(
name: _tokenNameController.text,
title: _tokenSymbolController.text.toUpperCase(),
decimals: int.parse(_tokenDecimalController.text),
iconPath: _tokenIconPathController.text,
),
contractAddress: _contractAddressController.text,
);
try {
await widget.homeSettingsViewModel.addToken(
token: CryptoCurrency(
name: _tokenNameController.text,
title: _tokenSymbolController.text.toUpperCase(),
decimals: int.parse(_tokenDecimalController.text),
iconPath: _tokenIconPathController.text,
),
contractAddress: _contractAddressController.text,
);
if (mounted) {
Navigator.pop(context);
}
} catch (e) {
showPopUp<void>(
context: context,
builder: (dialogContext) {
return AlertWithOneAction(
alertTitle: S.current.warning,
alertContent: e.toString(),
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(dialogContext).pop(),
);
},
);
}
};
if (hasPotentialError) {
@@ -235,9 +254,6 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
actionRightButton: () async {
Navigator.of(dialogContext).pop();
await actionCall();
if (mounted) {
Navigator.pop(context);
}
},
actionLeftButton: () => Navigator.of(dialogContext).pop(),
);
@@ -25,6 +25,7 @@ class BalancePage extends StatelessWidget {
builder: (context) {
final isEVMCompatible = isEVMCompatibleChain(dashboardViewModel.type);
return DefaultTabController(
key: ValueKey<bool>(isEVMCompatible),
length: isEVMCompatible ? 2 : 1,
child: Column(
children: [