import 'package:cw_core/cake_hive.dart'; import 'package:cw_core/nano_account.dart'; import 'package:cw_core/account.dart'; import 'package:cw_core/node.dart'; import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/wallet_service.dart'; import 'package:cw_core/output_info.dart'; import 'package:cw_core/nano_account_info_response.dart'; import 'package:mobx/mobx.dart'; import 'package:hive/hive.dart'; import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cw_nano/nano_client.dart'; import 'package:cw_nano/nano_mnemonic.dart'; import 'package:cw_nano/nano_wallet.dart'; import 'package:cw_nano/nano_wallet_service.dart'; import 'package:cw_nano/nano_transaction_info.dart'; import 'package:cw_nano/nano_transaction_credentials.dart'; import 'package:cw_nano/nano_wallet_creation_credentials.dart'; // needed for nano_util: import 'dart:convert'; import 'dart:typed_data'; import 'package:convert/convert.dart'; import "package:ed25519_hd_key/ed25519_hd_key.dart"; import 'package:libcrypto/libcrypto.dart'; import 'package:nanodart/nanodart.dart' as ND; import 'package:decimal/decimal.dart'; part 'cw_nano.dart'; Nano? nano = CWNano(); NanoUtil? nanoUtil = CWNanoUtil(); abstract class Nano { NanoAccountList getAccountList(Object wallet); Account getCurrentAccount(Object wallet); void setCurrentAccount(Object wallet, int id, String label, String? balance); WalletService createNanoWalletService(Box walletInfoSource); WalletCredentials createNanoNewWalletCredentials({ required String name, String password, }); WalletCredentials createNanoRestoreWalletFromSeedCredentials({ required String name, required String password, required String mnemonic, DerivationType? derivationType, }); WalletCredentials createNanoRestoreWalletFromKeysCredentials({ required String name, required String password, required String seedKey, DerivationType? derivationType, }); List getNanoWordList(String language); Map getKeys(Object wallet); Object createNanoTransactionCredentials(List outputs); Future changeRep(Object wallet, String address); Future updateTransactions(Object wallet); BigInt getTransactionAmountRaw(TransactionInfo transactionInfo); } abstract class NanoAccountList { ObservableList get accounts; void update(Object wallet); void refresh(Object wallet); Future> getAll(Object wallet); Future addAccount(Object wallet, {required String label}); Future setLabelAccount(Object wallet, {required int accountIndex, required String label}); } abstract class NanoUtil { String seedToPrivate(String seed, int index); String seedToAddress(String seed, int index); String seedToMnemonic(String seed); Future mnemonicToSeed(String mnemonic); String privateKeyToPublic(String privateKey); String addressToPublicKey(String publicAddress); String privateKeyToAddress(String privateKey); String publicKeyToAddress(String publicKey); bool isValidSeed(String seed); Future hdMnemonicListToSeed(List words); Future hdSeedToPrivate(String seed, int index); Future hdSeedToAddress(String seed, int index); Future uniSeedToAddress(String seed, int index, String type); Future uniSeedToPrivate(String seed, int index, String type); bool isValidBip39Seed(String seed); static const int maxDecimalDigits = 6; // Max digits after decimal BigInt rawPerNano = BigInt.parse("1000000000000000000000000000000"); BigInt rawPerNyano = BigInt.parse("1000000000000000000000000"); BigInt rawPerBanano = BigInt.parse("100000000000000000000000000000"); BigInt rawPerXMR = BigInt.parse("1000000000000"); BigInt convertXMRtoNano = BigInt.parse("1000000000000000000"); Decimal getRawAsDecimal(String? raw, BigInt? rawPerCur); String truncateDecimal(Decimal input, {int digits = maxDecimalDigits}); String getRawAsUsableString(String? raw, BigInt rawPerCur); String getRawAccuracy(String? raw, BigInt rawPerCur); String getAmountAsRaw(String amount, BigInt rawPerCur); // derivationInfo: Future getInfoFromSeedOrMnemonic( DerivationType derivationType, { String? seedKey, String? mnemonic, required Node node, }); Future> compareDerivationMethods({ String? mnemonic, String? privateKey, required Node node, }); }