Ywallet zcash (#2810)

* feat(zcash): initial commit
- initial work on cw_zcash
  - use single .db for everything zcash to speed up sync and scanning
  - implement silent autoshielding of non-orchard funds
  - use FFI for everything to fetch the data
  - add support for passphrase by adding extra word to seed phrase
  - enforce lints on CI for cw_zcash directory
- use correct zcash name, and call transparent zcash tZEC
- minor cleanups outsite of cw_zcash
  - gitmodules, gitignore
  - db debug
  - fix broken addressPageType in WalletInfo
  - enable debug options in kDebugMode and kProfileMode

* feat: T address rotation (and cache) wip: minor fixes

* wip: shield tx list

* fix fiat amounts fix derrivation of rotation account addresses screen
for zcash block height fix T address shields improvements Amount in
disposable T shields UI improvements
show pending outgoing tx in tx history

* fix null check on passphrase page fix tx showing as pending rename auto
shield txs fixed send all to include fee use rotating address in
addressForExchange wrap all calls of WarpApi.getLatestHeight in try
catch to prevent leaking errors

other minor fixes from notion

* wallet group debug cache sent tx address wallet T address rotation fixes
automatically pick the fee for auto-shield

* fix T address cache deserialization fix autoshield icon fix autoshield
text getCachedDestinationAddress fix send address cache

* address comments from review

* wip: iOS fix

* fix swap

* Allow cakepay payment from zcash wallet

* fix: ios (I'm stupid) fix: reorder addresses to make orchard default
fix: send all balance

* 5.6.6 bump fix: ios apple review add transport error to ignored
exceptions

* fix: leaving dust behind when sweeping all

* Change wallets order

* fix: reflect balance of pending out txs fix: restore height support

* linux support (disabled)

* fix: date picker for zcash on restore screen fix: build script for linux
match WarpApi.warpSync args with upstream

* fix: linter script

* ensure all exchange providers support ZEC (#2802)

* ensure all exchange providers support ZEC

* remove zaddr and tzec currencies and refactor providers

* Update lib/exchange/provider/near_Intents_exchange_provider.dart

* add back old zcash currencies for backward compatibility, thanks Czarek

* minor fix [skip ci]

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

* Update android/app/src/main/AndroidManifestBase.xml [skip ci]

* Update ios/Runner/InfoBase.plist [skip ci]

* fix: remove unused code fix: macos fix: disable on linux and macos

* update build numbers [skip ci]

* Add zcash to birdpay

---------

Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: Serhii <borodenko.sv@gmail.com>
This commit is contained in:
Omar Hatem
2026-01-16 03:16:41 +01:00
committed by GitHub
co-authored by Czarek Nakamoto Serhii
parent 2a77d359f1
commit ef9b0fbae6
141 changed files with 5664 additions and 284 deletions
@@ -16,10 +16,8 @@ import 'package:cw_core/utils/proxy_wrapper.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class ChainflipExchangeProvider extends ExchangeProvider {
ChainflipExchangeProvider({required this.tradesStore})
: super(pairList: supportedPairs(_notSupported));
ChainflipExchangeProvider({required this.tradesStore});
static final List<CryptoCurrency> _notSupported = [];
static final List<CryptoCurrency> _supported = [
CryptoCurrency.btc,
CryptoCurrency.eth,
@@ -21,13 +21,8 @@ import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class ChangeNowExchangeProvider extends ExchangeProvider {
ChangeNowExchangeProvider({required SettingsStore settingsStore})
: _settingsStore = settingsStore,
_lastUsedRateId = '',
super(pairList: supportedPairs(_notSupported));
_lastUsedRateId = '';
static const List<CryptoCurrency> _notSupported = [
CryptoCurrency.zaddr,
CryptoCurrency.xhv,
];
static final apiKey =
isMoneroOnly ? secrets.changeNowMoneroApiKey : secrets.changeNowCakeWalletApiKey;
+1 -3
View File
@@ -6,12 +6,10 @@ import 'package:cake_wallet/exchange/trade_request.dart';
import 'package:cw_core/crypto_currency.dart';
abstract class ExchangeProvider {
ExchangeProvider({required this.pairList});
ExchangeProvider();
String get title;
List<ExchangePair> pairList;
ExchangeProviderDescription get description;
bool get isAvailable;
@@ -16,33 +16,13 @@ import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class ExolixExchangeProvider extends ExchangeProvider {
ExolixExchangeProvider() : super(pairList: supportedPairs(_notSupported));
ExolixExchangeProvider();
static final apiKey = isMoneroOnly ? secrets.exolixMoneroApiKey : secrets.exolixCakeWalletApiKey;
static const apiBaseUrl = 'exolix.com';
static const transactionsPath = '/api/v2/transactions';
static const ratePath = '/api/v2/rate';
static const List<CryptoCurrency> _notSupported = [
CryptoCurrency.usdt,
CryptoCurrency.xhv,
CryptoCurrency.btt,
CryptoCurrency.firo,
CryptoCurrency.zaddr,
CryptoCurrency.xvg,
CryptoCurrency.kmd,
CryptoCurrency.paxg,
CryptoCurrency.rune,
CryptoCurrency.scrt,
CryptoCurrency.btcln,
CryptoCurrency.cro,
CryptoCurrency.ftm,
CryptoCurrency.frax,
CryptoCurrency.gusd,
CryptoCurrency.gtc,
CryptoCurrency.weth,
];
@override
String get title => 'Exolix';
@@ -16,9 +16,7 @@ import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class LetsExchangeExchangeProvider extends ExchangeProvider {
LetsExchangeExchangeProvider() : super(pairList: supportedPairs(_notSupported));
static const List<CryptoCurrency> _notSupported = [];
LetsExchangeExchangeProvider();
static const apiKey = secrets.letsExchangeBearerToken;
static const _baseUrl = 'api.letsexchange.io';
@@ -17,10 +17,7 @@ import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class NearIntentsExchangeProvider extends ExchangeProvider {
NearIntentsExchangeProvider()
: super(pairList: supportedPairs(_notSupported));
static const List<CryptoCurrency> _notSupported = [];
NearIntentsExchangeProvider();
static const apiKey = secrets.nearIntentsBearerToken;
static const _baseUrl = '1click.chaindefuser.com';
@@ -44,7 +41,6 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
// UTXO
'LTC': 'ltc1qhdwz74m3wuuhppv2mckagqk9e2e49z5j4kucnv',
'BTC': 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kygt080',
'ZZEC': 't1Zcash4hPS2bq8rTQkN9bKpZV1X4W3pZxK',
'DOGE': 'D9t7rGQ9mE3hJ2z1w8pGQxkGmKjYwYc8pQ',
'BCH': 'qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a',
@@ -63,6 +59,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
'TON': 'UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
'XLM': 'GA3D5O2W7YQZJQ3H4Y5QW6N7V8X9Z0A1B2C3D4E5F6G7H8I9J0',
'ADA': 'addr1vyc33hdv5vag52f3d8h0qsngu52vm27x28zkzru333jma9gaxd38v',
'ZEC': 't1VdfFUbyTT7ZSdeEaHuwB7veGD1NXoUhGS',
};
String getNearDummyAddress(CryptoCurrency currency) {
@@ -430,8 +427,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
try {
final uri = Uri.https(_baseUrl, '$_versionPath$_tokenPath');
final response =
await ProxyWrapper().get(clearnetUri: uri, headers: _headers);
final response = await ProxyWrapper().get(clearnetUri: uri, headers: _headers);
if (response.statusCode != 200) return [];
final data = json.decode(response.body) as List<dynamic>;
@@ -532,14 +528,6 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
};
}
String _normalizeTitleToNearSymbol(CryptoCurrency currency) {
final title = currency.title.toUpperCase();
return switch (title) {
'TZEC' => 'ZEC',
_ => title,
};
}
String? _normalizeTagToNearBlockchain(String? tag) {
return switch (tag) {
'TRX' => 'tron',
@@ -559,7 +547,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
Token? currencyToNearAssetId(CryptoCurrency currency, List<Token> supported) {
if (supported.isEmpty) return null;
final symbol = _normalizeTitleToNearSymbol(currency).toUpperCase();
final symbol = currency.title.toUpperCase();
final blockchain = _normalizeTagToNearBlockchain(currency.tag);
// Native asset (no contract)
@@ -16,23 +16,7 @@ import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class SideShiftExchangeProvider extends ExchangeProvider {
SideShiftExchangeProvider() : super(pairList: supportedPairs(_notSupported));
static const List<CryptoCurrency> _notSupported = [
CryptoCurrency.xhv,
CryptoCurrency.dcr,
CryptoCurrency.kmd,
CryptoCurrency.oxt,
CryptoCurrency.pivx,
CryptoCurrency.rune,
CryptoCurrency.rvn,
CryptoCurrency.scrt,
CryptoCurrency.stx,
CryptoCurrency.bttc,
CryptoCurrency.usdt,
CryptoCurrency.eos,
CryptoCurrency.xmr,
];
SideShiftExchangeProvider();
static const affiliateId = secrets.sideShiftAffiliateId;
static const apiBaseUrl = 'https://sideshift.ai/api';
@@ -16,12 +16,8 @@ import 'package:cw_core/crypto_currency.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class SimpleSwapExchangeProvider extends ExchangeProvider {
SimpleSwapExchangeProvider() : super(pairList: supportedPairs(_notSupported));
SimpleSwapExchangeProvider();
static const List<CryptoCurrency> _notSupported = [
CryptoCurrency.zaddr,
CryptoCurrency.xhv,
];
static final apiKey =
DeviceInfo.instance.isMobile ? secrets.simpleSwapApiKey : secrets.simpleSwapApiKeyDesktop;
@@ -347,8 +343,6 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
static String _normalizeCurrency(CryptoCurrency currency) {
switch (currency) {
case CryptoCurrency.zaddr:
return 'zec';
case CryptoCurrency.zec:
return 'zec';
case CryptoCurrency.bnb:
@@ -15,9 +15,7 @@ import 'package:cw_core/crypto_currency.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class StealthExExchangeProvider extends ExchangeProvider {
StealthExExchangeProvider() : super(pairList: supportedPairs(_notSupported));
static const List<CryptoCurrency> _notSupported = [];
StealthExExchangeProvider();
static final apiKey = secrets.stealthExBearerToken;
static final _additionalFeePercent = double.tryParse(secrets.stealthExAdditionalFeePercent);
@@ -15,9 +15,7 @@ import 'package:cw_core/utils/proxy_wrapper.dart';
import 'package:cw_core/crypto_currency.dart';
class SwapsXyzExchangeProvider extends ExchangeProvider {
SwapsXyzExchangeProvider() : super(pairList: supportedPairs(_notSupported));
static const List<CryptoCurrency> _notSupported = [];
SwapsXyzExchangeProvider();
static final _apiKey = secrets.swapsXyzApiKey;
static const _baseUrl = 'api-v2.swaps.xyz';
@@ -16,25 +16,7 @@ import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class SwapTradeExchangeProvider extends ExchangeProvider {
SwapTradeExchangeProvider() : super(pairList: supportedPairs(_notSupported));
static final List<CryptoCurrency> _notSupported = [
...(CryptoCurrency.all
.where((element) => ![
CryptoCurrency.btc,
CryptoCurrency.sol,
CryptoCurrency.eth,
CryptoCurrency.ltc,
CryptoCurrency.ada,
CryptoCurrency.bch,
CryptoCurrency.usdterc20,
CryptoCurrency.usdttrc20,
CryptoCurrency.bnb,
CryptoCurrency.xmr,
CryptoCurrency.zec,
].contains(element))
.toList())
];
SwapTradeExchangeProvider();
static final markup = secrets.swapTradeExchangeMarkup;
@@ -220,8 +202,11 @@ class SwapTradeExchangeProvider extends ExchangeProvider {
final responseBody = json.decode(response.body) as Map<String, dynamic>;
if (response.statusCode == 400 || responseBody["success"] == false) {
final error = responseBody['errors'][0]['msg'] as String;
final List<dynamic> errorsList = responseBody['errors'] as List? ?? [];
final error = errorsList.isNotEmpty
? (errorsList[0]['msg'] as String?) ?? responseBody.toString()
: responseBody.toString();
ExchangeProviderLogger.logError(
provider: description,
function: 'createTrade',
@@ -14,26 +14,7 @@ import 'package:hive/hive.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class ThorChainExchangeProvider extends ExchangeProvider {
ThorChainExchangeProvider({required this.tradesStore})
: super(pairList: supportedPairs(_notSupported));
static final List<CryptoCurrency> _notSupported = [
...(CryptoCurrency.all
.where((element) => ![
CryptoCurrency.btc,
// CryptoCurrency.eth,
CryptoCurrency.ltc,
CryptoCurrency.bch,
CryptoCurrency.usdtbsc,
// CryptoCurrency.aave,
// CryptoCurrency.dai,
// CryptoCurrency.gusd,
// CryptoCurrency.usdc,
// CryptoCurrency.usdterc20,
// CryptoCurrency.wbtc, // TODO: temporarily commented until https://github.com/cake-tech/cake_wallet/pull/1436 is merged
].contains(element))
.toList())
];
ThorChainExchangeProvider({required this.tradesStore});
static final isRefundAddressSupported = [CryptoCurrency.eth];
@@ -17,8 +17,7 @@ import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class TrocadorExchangeProvider extends ExchangeProvider {
TrocadorExchangeProvider({this.useTorOnly = false, this.providerStates = const {}})
: _lastUsedRateId = '',
_provider = [],
super(pairList: supportedPairs(_notSupported));
_provider = [];
bool useTorOnly;
Map<String, bool> providerStates;
@@ -48,11 +47,6 @@ class TrocadorExchangeProvider extends ExchangeProvider {
'SwapSpace',
];
static const List<CryptoCurrency> _notSupported = [
CryptoCurrency.stx,
CryptoCurrency.zaddr,
];
static final apiKey = isMoneroOnly ? secrets.trocadorMoneroApiKey : secrets.trocadorApiKey;
static const clearNetAuthority = 'api.trocador.app';
static const onionApiAuthority = clearNetAuthority;
@@ -13,9 +13,7 @@ import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/utils/proxy_wrapper.dart';
import 'package:cake_wallet/utils/exchange_provider_logger.dart';
class XOSwapExchangeProvider extends ExchangeProvider {
XOSwapExchangeProvider() : super(pairList: supportedPairs(_notSupported));
static const List<CryptoCurrency> _notSupported = [];
XOSwapExchangeProvider();
static const _apiAuthority = 'exchange.exodus.io';
static const _apiPath = '/v3';