mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-29 06:38:45 +01:00
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:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user