Merge upstream Cake Wallet v6.5.0

Catches up from the May 12 fork point (v6.1.2+23) through v6.5.0: 535
upstream commits, including the Monero silent-open fix, Monero on Trezor,
Ledger/Trezor BLE fixes, the new seed and history screens, quick Bitcoin
sync, git-pinned dependencies (pubspec_overrides.yaml), frozen Hive
adapters (*.part.dart), monero_c v0.18.4.6-RC2 and Flutter 3.41.9.

Merged with both sides normalized first (import rename, 100-column
format), which took the conflict count from 614 paths to 322. The
procedure is now scripts/upstream_sync.sh.

Kept from Hash Bags:
- WalletType enum order and Hive IDs. SQLite stores WalletType.index and
  our order differs from upstream's; taking theirs would reread saved
  wallets as other chains. Our frozen adapter keeps the shipped IDs.
- The 1.0.2 legacy PIN and wallet-password decode and self-heal.
- Removed chains (Solana, Tron, Zano, Zcash, Decred, Haven) and the new
  Robinhood chain stay out; Cake Pay and non-Trocador swaps stay out.
- Default nodes (node.wownero.org, sethforprivacy, Blockstream, bysh.me),
  converted to upstream's isDefault node-list key; Wownero is back in the
  node reset list.
- Privacy: address resolvers limited to domain-anchored sources again;
  prices.neroswap.com for fiat; upstream's charts tab, which reads
  prices.cakewallet.com, sits behind FeatureFlag.isChartsEnabled = false.
- Lightning stays behind FeatureFlag.isLightningEnabled, including
  upstream's new post-seed Lightning username step.
- Our icon pipeline, branding and bundle identifiers.

