Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Zano (Android and iOS) #1661

Merged
merged 64 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
70b1241
my experiments
LeoBlackCat Oct 2, 2023
f6485d9
Inital code for Zano integration
LeoBlackCat Oct 13, 2023
7a00a5d
Added missing android log lib
LeoBlackCat Oct 13, 2023
219f43a
added dummy wallet & some zano implementation
LeoBlackCat Oct 15, 2023
a260d0a
fixing api for zano
LeoBlackCat Oct 25, 2023
d5f84fe
fixed zano build script
LeoBlackCat Oct 26, 2023
6d7f2be
attempt tp fix namespace problem
LeoBlackCat Oct 26, 2023
9265651
added copy script for Zano files
LeoBlackCat Oct 26, 2023
58e5059
changes for zano wallet
LeoBlackCat Oct 31, 2023
dda6d4c
last updates
LeoBlackCat Nov 17, 2023
2d886e1
zano.dart test app
LeoBlackCat Dec 2, 2023
8d3dd6f
wallet recovery
LeoBlackCat Dec 14, 2023
3eaec03
added pending transfer, some cleanup of unused
LeoBlackCat Dec 16, 2023
df984ca
some cleanup
LeoBlackCat Dec 16, 2023
e4c775b
send + receive qr code
LeoBlackCat Dec 16, 2023
1418679
last upd
LeoBlackCat Jan 8, 2024
20cf071
updated build_zano.sh
LeoBlackCat Mar 5, 2024
00a5bd9
updated zano ApiCalls, removed dummy
LeoBlackCat Mar 6, 2024
3c2953a
updated zano ApiCalls, removed dummy
LeoBlackCat Mar 6, 2024
e1da71a
added logging for get status/get info
LeoBlackCat Mar 6, 2024
7fcdc8c
restored old wallet.dart
LeoBlackCat Mar 6, 2024
b3e453a
restoring original versions of files
LeoBlackCat Mar 7, 2024
d684be6
restoring original versions of files
LeoBlackCat Mar 7, 2024
b585da5
restored get_height_by_date.dart, removed unnecessary calls for zano …
LeoBlackCat Mar 7, 2024
ba2dde7
restoring original versions
LeoBlackCat Mar 7, 2024
43e9cd2
added multiple destinations, send all flag; some refactoring
LeoBlackCat Mar 8, 2024
9228d91
logging
LeoBlackCat Mar 8, 2024
75f1f3f
removed the duplicate
LeoBlackCat Mar 9, 2024
23485a4
fixed syncing sync status, decimal division, safe null json parsing
LeoBlackCat Mar 10, 2024
26e3a6c
merge with latest cakewallet to leofork
LeoBlackCat Mar 10, 2024
ce95229
some fixes after merge
LeoBlackCat Mar 10, 2024
5699230
added multibalance/asset support for zano (ui)
LeoBlackCat Mar 14, 2024
b2b6578
adding/removing from whitelist
LeoBlackCat Mar 15, 2024
c74a114
transfers in different assets
LeoBlackCat Mar 16, 2024
5af75aa
transfers for multiple destinations and send all, some refactoring
LeoBlackCat Mar 18, 2024
662aba5
whitelists, some refactoring
LeoBlackCat Mar 19, 2024
9d9fe4a
added different digits (decimal points) for formatters, some refactoring
LeoBlackCat Mar 20, 2024
42731fc
open, create, restore wallet refactoring; whitelists
LeoBlackCat Apr 3, 2024
89b572c
whitelists
LeoBlackCat Apr 6, 2024
54a522a
getting and updating transaction list; restoring a wallet from QR code
LeoBlackCat Apr 9, 2024
9f93cb3
several attempts to close wallet
LeoBlackCat Apr 9, 2024
0a6f162
some refactoring
LeoBlackCat Apr 9, 2024
e02f088
added seed phrase
LeoBlackCat Apr 10, 2024
82f6b15
resolve conflicts and merge
LeoBlackCat Aug 3, 2024
e7b29c0
Merge branch 'cake-tech:main' into main
LeoBlackCat Aug 3, 2024
02bfe64
changed fields to BigInt, some fixes
LeoBlackCat Aug 7, 2024
a6b6a54
Merge branch 'cake-tech:main' into main
LeoBlackCat Aug 7, 2024
8c7d87b
modified build scripts for android
LeoBlackCat Aug 7, 2024
52410b6
Merge branch 'cake-tech:main' into main
LeoBlackCat Aug 8, 2024
9c6ddba
build scripts
LeoBlackCat Aug 10, 2024
261da43
Merge branch 'main' of https://github.com/hyle-team/zano_cake_wallet …
LeoBlackCat Aug 10, 2024
7474291
restored accidently removed cw_haven.dart
LeoBlackCat Aug 13, 2024
b210dfe
inital ios integration(zano libs built)
cryptozoidberg Aug 14, 2024
18d0547
update in script
cryptozoidberg Aug 14, 2024
2dbea9b
latest changes
cryptozoidberg Aug 16, 2024
f7474b9
Applied a patch for iOS build (Boost and Zano scripts)
LeoBlackCat Sep 1, 2024
367c863
Removed zano.dart (script-generated) and some unnecessary files
LeoBlackCat Sep 2, 2024
d5e9530
Revert "Removed zano.dart (script-generated) and some unnecessary files"
LeoBlackCat Sep 2, 2024
bf8e884
Removed zano.dart (generated by scripts), some files restored to init…
LeoBlackCat Sep 2, 2024
2c83de3
added timer library
LeoBlackCat Oct 22, 2024
956c469
changed paths in build_zano.sh
LeoBlackCat Oct 23, 2024
91a063a
build_zano.sh
LeoBlackCat Oct 23, 2024
cda4a38
edit_token_page.dart - removed flag skipZanoAddressValidation
LeoBlackCat Oct 26, 2024
3caca5c
lib/core/address_validator.dart - updated zano address regex
LeoBlackCat Oct 27, 2024
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ cw_shared_external/ios/External/
cw_haven/ios/External/
cw_haven/android/.externalNativeBuild/
cw_haven/android/.cxx/

