Skip to content

Commit

Permalink
Changes from review [run tests]
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCyjaneK committed Jan 17, 2025
1 parent d64971c commit 3d7e4a2
Show file tree
Hide file tree
Showing 29 changed files with 46 additions and 203 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,5 @@ scripts/monero_c
# iOS generated framework bin
ios/MoneroWallet.framework/MoneroWallet
ios/WowneroWallet.framework/WowneroWallet
ios/ZanoWallet.framework/ZanoWallet
*_libwallet2_api_c.dylib
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ analyzer:
lib/solana/cw_solana.dart,
lib/tron/cw_tron.dart,
lib/wownero/cw_wownero.dart,
lib/zano/cw_wownero.dart,
lib/zano/cw_zano.dart,
]
language:
strict-casts: true
Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifestBase.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
<data android:scheme="wownero" />
<data android:scheme="wownero-wallet" />
<data android:scheme="wownero_wallet" />
<data android:scheme="zano" />
<data android:scheme="zano-wallet" />
<data android:scheme="zano_wallet" />
</intent-filter>
<!-- nano-gpt link scheme -->
<intent-filter android:autoVerify="true">
Expand Down
2 changes: 1 addition & 1 deletion cw_core/lib/crypto_currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
static const usdcTrc20 = CryptoCurrency(title: 'USDC', tag: 'TRX', fullName: 'USDC Coin', raw: 92, name: 'usdctrc20', iconPath: 'assets/images/usdc_icon.png', decimals: 6);
static const tbtc = CryptoCurrency(title: 'tBTC', fullName: 'Testnet Bitcoin', raw: 93, name: 'tbtc', iconPath: 'assets/images/tbtc.png', decimals: 8);
static const wow = CryptoCurrency(title: 'WOW', fullName: 'Wownero', raw: 94, name: 'wow', iconPath: 'assets/images/wownero_icon.png', decimals: 11);
static const zano = CryptoCurrency(title: 'ZANO', tag: 'ZANO', fullName: 'Zano', raw: 94, name: 'zano', iconPath: 'assets/images/zano_icon.png', decimals: 12);
static const ton = CryptoCurrency(title: 'TON', fullName: 'Toncoin', raw: 95, name: 'ton', iconPath: 'assets/images/ton_icon.png', decimals: 8);
static const zano = CryptoCurrency(title: 'ZANO', tag: 'ZANO', fullName: 'Zano', raw: 96, name: 'zano', iconPath: 'assets/images/zano_icon.png', decimals: 12);

static final Map<int, CryptoCurrency> _rawCurrencyMap =
[...all, ...havenCurrencies].fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
Expand Down
7 changes: 3 additions & 4 deletions cw_core/lib/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,17 @@ class Node extends HiveObject with Keyable {
}

Future<bool> requestZanoNode() async {
// TODO: fix it
return true;
return requestMoneroNode(methodName: "getinfo");
}