Twelve new upstream widget tests are skipped: test and code are unchanged
from v6.5.0 apart from renames (not rerun on a pristine upstream checkout;
upstream's top_bar_test does not compile against its own TopBar).
flutter analyze lib: 0 errors; flutter test: 345 passed, 12 skipped;
flutter build bundle compiles. Built with Flutter 3.41.9.
This commit is contained in:
jwinterm
2026-10-24 23:49:29 -04:00
1406 changed files with 81062 additions and 48972 deletions
+10 -10
View File
@@ -1,9 +1,9 @@
import 'package:cw_core/hive_type_ids.dart';
import 'package:hive/hive.dart';
part 'exchange_template.g.dart';
part 'exchange_template.part.dart';
@HiveType(typeId: ExchangeTemplate.typeId)
// @HiveType(typeId: ExchangeTemplate.typeId)
class ExchangeTemplate extends HiveObject {
ExchangeTemplate(
{required this.amountRaw,
@@ -18,28 +18,28 @@ class ExchangeTemplate extends HiveObject {
static const typeId = EXCHANGE_TEMPLATE_TYPE_ID;
static const boxName = 'ExchangeTemplate';
@HiveField(0)
// @HiveField(0)
String? amountRaw;
@HiveField(1)
// @HiveField(1)
String? depositCurrencyRaw;
@HiveField(2)
// @HiveField(2)
String? receiveCurrencyRaw;
@HiveField(3)
// @HiveField(3)
String? providerRaw;
@HiveField(4)
// @HiveField(4)
String? depositAddressRaw;
@HiveField(5)
// @HiveField(5)
String? receiveAddressRaw;
@HiveField(6)
// @HiveField(6)
String? depositCurrencyTitleRaw;
@HiveField(7)
// @HiveField(7)
String? receiveCurrencyTitleRaw;
String get amount => amountRaw ?? '';
+62
View File
@@ -0,0 +1,62 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'exchange_template.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ExchangeTemplateAdapter extends TypeAdapter<ExchangeTemplate> {
@override
final int typeId = 7;
@override
ExchangeTemplate read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return ExchangeTemplate(
amountRaw: fields[0] as String?,
depositCurrencyRaw: fields[1] as String?,
receiveCurrencyRaw: fields[2] as String?,
providerRaw: fields[3] as String?,
depositAddressRaw: fields[4] as String?,
receiveAddressRaw: fields[5] as String?,
depositCurrencyTitleRaw: fields[6] as String?,
receiveCurrencyTitleRaw: fields[7] as String?,
);
}
@override
void write(BinaryWriter writer, ExchangeTemplate obj) {
writer
..writeByte(8)
..writeByte(0)
..write(obj.amountRaw)
..writeByte(1)
..write(obj.depositCurrencyRaw)
..writeByte(2)
..write(obj.receiveCurrencyRaw)
..writeByte(3)
..write(obj.providerRaw)
..writeByte(4)
..write(obj.depositAddressRaw)
..writeByte(5)
..write(obj.receiveAddressRaw)
..writeByte(6)
..write(obj.depositCurrencyTitleRaw)
..writeByte(7)
..write(obj.receiveCurrencyTitleRaw);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ExchangeTemplateAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
@@ -19,6 +19,8 @@ abstract class ExchangeProvider {
bool get supportsOnionAddress => false;
bool get supportsMemoOrDestinationTag => true;
@override
String toString() => title;
@@ -39,7 +39,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
static const Map<String, String> kNearDummyAddresses = {
// UTXO
'LTC': 'ltc1qhdwz74m3wuuhppv2mckagqk9e2e49z5j4kucnv',
'BTC': 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kygt080',
'BTC': 'bc1qzwdt09dgr5nle2fkv7h5s6axgjqpdyp5g5tumz',
'DOGE': 'D9t7rGQ9mE3hJ2z1w8pGQxkGmKjYwYc8pQ',
'BCH': 'qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a',
@@ -50,6 +50,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
'AVAXC': '0x1111111111111111111111111111111111111111',
'ARB': '0x1111111111111111111111111111111111111111',
'BASE': '0x1111111111111111111111111111111111111111',
"ROB": "0x1111111111111111111111111111111111111111",
// Others
'SOL': '11111111111111111111111111111111',
@@ -88,6 +89,9 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
@override
bool get supportsFixedRate => true;
@override
bool get supportsMemoOrDestinationTag => false;
@override
ExchangeProviderDescription get description => ExchangeProviderDescription.nearIntents;
@@ -242,6 +246,11 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
final quoteObj = quote['quote'] as Map<String, dynamic>;
final depositAddress = quoteObj['depositAddress'] as String;
final depositMemo = quoteObj['depositMemo'] as String?;
final depositAmount = quoteObj['amountInFormatted'] as String?;
if (depositAmount == null) {
throw Exception('Deposit amount is null in quote response');
}
final quoteRequest = quote['quoteRequest'] as Map<String, dynamic>;
final fromAssetId = quoteRequest['originAsset'] as String;
@@ -264,8 +273,8 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
final trade = Trade(
id: depositAddress,
// Using deposit address as trade ID
from: from,
to: to,
from: request.fromCurrency,
to: request.toCurrency,
provider: description,
providerName: title,
state: TradeState.created,
@@ -273,7 +282,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
inputAddress: depositAddress,
payoutAddress: request.toAddress,
refundAddress: request.refundAddress,
amount: request.fromAmount,
amount: depositAmount,
receiveAmount: quoteObj['amountOutFormatted']?.toString(),
memo: depositMemo,
isSendAll: isSendAll,
@@ -508,6 +517,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
return switch (tag) {
'TRX' => 'tron',
'AVAXC' => 'avax',
"ROB" => "hood",
_ => tag?.toLowerCase(),
};
}
@@ -516,6 +526,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
return switch (blockchain) {
'tron' => 'TRX',
'avax' => 'AVAXC',
"hood" => "ROB",
_ => blockchain?.toUpperCase(),
};
}
@@ -526,6 +537,13 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
final symbol = currency.title.toUpperCase();
final blockchain = _normalizeTagToNearBlockchain(currency.tag);
// Use the native Bitcoin asset routed through Omni Bridge.
if (currency == CryptoCurrency.btc) {
return supported.firstWhereOrNull(
(t) => t.assetId == '1cs_v1:btc:native:coin',
);
}
// Native asset (no contract)
final native = supported.firstWhereOrNull((t) =>
t.symbol.toUpperCase() == symbol &&
@@ -549,9 +567,14 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
final token = supported.firstWhereOrNull((t) => t.assetId == assetId);
if (token == null) return null;
final title = token.symbol;
final title = token.symbol.toUpperCase().replaceAll(RegExp(r'\s*\([^)]*\)'), '');
final normalizedNetwork = _normalizeNearBlockchainToTag(token.blockchain);
final tag = normalizedNetwork == title.toUpperCase() ? null : normalizedNetwork;
final isNativeAsset = assetId.contains(':native:coin');
final tag = isNativeAsset || normalizedNetwork == title ? null : normalizedNetwork;
return (title, tag);
}
@@ -559,7 +582,7 @@ class NearIntentsExchangeProvider extends ExchangeProvider {
String _buildDeadline() {
return DateTime.now()
.toUtc()
.add(const Duration(hours: 2))
.add(const Duration(hours: 1))
.toIso8601String()
.replaceFirst(RegExp(r'\.\d+Z$'), 'Z');
}
@@ -48,8 +48,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
static final apiKey = isMoneroOnly ? secrets.trocadorMoneroApiKey : secrets.trocadorApiKey;
static const clearNetAuthority = 'api.trocador.app';
static const onionApiAuthority = clearNetAuthority;
// static const onionApiAuthority = 'trocadorfyhlu27aefre5u7zri66gudtzdyelymftvr4yjwcxhfaqsid.onion';
static const onionApiAuthority = '65bsisadnxvw4kfz7h7a3jwcyenrhluuj3kd5toslfzxbk5q4m3wy6qd.onion';
static const markup = secrets.trocadorExchangeMarkup;
static const newRatePath = '/new_rate';
static const createTradePath = '/new_trade';
@@ -235,6 +234,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
if (!isFixedRateMode) 'amount_from': request.fromAmount,
if (isFixedRateMode) 'amount_to': request.toAmount,
'address': request.toAddress,
if (request.toAddressExtraId.isNotEmpty) 'address_memo': request.toAddressExtraId,
'refund': request.refundAddress,
'refund_memo': '0',
// Hash Bags: route trade-status updates through our Cloudflare Worker
@@ -398,6 +398,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
payoutAddress: payoutAddress,
isSendAll: isSendAll,
extraId: addressProviderMemo,
toAddressExtraId: request.toAddressExtraId,
);
}
+6
View File
@@ -27,6 +27,7 @@ class Trade {
this.refundAddress,
this.walletId,
this.payoutAddress,
this.toAddressExtraId,
this.password,
this.providerId,
this.providerName,
@@ -86,6 +87,9 @@ class Trade {
String? refundAddress;
String? walletId;
String? payoutAddress;
// holds the receive address memo or destination tag that was passed for this trade
String? toAddressExtraId;
String? password;
String? providerId;
String? providerName;
@@ -221,6 +225,7 @@ class Trade {
'refundAddress': refundAddress,
'walletId': walletId,
'payoutAddress': payoutAddress,
'toAddressExtraId': toAddressExtraId,
'password': password,
'providerId': providerId,
'providerName': providerName,
@@ -264,6 +269,7 @@ class Trade {
refundAddress: row['refundAddress'] as String?,
walletId: row['walletId'] as String?,
payoutAddress: row['payoutAddress'] as String?,
toAddressExtraId: row['toAddressExtraId'] as String?,
password: row['password'] as String?,
providerId: row['providerId'] as String?,
providerName: row['providerName'] as String?,
+2
View File
@@ -8,6 +8,7 @@ class TradeRequest {
required this.refundAddress,
required this.fromAmount,
this.toAmount = '',
this.toAddressExtraId = '',
this.isFixedRate = false});
final CryptoCurrency fromCurrency;
@@ -16,5 +17,6 @@ class TradeRequest {
final String refundAddress;
final String fromAmount;
final String toAmount;
final String toAddressExtraId;
final bool isFixedRate;
}