2023-08-10 22:34:20 +00:00
|
|
|
import 'package:cw_core/nano_account.dart';
|
2023-08-02 17:16:43 +00:00
|
|
|
import 'package:cw_nano/nano_mnemonic.dart';
|
2023-07-26 17:15:22 +00:00
|
|
|
import 'package:cw_nano/nano_wallet.dart';
|
2023-07-25 15:21:49 +00:00
|
|
|
import 'package:cw_nano/nano_wallet_service.dart';
|
2023-08-04 18:11:09 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
import 'package:cw_core/account.dart';
|
2023-07-24 20:23:09 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
2023-07-24 18:09:28 +00:00
|
|
|
import 'package:cw_core/wallet_credentials.dart';
|
2023-08-02 17:16:43 +00:00
|
|
|
import 'package:cw_nano/nano_wallet_info.dart';
|
2023-07-24 18:09:28 +00:00
|
|
|
import 'package:cw_core/wallet_info.dart';
|
2023-07-24 20:23:09 +00:00
|
|
|
import 'package:cw_core/transaction_history.dart';
|
2023-07-24 18:09:28 +00:00
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2023-08-02 17:16:43 +00:00
|
|
|
import 'package:cw_core/output_info.dart';
|
2023-07-24 18:09:28 +00:00
|
|
|
import 'package:hive/hive.dart';
|
2023-07-31 13:10:33 +00:00
|
|
|
import 'package:cw_nano/nano_transaction_credentials.dart';
|
2023-07-24 18:09:28 +00:00
|
|
|
|
|
|
|
part 'cw_nano.dart';
|
|
|
|
|
|
|
|
Nano? nano = CWNano();
|
|
|
|
|
|
|
|
abstract class Nano {
|
2023-08-10 22:34:20 +00:00
|
|
|
NanoAccountList getAccountList(Object wallet);
|
|
|
|
|
|
|
|
Account getCurrentAccount(Object wallet);
|
|
|
|
|
|
|
|
void setCurrentAccount(Object wallet, int id, String label, String? balance);
|
2023-07-24 20:23:09 +00:00
|
|
|
|
2023-07-24 18:09:28 +00:00
|
|
|
WalletService createNanoWalletService(Box<WalletInfo> walletInfoSource);
|
|
|
|
|
2023-07-24 20:23:09 +00:00
|
|
|
TransactionHistoryBase getTransactionHistory(Object wallet);
|
|
|
|
|
|
|
|
WalletCredentials createNanoNewWalletCredentials({
|
|
|
|
required String name,
|
|
|
|
String password,
|
2023-07-24 18:09:28 +00:00
|
|
|
});
|
2023-08-10 22:34:20 +00:00
|
|
|
|
2023-07-25 20:31:52 +00:00
|
|
|
WalletCredentials createNanoRestoreWalletFromSeedCredentials({
|
|
|
|
required String name,
|
|
|
|
required String password,
|
2023-07-31 13:10:33 +00:00
|
|
|
required String mnemonic,
|
|
|
|
DerivationType? derivationType,
|
2023-07-25 20:31:52 +00:00
|
|
|
});
|
|
|
|
|
2023-07-24 20:23:09 +00:00
|
|
|
String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
|
|
|
|
|
|
|
void onStartup();
|
|
|
|
|
|
|
|
List<String> getNanoWordList(String language);
|
2023-07-31 15:39:22 +00:00
|
|
|
Map<String, String> getKeys(Object wallet);
|
2023-07-31 13:10:33 +00:00
|
|
|
Object createNanoTransactionCredentials(List<Output> outputs);
|
2023-07-24 20:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class NanoAccountList {
|
2023-08-10 22:34:20 +00:00
|
|
|
ObservableList<NanoAccount> get accounts;
|
2023-07-24 20:23:09 +00:00
|
|
|
void update(Object wallet);
|
|
|
|
void refresh(Object wallet);
|
2023-08-10 22:34:20 +00:00
|
|
|
Future<List<NanoAccount>> getAll(Object wallet);
|
2023-07-24 20:23:09 +00:00
|
|
|
Future<void> addAccount(Object wallet, {required String label});
|
|
|
|
Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
2023-07-24 18:09:28 +00:00
|
|
|
}
|