From a1ef84fbe64f5e815bdfd24e4854a189720f1589 Mon Sep 17 00:00:00 2001 From: detherminal <76167420+detherminal@users.noreply.github.com> Date: Fri, 28 Jul 2023 23:00:14 +0300 Subject: [PATCH] fix stellarTestNet and dependency problems --- .../add_edit_node_view.dart | 5 +++- .../manage_nodes_views/node_details_view.dart | 2 +- lib/services/coins/coin_service.dart | 9 ++++++++ lib/themes/color_theme.dart | 2 +- lib/themes/stack_colors.dart | 2 +- lib/utilities/address_utils.dart | 2 +- lib/utilities/amount/amount_unit.dart | 2 +- lib/utilities/block_explorers.dart | 2 +- lib/utilities/constants.dart | 10 ++++---- lib/utilities/default_nodes.dart | 6 ++--- lib/utilities/enums/coin_enum.dart | 23 +++++++++++-------- .../enums/derive_path_type_enum.dart | 2 +- lib/widgets/node_card.dart | 2 +- lib/widgets/node_options_sheet.dart | 2 +- pubspec.lock | 10 ++++---- pubspec.yaml | 3 +-- 16 files changed, 49 insertions(+), 35 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index 781a566ef..4bd42f70b 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -197,7 +197,7 @@ class _AddEditNodeViewState extends ConsumerState { case Coin.nano: case Coin.banano: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: throw UnimplementedError(); //TODO: check network/node case Coin.tezos: @@ -732,11 +732,14 @@ class _NodeFormState extends ConsumerState { case Coin.namecoin: case Coin.bitcoincash: case Coin.particl: + case Coin.stellar: + case Coin.tezos: case Coin.bitcoinTestNet: case Coin.litecoinTestNet: case Coin.bitcoincashTestnet: case Coin.firoTestNet: case Coin.dogecoinTestNet: + case Coin.stellarTestNet: case Coin.epicCash: case Coin.nano: case Coin.banano: diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart index 31a9c6717..d22af6e25 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart @@ -174,7 +174,7 @@ class _NodeDetailsViewState extends ConsumerState { case Coin.banano: case Coin.tezos: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: throw UnimplementedError(); //TODO: check network/node } diff --git a/lib/services/coins/coin_service.dart b/lib/services/coins/coin_service.dart index 394ff5fc1..9ee397e0d 100644 --- a/lib/services/coins/coin_service.dart +++ b/lib/services/coins/coin_service.dart @@ -229,6 +229,15 @@ abstract class CoinServiceAPI { tracker: tracker, ); + case Coin.stellarTestNet: + return StellarWallet( + walletId: walletId, + walletName: walletName, + coin: coin, + secureStore: secureStorageInterface, + tracker: tracker, + ); + case Coin.tezos: return TezosWallet( walletId: walletId, diff --git a/lib/themes/color_theme.dart b/lib/themes/color_theme.dart index abec28d4e..0e6816dd8 100644 --- a/lib/themes/color_theme.dart +++ b/lib/themes/color_theme.dart @@ -65,7 +65,7 @@ class CoinThemeColorDefault { case Coin.particl: return particl; case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return stellar; case Coin.nano: return nano; diff --git a/lib/themes/stack_colors.dart b/lib/themes/stack_colors.dart index cbec0077a..fde5219cf 100644 --- a/lib/themes/stack_colors.dart +++ b/lib/themes/stack_colors.dart @@ -1708,7 +1708,7 @@ class StackColors extends ThemeExtension { case Coin.particl: return _coin.particl; case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return _coin.stellar; case Coin.nano: return _coin.nano; diff --git a/lib/utilities/address_utils.dart b/lib/utilities/address_utils.dart index 3fa895282..b4974d8c6 100644 --- a/lib/utilities/address_utils.dart +++ b/lib/utilities/address_utils.dart @@ -143,7 +143,7 @@ class AddressUtils { return Address.validateAddress(address, firoTestNetwork); case Coin.dogecoinTestNet: return Address.validateAddress(address, dogecointestnet); - case Coin.stellarTestnet: + case Coin.stellarTestNet: return RegExp(r"^[G][A-Z0-9]{55}$").hasMatch(address); } } diff --git a/lib/utilities/amount/amount_unit.dart b/lib/utilities/amount/amount_unit.dart index 6a646fd11..00055a0fe 100644 --- a/lib/utilities/amount/amount_unit.dart +++ b/lib/utilities/amount/amount_unit.dart @@ -51,7 +51,7 @@ enum AmountUnit { case Coin.eCash: case Coin.epicCash: case Coin.stellar: // TODO: check if this is correct - case Coin.stellarTestnet: + case Coin.stellarTestNet: case Coin.tezos: return AmountUnit.values.sublist(0, 4); diff --git a/lib/utilities/block_explorers.dart b/lib/utilities/block_explorers.dart index bb4ac06fb..ddc055fb1 100644 --- a/lib/utilities/block_explorers.dart +++ b/lib/utilities/block_explorers.dart @@ -60,7 +60,7 @@ Uri getDefaultBlockExplorerUrlFor({ return Uri.parse("https://www.nanolooker.com/block/$txid"); case Coin.banano: return Uri.parse("https://www.bananolooker.com/block/$txid"); - case Coin.stellarTestnet: + case Coin.stellarTestNet: return Uri.parse("https://testnet.stellarchain.io/transactions/$txid"); case Coin.tezos: return Uri.parse("https://tzstats.com/$txid"); diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index 1253e08f1..1bd3a5a50 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -102,7 +102,7 @@ abstract class Constants { return _satsPerCoinECash; case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return _satsPerCoinStellar; case Coin.tezos: @@ -146,7 +146,7 @@ abstract class Constants { return _decimalPlacesECash; case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return _decimalPlacesStellar; case Coin.tezos: @@ -174,7 +174,7 @@ abstract class Constants { case Coin.particl: case Coin.nano: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: values.addAll([24, 12]); break; case Coin.banano: @@ -238,7 +238,7 @@ abstract class Constants { return 1; case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return 5; case Coin.tezos: @@ -271,7 +271,7 @@ abstract class Constants { case Coin.nano: case Coin.banano: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: case Coin.tezos: return 24; diff --git a/lib/utilities/default_nodes.dart b/lib/utilities/default_nodes.dart index 7a4daf2f2..7fed3d7fd 100644 --- a/lib/utilities/default_nodes.dart +++ b/lib/utilities/default_nodes.dart @@ -292,10 +292,10 @@ abstract class DefaultNodes { host: "https://horizon-testnet.stellar.org/", port: 50022, name: defaultName, - id: _nodeId(Coin.stellarTestnet), + id: _nodeId(Coin.stellarTestNet), useSSL: true, enabled: true, - coinName: Coin.stellarTestnet.name, + coinName: Coin.stellarTestNet.name, isFailover: true, isDown: false, ); @@ -365,7 +365,7 @@ abstract class DefaultNodes { case Coin.dogecoinTestNet: return dogecoinTestnet; - case Coin.stellarTestnet: + case Coin.stellarTestNet: return stellarTestnet; } } diff --git a/lib/utilities/enums/coin_enum.dart b/lib/utilities/enums/coin_enum.dart index b62e4ea67..2e5062b6d 100644 --- a/lib/utilities/enums/coin_enum.dart +++ b/lib/utilities/enums/coin_enum.dart @@ -60,9 +60,10 @@ enum Coin { dogecoinTestNet, firoTestNet, litecoinTestNet, + stellarTestNet, } -final int kTestNetCoinCount = 4; // Util.isDesktop ? 5 : 4; +final int kTestNetCoinCount = 5; // Util.isDesktop ? 5 : 4; // remove firotestnet for now extension CoinExt on Coin { @@ -110,6 +111,8 @@ extension CoinExt on Coin { return "tFiro"; case Coin.dogecoinTestNet: return "tDogecoin"; + case Coin.stellarTestNet: + return "tStellar"; } } @@ -157,7 +160,7 @@ extension CoinExt on Coin { return "tFIRO"; case Coin.dogecoinTestNet: return "tDOGE"; - case Coin.stellarTestnet: + case Coin.stellarTestNet: return "tXLM"; } } @@ -207,7 +210,7 @@ extension CoinExt on Coin { return "firo"; case Coin.dogecoinTestNet: return "dogecoin"; - case Coin.stellarTestnet: + case Coin.stellarTestNet: return "stellar"; } } @@ -237,7 +240,7 @@ extension CoinExt on Coin { case Coin.nano: case Coin.banano: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return false; } } @@ -267,7 +270,7 @@ extension CoinExt on Coin { case Coin.nano: case Coin.banano: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return false; } } @@ -297,7 +300,7 @@ extension CoinExt on Coin { case Coin.litecoinTestNet: case Coin.bitcoincashTestnet: case Coin.firoTestNet: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return true; } } @@ -337,7 +340,7 @@ extension CoinExt on Coin { case Coin.firoTestNet: return Coin.firo; - case Coin.stellarTestnet: + case Coin.stellarTestNet: return Coin.stellar; } } @@ -380,7 +383,7 @@ extension CoinExt on Coin { return particl.MINIMUM_CONFIRMATIONS; case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: return xlm.MINIMUM_CONFIRMATIONS; case Coin.tezos: @@ -500,7 +503,7 @@ Coin coinFromPrettyName(String name) { case "Stellar Testnet": case "stellarTestnet": case "tStellar": - return Coin.stellarTestnet; + return Coin.stellarTestNet; default: throw ArgumentError.value( @@ -556,7 +559,7 @@ Coin coinFromTickerCaseInsensitive(String ticker) { case "ban": return Coin.banano; case "txlm": - return Coin.stellarTestnet; + return Coin.stellarTestNet; default: throw ArgumentError.value( ticker, "name", "No Coin enum value with that ticker"); diff --git a/lib/utilities/enums/derive_path_type_enum.dart b/lib/utilities/enums/derive_path_type_enum.dart index 5b94f41f6..f3c456f67 100644 --- a/lib/utilities/enums/derive_path_type_enum.dart +++ b/lib/utilities/enums/derive_path_type_enum.dart @@ -50,7 +50,7 @@ extension DerivePathTypeExt on DerivePathType { case Coin.nano: case Coin.banano: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: case Coin.tezos: // TODO: Is this true? throw UnsupportedError( "$coin does not use bitcoin style derivation paths"); diff --git a/lib/widgets/node_card.dart b/lib/widgets/node_card.dart index 661af4190..8d4c29ac2 100644 --- a/lib/widgets/node_card.dart +++ b/lib/widgets/node_card.dart @@ -196,7 +196,7 @@ class _NodeCardState extends ConsumerState { case Coin.banano: case Coin.tezos: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: throw UnimplementedError(); //TODO: check network/node } diff --git a/lib/widgets/node_options_sheet.dart b/lib/widgets/node_options_sheet.dart index 953ac78a1..63fd2b13e 100644 --- a/lib/widgets/node_options_sheet.dart +++ b/lib/widgets/node_options_sheet.dart @@ -179,7 +179,7 @@ class NodeOptionsSheet extends ConsumerWidget { case Coin.banano: case Coin.tezos: case Coin.stellar: - case Coin.stellarTestnet: + case Coin.stellarTestNet: throw UnimplementedError(); //TODO: check network/node } diff --git a/pubspec.lock b/pubspec.lock index 111b58d75..c01aca249 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -459,7 +459,7 @@ packages: source: hosted version: "0.6.0" dio: - dependency: "direct overridden" + dependency: transitive description: name: dio sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8" @@ -1297,10 +1297,10 @@ packages: dependency: transitive description: name: pretty_dio_logger - sha256: "00b80053063935cf9a6190da344c5373b9d0e92da4c944c878ff2fbef0ef6dc2" + sha256: "948f7eeb36e7aa0760b51c1a8e3331d4b21e36fabd39efca81f585ed93893544" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.2.0-beta-1" process: dependency: transitive description: @@ -1519,10 +1519,10 @@ packages: dependency: "direct main" description: name: stellar_flutter_sdk - sha256: "7a9b7dc76018bbd0b9c828045cf0e26e07ec44208fb1a1733273de2390205475" + sha256: "4c55b1b6dfbde7f89bba59a422754280715fa3b5726cff5e7eeaed454d2c4b89" url: "https://pub.dev" source: hosted - version: "1.6.0" + version: "1.5.3" stream_channel: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4e4a6755e..e3fa11745 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -138,7 +138,7 @@ dependencies: desktop_drop: ^0.4.1 nanodart: ^2.0.0 basic_utils: ^5.5.4 - stellar_flutter_sdk: ^1.6.0 + stellar_flutter_sdk: ^1.5.3 tezart: ^2.0.5 dev_dependencies: @@ -203,7 +203,6 @@ dependency_overrides: crypto: 3.0.2 analyzer: ^5.2.0 pinenacl: ^0.3.3 - dio : ^4.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec