mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Remove haven (#2085)
* decred: Add decred. (#1322) * multi: Add initial decred screens. (#1165) Use a mock libwallet for now. * cw_decred: add libdcrwallet dependency and link library for android, ios and macos (#1240) * change cw_decred from package to plugin * add libdcrwallet dependency and link library for android, ios and macos * remove spvwallet, make some libdcrwallet fns async, light refactor * libdcrwallet: use json payload returns * use specific libwallet commit hash * decred: fix Rename wallet. --------- Co-authored-by: JoeGruff <joegruffins@gmail.com> * decred: Add sync. * decred: Add send transaction. * decred: Fix fee estimation. * decred: List transactions. * decred: Add rescan. * decred: Sign message. * decred: Add new addr and addrs. * decred: Add change wallet pass. * decred: Add restore from seed. * decred: Add watching only wallets. * decred: Enable mainnet. * decred: Allow using blank node address. This allows a persistent peer to be unset, falling back to decred seeders. * decred: Rescan from wallet birthday. * add and update macos build scripts, update build readme, gitignore macos project.pbxproj Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> * multi: hide decred rescan page if it's not ready - move hasRescan method to WalletBase and implement for decred Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> * cw_decred: fix bug where decred wallets are not loaded after app restart Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> * add buy and sell for decred via onramp Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> * bug-fix: account for other send outputs that are part of the same tx Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> * decred: Return address with no peers. * decred: Update pubspec. * decred: Add verify message. * upgrade hive_generator dep in cw_decred * decred: Clean up code. --------- Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> Co-authored-by: Wisdom Arerosuoghene <wisdom.arerosuoghene@gmail.com> Co-authored-by: Philemon Ukane <ukanephilemon@gmail.com> * fix extracted addresses not used fix conflicts with main * remove print [skip ci] * minor formatting * fix initial migration version * add build decred script to workflow * install go before build decred fix switch cases * trial 2 to fix decred build * re-install go * revert build script change * refactor/clean nodes functions * Fix address book issue Fix send ALL (to be continued with the fees point) * Fix transactions display issues Add missing file * Fix unconfirmed balance not displayed Change Wallet order Minor cleanup * Fix workflow * Fix workflow * Fix workflow * test * hardcode path for now * fix + cleanup decred build script to work on mac and linux * Update decred build script * Run actions on pull requests, extract commit message * run after checkout * add safe directory * Get commit message from base.sha instead of last commit * base -> head * Do not merge main branch into pr * [skip slack] [run tests] clone by sha * Proper name for decred library in the build script * Throw an error when ANDROID_HOME or ANDROID_NDK_VERSION is missing * Fix conflicts with main * minor code enhancement * decred: Add used address history. (#1941) * decred: Update pubspec. * decred testnet * decred: Add used address history. * decred: Remove default node list. * populate transaction history before sync begins * decred: Add some awaits. * decred: Fix send all. * decred: Add clang export to build script. * decred: Update logo colors. * cleanup cw_decred.dart * make decred wallet addresses selectable in receive page * decred: Always set default addr when used. * decred: Add back default node list. * decred: Allow creating addresses manually. --------- Co-authored-by: Wisdom Arerosuoghene <wisdom.arerosuoghene@gmail.com> Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * minor fixes and cleanup * minor fix, feel free to test now * - Fix transaction details - Fix Nodes - Add processing sync status * Add decred info card * push missing file * Add missing text for decred info card * minor: change docs link [skip ci] * decred: Update derivation info. (#2013) * decred: Update derivation info. * decred: Allow unsynced unused addresses. * decred: Update dcrwallet dep to 4.3.0. * Merge main and fix conflicts * Merge main and fix conflicts * decred: Fix background sync panic. (#2080) * decred: Run libwallet in isolate. (#2077) * decred: Fix contact save inquiry. (#2083) Also fix tx time and the fee shown on pending transactions. * Disable send button in view only decred wallets * - Fix frozen coins - Add URI support - Fix fees in tx details - Handle empty coins send - Handle wallets in address book * Merge main * remove print [skip ci] * Fix restore from QR * minor improvement for QR restore * Remove Haven Wallet * Remove haven scripts * minor fixes [skip ci] * decred: Get slip44 addrs before sync completes. (#2092) * - Fix loading wallet more than one time - Fix minor UI issue * fix merge issue * fix merge issue --------- Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com> Co-authored-by: JoeGruffins <34998433+JoeGruffins@users.noreply.github.com> Co-authored-by: Wisdom Arerosuoghene <wisdom.arerosuoghene@gmail.com> Co-authored-by: Philemon Ukane <ukanephilemon@gmail.com> Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
This commit is contained in:
parent
0ba54fa602
commit
a34cf24897
128 changed files with 52 additions and 22310 deletions
|
@ -2,7 +2,6 @@ import 'dart:io';
|
|||
|
||||
const bitcoinOutputPath = 'lib/bitcoin/bitcoin.dart';
|
||||
const moneroOutputPath = 'lib/monero/monero.dart';
|
||||
const havenOutputPath = 'lib/haven/haven.dart';
|
||||
const ethereumOutputPath = 'lib/ethereum/ethereum.dart';
|
||||
const bitcoinCashOutputPath = 'lib/bitcoin_cash/bitcoin_cash.dart';
|
||||
const nanoOutputPath = 'lib/nano/nano.dart';
|
||||
|
@ -21,7 +20,6 @@ Future<void> main(List<String> args) async {
|
|||
const prefix = '--';
|
||||
final hasBitcoin = args.contains('${prefix}bitcoin');
|
||||
final hasMonero = args.contains('${prefix}monero');
|
||||
final hasHaven = args.contains('${prefix}haven');
|
||||
final hasEthereum = args.contains('${prefix}ethereum');
|
||||
final hasBitcoinCash = args.contains('${prefix}bitcoinCash');
|
||||
final hasNano = args.contains('${prefix}nano');
|
||||
|
@ -36,7 +34,6 @@ Future<void> main(List<String> args) async {
|
|||
|
||||
await generateBitcoin(hasBitcoin);
|
||||
await generateMonero(hasMonero);
|
||||
await generateHaven(hasHaven);
|
||||
await generateEthereum(hasEthereum);
|
||||
await generateBitcoinCash(hasBitcoinCash);
|
||||
await generateNano(hasNano);
|
||||
|
@ -51,7 +48,6 @@ Future<void> main(List<String> args) async {
|
|||
await generatePubspec(
|
||||
hasMonero: hasMonero,
|
||||
hasBitcoin: hasBitcoin,
|
||||
hasHaven: hasHaven,
|
||||
hasEthereum: hasEthereum,
|
||||
hasNano: hasNano,
|
||||
hasBanano: hasBanano,
|
||||
|
@ -67,7 +63,6 @@ Future<void> main(List<String> args) async {
|
|||
await generateWalletTypes(
|
||||
hasMonero: hasMonero,
|
||||
hasBitcoin: hasBitcoin,
|
||||
hasHaven: hasHaven,
|
||||
hasEthereum: hasEthereum,
|
||||
hasNano: hasNano,
|
||||
hasBanano: hasBanano,
|
||||
|
@ -654,194 +649,6 @@ abstract class WowneroAccountList {
|
|||
await outputFile.writeAsString(output);
|
||||
}
|
||||
|
||||
Future<void> generateHaven(bool hasImplementation) async {
|
||||
final outputFile = File(havenOutputPath);
|
||||
const havenCommonHeaders = """
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cw_core/wallet_credentials.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/output_info.dart';
|
||||
import 'package:cake_wallet/view_model/send/output.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cake_wallet/core/key_service.dart';
|
||||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
import 'package:cake_wallet/entities/haven_seed_store.dart';
|
||||
import 'package:cw_core/cake_hive.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
""";
|
||||
const havenCWHeaders = """
|
||||
import 'package:cw_core/get_height_by_date.dart';
|
||||
import 'package:cw_core/monero_amount_format.dart';
|
||||
import 'package:cw_core/monero_transaction_priority.dart';
|
||||
import 'package:cw_haven/haven_wallet_service.dart';
|
||||
import 'package:cw_haven/haven_wallet.dart';
|
||||
import 'package:cw_haven/haven_transaction_info.dart';
|
||||
import 'package:cw_haven/haven_transaction_history.dart';
|
||||
import 'package:cw_core/account.dart' as monero_account;
|
||||
import 'package:cw_haven/api/wallet.dart' as monero_wallet_api;
|
||||
import 'package:cw_haven/mnemonics/english.dart';
|
||||
import 'package:cw_haven/mnemonics/chinese_simplified.dart';
|
||||
import 'package:cw_haven/mnemonics/dutch.dart';
|
||||
import 'package:cw_haven/mnemonics/german.dart';
|
||||
import 'package:cw_haven/mnemonics/japanese.dart';
|
||||
import 'package:cw_haven/mnemonics/russian.dart';
|
||||
import 'package:cw_haven/mnemonics/spanish.dart';
|
||||
import 'package:cw_haven/mnemonics/portuguese.dart';
|
||||
import 'package:cw_haven/mnemonics/french.dart';
|
||||
import 'package:cw_haven/mnemonics/italian.dart';
|
||||
import 'package:cw_haven/haven_transaction_creation_credentials.dart';
|
||||
import 'package:cw_haven/api/balance_list.dart';
|
||||
import 'package:cw_haven/haven_wallet_service.dart';
|
||||
""";
|
||||
const havenCwPart = "part 'cw_haven.dart';";
|
||||
const havenContent = """
|
||||
class Account {
|
||||
Account({required this.id, required this.label});
|
||||
final int id;
|
||||
final String label;
|
||||
}
|
||||
|
||||
class Subaddress {
|
||||
Subaddress({
|
||||
required this.id,
|
||||
required this.label,
|
||||
required this.address});
|
||||
final int id;
|
||||
final String label;
|
||||
final String address;
|
||||
}
|
||||
|
||||
class HavenBalance extends Balance {
|
||||
HavenBalance({required this.fullBalance, required this.unlockedBalance})
|
||||
: formattedFullBalance = haven!.formatterMoneroAmountToString(amount: fullBalance),
|
||||
formattedUnlockedBalance =
|
||||
haven!.formatterMoneroAmountToString(amount: unlockedBalance),
|
||||
super(unlockedBalance, fullBalance);
|
||||
|
||||
HavenBalance.fromString(
|
||||
{required this.formattedFullBalance,
|
||||
required this.formattedUnlockedBalance})
|
||||
: fullBalance = haven!.formatterMoneroParseAmount(amount: formattedFullBalance),
|
||||
unlockedBalance = haven!.formatterMoneroParseAmount(amount: formattedUnlockedBalance),
|
||||
super(haven!.formatterMoneroParseAmount(amount: formattedUnlockedBalance),
|
||||
haven!.formatterMoneroParseAmount(amount: formattedFullBalance));
|
||||
|
||||
final int fullBalance;
|
||||
final int unlockedBalance;
|
||||
final String formattedFullBalance;
|
||||
final String formattedUnlockedBalance;
|
||||
|
||||
@override
|
||||
String get formattedAvailableBalance => formattedUnlockedBalance;
|
||||
|
||||
@override
|
||||
String get formattedAdditionalBalance => formattedFullBalance;
|
||||
}
|
||||
|
||||
class AssetRate {
|
||||
AssetRate(this.asset, this.rate);
|
||||
|
||||
final String asset;
|
||||
final int rate;
|
||||
}
|
||||
|
||||
abstract class HavenWalletDetails {
|
||||
// FIX-ME: it's abstract class
|
||||
@observable
|
||||
late Account account;
|
||||
// FIX-ME: it's abstract class
|
||||
@observable
|
||||
late HavenBalance balance;
|
||||
}
|
||||
|
||||
abstract class Haven {
|
||||
HavenAccountList getAccountList(Object wallet);
|
||||
|
||||
MoneroSubaddressList getSubaddressList(Object wallet);
|
||||
|
||||
TransactionHistoryBase getTransactionHistory(Object wallet);
|
||||
|
||||
HavenWalletDetails getMoneroWalletDetails(Object wallet);
|
||||
|
||||
String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
||||
|
||||
int getHeightByDate({required DateTime date});
|
||||
Future<int> getCurrentHeight();
|
||||
TransactionPriority getDefaultTransactionPriority();
|
||||
TransactionPriority deserializeMoneroTransactionPriority({required int raw});
|
||||
List<TransactionPriority> getTransactionPriorities();
|
||||
List<String> getMoneroWordList(String language);
|
||||
|
||||
WalletCredentials createHavenRestoreWalletFromKeysCredentials({
|
||||
required String name,
|
||||
required String spendKey,
|
||||
required String viewKey,
|
||||
required String address,
|
||||
required String password,
|
||||
required String language,
|
||||
required int height});
|
||||
WalletCredentials createHavenRestoreWalletFromSeedCredentials({required String name, required String password, required int height, required String mnemonic});
|
||||
WalletCredentials createHavenNewWalletCredentials({required String name, required String language, String? password});
|
||||
Map<String, String> getKeys(Object wallet);
|
||||
Object createHavenTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority, required String assetType});
|
||||
String formatterMoneroAmountToString({required int amount});
|
||||
double formatterMoneroAmountToDouble({required int amount});
|
||||
int formatterMoneroParseAmount({required String amount});
|
||||
Account getCurrentAccount(Object wallet);
|
||||
void setCurrentAccount(Object wallet, int id, String label);
|
||||
void onStartup();
|
||||
int getTransactionInfoAccountId(TransactionInfo tx);
|
||||
WalletService createHavenWalletService(Box<WalletInfo> walletInfoSource);
|
||||
Future<void> backupHavenSeeds(Box<HavenSeedStore> havenSeedStore);
|
||||
CryptoCurrency assetOfTransaction(TransactionInfo tx);
|
||||
List<AssetRate> getAssetRate();
|
||||
}
|
||||
|
||||
abstract class MoneroSubaddressList {
|
||||
ObservableList<Subaddress> get subaddresses;
|
||||
void update(Object wallet, {required int accountIndex});
|
||||
void refresh(Object wallet, {required int accountIndex});
|
||||
List<Subaddress> getAll(Object wallet);
|
||||
Future<void> addSubaddress(Object wallet, {required int accountIndex, required String label});
|
||||
Future<void> setLabelSubaddress(Object wallet,
|
||||
{required int accountIndex, required int addressIndex, required String label});
|
||||
}
|
||||
|
||||
abstract class HavenAccountList {
|
||||
ObservableList<Account> get accounts;
|
||||
void update(Object wallet);
|
||||
void refresh(Object wallet);
|
||||
List<Account> getAll(Object wallet);
|
||||
Future<void> addAccount(Object wallet, {required String label});
|
||||
Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
||||
}
|
||||
""";
|
||||
|
||||
const havenEmptyDefinition = 'Haven? haven;\n';
|
||||
const havenCWDefinition = 'Haven? haven = CWHaven();\n';
|
||||
|
||||
final output = '$havenCommonHeaders\n' +
|
||||
(hasImplementation ? '$havenCWHeaders\n' : '\n') +
|
||||
(hasImplementation ? '$havenCwPart\n\n' : '\n') +
|
||||
(hasImplementation ? havenCWDefinition : havenEmptyDefinition) +
|
||||
'\n' +
|
||||
havenContent;
|
||||
|
||||
if (outputFile.existsSync()) {
|
||||
await outputFile.delete();
|
||||
}
|
||||
|
||||
await outputFile.writeAsString(output);
|
||||
}
|
||||
|
||||
Future<void> generateEthereum(bool hasImplementation) async {
|
||||
final outputFile = File(ethereumOutputPath);
|
||||
const ethereumCommonHeaders = """
|
||||
|
@ -1573,7 +1380,6 @@ abstract class Decred {
|
|||
Future<void> generatePubspec({
|
||||
required bool hasMonero,
|
||||
required bool hasBitcoin,
|
||||
required bool hasHaven,
|
||||
required bool hasEthereum,
|
||||
required bool hasNano,
|
||||
required bool hasBanano,
|
||||
|
@ -1598,14 +1404,6 @@ Future<void> generatePubspec({
|
|||
cw_bitcoin:
|
||||
path: ./cw_bitcoin
|
||||
""";
|
||||
const cwHaven = """
|
||||
cw_haven:
|
||||
path: ./cw_haven
|
||||
""";
|
||||
const cwSharedExternal = """
|
||||
cw_shared_external:
|
||||
path: ./cw_shared_external
|
||||
""";
|
||||
const flutterSecureStorage = """
|
||||
flutter_secure_storage:
|
||||
git:
|
||||
|
@ -1702,10 +1500,6 @@ Future<void> generatePubspec({
|
|||
output += '\n$cwTron';
|
||||
}
|
||||
|
||||
if (hasHaven) {
|
||||
output += '\n$cwSharedExternal\n$cwHaven';
|
||||
}
|
||||
|
||||
if (hasDecred) {
|
||||
output += '\n$cwDecred';
|
||||
}
|
||||
|
@ -1741,7 +1535,6 @@ Future<void> generatePubspec({
|
|||
Future<void> generateWalletTypes({
|
||||
required bool hasMonero,
|
||||
required bool hasBitcoin,
|
||||
required bool hasHaven,
|
||||
required bool hasEthereum,
|
||||
required bool hasNano,
|
||||
required bool hasBanano,
|
||||
|
@ -1815,10 +1608,6 @@ Future<void> generateWalletTypes({
|
|||
outputContent += '\tWalletType.wownero,\n';
|
||||
}
|
||||
|
||||
if (hasHaven) {
|
||||
outputContent += '\tWalletType.haven,\n';
|
||||
}
|
||||
|
||||
outputContent += '];\n';
|
||||
await walletTypesFile.writeAsString(outputContent);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue