2023-10-02 14:17:35 +00:00
|
|
|
part of 'zano.dart';
|
|
|
|
|
|
|
|
class CWZano extends Zano {
|
|
|
|
|
2024-04-09 10:59:43 +00:00
|
|
|
List<ZanoAsset> getZanoAssets(WalletBase wallet) => (wallet as ZanoWallet).zanoAssets.values.toList();
|
2024-03-14 06:28:29 +00:00
|
|
|
|
2024-03-15 12:42:27 +00:00
|
|
|
@override
|
2024-03-16 10:55:03 +00:00
|
|
|
Future<CryptoCurrency> addZanoAssetById(WalletBase wallet, String assetId) async => await (wallet as ZanoWallet).addZanoAssetById(assetId);
|
2024-03-15 12:42:27 +00:00
|
|
|
|
2024-03-14 06:28:29 +00:00
|
|
|
@override
|
2024-03-19 15:51:08 +00:00
|
|
|
Future<void> changeZanoAssetAvailability(WalletBase wallet, CryptoCurrency token) async => await (wallet as ZanoWallet).changeZanoAssetAvailability(token as ZanoAsset);
|
2024-03-14 06:28:29 +00:00
|
|
|
|
|
|
|
@override
|
2024-03-16 10:55:03 +00:00
|
|
|
Future<void> deleteZanoAsset(WalletBase wallet, CryptoCurrency token) async => await (wallet as ZanoWallet).deleteZanoAsset(token as ZanoAsset);
|
2024-03-14 06:28:29 +00:00
|
|
|
|
|
|
|
@override
|
2024-03-15 12:42:27 +00:00
|
|
|
Future<ZanoAsset?> getZanoAsset(WalletBase wallet, String assetId) async {
|
2024-03-14 06:28:29 +00:00
|
|
|
final zanoWallet = wallet as ZanoWallet;
|
2024-03-15 12:42:27 +00:00
|
|
|
return await zanoWallet.getZanoAsset(assetId);
|
2024-03-14 06:28:29 +00:00
|
|
|
}
|
|
|
|
|
2024-03-19 15:51:08 +00:00
|
|
|
// @override
|
2024-04-09 10:59:43 +00:00
|
|
|
// TransactionHistoryBase getTransactionHistory(Object wallet) {
|
|
|
|
// final zanoWallet = wallet as ZanoWallet;
|
|
|
|
// return zanoWallet.transactionHistory;
|
2024-03-19 15:51:08 +00:00
|
|
|
// }
|
2023-10-02 14:17:35 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
TransactionPriority getDefaultTransactionPriority() {
|
|
|
|
return MoneroTransactionPriority.automatic;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
TransactionPriority deserializeMoneroTransactionPriority({required int raw}) {
|
|
|
|
return MoneroTransactionPriority.deserialize(raw: raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
List<TransactionPriority> getTransactionPriorities() {
|
|
|
|
return MoneroTransactionPriority.all;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2023-12-16 08:49:23 +00:00
|
|
|
List<String> getWordList(String language) {
|
|
|
|
assert(language.toLowerCase() == LanguageList.english.toLowerCase());
|
|
|
|
return EnglishMnemonics.words;
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
WalletCredentials createZanoRestoreWalletFromKeysCredentials(
|
2024-03-16 10:55:03 +00:00
|
|
|
{required String name,
|
|
|
|
required String spendKey,
|
|
|
|
required String viewKey,
|
|
|
|
required String address,
|
|
|
|
required String password,
|
|
|
|
required String language,
|
|
|
|
required int height}) {
|
|
|
|
return ZanoRestoreWalletFromKeysCredentials(
|
|
|
|
name: name, spendKey: spendKey, viewKey: viewKey, address: address, password: password, language: language, height: height);
|
2024-03-08 10:50:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2024-03-16 10:55:03 +00:00
|
|
|
WalletCredentials createZanoRestoreWalletFromSeedCredentials(
|
|
|
|
{required String name, required String password, required int height, required String mnemonic}) {
|
2024-03-08 10:50:34 +00:00
|
|
|
return ZanoRestoreWalletFromSeedCredentials(name: name, password: password, height: height, mnemonic: mnemonic);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
WalletCredentials createZanoNewWalletCredentials({required String name, String? password}) {
|
2023-11-17 17:40:23 +00:00
|
|
|
return ZanoNewWalletCredentials(name: name, password: password);
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|
|
|
|
|
2024-04-09 10:59:43 +00:00
|
|
|
// @override
|
|
|
|
// Map<String, String> getKeys(Object wallet) {
|
|
|
|
// final zanoWallet = wallet as ZanoWallet;
|
|
|
|
// final keys = zanoWallet.keys;
|
|
|
|
// return <String, String>{
|
|
|
|
// 'privateSpendKey': keys.privateSpendKey,
|
|
|
|
// 'privateViewKey': keys.privateViewKey,
|
|
|
|
// 'publicSpendKey': keys.publicSpendKey,
|
|
|
|
// 'publicViewKey': keys.publicViewKey
|
|
|
|
// };
|
|
|
|
// }
|
2023-10-02 14:17:35 +00:00
|
|
|
|
|
|
|
@override
|
2024-03-16 10:55:03 +00:00
|
|
|
Object createZanoTransactionCredentials({required List<Output> outputs, required TransactionPriority priority, required CryptoCurrency currency}) {
|
2024-03-08 10:50:34 +00:00
|
|
|
return ZanoTransactionCredentials(
|
2024-03-16 10:55:03 +00:00
|
|
|
outputs: outputs
|
|
|
|
.map((out) => OutputInfo(
|
|
|
|
fiatAmount: out.fiatAmount,
|
|
|
|
cryptoAmount: out.cryptoAmount,
|
|
|
|
address: out.address,
|
|
|
|
note: out.note,
|
|
|
|
sendAll: out.sendAll,
|
|
|
|
extractedAddress: out.extractedAddress,
|
|
|
|
isParsedAddress: out.isParsedAddress,
|
|
|
|
formattedCryptoAmount: out.formattedCryptoAmount))
|
|
|
|
.toList(),
|
|
|
|
priority: priority as MoneroTransactionPriority,
|
|
|
|
currency: currency,
|
|
|
|
);
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2024-03-20 11:17:48 +00:00
|
|
|
double formatterIntAmountToDouble({required int amount, required CryptoCurrency currency}) {
|
|
|
|
if (currency is ZanoAsset) return ZanoFormatter.intAmountToDouble(amount, currency.decimalPoint);
|
|
|
|
return ZanoFormatter.intAmountToDouble(amount);
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2024-03-20 11:17:48 +00:00
|
|
|
int formatterParseAmount({required String amount, required CryptoCurrency currency}) {
|
|
|
|
if (currency is ZanoAsset) return ZanoFormatter.parseAmount(amount, currency.decimalPoint);
|
|
|
|
return ZanoFormatter.parseAmount(amount);
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|
|
|
|
|
2024-04-09 10:59:43 +00:00
|
|
|
// @override
|
|
|
|
// int getTransactionInfoAccountId(TransactionInfo tx) {
|
|
|
|
// final zanoTransactionInfo = tx as ZanoTransactionInfo;
|
|
|
|
// return zanoTransactionInfo.accountIndex;
|
|
|
|
// }
|
2023-10-02 14:17:35 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
WalletService createZanoWalletService(Box<WalletInfo> walletInfoSource) {
|
|
|
|
return ZanoWalletService(walletInfoSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2024-03-16 10:55:03 +00:00
|
|
|
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction) {
|
|
|
|
transaction as ZanoTransactionInfo;
|
|
|
|
if (transaction.tokenSymbol == CryptoCurrency.zano.title) {
|
|
|
|
return CryptoCurrency.zano;
|
|
|
|
}
|
|
|
|
wallet as ZanoWallet;
|
2024-04-09 10:59:43 +00:00
|
|
|
final asset = wallet.zanoAssets.values.firstWhereOrNull((element) => element.ticker == transaction.tokenSymbol);
|
|
|
|
return asset ?? CryptoCurrency.zano;
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|
|
|
|
|
2024-03-14 06:28:29 +00:00
|
|
|
String getZanoAssetAddress(CryptoCurrency asset) => (asset as ZanoAsset).assetId;
|
2024-03-20 11:17:48 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String getAddress(WalletBase wallet) => (wallet as ZanoWallet).walletAddresses.address;
|
2023-10-02 14:17:35 +00:00
|
|
|
}
|