diff --git a/crypto_plugins/flutter_libepiccash b/crypto_plugins/flutter_libepiccash index 238455f2b..25e6cb3a3 160000 --- a/crypto_plugins/flutter_libepiccash +++ b/crypto_plugins/flutter_libepiccash @@ -1 +1 @@ -Subproject commit 238455f2b3fe39564cc617ed0ea45f22971aa644 +Subproject commit 25e6cb3a3e7bee04e425af6beccb47e8d0708fdb diff --git a/crypto_plugins/frostdart b/crypto_plugins/frostdart index f111cdf18..6f1310ecc 160000 --- a/crypto_plugins/frostdart +++ b/crypto_plugins/frostdart @@ -1 +1 @@ -Subproject commit f111cdf183bec1c71c2b20cf265d3879a81f7903 +Subproject commit 6f1310eccd336fb3c8dc00b61e39a3f0f3a2b59a diff --git a/docs/building.md b/docs/building.md index 14109e627..4ba1b7150 100644 --- a/docs/building.md +++ b/docs/building.md @@ -13,12 +13,12 @@ Here you will find instructions on how to install the necessary tools for buildi The following instructions are for building and running on a Linux host. Alternatively, see the [Mac](#mac-host) and/or [Windows](#windows-host) section. This entire section (except for the Android Studio section) needs to be completed in WSL if building on a Windows host. ### Flutter -Install Flutter 3.29.0 by [following their guide](https://docs.flutter.dev/get-started/install/linux/desktop?tab=download#install-the-flutter-sdk). You can also clone https://github.com/flutter/flutter, check out the `3.29.0` tag, and add its `flutter/bin` folder to your PATH as in +Install Flutter 3.29.2 by [following their guide](https://docs.flutter.dev/get-started/install/linux/desktop?tab=download#install-the-flutter-sdk). You can also clone https://github.com/flutter/flutter, check out the `3.29.2` tag, and add its `flutter/bin` folder to your PATH as in ```sh FLUTTER_DIR="$HOME/development/flutter" git clone https://github.com/flutter/flutter.git "$FLUTTER_DIR" cd "$FLUTTER_DIR" -git checkout 3.29.0 +git checkout 3.29.2 echo 'export PATH="$PATH:'"$FLUTTER_DIR"'/bin"' >> "$HOME/.profile" source "$HOME/.profile" flutter precache @@ -38,7 +38,7 @@ Use `Tools > SDK Manager` to install: - `SDK Tools > Android SDK command line tools` - `SDK Tools > CMake` and for Android builds, - - `SDK Tools > Android SDK (API 30)` + - `SDK Tools > Android SDK (API 35)` - `SDK Tools > NDK` Then in `File > Settings > Plugins`, install the **Flutter** and **Dart** plugins and restart the IDE. In `File > Settings > Languages & Frameworks > Flutter > Editor`, enable auto format on save to match the project's code style. If you have problems with the Dart SDK, make sure to run `flutter` in a terminal to download it (use `source ~/.bashrc` to update your environment variables if you're still using the same terminal from which you ran `setup.sh`). Run `flutter doctor` to install any missing dependencies and review and agree to any license agreements. @@ -68,13 +68,13 @@ sudo apt install pipx libgcrypt20-dev libglib2.0-dev libsecret-1-dev pipx install meson==0.64.1 markdown==3.4.1 markupsafe==2.1.1 jinja2==3.1.2 pygments==2.13.0 toml==0.10.2 typogrify==2.0.7 tomli==2.0.1 ``` -Install [Rust](https://www.rust-lang.org/tools/install) via [rustup.rs](https://rustup.rs), the required Rust toolchains, and `cargo-ndk 2.12.7` with command: +Install [Rust](https://www.rust-lang.org/tools/install) via [rustup.rs](https://rustup.rs), the required Rust toolchains, and `cargo-ndk` with command: ``` curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.bashrc rustup install 1.85.1 1.81.0 rustup default 1.85.1 -cargo install cargo-ndk --version 2.12.7 --locked +cargo install cargo-ndk ``` Android specific dependencies: @@ -215,7 +215,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.bashrc rustup install 1.85.1 1.81.0 rustup default 1.85.1 -cargo install cargo-ndk --version 2.12.7 --locked +cargo install cargo-ndk cargo install cbindgen cargo-lipo rustup target add aarch64-apple-ios aarch64-apple-darwin ``` @@ -223,7 +223,7 @@ rustup target add aarch64-apple-ios aarch64-apple-darwin Optionally download [Android Studio](https://developer.android.com/studio) as an IDE and activate its Dart and Flutter plugins. VS Code may work as an alternative, but this is not recommended. ### Flutter -Install [Flutter](https://docs.flutter.dev/get-started/install) 3.29.0 on your Mac host by following [these instructions](https://docs.flutter.dev/get-started/install/macos). Run `flutter doctor` in a terminal to confirm its installation. +Install [Flutter](https://docs.flutter.dev/get-started/install) 3.29.2 on your Mac host by following [these instructions](https://docs.flutter.dev/get-started/install/macos). Run `flutter doctor` in a terminal to confirm its installation. ### Build plugins and configure #### Building plugins for iOS @@ -290,13 +290,13 @@ If the DLLs were built on the WSL filesystem instead of on Windows, copy the res Frostdart will be built by the Windows host later. ### Install Flutter on Windows host -Install Flutter 3.29.0 on your Windows host (not in WSL2) by [following their guide](https://docs.flutter.dev/get-started/install/windows/desktop?tab=download#install-the-flutter-sdk) or by cloning https://github.com/flutter/flutter, checking out the `3.29.0` tag, and adding its `flutter/bin` folder to your PATH as in +Install Flutter 3.29.2 on your Windows host (not in WSL2) by [following their guide](https://docs.flutter.dev/get-started/install/windows/desktop?tab=download#install-the-flutter-sdk) or by cloning https://github.com/flutter/flutter, checking out the `3.29.2` tag, and adding its `flutter/bin` folder to your PATH as in ```bat @echo off set "FLUTTER_DIR=%USERPROFILE%\development\flutter" git clone https://github.com/flutter/flutter.git "%FLUTTER_DIR%" cd /d "%FLUTTER_DIR%" -git checkout 3.29.0 +git checkout 3.29.2 setx PATH "%PATH%;%FLUTTER_DIR%\bin" echo Flutter setup completed. Please restart your command prompt. ``` @@ -308,7 +308,7 @@ Install [Rust](https://www.rust-lang.org/tools/install) on the Windows host (not ``` rustup install 1.85.1 1.81.0 rustup default 1.85.1 -cargo install cargo-ndk --version 2.12.7 --locked +cargo install cargo-ndk ``` ### Windows SDK and Developer Mode diff --git a/lib/services/exchange/nanswap/api_response_models/n_currency.dart b/lib/services/exchange/nanswap/api_response_models/n_currency.dart index 87f42de12..35b01e87e 100644 --- a/lib/services/exchange/nanswap/api_response_models/n_currency.dart +++ b/lib/services/exchange/nanswap/api_response_models/n_currency.dart @@ -4,7 +4,7 @@ class NCurrency { final String name; final String image; final String network; - final bool hasExternalId; + final bool? hasExternalId; final bool feeLess; NCurrency({ @@ -24,7 +24,7 @@ class NCurrency { name: json['name'] as String, image: json['image'] as String, network: json['network'] as String, - hasExternalId: json['hasExternalId'] as bool, + hasExternalId: json['hasExternalId'] as bool?, feeLess: json['feeless'] as bool, ); } diff --git a/lib/services/exchange/nanswap/nanswap_api.dart b/lib/services/exchange/nanswap/nanswap_api.dart index 7d2465530..6e2848586 100644 --- a/lib/services/exchange/nanswap/nanswap_api.dart +++ b/lib/services/exchange/nanswap/nanswap_api.dart @@ -33,12 +33,11 @@ class NanswapAPI { try { final response = await _client.get( url: uri, - headers: { - 'Accept': 'application/json', - }, - proxyInfo: Prefs.instance.useTor - ? TorService.sharedInstance.getProxyInfo() - : null, + headers: {'Accept': 'application/json'}, + proxyInfo: + Prefs.instance.useTor + ? TorService.sharedInstance.getProxyInfo() + : null, ); code = response.code; @@ -56,10 +55,7 @@ class NanswapAPI { } } - Future<dynamic> _makePostRequest( - Uri uri, - Map<String, dynamic> body, - ) async { + Future<dynamic> _makePostRequest(Uri uri, Map<String, dynamic> body) async { int code = -1; try { final response = await _client.post( @@ -70,9 +66,10 @@ class NanswapAPI { 'Accept': 'application/json', }, body: jsonEncode(body), - proxyInfo: Prefs.instance.useTor - ? TorService.sharedInstance.getProxyInfo() - : null, + proxyInfo: + Prefs.instance.useTor + ? TorService.sharedInstance.getProxyInfo() + : null, ); code = response.code; @@ -117,9 +114,7 @@ class NanswapAPI { // // application/json Future<ExchangeResponse<List<NCurrency>>> getSupportedCurrencies() async { - final uri = _buildUri( - endpoint: "all-currencies", - ); + final uri = _buildUri(endpoint: "all-currencies"); try { final json = await _makeGetRequest(uri); @@ -128,11 +123,7 @@ class NanswapAPI { for (final key in (json as Map).keys) { final _map = json[key] as Map; _map["id"] = key; - result.add( - NCurrency.fromJson( - Map<String, dynamic>.from(_map), - ), - ); + result.add(NCurrency.fromJson(Map<String, dynamic>.from(_map))); } return ExchangeResponse(value: result); @@ -196,11 +187,7 @@ class NanswapAPI { map["to"] ??= to.toUpperCase(); map["from"] ??= from.toUpperCase(); - return ExchangeResponse( - value: NEstimate.fromJson( - map, - ), - ); + return ExchangeResponse(value: NEstimate.fromJson(map)); } catch (e, s) { Logging.instance.e( "Nanswap.getEstimate() response was: $json", @@ -270,11 +257,7 @@ class NanswapAPI { map["to"] ??= to.toUpperCase(); map["from"] ??= from.toUpperCase(); - return ExchangeResponse( - value: NEstimate.fromJson( - map, - ), - ); + return ExchangeResponse(value: NEstimate.fromJson(map)); } catch (e, s) { Logging.instance.e( "Nanswap.getEstimateReverse() exception: ", @@ -312,20 +295,14 @@ class NanswapAPI { }) async { final uri = _buildUri( endpoint: "get-limits", - params: { - "to": to.toUpperCase(), - "from": from.toUpperCase(), - }, + params: {"to": to.toUpperCase(), "from": from.toUpperCase()}, ); try { final json = await _makeGetRequest(uri); return ExchangeResponse( - value: ( - minFrom: json["min"] as num, - maxFrom: json["max"] as num, - ), + value: (minFrom: json["min"] as num, maxFrom: json["max"] as num), ); } catch (e, s) { Logging.instance.e( @@ -397,9 +374,7 @@ class NanswapAPI { required String toAddress, String? extraIdOrMemo, }) async { - final uri = _buildUri( - endpoint: "create-order", - ); + final uri = _buildUri(endpoint: "create-order"); final body = { "from": from.toUpperCase(), @@ -417,9 +392,7 @@ class NanswapAPI { try { return ExchangeResponse( - value: NTrade.fromJson( - Map<String, dynamic>.from(json as Map), - ), + value: NTrade.fromJson(Map<String, dynamic>.from(json as Map)), ); } catch (_) { debugPrint(json.toString()); @@ -489,21 +462,14 @@ class NanswapAPI { // // The order id Future<ExchangeResponse<NTrade>> getOrder({required String id}) async { - final uri = _buildUri( - endpoint: "get-order", - params: { - "id": id, - }, - ); + final uri = _buildUri(endpoint: "get-order", params: {"id": id}); try { final json = await _makeGetRequest(uri); try { return ExchangeResponse( - value: NTrade.fromJson( - Map<String, dynamic>.from(json as Map), - ), + value: NTrade.fromJson(Map<String, dynamic>.from(json as Map)), ); } catch (_) { debugPrint(json.toString()); diff --git a/lib/wallets/wallet/impl/xelis_wallet.dart b/lib/wallets/wallet/impl/xelis_wallet.dart index 72094fcf4..bcbf09f4c 100644 --- a/lib/wallets/wallet/impl/xelis_wallet.dart +++ b/lib/wallets/wallet/impl/xelis_wallet.dart @@ -361,12 +361,22 @@ class XelisWallet extends LibXelisWallet { await libXelisWallet!.rescan(topoheight: BigInt.from(pruningHeight)); } - final txList = objTransactions ?? - (await libXelisWallet!.allHistory()) - .map((jsonStr) => xelis_sdk.TransactionEntry.fromJson( - json.decode(jsonStr), - ) as xelis_sdk.TransactionEntry) - .toList(); + xelis_sdk.TransactionEntry _checkDecodeJsonStringTxEntry( + String jsonString, + ) { + final json = jsonDecode(jsonString); + if (json is Map) { + return xelis_sdk.TransactionEntry.fromJson(json.cast()); + } + + throw Exception("Not a Map on jsonDecode($jsonString)"); + } + + final txList = + objTransactions ?? + (await libXelisWallet!.allHistory()) + .map(_checkDecodeJsonStringTxEntry) + .toList(); final List<TransactionV2> txns = [];