cake_wallet/lib/nano/nano.dart

74 lines
2.1 KiB
Dart
Raw Normal View History

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-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';
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';
import 'package:hive/hive.dart';
2023-07-24 20:23:09 +00:00
import 'package:cw_nano/nano_balance.dart';
import 'package:cw_nano/nano_wallet_creation_credentials.dart';
2023-07-24 21:01:07 +00:00
import 'package:mobx/mobx.dart';
import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/transaction_history.dart';
import 'package:cw_core/wallet_service.dart';
import 'package:hive/hive.dart';
2023-07-25 20:31:52 +00:00
import 'package:cw_nano/nano_mnemonic.dart';
2023-07-24 18:09:28 +00:00
part 'cw_nano.dart';
Nano? nano = CWNano();
2023-07-24 20:23:09 +00:00
class Account {
Account({required this.id, required this.label, this.balance});
final int id;
final String label;
final String? balance;
}
abstract class NanoWalletDetails {
@observable
late Account account;
@observable
late NanoBalance balance;
}
2023-07-24 18:09:28 +00:00
abstract class Nano {
2023-07-24 20:23:09 +00:00
// NanoAccountList getAccountList(Object wallet);
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);
NanoWalletDetails getNanoWalletDetails(Object wallet);
WalletCredentials createNanoNewWalletCredentials({
required String name,
String password,
2023-07-24 18:09:28 +00:00
});
2023-07-25 20:31:52 +00:00
WalletCredentials createNanoRestoreWalletFromSeedCredentials({
required String name,
required String mnemonic,
required String password,
2023-07-26 17:15:22 +00:00
required 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);
}
abstract class NanoAccountList {
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});
2023-07-24 18:09:28 +00:00
}