Skip to content

Commit

Permalink
Merge branch 'cyjan-ios-xcframework' into cyjan-ios-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCyjaneK committed Feb 5, 2025
2 parents 78a956d + 7faa094 commit cc765cd
Show file tree
Hide file tree
Showing 70 changed files with 616 additions and 428 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automated_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
echo "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';" >> lib/.secrets.g.dart
echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const swapTradeExchangeMarkup = '${{ secrets.SWAPTRADE_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr_test_build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
echo "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';" >> lib/.secrets.g.dart
echo "const swapTradeExchangeMarkup = '${{ secrets.SWAPTRADE_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr_test_build_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
echo "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';" >> lib/.secrets.g.dart
echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const swapTradeExchangeMarkup = '${{ secrets.SWAPTRADE_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr_test_build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
echo "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';" >> lib/.secrets.g.dart
echo "const swapTradeExchangeMarkup = '${{ secrets.SWAPTRADE_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
Expand Down
Binary file modified assets/images/zano_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions assets/text/Monerocom_Release_Notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Monero restore with passphrase support
Add Chainflip Exchange provider
Added passphrase support
Added decentralized cross-chain exchange, Chainflip
UI enhancements
Bug fixes
6 changes: 3 additions & 3 deletions assets/text/Release_Notes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Add Zano Wallet
Monero/Wownero/Zano restore with passphrase support
Add Chainflip Exchange provider
Added Zano wallet support
Added Monero/Wownero passphrase support
Added decentralized cross-chain exchange, Chainflip
UI enhancements
Bug fixes
10 changes: 10 additions & 0 deletions cw_core/lib/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@ class CreateAssociatedTokenAccountException implements Exception {
class SignSPLTokenTransactionRentException implements Exception {}

class NoAssociatedTokenAccountException implements Exception {}


/// ==============================================================================
/// ==============================================================================
class RestoreFromSeedException implements Exception {
final String message;

RestoreFromSeedException(this.message);
}
7 changes: 3 additions & 4 deletions cw_monero/lib/api/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ String getSeed() {
if (cakepolyseed != "") {
if (cakepassphrase != "") {
try {
final lang = PolyseedLang.getByPhrase(cakepassphrase);
final lang = PolyseedLang.getByPhrase(cakepolyseed);
final coin = PolyseedCoin.POLYSEED_MONERO;
final ps = Polyseed.decode(cakepolyseed, lang, coin);
final passphrase = getPassphrase();
if (ps.isEncrypted || passphrase == "") return ps.encode(lang, coin);
ps.crypt(getPassphrase());
if (ps.isEncrypted || cakepassphrase == "") return ps.encode(lang, coin);
ps.crypt(cakepassphrase);
return ps.encode(lang, coin);
} catch (e) {
printV(e);
Expand Down
7 changes: 6 additions & 1 deletion cw_monero/lib/api/wallet_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void createWalletSync(
{required String path,
required String password,
required String language,
required String passphrase,
int nettype = 0}) {
txhistory = null;
final newWptr = monero.WalletManager_createWallet(wmPtr,
Expand All @@ -80,6 +81,7 @@ void createWalletSync(
throw WalletCreationException(message: monero.Wallet_errorString(newWptr));
}
wptr = newWptr;
monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase);
monero.Wallet_store(wptr!, path: path);
openedWalletsByPath[path] = wptr!;
_lastOpenedWallet = path;
Expand Down Expand Up @@ -390,8 +392,9 @@ void _createWallet(Map<String, dynamic> args) {
final path = args['path'] as String;
final password = args['password'] as String;
final language = args['language'] as String;
final passphrase = args['passphrase'] as String;

createWalletSync(path: path, password: password, language: language);
createWalletSync(path: path, password: password, language: language, passphrase: passphrase);
}

void _restoreFromSeed(Map<String, dynamic> args) {
Expand Down Expand Up @@ -459,11 +462,13 @@ Future<void> createWallet(
{required String path,
required String password,
required String language,
required String passphrase,
int nettype = 0}) async =>
_createWallet({
'path': path,
'password': password,
'language': language,
'passphrase': passphrase,
'nettype': nettype
});

Expand Down
2 changes: 1 addition & 1 deletion cw_monero/lib/monero_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
passphrase: monero_wallet.getPassphrase());

int? get restoreHeight =>
transactionHistory.transactions.values.firstOrNull?.height;
transactionHistory.transactions.values.firstOrNull?.height ?? monero.Wallet_getRefreshFromBlockHeight(wptr!);

monero_wallet.SyncListener? _listener;
ReactionDisposer? _onAccountChangeReaction;
Expand Down
11 changes: 8 additions & 3 deletions cw_monero/lib/monero_wallet_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import 'package:polyseed/polyseed.dart';

class MoneroNewWalletCredentials extends WalletCredentials {
MoneroNewWalletCredentials(
{required String name, required this.language, required this.isPolyseed, String? password})
{required String name, required this.language, required this.isPolyseed, String? password, this.passphrase})
: super(name: name, password: password);

final String language;
final bool isPolyseed;
final String? passphrase;
}

class MoneroRestoreWalletFromHardwareCredentials extends WalletCredentials {
Expand Down Expand Up @@ -92,7 +93,7 @@ class MoneroWalletService extends WalletService<
@override
WalletType getType() => WalletType.monero;

@override
@override
Future<MoneroWallet> create(MoneroNewWalletCredentials credentials, {bool? isTestnet}) async {
try {
final path = await pathForWallet(name: credentials.name, type: getType());
Expand All @@ -112,7 +113,7 @@ class MoneroWalletService extends WalletService<
}

await monero_wallet_manager.createWallet(
path: path, password: credentials.password!, language: credentials.language);
path: path, password: credentials.password!, language: credentials.language, passphrase: credentials.passphrase??"");
final wallet = MoneroWallet(
walletInfo: credentials.walletInfo!,
unspentCoinsInfo: unspentCoinsInfoSource,
Expand Down Expand Up @@ -382,6 +383,10 @@ class MoneroWalletService extends WalletService<
restoreHeight: height,
spendKey: spendKey);


monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed);
monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase??'');

final wallet = MoneroWallet(
walletInfo: walletInfo,
unspentCoinsInfo: unspentCoinsInfoSource,
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: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442
resolved-ref: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442
ref: "9301097ff504525070cc0cb915fe2f1bb0670345"
resolved-ref: "9301097ff504525070cc0cb915fe2f1bb0670345"
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion cw_monero/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442
ref: 9301097ff504525070cc0cb915fe2f1bb0670345
path: impls/monero.dart
mutex: ^3.1.0
ledger_flutter_plus: ^1.4.1
Expand Down
4 changes: 3 additions & 1 deletion cw_mweb/ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ Icon?

/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh
/Flutter/flutter_export_environment.sh

Mwebd.xcframework
3 changes: 2 additions & 1 deletion cw_mweb/ios/cw_mweb.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ A new Flutter plugin project.
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '11.0'
s.libraries = 'resolv'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
s.ios.vendored_frameworks = 'Mwebd.xcframework'
s.vendored_frameworks = 'Mwebd.xcframework'
s.preserve_paths = 'Mwebd.xcframework/**/*'

end
2 changes: 1 addition & 1 deletion cw_wownero/lib/api/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ String getSeed() {
if (cakepolyseed != "") {
if (cakepassphrase != "") {
try {
final lang = PolyseedLang.getByPhrase(cakepassphrase);
final lang = PolyseedLang.getByPhrase(cakepolyseed);
final coin = PolyseedCoin.POLYSEED_WOWNERO;
final ps = Polyseed.decode(cakepolyseed, lang, coin);
final passphrase = getPassphrase();
Expand Down
8 changes: 7 additions & 1 deletion cw_wownero/lib/api/wallet_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void createWalletSync(
{required String path,
required String password,
required String language,
required String passphrase,
int nettype = 0}) {
txhistory = null;
final newWptr = wownero.WalletManager_createWallet(wmPtr,
Expand All @@ -76,6 +77,8 @@ void createWalletSync(
throw WalletCreationException(message: wownero.Wallet_errorString(newWptr));
}
wptr = newWptr;
wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase);

wownero.Wallet_store(wptr!, path: path);
openedWalletsByPath[path] = wptr!;

Expand Down Expand Up @@ -362,8 +365,9 @@ void _createWallet(Map<String, dynamic> args) {
final path = args['path'] as String;
final password = args['password'] as String;
final language = args['language'] as String;
final passphrase = args['passphrase'] as String;

createWalletSync(path: path, password: password, language: language);
createWalletSync(path: path, password: password, language: language, passphrase: passphrase);
}

void _restoreFromSeed(Map<String, dynamic> args) {
Expand Down Expand Up @@ -431,11 +435,13 @@ Future<void> createWallet(
{required String path,
required String password,
required String language,
required String passphrase,
int nettype = 0}) async =>
_createWallet({
'path': path,
'password': password,
'language': language,
'passphrase': passphrase,
'nettype': nettype
});

Expand Down
5 changes: 5 additions & 0 deletions cw_wownero/lib/wownero_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wownero_amount_format.dart';
import 'package:cw_core/wownero_balance.dart';
import 'package:cw_wownero/api/account_list.dart';
import 'package:cw_wownero/api/coins_info.dart';
import 'package:cw_wownero/api/structs/pending_transaction.dart';
import 'package:cw_wownero/api/transaction_history.dart' as transaction_history;
Expand Down Expand Up @@ -131,6 +132,10 @@ abstract class WowneroWalletBase
publicViewKey: wownero_wallet.getPublicViewKey(),
passphrase: wownero_wallet.getPassphrase());

int? get restoreHeight =>
transactionHistory.transactions.values.firstOrNull?.height ?? wownero.Wallet_getRefreshFromBlockHeight(wptr!);


wownero_wallet.SyncListener? _listener;
ReactionDisposer? _onAccountChangeReaction;
ReactionDisposer? _onTxHistoryChangeReaction;
Expand Down
9 changes: 7 additions & 2 deletions cw_wownero/lib/wownero_wallet_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_service.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cw_core/get_height_by_date.dart';
import 'package:cw_wownero/api/account_list.dart';
import 'package:cw_wownero/api/exceptions/wallet_opening_exception.dart';
import 'package:cw_wownero/api/wallet_manager.dart' as wownero_wallet_manager;
import 'package:cw_wownero/api/wallet_manager.dart';
Expand All @@ -21,11 +22,12 @@ import 'package:monero/wownero.dart' as wownero;

class WowneroNewWalletCredentials extends WalletCredentials {
WowneroNewWalletCredentials(
{required String name, required this.language, required this.isPolyseed, String? password})
{required String name, required this.language, required this.isPolyseed, this.passphrase, String? password})
: super(name: name, password: password);

final String language;
final bool isPolyseed;
final String? passphrase;
}

class WowneroRestoreWalletFromSeedCredentials extends WalletCredentials {
Expand Down Expand Up @@ -95,7 +97,7 @@ class WowneroWalletService extends WalletService<
}

await wownero_wallet_manager.createWallet(
path: path, password: credentials.password!, language: credentials.language);
path: path, password: credentials.password!, language: credentials.language, passphrase: credentials.passphrase??'');
final wallet = WowneroWallet(
walletInfo: credentials.walletInfo!, unspentCoinsInfo: unspentCoinsInfoSource, password: credentials.password!);
await wallet.init();
Expand Down Expand Up @@ -345,6 +347,9 @@ class WowneroWalletService extends WalletService<
restoreHeight: height,
spendKey: spendKey);

wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed);
wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.passphrase", value: passphrase??'');

final wallet = WowneroWallet(walletInfo: walletInfo, unspentCoinsInfo: unspentCoinsInfoSource, password: password);
await wallet.init();

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: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442
resolved-ref: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442
ref: "9301097ff504525070cc0cb915fe2f1bb0670345"
resolved-ref: "9301097ff504525070cc0cb915fe2f1bb0670345"
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion cw_wownero/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442 # monero_c hash
ref: 9301097ff504525070cc0cb915fe2f1bb0670345 # monero_c hash
path: impls/monero.dart
mutex: ^3.1.0

Expand Down
2 changes: 1 addition & 1 deletion cw_zano/lib/zano_wallet_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ mixin ZanoWalletApi {
final code = map!['error']!['code'] ?? '';
final message = map['error']!['message'] ?? '';
if (code == Consts.errorWrongSeed) {
throw RestoreFromSeedsException('Error restoring wallet, wrong seed');
throw RestoreFromSeedsException('Error restoring wallet\nPlease check the seed words are correct. Additionally, if you created this wallet with a passphrase please add it under the Advanced Settings page.');
} else if (code == Consts.errorAlreadyExists) {
throw RestoreFromSeedsException('Error restoring wallet, already exists');
}
Expand Down
4 changes: 3 additions & 1 deletion cw_zano/lib/zano_wallet_exceptions.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:cw_core/exceptions.dart';

class ZanoWalletException implements Exception {
final String message;

Expand All @@ -6,7 +8,7 @@ class ZanoWalletException implements Exception {
String toString() => '${this.runtimeType} (message: $message)';
}

class RestoreFromSeedsException extends ZanoWalletException {
class RestoreFromSeedsException extends RestoreFromSeedException {
RestoreFromSeedsException(String message) : super(message);
}

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: "9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442"
resolved-ref: "9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442"
ref: "9301097ff504525070cc0cb915fe2f1bb0670345"
resolved-ref: "9301097ff504525070cc0cb915fe2f1bb0670345"
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion cw_zano/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: 9d619f1aaec9f0f7d9a15c31ee2bde4ff79e6442 # monero_c hash
ref: 9301097ff504525070cc0cb915fe2f1bb0670345 # monero_c hash
path: impls/monero.dart
dev_dependencies:
flutter_test:
Expand Down
1 change: 1 addition & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Runner/GeneratedPluginRegistrant.*
!default.perspectivev3

Mwebd.xcframework
*Wallet.xcframework
Binary file removed ios/MoneroWallet.framework/Info.plist
Binary file not shown.
Loading

0 comments on commit cc765cd

Please sign in to comment.