cw_zano/ios/External/
lib/bitcoin/bitcoin.dart
lib/monero/monero.dart
lib/haven/haven.dart
Expand All @@ -137,6 +137,7 @@ lib/polygon/polygon.dart
lib/solana/solana.dart
lib/tron/tron.dart
lib/wownero/wownero.dart
lib/zano/zano.dart

ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png
Expand Down
Binary file added 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: 4 additions & 0 deletions assets/zano_node_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-
uri: zano.org
is_default: true
useSSL: true
16 changes: 16 additions & 0 deletions cw_bitcoin/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.3"
decimal:
dependency: transitive
description:
name: decimal
sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
encrypt:
dependency: transitive
description:
Expand Down Expand Up @@ -712,6 +720,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.2.1"
rational:
dependency: transitive
description:
name: rational
sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336
url: "https://pub.dev"
source: hosted
version: "2.2.3"
reactive_ble_mobile:
dependency: transitive
description:
Expand Down
10 changes: 10 additions & 0 deletions cw_core/lib/amount_converter.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:decimal/decimal.dart';
import 'package:decimal/intl.dart';
import 'package:intl/intl.dart';
import 'package:cw_core/crypto_currency.dart';

Expand Down Expand Up @@ -43,6 +45,8 @@ class AmountConverter {
case CryptoCurrency.xnzd:
case CryptoCurrency.xusd:
return _moneroAmountToString(amount);
case CryptoCurrency.zano:
return _moneroAmountToStringUsingDecimals(amount);
default:
return '';
}
Expand All @@ -59,4 +63,10 @@ class AmountConverter {

static String _wowneroAmountToString(int amount) => _wowneroAmountFormat
.format(cryptoAmountToDouble(amount: amount, divider: _wowneroAmountDivider));

static Decimal cryptoAmountToDecimal({required int amount, required int divider}) =>
(Decimal.fromInt(amount) / Decimal.fromInt(divider)).toDecimal();

static String _moneroAmountToStringUsingDecimals(int amount) => _moneroAmountFormat.format(
DecimalIntl(cryptoAmountToDecimal(amount: amount, divider: _moneroAmountDivider)));
}
4 changes: 3 additions & 1 deletion cw_core/lib/crypto_currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
CryptoCurrency.usdcTrc20,
CryptoCurrency.tbtc,
CryptoCurrency.wow,
CryptoCurrency.zano,
];

static const havenCurrencies = [
Expand Down Expand Up @@ -223,7 +224,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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the raw value should increased as it acts like an id for the object, so we can't have 2 similar ids



static final Map<int, CryptoCurrency> _rawCurrencyMap =
[...all, ...havenCurrencies].fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
Expand Down
3 changes: 3 additions & 0 deletions cw_core/lib/currency_for_wallet_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ CryptoCurrency currencyForWalletType(WalletType type, {bool? isTestnet}) {
return CryptoCurrency.trx;
case WalletType.wownero:
return CryptoCurrency.wow;
case WalletType.zano:
return CryptoCurrency.zano;
case WalletType.none:
throw Exception(

'Unexpected wallet type: ${type.toString()} for CryptoCurrency currencyForWalletType');
}
}
2 changes: 2 additions & 0 deletions cw_core/lib/hive_type_ids.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ const SPL_TOKEN_TYPE_ID = 16;
const DERIVATION_INFO_TYPE_ID = 17;
const TRON_TOKEN_TYPE_ID = 18;
const HARDWARE_WALLET_TYPE_TYPE_ID = 19;
const ZANO_ASSET_TYPE_ID = 20;

9 changes: 9 additions & 0 deletions cw_core/lib/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class Node extends HiveObject with Keyable {
case WalletType.solana:
case WalletType.tron:
return Uri.https(uriRaw, path ?? '');
case WalletType.zano:
return Uri.https(uriRaw, '');
case WalletType.none:
throw Exception('Unexpected type ${type.toString()} for Node uri');
}
Expand Down Expand Up @@ -157,6 +159,8 @@ class Node extends HiveObject with Keyable {
case WalletType.solana:
case WalletType.tron:
return requestElectrumServer();
case WalletType.zano:
return requestZanoNode();
case WalletType.none:
return false;
}
Expand All @@ -165,6 +169,11 @@ class Node extends HiveObject with Keyable {
}
}

