successfully builds!

This commit is contained in:
fosse 2023-07-24 17:01:07 -04:00
parent e3624880c5
commit ae0727ad33
4 changed files with 61 additions and 80 deletions

View file

@ -1,26 +1,47 @@
import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart';
// class NanoNewWalletCredentials extends WalletCredentials {
// NanoNewWalletCredentials({required String name, WalletInfo? walletInfo})
// : super(name: name, walletInfo: walletInfo);
// }
// class NanoRestoreWalletFromSeedCredentials extends WalletCredentials {
// NanoRestoreWalletFromSeedCredentials(
// {required String name,
// required String password,
// required this.mnemonic,
// WalletInfo? walletInfo})
// : super(name: name, password: password, walletInfo: walletInfo);
// final String mnemonic;
// }
// class NanoRestoreWalletFromWIFCredentials extends WalletCredentials {
// NanoRestoreWalletFromWIFCredentials(
// {required String name, required String password, required this.wif, WalletInfo? walletInfo})
// : super(name: name, password: password, walletInfo: walletInfo);
// final String wif;
// }
class NanoNewWalletCredentials extends WalletCredentials {
NanoNewWalletCredentials({required String name, WalletInfo? walletInfo})
: super(name: name, walletInfo: walletInfo);
NanoNewWalletCredentials({required String name, required this.language, String? password})
: super(name: name, password: password);
final String language;
}
class NanoRestoreWalletFromSeedCredentials extends WalletCredentials {
NanoRestoreWalletFromSeedCredentials(
{required String name,
required String password,
required this.mnemonic,
WalletInfo? walletInfo})
: super(name: name, password: password, walletInfo: walletInfo);
{required String name, required this.mnemonic, int height = 0, String? password})
: super(name: name, password: password, height: height);
final String mnemonic;
}
class NanoRestoreWalletFromWIFCredentials extends WalletCredentials {
NanoRestoreWalletFromWIFCredentials(
{required String name, required String password, required this.wif, WalletInfo? walletInfo})
: super(name: name, password: password, walletInfo: walletInfo);
final String wif;
class NanoWalletLoadingException implements Exception {
@override
String toString() => 'Failure to load the wallet.';
}

View file

@ -1,64 +1,10 @@
part of 'nano.dart';
// class CWMoneroAccountList extends MoneroAccountList {
// CWMoneroAccountList(this._wallet);
// final Object _wallet;
// @override
// @computed
// ObservableList<Account> get accounts {
// final moneroWallet = _wallet as MoneroWallet;
// final accounts = moneroWallet.walletAddresses.accountList
// .accounts
// .map((acc) => Account(id: acc.id, label: acc.label, balance: acc.balance))
// .toList();
// return ObservableList<Account>.of(accounts);
// }
// @override
// void update(Object wallet) {
// final moneroWallet = wallet as MoneroWallet;
// moneroWallet.walletAddresses.accountList.update();
// }
// @override
// void refresh(Object wallet) {
// final moneroWallet = wallet as MoneroWallet;
// moneroWallet.walletAddresses.accountList.refresh();
// }
// @override
// List<Account> getAll(Object wallet) {
// final moneroWallet = wallet as MoneroWallet;
// return moneroWallet.walletAddresses.accountList
// .getAll()
// .map((acc) => Account(id: acc.id, label: acc.label, balance: acc.balance))
// .toList();
// }
// @override
// Future<void> addAccount(Object wallet, {required String label}) async {
// final moneroWallet = wallet as MoneroWallet;
// await moneroWallet.walletAddresses.accountList.addAccount(label: label);
// }
// @override
// Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label}) async {
// final moneroWallet = wallet as MoneroWallet;
// await moneroWallet.walletAddresses.accountList
// .setLabelAccount(
// accountIndex: accountIndex,
// label: label);
// }
// }
class CWNano extends Nano {
// @override
// NanoAccountList getAccountList(Object wallet) {
// return CWNanoAccountList(wallet);
// }
// NanoAccountList getAccountList(Object wallet) {
// return CWNanoAccountList(wallet);
// }
@override
List<String> getNanoWordList(String language) {
@ -67,7 +13,16 @@ class CWNano extends Nano {
@override
WalletService createNanoWalletService(Box<WalletInfo> walletInfoSource) {
return NanoWalletService(walletInfoSource);
// return NanoWalletService(walletInfoSource);
throw UnimplementedError();
}
NanoWalletDetails getNanoWalletDetails(Object wallet) {
throw UnimplementedError();
}
String getTransactionAddress(Object wallet, int accountIndex, int addressIndex) {
throw UnimplementedError();
}
// @override
@ -83,7 +38,11 @@ class CWNano extends Nano {
required String language,
String? password,
}) {
return NanoNewWalletCredentials(name: name, password: password, language: language);
return NanoNewWalletCredentials(
name: name,
password: password,
language: language,
);
}
@override
@ -97,9 +56,4 @@ class CWNano extends Nano {
void onStartup() {
// monero_wallet_api.onStartup();
}
@override
List<String> getMoneroWordList(String language) {
throw UnimplementedError();
}
}

View file

@ -4,9 +4,14 @@ 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';
import 'package:cw_nano/api/wallet.dart' as nano_wallet_api;
import 'package:cw_nano/nano_balance.dart';
import 'package:cw_nano/nano_wallet_creation_credentials.dart';
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';
part 'cw_nano.dart';

View file

@ -4,6 +4,7 @@ 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 nanoOutputPath = 'lib/nano/nano.dart';
const walletTypesPath = 'lib/wallet_types.g.dart';
const pubspecDefaultPath = 'pubspec_default.yaml';
const pubspecOutputPath = 'pubspec.yaml';
@ -574,7 +575,7 @@ abstract class Ethereum {
}
Future<void> generateNano(bool hasImplementation) async {
final outputFile = File(ethereumOutputPath);
final outputFile = File(nanoOutputPath);
const nanoCommonHeaders = """
""";
const nanoCWHeaders = """
@ -676,7 +677,7 @@ Future<void> generatePubspec({
path: ./cw_nano
""";
const cwBanano = """
cw_nano:
cw_banano:
path: ./cw_banano
""";
final inputFile = File(pubspecOutputPath);