Future<bool> requestMoneroNode() async {
Future<bool> requestMoneroNode({String methodName = "get_info"}) async {
if (uri.toString().contains(".onion") || useSocksProxy) {
return await requestNodeWithProxy();
}
final path = '/json_rpc';
final rpcUri = isSSL ? Uri.https(uri.authority, path) : Uri.http(uri.authority, path);
final realm = 'monero-rpc';
final body = {'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'};
final body = {'jsonrpc': '2.0', 'id': '0', 'method': methodName};

try {
final authenticatingClient = HttpClient();
Expand Down
4 changes: 2 additions & 2 deletions cw_monero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ packages:
dependency: "direct main"
description:
path: "impls/monero.dart"
ref: "c3dd64bdee37d361a2c1252d127fb575936e43e6"
resolved-ref: "c3dd64bdee37d361a2c1252d127fb575936e43e6"
ref: c3dd64bdee37d361a2c1252d127fb575936e43e6
resolved-ref: c3dd64bdee37d361a2c1252d127fb575936e43e6
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
4 changes: 2 additions & 2 deletions cw_wownero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ packages:
dependency: "direct main"
description:
path: "impls/monero.dart"
ref: "c3dd64bdee37d361a2c1252d127fb575936e43e6"
resolved-ref: "c3dd64bdee37d361a2c1252d127fb575936e43e6"
ref: c3dd64bdee37d361a2c1252d127fb575936e43e6
resolved-ref: c3dd64bdee37d361a2c1252d127fb575936e43e6
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
1 change: 1 addition & 0 deletions cw_zano/lib/zano_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ abstract class ZanoWalletBase extends WalletBase<ZanoBalance, ZanoTransactionHis
_isTransactionUpdating = true;
final transactions = await fetchTransactions();
if (transactions.length == transactionHistory.transactions.length) {
_isTransactionUpdating = false;
return;
}
transactionHistory.clear();
Expand Down
4 changes: 2 additions & 2 deletions cw_zano/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ packages:
dependency: "direct main"
description:
path: "impls/monero.dart"
ref: "c3dd64bdee37d361a2c1252d127fb575936e43e6"
resolved-ref: "c3dd64bdee37d361a2c1252d127fb575936e43e6"
ref: c3dd64bdee37d361a2c1252d127fb575936e43e6
resolved-ref: c3dd64bdee37d361a2c1252d127fb575936e43e6
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 0 additions & 2 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ Runner/GeneratedPluginRegistrant.*
!default.perspectivev3

Mwebd.xcframework
ZanoWallet
zano_libwallet2_api_c.dylib
2 changes: 1 addition & 1 deletion lib/core/address_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AddressValidator extends TextValidator {
: LitecoinNetwork.mainnet,
)
: type == CryptoCurrency.zano
? zano!.validateAddress
? zano?.validateAddress
: null,
pattern: getPattern(type),
length: getLength(type));
Expand Down
2 changes: 1 addition & 1 deletion lib/entities/default_settings_migration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ Future<void> defaultSettingsMigration(
oldUri: ['rpc.ankr.com'],
);
break;
case 46:
case 48:
await _fixNodesUseSSLFlag(nodes);
await updateWalletTypeNodesWithNewNode(
newNodeUri: 'litecoin.stackwallet.com:20063',
Expand Down
16 changes: 15 additions & 1 deletion lib/src/screens/dashboard/edit_token_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,21 @@ class _EditTokenPageBodyState extends State<EditTokenPageBody> {
},
);
} else {
await actionCall();
try {
await actionCall();
} catch (e) {
showPopUp<void>(
context: context,
builder: (dialogContext) {
return AlertWithOneAction(
alertTitle: "Unable to add token",
alertContent: "$e",
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop(),
);
},
);
}
if (mounted) {
Navigator.pop(context);
}
Expand Down
23 changes: 0 additions & 23 deletions lib/view_model/dashboard/home_settings_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,29 +117,6 @@ abstract class HomeSettingsViewModelBase with Store {
isAddingToken = false;
}

if (_balanceViewModel.wallet.type == WalletType.polygon) {
final polygonToken = Erc20Token(
name: token.name,
symbol: token.title,
decimal: token.decimals,
contractAddress: contractAddress,
iconPath: token.iconPath,
);
await polygon!.addErc20Token(_balanceViewModel.wallet, polygonToken);
}

if (_balanceViewModel.wallet.type == WalletType.solana) {
await solana!.addSPLToken(
_balanceViewModel.wallet,
token,
contractAddress,
);
}

if (_balanceViewModel.wallet.type == WalletType.tron) {
await tron!.addTronToken(_balanceViewModel.wallet, token, contractAddress);
}

if (_balanceViewModel.wallet.type == WalletType.zano) {
await zano!.addZanoAssetById(_balanceViewModel.wallet, contractAddress);
}
Expand Down
9 changes: 3 additions & 6 deletions lib/view_model/exchange/exchange_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
case WalletType.monero:
case WalletType.wownero:
case WalletType.haven:
case WalletType.zano:
return transactionPriority == monero!.getMoneroTransactionPrioritySlow();
case WalletType.bitcoin:
return transactionPriority == bitcoin!.getBitcoinTransactionPrioritySlow();
Expand All @@ -319,8 +320,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
return transactionPriority == bitcoinCash!.getBitcoinCashTransactionPrioritySlow();
case WalletType.polygon:
return transactionPriority == polygon!.getPolygonTransactionPrioritySlow();
case WalletType.zano:
return transactionPriority == monero!.getMoneroTransactionPrioritySlow();
default:
return false;
}
Expand Down Expand Up @@ -751,7 +750,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
break;
case WalletType.zano:
depositCurrency = CryptoCurrency.zano;
receiveCurrency = CryptoCurrency.btc;
receiveCurrency = CryptoCurrency.xmr;
break;
case WalletType.none:
break;
Expand Down Expand Up @@ -827,6 +826,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
case WalletType.monero:
case WalletType.haven:
case WalletType.wownero:
case WalletType.zano:
_settingsStore.priority[wallet.type] = monero!.getMoneroTransactionPriorityAutomatic();
break;
case WalletType.bitcoin:
Expand All @@ -844,9 +844,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
case WalletType.polygon:
_settingsStore.priority[wallet.type] = polygon!.getDefaultTransactionPriority();
break;
case WalletType.zano:
_settingsStore.priority[wallet.type] = monero!.getMoneroTransactionPriorityAutomatic();
break;
default:
break;
}
Expand Down
4 changes: 0 additions & 4 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <devicelocale/devicelocale_plugin.h>
#include <flutter_local_authentication/flutter_local_authentication_plugin.h>
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
Expand All @@ -18,9 +17,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_local_authentication_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterLocalAuthenticationPlugin");
flutter_local_authentication_plugin_register_with_registrar(flutter_local_authentication_registrar);
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
Expand Down
2 changes: 1 addition & 1 deletion linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
list(APPEND FLUTTER_PLUGIN_LIST
devicelocale
flutter_local_authentication
flutter_secure_storage_linux
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
sp_scanner
)

set(PLUGIN_BUNDLED_LIBRARIES)
Expand Down
2 changes: 0 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import devicelocale
import fast_scanner
import flutter_inappwebview_macos
import flutter_local_authentication
import flutter_secure_storage_macos
import in_app_review
import package_info_plus
import path_provider_foundation
Expand All @@ -30,7 +29,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
FlutterLocalAuthenticationPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalAuthenticationPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
99 changes: 0 additions & 99 deletions scripts/android/build_zano.sh

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/android/build_zano_all.sh

This file was deleted.

1 change: 0 additions & 1 deletion scripts/android/copy_monero_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ mkdir -p ${CW_MONERO_EXTERNAL_DIR}/include
mkdir -p ${CW_ZANO_EXTERNAL_DIR}/include

cp $CW_EXRTERNAL_DIR/x86/include/haven/wallet2_api.h ${CW_HAVEN_EXTERNAL_DIR}/include
# cp $CW_EXRTERNAL_DIR/x86/include/zano/wallet2_api.h ${CW_ZANO_EXTERNAL_DIR}/include
Loading

0 comments on commit 3d7e4a2

Please sign in to comment.