Future<bool> requestZanoNode() async {
// TODO: fix it
return true;
}
Comment on lines +172 to +175
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a normal get request should suffice here I believe


Future<bool> requestMoneroNode() async {
if (uri.toString().contains(".onion") || useSocksProxy) {
return await requestNodeWithProxy();
Expand Down
18 changes: 17 additions & 1 deletion cw_core/lib/wallet_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const walletTypes = [
WalletType.polygon,
WalletType.solana,
WalletType.tron,
WalletType.zano,
];

@HiveType(typeId: WALLET_TYPE_TYPE_ID)
Expand Down Expand Up @@ -58,6 +59,10 @@ enum WalletType {

@HiveField(12)
wownero,

@HiveField(13)
zano,

}

int serializeToInt(WalletType type) {
Expand Down Expand Up @@ -86,6 +91,8 @@ int serializeToInt(WalletType type) {
return 10;
case WalletType.wownero:
return 11;
case WalletType.zano:
return 12;
case WalletType.none:
return -1;
}
Expand Down Expand Up @@ -117,8 +124,11 @@ WalletType deserializeFromInt(int raw) {
return WalletType.tron;
case 11:
return WalletType.wownero;
case 12:
return WalletType.zano;
default:
throw Exception('Unexpected token: $raw for WalletType deserializeFromInt');
throw Exception(
'Unexpected token: $raw for WalletType deserializeFromInt');
}
}

Expand Down Expand Up @@ -148,6 +158,8 @@ String walletTypeToString(WalletType type) {
return 'Tron';
case WalletType.wownero:
return 'Wownero';
case WalletType.zano:
return 'Zano';
case WalletType.none:
return '';
}
Expand Down Expand Up @@ -179,6 +191,8 @@ String walletTypeToDisplayName(WalletType type) {
return 'Tron (TRX)';
case WalletType.wownero:
return 'Wownero (WOW)';
case WalletType.zano:
return 'Zano (ZANO)';
case WalletType.none:
return '';
}
Expand Down Expand Up @@ -213,6 +227,8 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type, {bool isTestnet = fal
return CryptoCurrency.trx;
case WalletType.wownero:
return CryptoCurrency.wow;
case WalletType.zano:
return CryptoCurrency.zano;
case WalletType.none:
throw Exception(
'Unexpected wallet type: ${type.toString()} for CryptoCurrency walletTypeToCryptoCurrency');
Expand Down
16 changes: 16 additions & 0 deletions cw_core/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.4"
decimal:
dependency: "direct main"
description:
name: decimal
sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
encrypt:
dependency: "direct main"
description:
Expand Down Expand Up @@ -539,6 +547,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.3"
rational:
dependency: transitive
description:
name: rational
sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf
url: "https://pub.dev"
source: hosted
version: "2.2.2"
shelf:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions cw_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
flutter_mobx: ^2.0.6+1
intl: ^0.18.0
encrypt: ^5.0.1
decimal: ^2.3.3
socks5_proxy: ^1.0.4
unorm_dart: ^0.3.0
# tor:
Expand Down
16 changes: 16 additions & 0 deletions cw_haven/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.4"
decimal:
dependency: transitive
description:
name: decimal
sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
encrypt:
dependency: transitive
description:
Expand Down Expand Up @@ -538,6 +546,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.1"
rational:
dependency: transitive
description:
name: rational
sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf
url: "https://pub.dev"
source: hosted
version: "2.2.2"
shelf:
dependency: transitive
description:
Expand Down
16 changes: 16 additions & 0 deletions cw_monero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.4"
decimal:
dependency: transitive
description:
name: decimal
sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
encrypt:
dependency: "direct main"
description:
Expand Down Expand Up @@ -579,6 +587,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.1"
rational:
dependency: transitive
description:
name: rational
sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf
url: "https://pub.dev"
source: hosted
version: "2.2.2"
shelf:
dependency: transitive
description:
Expand Down
16 changes: 16 additions & 0 deletions cw_wownero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.4"
decimal:
dependency: transitive
description:
name: decimal
sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
encrypt:
dependency: "direct main"
description:
Expand Down Expand Up @@ -579,6 +587,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.1"
rational:
dependency: transitive
description:
name: rational
sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336
url: "https://pub.dev"
source: hosted
version: "2.2.3"
shelf:
dependency: transitive
description:
Expand Down
7 changes: 7 additions & 0 deletions cw_zano/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.dart_tool/

.packages
.pub/

build/
10 changes: 10 additions & 0 deletions cw_zano/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 4d7946a68d26794349189cf21b3f68cc6fe61dcb
channel: stable

project_type: plugin
3 changes: 3 additions & 0 deletions cw_zano/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions cw_zano/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
15 changes: 15 additions & 0 deletions cw_zano/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# cw_zano

A new flutter plugin project.

## Getting Started

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

9 changes: 9 additions & 0 deletions cw_zano/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx/
Loading