Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crypto_plugins/flutter_libepiccash
2 changes: 1 addition & 1 deletion crypto_plugins/frostdart
20 changes: 10 additions & 10 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -215,15 +215,15 @@ 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
```

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
Expand Down Expand Up @@ -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.
```
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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,
);
}
Expand Down
74 changes: 20 additions & 54 deletions lib/services/exchange/nanswap/nanswap_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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: ",
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(),
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
22 changes: 16 additions & 6 deletions lib/wallets/wallet/impl/xelis_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
Loading