mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 02:34:59 +00:00
updated zano ApiCalls, removed dummy
This commit is contained in:
parent
00a5bd941f
commit
3c2953a718
62 changed files with 244 additions and 1418 deletions
|
@ -200,7 +200,6 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
|
|||
static const dydx = CryptoCurrency(title: 'DYDX', tag: 'ETH', fullName: 'dYdX', raw: 84, name: 'dydx', iconPath: 'assets/images/dydx_icon.png');
|
||||
static const steth = CryptoCurrency(title: 'STETH', tag: 'ETH', fullName: 'Lido Staked Ethereum', raw: 85, name: 'steth', iconPath: 'assets/images/steth_icon.png');
|
||||
static const zano = CryptoCurrency(title: 'ZANO', tag: 'ZANO', fullName: 'Zano', raw: 86, name: 'zano', iconPath: 'assets/images/zano_icon.png');
|
||||
static const dummy = CryptoCurrency(title: 'DUMMY', tag: 'DUMMY', fullName: 'Dummy', raw: 87, name: 'dummy', iconPath: 'assets/images/zano_icon.png');
|
||||
|
||||
|
||||
static final Map<int, CryptoCurrency> _rawCurrencyMap =
|
||||
|
|
|
@ -15,8 +15,6 @@ CryptoCurrency currencyForWalletType(WalletType type) {
|
|||
return CryptoCurrency.eth;
|
||||
case WalletType.zano:
|
||||
return CryptoCurrency.zano;
|
||||
case WalletType.dummy:
|
||||
return CryptoCurrency.dummy;
|
||||
default:
|
||||
throw Exception(
|
||||
'Unexpected wallet type: ${type.toString()} for CryptoCurrency currencyForWalletType');
|
||||
|
|
|
@ -80,8 +80,6 @@ class Node extends HiveObject with Keyable {
|
|||
return Uri.http(uriRaw, '');
|
||||
case WalletType.ethereum:
|
||||
return Uri.https(uriRaw, '');
|
||||
case WalletType.dummy:
|
||||
return Uri.https(uriRaw, '');
|
||||
default:
|
||||
throw Exception('Unexpected type ${type.toString()} for Node uri');
|
||||
}
|
||||
|
@ -135,8 +133,6 @@ class Node extends HiveObject with Keyable {
|
|||
return requestZanoNode();
|
||||
case WalletType.ethereum:
|
||||
return requestElectrumServer();
|
||||
case WalletType.dummy:
|
||||
throw UnimplementedError();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ const walletTypes = [
|
|||
WalletType.haven,
|
||||
WalletType.ethereum,
|
||||
WalletType.zano,
|
||||
WalletType.dummy,
|
||||
];
|
||||
|
||||
@HiveType(typeId: WALLET_TYPE_TYPE_ID)
|
||||
|
@ -36,9 +35,6 @@ enum WalletType {
|
|||
|
||||
@HiveField(6)
|
||||
zano,
|
||||
|
||||
@HiveField(7)
|
||||
dummy,
|
||||
}
|
||||
|
||||
int serializeToInt(WalletType type) {
|
||||
|
@ -55,8 +51,6 @@ int serializeToInt(WalletType type) {
|
|||
return 4;
|
||||
case WalletType.zano:
|
||||
return 5;
|
||||
case WalletType.dummy:
|
||||
return 6;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -76,8 +70,6 @@ WalletType deserializeFromInt(int raw) {
|
|||
return WalletType.ethereum;
|
||||
case 5:
|
||||
return WalletType.zano;
|
||||
case 6:
|
||||
return WalletType.dummy;
|
||||
default:
|
||||
throw Exception(
|
||||
'Unexpected token: $raw for WalletType deserializeFromInt');
|
||||
|
@ -98,8 +90,6 @@ String walletTypeToString(WalletType type) {
|
|||
return 'Ethereum';
|
||||
case WalletType.zano:
|
||||
return 'Zano';
|
||||
case WalletType.dummy:
|
||||
return 'Dummy';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
@ -119,8 +109,6 @@ String walletTypeToDisplayName(WalletType type) {
|
|||
return 'Ethereum (ETH)';
|
||||
case WalletType.zano:
|
||||
return 'Zano (ZANO)';
|
||||
case WalletType.dummy:
|
||||
return 'Dummy (DUMMY)';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
@ -140,8 +128,6 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type) {
|
|||
return CryptoCurrency.zano;
|
||||
case WalletType.ethereum:
|
||||
return CryptoCurrency.eth;
|
||||
case WalletType.dummy:
|
||||
return CryptoCurrency.dummy;
|
||||
default:
|
||||
throw Exception(
|
||||
'Unexpected wallet type: ${type.toString()} for CryptoCurrency walletTypeToCryptoCurrency');
|
||||
|
|
30
cw_dummy/.gitignore
vendored
30
cw_dummy/.gitignore
vendored
|
@ -1,30 +0,0 @@
|
|||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
/pubspec.lock
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.packages
|
||||
build/
|
|
@ -1,10 +0,0 @@
|
|||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
channel: stable
|
||||
|
||||
project_type: package
|
|
@ -1,3 +0,0 @@
|
|||
## 0.0.1
|
||||
|
||||
* TODO: Describe initial release.
|
|
@ -1 +0,0 @@
|
|||
TODO: Add your license here.
|
|
@ -1,39 +0,0 @@
|
|||
<!--
|
||||
This README describes the package. If you publish this package to pub.dev,
|
||||
this README's contents appear on the landing page for your package.
|
||||
|
||||
For information about how to write a good package README, see the guide for
|
||||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
|
||||
|
||||
For general information about developing packages, see the Dart guide for
|
||||
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
|
||||
and the Flutter guide for
|
||||
[developing packages and plugins](https://flutter.dev/developing-packages).
|
||||
-->
|
||||
|
||||
TODO: Put a short description of the package here that helps potential users
|
||||
know whether this package might be useful for them.
|
||||
|
||||
## Features
|
||||
|
||||
TODO: List what your package can do. Maybe include images, gifs, or videos.
|
||||
|
||||
## Getting started
|
||||
|
||||
TODO: List prerequisites and provide or point to information on how to
|
||||
start using the package.
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Include short and useful examples for package users. Add longer examples
|
||||
to `/example` folder.
|
||||
|
||||
```dart
|
||||
const like = 'sample';
|
||||
```
|
||||
|
||||
## Additional information
|
||||
|
||||
TODO: Tell users more about the package: where to find more information, how to
|
||||
contribute to the package, how to file issues, what response they can expect
|
||||
from the package authors, and more.
|
|
@ -1,4 +0,0 @@
|
|||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
|
@ -1,7 +0,0 @@
|
|||
library cw_dummy;
|
||||
|
||||
/// A Calculator.
|
||||
class Calculator {
|
||||
/// Returns [value] plus 1.
|
||||
int addOne(int value) => value + 1;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
import 'package:cw_core/balance.dart';
|
||||
|
||||
class DummyBalance extends Balance {
|
||||
DummyBalance(super.available, super.additional);
|
||||
|
||||
@override
|
||||
// TODO: implement formattedAdditionalBalance
|
||||
String get formattedAdditionalBalance => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
// TODO: implement formattedAvailableBalance
|
||||
String get formattedAvailableBalance => throw UnimplementedError();
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
import 'package:cw_core/output_info.dart';
|
||||
|
||||
import 'dummy_transaction_priority.dart';
|
||||
|
||||
class DummyTransactionCreationCredentials {
|
||||
final List<OutputInfo> outputs;
|
||||
final DummyTransactionPriority? priority;
|
||||
|
||||
DummyTransactionCreationCredentials({required this.outputs, this.priority});
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
|
||||
import 'dummy_transaction_info.dart';
|
||||
|
||||
part 'dummy_transaction_history.g.dart';
|
||||
|
||||
class DummyTransactionHistory = DummyTransactionHistoryBase
|
||||
with _$DummyTransactionHistory;
|
||||
|
||||
abstract class DummyTransactionHistoryBase
|
||||
extends TransactionHistoryBase<DummyTransactionInfo> with Store {
|
||||
DummyTransactionHistoryBase() {
|
||||
transactions = ObservableMap<String, DummyTransactionInfo>();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save() async {
|
||||
throw UnimplementedError;
|
||||
}
|
||||
|
||||
@override
|
||||
void addOne(DummyTransactionInfo transaction) => transactions[transaction.id] = transaction;
|
||||
|
||||
@override
|
||||
void addMany(Map<String, DummyTransactionInfo> transactions) =>
|
||||
this.transactions.addAll(transactions);
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
import 'package:cw_core/transaction_info.dart';
|
||||
|
||||
class DummyTransactionInfo extends TransactionInfo {
|
||||
@override
|
||||
String amountFormatted() {
|
||||
// TODO: implement amountFormatted
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
void changeFiatAmount(String amount) {
|
||||
// TODO: implement changeFiatAmount
|
||||
}
|
||||
|
||||
@override
|
||||
String? feeFormatted() {
|
||||
// TODO: implement feeFormatted
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
String fiatAmount() {
|
||||
// TODO: implement fiatAmount
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import 'package:cw_core/transaction_priority.dart';
|
||||
|
||||
class DummyTransactionPriority extends TransactionPriority {
|
||||
const DummyTransactionPriority({required super.title, required super.raw});
|
||||
|
||||
static const List<DummyTransactionPriority> all = [slow, medium, fast];
|
||||
|
||||
static const slow = DummyTransactionPriority(title: 'Slow', raw: 0);
|
||||
static const medium = DummyTransactionPriority(title: 'Medium', raw: 1);
|
||||
static const fast = DummyTransactionPriority(title: 'Fast', raw: 2);
|
||||
|
||||
static DummyTransactionPriority deserialize({required int raw}) {
|
||||
switch (raw) {
|
||||
case 0: return slow;
|
||||
case 1: return medium;
|
||||
case 2: return fast;
|
||||
default: throw Exception('Unexpected token: $raw for DummyTransactionPriority deserialize');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/node.dart';
|
||||
import 'package:cw_core/pending_transaction.dart';
|
||||
import 'package:cw_core/sync_status.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
|
||||
import 'dummy_balance.dart';
|
||||
import 'dummy_transaction_history.dart';
|
||||
import 'dummy_transaction_info.dart';
|
||||
import 'dummy_wallet_addresses.dart';
|
||||
|
||||
part 'dummy_wallet.g.dart';
|
||||
|
||||
class DummyWallet = DummyWalletBase with _$DummyWallet;
|
||||
|
||||
abstract class DummyWalletBase extends WalletBase<DummyBalance,
|
||||
DummyTransactionHistory, DummyTransactionInfo> with Store {
|
||||
DummyWalletBase({required WalletInfo walletInfo}) : super(walletInfo) {}
|
||||
|
||||
@override
|
||||
int calculateEstimatedFee(TransactionPriority priority, int? amount) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> changePassword(String password) async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> close() async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> connectToNode({required Node node}) async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<PendingTransaction> createTransaction(Object credentials) async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<Map<String, DummyTransactionInfo>> fetchTransactions() async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> renameWalletFiles(String newWalletName) async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> rescan({required int height}) async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> save() async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> startSync() async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void>? updateBalance() => null;
|
||||
|
||||
@override
|
||||
@observable
|
||||
late ObservableMap<CryptoCurrency, DummyBalance> balance;
|
||||
|
||||
@override
|
||||
Object get keys => throw UnimplementedError("keys");
|
||||
|
||||
@override
|
||||
String get seed => "seed";
|
||||
|
||||
@override
|
||||
@observable
|
||||
late SyncStatus syncStatus;
|
||||
|
||||
@override
|
||||
late DummyWalletAddresses walletAddresses;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/wallet_addresses.dart';
|
||||
|
||||
part 'dummy_wallet_addresses.g.dart';
|
||||
|
||||
class DummyWalletAddresses = DummyWalletAddressesBase with _$DummyWalletAddresses;
|
||||
|
||||
abstract class DummyWalletAddressesBase extends WalletAddresses with Store {
|
||||
DummyWalletAddressesBase(super.walletInfo);
|
||||
|
||||
@override
|
||||
@observable
|
||||
late String address;
|
||||
|
||||
@override
|
||||
Future<void> init() async => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> updateAddressesInBox() async => throw UnimplementedError();
|
||||
|
||||
// TODO: from electrum wallet addresses implementation
|
||||
Future<void> generateNewAddress() async => throw UnimplementedError();
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import 'package:cw_core/wallet_credentials.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
|
||||
class DummyNewWalletCredentials extends WalletCredentials {
|
||||
DummyNewWalletCredentials({required String name, WalletInfo? walletInfo})
|
||||
: super(name: name, walletInfo: walletInfo);
|
||||
}
|
||||
|
||||
class DummyRestoreWalletFromSeedCredentials extends WalletCredentials {
|
||||
DummyRestoreWalletFromSeedCredentials({required String name, WalletInfo? walletInfo})
|
||||
: super(name: name, walletInfo: walletInfo);
|
||||
}
|
||||
|
||||
class DummyRestoreWalletFromKeyCredentials extends WalletCredentials {
|
||||
DummyRestoreWalletFromKeyCredentials({required String name, WalletInfo? walletInfo})
|
||||
: super(name: name, walletInfo: walletInfo);
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/pathForWallet.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_credentials.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import 'dummy_wallet_creation_credentials.dart';
|
||||
|
||||
|
||||
class DummyWalletService extends WalletService<DummyNewWalletCredentials, DummyRestoreWalletFromSeedCredentials, DummyRestoreWalletFromKeyCredentials> {
|
||||
DummyWalletService(this.walletInfoSource);
|
||||
|
||||
final Box<WalletInfo> walletInfoSource;
|
||||
|
||||
@override
|
||||
Future<WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>> create(WalletCredentials credentials) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
WalletType getType() => WalletType.dummy;
|
||||
|
||||
@override
|
||||
Future<bool> isWalletExit(String name) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>> openWallet(String name, String password) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> remove(String wallet) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> rename(String currentName, String password, String newName) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>> restoreFromKeys(DummyRestoreWalletFromKeyCredentials credentials) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>> restoreFromSeed(DummyRestoreWalletFromSeedCredentials credentials) => throw UnimplementedError();
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
/home/leo/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
|
||||
// Registers Flutter plugins.
|
||||
void fl_register_plugins(FlPluginRegistry* registry);
|
||||
|
||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
|
@ -1,12 +0,0 @@
|
|||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import path_provider_foundation
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// This is a generated file; do not edit or check into version control.
|
||||
FLUTTER_ROOT=/home/leo/flutter
|
||||
FLUTTER_APPLICATION_PATH=/opt/android/cake_wallet/cw_dummy
|
||||
COCOAPODS_PARALLEL_CODE_SIGN=true
|
||||
FLUTTER_BUILD_DIR=build
|
||||
FLUTTER_BUILD_NAME=0.0.1
|
||||
FLUTTER_BUILD_NUMBER=0.0.1
|
||||
DART_OBFUSCATION=false
|
||||
TRACK_WIDGET_CREATION=true
|
||||
TREE_SHAKE_ICONS=false
|
||||
PACKAGE_CONFIG=.dart_tool/package_config.json
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
# This is a generated file; do not edit or check into version control.
|
||||
export "FLUTTER_ROOT=/home/leo/flutter"
|
||||
export "FLUTTER_APPLICATION_PATH=/opt/android/cake_wallet/cw_dummy"
|
||||
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
|
||||
export "FLUTTER_BUILD_DIR=build"
|
||||
export "FLUTTER_BUILD_NAME=0.0.1"
|
||||
export "FLUTTER_BUILD_NUMBER=0.0.1"
|
||||
export "DART_OBFUSCATION=false"
|
||||
export "TRACK_WIDGET_CREATION=true"
|
||||
export "TREE_SHAKE_ICONS=false"
|
||||
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
|
|
@ -1,70 +0,0 @@
|
|||
name: cw_dummy
|
||||
description: A new Flutter package project.
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.5 <3.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
ffi: ^2.0.1
|
||||
http: ^1.1.0
|
||||
path_provider: ^2.0.11
|
||||
mobx: ^2.0.7+4
|
||||
flutter_mobx: ^2.0.6+1
|
||||
intl: ^0.18.0
|
||||
cw_core:
|
||||
path: ../cw_core
|
||||
|
||||
cw_zano:
|
||||
path: ../cw_zano
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
build_runner: ^2.1.11
|
||||
mobx_codegen: ^2.0.7
|
||||
build_resolvers: ^2.0.9
|
||||
hive_generator: ^1.1.3
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# To add assets to your package, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
#
|
||||
# For details regarding assets in packages, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
#
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# To add custom fonts to your package, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts in packages, see
|
||||
# https://flutter.dev/custom-fonts/#from-packages
|
|
@ -1,12 +0,0 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:cw_dummy/cw_dummy.dart';
|
||||
|
||||
void main() {
|
||||
test('adds one to input values', () {
|
||||
final calculator = Calculator();
|
||||
expect(calculator.addOne(2), 3);
|
||||
expect(calculator.addOne(-7), -6);
|
||||
expect(calculator.addOne(0), 1);
|
||||
});
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
#include <flutter/plugin_registry.h>
|
||||
|
||||
// Registers Flutter plugins.
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry);
|
||||
|
||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
|
@ -5,51 +5,50 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.11.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.1.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.17.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
@ -60,27 +59,46 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.10"
|
||||
version: "0.12.15"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.9.1"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.3"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
@ -90,58 +108,58 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.9.1"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
version: "1.11.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.2.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.19"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "0.5.1"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.1.4"
|
||||
sdks:
|
||||
dart: ">=2.12.0-0.0 <3.0.0"
|
||||
dart: ">=3.0.0-0 <4.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
|
|
@ -1,351 +0,0 @@
|
|||
import 'dart:ffi';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cw_zano/api/convert_utf8_to_string.dart';
|
||||
import 'package:cw_zano/api/model/get_recent_txs_and_info_params.dart';
|
||||
import 'package:cw_zano/api/model/transfer_params.dart';
|
||||
import 'package:cw_zano/api/structs/utf8_box.dart';
|
||||
import 'package:cw_zano/api/zano_api.dart';
|
||||
import 'package:ffi/ffi.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
// bool setup_node(char *address, char *login, char *password, bool use_ssl, bool is_light_wallet, char *error)
|
||||
final _setupNodeNative =
|
||||
zanoApi.lookup<NativeFunction<_setup_node>>('setup_node').asFunction<_SetupNode>();
|
||||
typedef _setup_node = Int8 Function(
|
||||
Pointer<Utf8>, Pointer<Utf8>?, Pointer<Utf8>?, Int8, Int8, Pointer<Utf8>);
|
||||
typedef _SetupNode = int Function(
|
||||
Pointer<Utf8>, Pointer<Utf8>?, Pointer<Utf8>?, int, int, Pointer<Utf8>);
|
||||
|
||||
// char * create_wallet(char *path, char *password, char *language, int32_t networkType, char *error)
|
||||
final _createWalletNative =
|
||||
zanoApi.lookup<NativeFunction<_create_wallet>>('create_wallet').asFunction<_CreateWallet>();
|
||||
typedef _create_wallet = Pointer<Utf8> Function(
|
||||
Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Int32, Pointer<Utf8>);
|
||||
typedef _CreateWallet = Pointer<Utf8> Function(
|
||||
Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, int, Pointer<Utf8>);
|
||||
|
||||
// char* async_call(char* method_name, uint64_t instance_id, char* params)
|
||||
final _asyncCallNative =
|
||||
zanoApi.lookup<NativeFunction<_async_call>>('async_call').asFunction<_AsyncCall>();
|
||||
typedef _async_call = Pointer<Utf8> Function(Pointer<Utf8>, Int64, Pointer<Utf8>);
|
||||
typedef _AsyncCall = Pointer<Utf8> Function(
|
||||
Pointer<Utf8> methodName, int hWallet, Pointer<Utf8> params);
|
||||
|
||||
// char* get_wallet_status(uint64_t hwallet)
|
||||
final _getWalletStatusNative = zanoApi
|
||||
.lookup<NativeFunction<_get_wallet_status>>('get_wallet_status')
|
||||
.asFunction<_GetWalletStatus>();
|
||||
typedef _get_wallet_status = Pointer<Utf8> Function(Int64);
|
||||
typedef _GetWalletStatus = Pointer<Utf8> Function(int hWallet);
|
||||
|
||||
// char *get_wallet_info(uint64_t hwallet)
|
||||
final _getWalletInfoNative = zanoApi
|
||||
.lookup<NativeFunction<_get_wallet_info>>('get_wallet_info')
|
||||
.asFunction<_GetWalletInfo>();
|
||||
typedef _get_wallet_info = Pointer<Utf8> Function(Int64);
|
||||
typedef _GetWalletInfo = Pointer<Utf8> Function(int hWallet);
|
||||
|
||||
// char* get_connectivity_status()
|
||||
final _getConnectivityStatusNative = zanoApi
|
||||
.lookup<NativeFunction<_get_connectivity_status>>('get_connectivity_status')
|
||||
.asFunction<_GetConnectivityStatus>();
|
||||
typedef _get_connectivity_status = Pointer<Utf8> Function();
|
||||
typedef _GetConnectivityStatus = Pointer<Utf8> Function();
|
||||
|
||||
// char* get_version()
|
||||
final _getVersionNative =
|
||||
zanoApi.lookup<NativeFunction<_get_version>>('get_version').asFunction<_GetVersion>();
|
||||
typedef _get_version = Pointer<Utf8> Function();
|
||||
typedef _GetVersion = Pointer<Utf8> Function();
|
||||
|
||||
// char * load_wallet(char *path, char *password, int32_t nettype)
|
||||
final _loadWalletNative =
|
||||
zanoApi.lookup<NativeFunction<_load_wallet>>('load_wallet').asFunction<_LoadWallet>();
|
||||
typedef _load_wallet = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>, Int8);
|
||||
typedef _LoadWallet = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>, int);
|
||||
|
||||
// char* try_pull_result(uint64_t job_id)
|
||||
final _tryPullResultNative = zanoApi
|
||||
.lookup<NativeFunction<_try_pull_result>>('try_pull_result')
|
||||
.asFunction<_TryPullResult>();
|
||||
typedef _try_pull_result = Pointer<Utf8> Function(Int64);
|
||||
typedef _TryPullResult = Pointer<Utf8> Function(int hWallet);
|
||||
|
||||
// void close_wallet(uint64_t hwallet)
|
||||
final _closeWalletNative =
|
||||
zanoApi.lookup<NativeFunction<_close_wallet>>('close_wallet').asFunction<_closeWalletStatus>();
|
||||
typedef _close_wallet = Void Function(Int64);
|
||||
typedef _closeWalletStatus = void Function(int hWallet);
|
||||
|
||||
// uint64_t get_current_tx_fee(uint64_t priority)
|
||||
final _getCurrentTxFeeNative = zanoApi
|
||||
.lookup<NativeFunction<_get_current_tx_fee>>('get_current_tx_fee')
|
||||
.asFunction<_getCurrentTxFee>();
|
||||
typedef _get_current_tx_fee = Int64 Function(Int64);
|
||||
typedef _getCurrentTxFee = int Function(int priority);
|
||||
|
||||
// char * restore_wallet_from_seed(char *path, char *password, char *seed, int32_t networkType, uint64_t restoreHeight, char *error)
|
||||
final _restoreWalletFromSeedNative = zanoApi
|
||||
.lookup<NativeFunction<_restore_wallet_from_seed>>('restore_wallet_from_seed')
|
||||
.asFunction<_RestoreWalletFromSeed>();
|
||||
typedef _restore_wallet_from_seed = Pointer<Utf8> Function(
|
||||
Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Int32, Int64, Pointer<Utf8>);
|
||||
typedef _RestoreWalletFromSeed = Pointer<Utf8> Function(
|
||||
Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, int, int, Pointer<Utf8>);
|
||||
|
||||
// char* set_password(uint64_t hwallet, char *password, Utf8Box &error)
|
||||
final _setPasswordNative =
|
||||
zanoApi.lookup<NativeFunction<_set_password>>('set_password').asFunction<_SetPassword>();
|
||||
typedef _set_password = Pointer<Utf8> Function(Int64 hWallet, Pointer<Utf8> password, Pointer<Utf8Box> error);
|
||||
typedef _SetPassword = Pointer<Utf8> Function(int hWallet, Pointer<Utf8> password, Pointer<Utf8Box> error);
|
||||
|
||||
String setPassword({required int hWallet, required String password}) {
|
||||
final passwordPointer = password.toNativeUtf8();
|
||||
final errorMessagePointer = calloc<Utf8Box>();
|
||||
final result =
|
||||
convertUTF8ToString(pointer: _setPasswordNative(hWallet, passwordPointer, errorMessagePointer));
|
||||
calloc.free(passwordPointer);
|
||||
|
||||
/*if (!changed) {
|
||||
final message = errorMessagePointer.ref.getValue();
|
||||
calloc.free(errorMessagePointer);
|
||||
throw Exception(message);
|
||||
}*/
|
||||
|
||||
calloc.free(errorMessagePointer);
|
||||
return result;
|
||||
}
|
||||
|
||||
// is_wallet_exist(char *path)
|
||||
final _isWalletExistNative = zanoApi
|
||||
.lookup<NativeFunction<_is_wallet_exist>>('is_wallet_exist')
|
||||
.asFunction<_IsWalletExist>();
|
||||
typedef _is_wallet_exist = Int8 Function(Pointer<Utf8>);
|
||||
typedef _IsWalletExist = int Function(Pointer<Utf8>);
|
||||
|
||||
bool isWalletExist({required String path}) {
|
||||
final pathPointer = path.toNativeUtf8();
|
||||
final isExist = _isWalletExistNative(pathPointer) != 0;
|
||||
calloc.free(pathPointer);
|
||||
return isExist;
|
||||
}
|
||||
|
||||
// char* get_address_info(char* address)
|
||||
final _getAddressInfoNative = zanoApi
|
||||
.lookup<NativeFunction<_get_address_info>>('get_address_info')
|
||||
.asFunction<_GetAddressInfo>();
|
||||
typedef _get_address_info = Pointer<Utf8> Function(Pointer<Utf8> password);
|
||||
typedef _GetAddressInfo = Pointer<Utf8> Function(Pointer<Utf8> address);
|
||||
|
||||
String getAddressInfo(String address) {
|
||||
debugPrint('get address info $address');
|
||||
final addressPointer = address.toNativeUtf8();
|
||||
final result =
|
||||
convertUTF8ToString(pointer: _getAddressInfoNative(addressPointer));
|
||||
debugPrint('get address info result $result');
|
||||
calloc.free(addressPointer);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool setupNode({
|
||||
required String address,
|
||||
String? login,
|
||||
String? password,
|
||||
bool useSSL = false,
|
||||
bool isLightWallet = false,
|
||||
/*String? socksProxyAddress*/
|
||||
}) {
|
||||
final addressPointer = address.toNativeUtf8();
|
||||
Pointer<Utf8>? loginPointer;
|
||||
Pointer<Utf8>? passwordPointer;
|
||||
|
||||
if (login != null) {
|
||||
loginPointer = login.toNativeUtf8();
|
||||
}
|
||||
|
||||
if (password != null) {
|
||||
passwordPointer = password.toNativeUtf8();
|
||||
}
|
||||
|
||||
final errorMessagePointer = ''.toNativeUtf8();
|
||||
debugPrint(
|
||||
"setup_node address $address login $login password $password useSSL $useSSL isLightWallet $isLightWallet");
|
||||
final isSetupNode = _setupNodeNative(addressPointer, loginPointer, passwordPointer,
|
||||
_boolToInt(useSSL), _boolToInt(isLightWallet), errorMessagePointer) !=
|
||||
0;
|
||||
debugPrint("setup_node result $isSetupNode");
|
||||
|
||||
calloc.free(addressPointer);
|
||||
|
||||
if (loginPointer != null) {
|
||||
calloc.free(loginPointer);
|
||||
}
|
||||
|
||||
if (passwordPointer != null) {
|
||||
calloc.free(passwordPointer);
|
||||
}
|
||||
|
||||
return isSetupNode;
|
||||
}
|
||||
|
||||
String asyncCall({required String methodName, required int hWallet, required String params}) {
|
||||
final methodNamePointer = methodName.toNativeUtf8();
|
||||
final paramsPointer = params.toNativeUtf8();
|
||||
|
||||
debugPrint('async_call method_name $methodName hWallet $hWallet params $params');
|
||||
final result =
|
||||
convertUTF8ToString(pointer: _asyncCallNative(methodNamePointer, hWallet, paramsPointer));
|
||||
|
||||
calloc.free(methodNamePointer);
|
||||
calloc.free(paramsPointer);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
String createWallet(
|
||||
{required String path, required String password, required String language, int nettype = 0}) {
|
||||
final pathPointer = path.toNativeUtf8();
|
||||
final passwordPointer = password.toNativeUtf8();
|
||||
final languagePointer = language.toNativeUtf8();
|
||||
final errorMessagePointer = ''.toNativeUtf8();
|
||||
debugPrint('create_wallet path $path password $password language $language');
|
||||
final result = convertUTF8ToString(
|
||||
pointer: _createWalletNative(
|
||||
pathPointer, passwordPointer, languagePointer, nettype, errorMessagePointer));
|
||||
debugPrint('create_wallet result $result');
|
||||
calloc.free(pathPointer);
|
||||
calloc.free(passwordPointer);
|
||||
calloc.free(languagePointer);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<String> invokeMethod(int hWallet, String methodName, String params) async {
|
||||
debugPrint('invoke method $methodName params $params');
|
||||
final invokeResult = asyncCall(
|
||||
methodName: 'invoke',
|
||||
hWallet: hWallet,
|
||||
params: json.encode({
|
||||
'method': methodName,
|
||||
'params': params,
|
||||
}));
|
||||
debugPrint('invoke result $invokeResult');
|
||||
final map = json.decode(invokeResult);
|
||||
if (map['job_id'] != null) {
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
final result = tryPullResult(map['job_id'] as int);
|
||||
return result;
|
||||
}
|
||||
return invokeResult;
|
||||
}
|
||||
|
||||
Future<String> store(int hWallet) async {
|
||||
return await invokeMethod(hWallet, 'store', '{}');
|
||||
}
|
||||
|
||||
Future<String> transfer(int hWallet, TransferParams params) async {
|
||||
final invokeResult = await asyncCall(
|
||||
methodName: 'invoke',
|
||||
hWallet: hWallet,
|
||||
params: '{"method": "transfer","params": ${jsonEncode(params)}}',
|
||||
);
|
||||
debugPrint('invoke result $invokeResult');
|
||||
var map = json.decode(invokeResult);
|
||||
if (map['job_id'] != null) {
|
||||
// TODO: fixit
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
final result = tryPullResult(map['job_id'] as int);
|
||||
return result;
|
||||
}
|
||||
return invokeResult;
|
||||
}
|
||||
|
||||
Future<String> getRecentTxsAndInfo(
|
||||
{required int hWallet,
|
||||
required int offset,
|
||||
required int count,
|
||||
bool updateProvisionInfo = true}) async {
|
||||
return await invokeMethod(
|
||||
hWallet,
|
||||
'get_recent_txs_and_info',
|
||||
json.encode(
|
||||
GetRecentTxsAndInfoParams(
|
||||
offset: offset,
|
||||
count: count,
|
||||
updateProvisionInfo: updateProvisionInfo,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getWalletStatus(int hWallet) {
|
||||
debugPrint('get_wallet_status hWallet $hWallet');
|
||||
final result = convertUTF8ToString(pointer: _getWalletStatusNative(hWallet));
|
||||
debugPrint('get_wallet_status result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
void closeWallet(int hWallet) {
|
||||
debugPrint('close_wallet hWallet $hWallet');
|
||||
_closeWalletNative(hWallet);
|
||||
}
|
||||
|
||||
int getCurrentTxFee(int priority) {
|
||||
debugPrint('get_current_tx_fee priority $priority');
|
||||
final result = _getCurrentTxFeeNative(priority);
|
||||
debugPrint('get_current_tx_fee result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
String getWalletInfo(int hWallet) {
|
||||
debugPrint('get_wallet_info hWallet $hWallet');
|
||||
final result = convertUTF8ToString(pointer: _getWalletInfoNative(hWallet));
|
||||
debugPrint('get_wallet_info result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
String getConnectivityStatus() {
|
||||
final result = convertUTF8ToString(pointer: _getConnectivityStatusNative());
|
||||
debugPrint('get_connectivity_status result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
String getVersion() {
|
||||
final result = convertUTF8ToString(pointer: _getVersionNative());
|
||||
debugPrint('get_version result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
String restoreWalletFromSeed(String path, String password, String seed) {
|
||||
debugPrint('restore_wallet_from_seed path $path password $password seed $seed');
|
||||
final pathPointer = path.toNativeUtf8();
|
||||
final passwordPointer = password.toNativeUtf8();
|
||||
final seedPointer = seed.toNativeUtf8();
|
||||
final errorMessagePointer = ''.toNativeUtf8();
|
||||
final result = convertUTF8ToString(
|
||||
pointer: _restoreWalletFromSeedNative(
|
||||
pathPointer, passwordPointer, seedPointer, 0, 0, errorMessagePointer));
|
||||
debugPrint('restore wallet from seed result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
String loadWallet(String path, String password, int nettype) {
|
||||
debugPrint('load_wallet path $path password $password nettype $nettype');
|
||||
final pathPointer = path.toNativeUtf8();
|
||||
final passwordPointer = password.toNativeUtf8();
|
||||
final result = convertUTF8ToString(
|
||||
pointer: _loadWalletNative(pathPointer, passwordPointer, nettype),
|
||||
);
|
||||
debugPrint('load_wallet result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
String tryPullResult(int jobId) {
|
||||
debugPrint('try_pull_result jobId $jobId');
|
||||
final result = convertUTF8ToString(pointer: _tryPullResultNative(jobId));
|
||||
debugPrint('try_pull_result result $result');
|
||||
return result;
|
||||
}
|
||||
|
||||
int _boolToInt(bool value) => value ? 1 : 0;
|
|
@ -3,11 +3,11 @@ class GetRecentTxsAndInfoParams {
|
|||
final int count;
|
||||
final bool updateProvisionInfo;
|
||||
|
||||
GetRecentTxsAndInfoParams({required this.offset, required this.count, required this.updateProvisionInfo});
|
||||
GetRecentTxsAndInfoParams({required this.offset, required this.count, this.updateProvisionInfo = true});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"offset": offset,
|
||||
"count": count,
|
||||
"update_provision_info": updateProvisionInfo,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'update_provision_info': updateProvisionInfo,
|
||||
};
|
||||
}
|
|
@ -2,7 +2,8 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_zano/api/calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart';
|
||||
import 'package:cw_zano/api/model/get_wallet_info_result.dart';
|
||||
import 'package:cw_zano/api/model/get_wallet_status_result.dart';
|
||||
import 'package:cw_zano/api/model/zano_wallet_keys.dart';
|
||||
|
@ -12,13 +13,13 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:mobx/mobx.dart' as mobx;
|
||||
|
||||
int getCurrentHeight(int hWallet) {
|
||||
final json = calls.getWalletStatus(hWallet);
|
||||
final json = ApiCalls.getWalletStatus(hWallet: hWallet);
|
||||
final walletStatus = GetWalletStatusResult.fromJson(jsonDecode(json) as Map<String, dynamic>);
|
||||
return walletStatus.currentWalletHeight;
|
||||
}
|
||||
|
||||
int getNodeHeightSync(int hWallet) {
|
||||
final json = calls.getWalletStatus(hWallet);
|
||||
final json = ApiCalls.getWalletStatus(hWallet: hWallet);
|
||||
final walletStatus = GetWalletStatusResult.fromJson(jsonDecode(json) as Map<String, dynamic>);
|
||||
return walletStatus.currentDaemonHeight;
|
||||
}
|
||||
|
@ -37,13 +38,13 @@ class SyncListener {
|
|||
int _lastKnownBlockHeight;
|
||||
int _initialSyncHeight;
|
||||
|
||||
Future<int> getNodeHeightOrUpdate(int hWallet, int baseHeight) async {
|
||||
if (_cachedBlockchainHeight < baseHeight || _cachedBlockchainHeight == 0) {
|
||||
_cachedBlockchainHeight = await compute<int, int>(getNodeHeightSync, hWallet);
|
||||
}
|
||||
// Future<int> getNodeHeightOrUpdate(int hWallet, int baseHeight) async {
|
||||
// if (_cachedBlockchainHeight < baseHeight || _cachedBlockchainHeight == 0) {
|
||||
// _cachedBlockchainHeight = await compute<int, int>(getNodeHeightSync, hWallet);
|
||||
// }
|
||||
|
||||
return _cachedBlockchainHeight;
|
||||
}
|
||||
// return _cachedBlockchainHeight;
|
||||
// }
|
||||
|
||||
void start(ZanoWalletBase wallet, int hWallet) async {
|
||||
_cachedBlockchainHeight = 0;
|
||||
|
@ -54,53 +55,56 @@ class SyncListener {
|
|||
onNewTransaction?.call();
|
||||
}*/
|
||||
|
||||
var syncHeight = getCurrentHeight(hWallet);
|
||||
var json = ApiCalls.getWalletStatus(hWallet: hWallet);
|
||||
final status = GetWalletStatusResult.fromJson(jsonDecode(json) as Map<String, dynamic>);
|
||||
// You can call getWalletInfo ONLY if getWalletStatus returns NOT is in long refresh and wallet state is 2 (ready)
|
||||
if (!status.isInLongRefresh && status.walletState == 2) {
|
||||
final syncHeight = status.currentWalletHeight;
|
||||
|
||||
final json = calls.getWalletInfo(hWallet);
|
||||
final result = GetWalletInfoResult.fromJson(jsonDecode(json) as Map<String, dynamic>);
|
||||
wallet.seed = result.wiExtended.seed;
|
||||
wallet.keys = ZanoWalletKeys(
|
||||
privateSpendKey: result.wiExtended.spendPrivateKey,
|
||||
privateViewKey: result.wiExtended.viewPrivateKey,
|
||||
publicSpendKey: result.wiExtended.spendPublicKey,
|
||||
publicViewKey: result.wiExtended.viewPublicKey,
|
||||
);
|
||||
json = ApiCalls.getWalletInfo(hWallet);
|
||||
final result = GetWalletInfoResult.fromJson(jsonDecode(json) as Map<String, dynamic>);
|
||||
wallet.seed = result.wiExtended.seed;
|
||||
wallet.keys = ZanoWalletKeys(
|
||||
privateSpendKey: result.wiExtended.spendPrivateKey,
|
||||
privateViewKey: result.wiExtended.viewPrivateKey,
|
||||
publicSpendKey: result.wiExtended.spendPublicKey,
|
||||
publicViewKey: result.wiExtended.viewPublicKey,
|
||||
);
|
||||
|
||||
final balance = result.wi.balances.first;
|
||||
wallet.assetId = balance.assetInfo.assetId;
|
||||
wallet.balance = mobx.ObservableMap.of(
|
||||
{CryptoCurrency.zano: ZanoBalance(total: balance.total, unlocked: balance.unlocked)});
|
||||
final balance = result.wi.balances.first;
|
||||
wallet.assetId = balance.assetInfo.assetId;
|
||||
wallet.balance = mobx.ObservableMap.of({CryptoCurrency.zano: ZanoBalance(total: balance.total, unlocked: balance.unlocked)});
|
||||
|
||||
if (_initialSyncHeight <= 0) {
|
||||
_initialSyncHeight = syncHeight;
|
||||
if (_initialSyncHeight <= 0) {
|
||||
_initialSyncHeight = syncHeight;
|
||||
}
|
||||
|
||||
final bchHeight = status.currentDaemonHeight;
|
||||
|
||||
if (_lastKnownBlockHeight == syncHeight) {
|
||||
return;
|
||||
}
|
||||
|
||||
_lastKnownBlockHeight = syncHeight;
|
||||
final track = bchHeight - _initialSyncHeight;
|
||||
final diff = track - (bchHeight - syncHeight);
|
||||
final ptc = diff <= 0 ? 0.0 : diff / track;
|
||||
final left = bchHeight - syncHeight;
|
||||
|
||||
if (syncHeight < 0 || left < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Actual new height; 2. Blocks left to finish; 3. Progress in percents;
|
||||
onNewBlock.call(syncHeight, left, ptc);
|
||||
}
|
||||
|
||||
final bchHeight = await getNodeHeightOrUpdate(hWallet, syncHeight);
|
||||
|
||||
if (_lastKnownBlockHeight == syncHeight || syncHeight == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
_lastKnownBlockHeight = syncHeight;
|
||||
final track = bchHeight - _initialSyncHeight;
|
||||
final diff = track - (bchHeight - syncHeight);
|
||||
final ptc = diff <= 0 ? 0.0 : diff / track;
|
||||
final left = bchHeight - syncHeight;
|
||||
|
||||
if (syncHeight < 0 || left < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Actual new height; 2. Blocks left to finish; 3. Progress in percents;
|
||||
onNewBlock?.call(syncHeight, left, ptc);
|
||||
});
|
||||
}
|
||||
|
||||
void stop() => _updateSyncInfoTimer?.cancel();
|
||||
}
|
||||
|
||||
SyncListener setListeners(
|
||||
void Function(int, int, double) onNewBlock, void Function() onNewTransaction) {
|
||||
SyncListener setListeners(void Function(int, int, double) onNewBlock, void Function() onNewTransaction) {
|
||||
final listener = SyncListener(onNewBlock, onNewTransaction);
|
||||
/**setListenerNative();*/
|
||||
return listener;
|
||||
|
|
|
@ -7,13 +7,13 @@ import 'package:cw_zano/api/model/transfer_result.dart';
|
|||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/amount_converter.dart';
|
||||
import 'package:cw_core/pending_transaction.dart';
|
||||
import 'package:cw_zano/api/calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart' as calls;
|
||||
import 'package:cw_zano/zano_wallet.dart';
|
||||
|
||||
class PendingZanoTransaction with PendingTransaction {
|
||||
PendingZanoTransaction(
|
||||
{required this.zanoWallet,
|
||||
required this.fee,
|
||||
required this.fee,
|
||||
required this.intAmount,
|
||||
//required this.stringAmount,
|
||||
required this.hWallet,
|
||||
|
@ -50,26 +50,24 @@ class PendingZanoTransaction with PendingTransaction {
|
|||
|
||||
@override
|
||||
Future<void> commit() async {
|
||||
final result = await calls.transfer(
|
||||
hWallet,
|
||||
TransferParams(
|
||||
destinations: [
|
||||
Destination(
|
||||
amount: intAmount.toString(),
|
||||
address: address,
|
||||
assetId: assetId,
|
||||
)
|
||||
],
|
||||
fee: fee,
|
||||
mixin: zanoMixin,
|
||||
paymentId: '',
|
||||
comment: comment,
|
||||
pushPayer: false,
|
||||
hideReceiver: false,
|
||||
));
|
||||
print('transfer result $result');
|
||||
final params = TransferParams(
|
||||
destinations: [
|
||||
Destination(
|
||||
amount: intAmount.toString(),
|
||||
address: address,
|
||||
assetId: assetId,
|
||||
)
|
||||
],
|
||||
fee: fee,
|
||||
mixin: zanoMixin,
|
||||
paymentId: '',
|
||||
comment: comment,
|
||||
pushPayer: false,
|
||||
hideReceiver: false,
|
||||
);
|
||||
final result = await zanoWallet.invokeMethod(hWallet, 'transfer', params);
|
||||
final map = jsonDecode(result);
|
||||
if (map['result'] != null && map['result']['result'] != null ) {
|
||||
if (map['result'] != null && map['result']['result'] != null) {
|
||||
transferResult = TransferResult.fromJson(
|
||||
map['result']['result'] as Map<String, dynamic>,
|
||||
);
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:cw_zano/api/calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart';
|
||||
import 'package:cw_zano/api/model/get_address_info_result.dart';
|
||||
|
||||
class ZanoUtils {
|
||||
static bool validateAddress(String address) {
|
||||
try {
|
||||
final result = GetAddressInfoResult.fromJson(
|
||||
jsonDecode(calls.getAddressInfo(address)) as Map<String, dynamic>,
|
||||
jsonDecode(ApiCalls.getAddressInfo(address: address)) as Map<String, dynamic>,
|
||||
);
|
||||
return result.valid;
|
||||
} catch (err) {
|
||||
|
|
|
@ -13,8 +13,11 @@ import 'package:cw_core/sync_status.dart';
|
|||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_zano/api/calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart';
|
||||
import 'package:cw_zano/api/model/get_recent_txs_and_info_params.dart';
|
||||
import 'package:cw_zano/api/model/history.dart';
|
||||
import 'package:cw_zano/api/model/store_result.dart';
|
||||
import 'package:cw_zano/api/model/zano_wallet_keys.dart';
|
||||
import 'package:cw_zano/api/wallet.dart' as zano_wallet;
|
||||
import 'package:cw_zano/api/zano_api.dart';
|
||||
|
@ -37,11 +40,9 @@ class ZanoWallet = ZanoWalletBase with _$ZanoWallet;
|
|||
typedef _load_wallet = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>, Int8);
|
||||
typedef _LoadWallet = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>, int);
|
||||
|
||||
|
||||
const int zanoMixin = 10;
|
||||
|
||||
abstract class ZanoWalletBase
|
||||
extends WalletBase<ZanoBalance, ZanoTransactionHistory, ZanoTransactionInfo> with Store {
|
||||
abstract class ZanoWalletBase extends WalletBase<ZanoBalance, ZanoTransactionHistory, ZanoTransactionInfo> with Store {
|
||||
ZanoWalletBase(WalletInfo walletInfo)
|
||||
: balance = ObservableMap.of({CryptoCurrency.zano: ZanoBalance(total: 0, unlocked: 0)}),
|
||||
_isTransactionUpdating = false,
|
||||
|
@ -64,6 +65,8 @@ abstract class ZanoWalletBase
|
|||
String assetId = '';
|
||||
|
||||
static const int _autoSaveInterval = 30;
|
||||
static const _statusDelivered = 'delivered';
|
||||
static const _maxAttempts = 10;
|
||||
|
||||
@override
|
||||
ZanoWalletAddresses walletAddresses;
|
||||
|
@ -80,8 +83,7 @@ abstract class ZanoWalletBase
|
|||
String seed = '';
|
||||
|
||||
@override
|
||||
ZanoWalletKeys keys = ZanoWalletKeys(
|
||||
privateSpendKey: '', privateViewKey: '', publicSpendKey: '', publicViewKey: '');
|
||||
ZanoWalletKeys keys = ZanoWalletKeys(privateSpendKey: '', privateViewKey: '', publicSpendKey: '', publicViewKey: '');
|
||||
|
||||
zano_wallet.SyncListener? _listener;
|
||||
/**ReactionDisposer? _onAccountChangeReaction;*/
|
||||
|
@ -100,6 +102,7 @@ abstract class ZanoWalletBase
|
|||
Future<void> init(String address) async {
|
||||
await walletAddresses.init();
|
||||
await walletAddresses.updateAddress(address);
|
||||
|
||||
///balance.addAll(getZanoBalance(/**accountIndex: walletAddresses.account?.id ?? 0*/));
|
||||
_setListeners();
|
||||
await updateTransactions();
|
||||
|
@ -112,8 +115,7 @@ abstract class ZanoWalletBase
|
|||
}
|
||||
}
|
||||
|
||||
_autoSaveTimer =
|
||||
Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
|
||||
_autoSaveTimer = Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -130,7 +132,7 @@ abstract class ZanoWalletBase
|
|||
Future<void> connectToNode({required Node node}) async {
|
||||
try {
|
||||
syncStatus = ConnectingSyncStatus();
|
||||
await calls.setupNode(
|
||||
await ApiCalls.setupNode(
|
||||
address: "195.201.107.230:33336", // node.uriRaw,
|
||||
login: "", // node.login,
|
||||
password: "", // node.password,
|
||||
|
@ -169,15 +171,11 @@ abstract class ZanoWalletBase
|
|||
Future<PendingTransaction> createTransaction(Object credentials) async {
|
||||
final creds = credentials as ZanoTransactionCreationCredentials;
|
||||
final output = creds.outputs.first;
|
||||
final address = output.isParsedAddress && (output.extractedAddress?.isNotEmpty ?? false)
|
||||
? output.extractedAddress!
|
||||
: output.address;
|
||||
final address = output.isParsedAddress && (output.extractedAddress?.isNotEmpty ?? false) ? output.extractedAddress! : output.address;
|
||||
final stringAmount = output.sendAll ? null : output.cryptoAmount!.replaceAll(',', '.');
|
||||
final fee = calculateEstimatedFee(creds.priority);
|
||||
final intAmount = (double.parse(stringAmount!) * pow(10, 12)).toInt();
|
||||
final transaction = PendingZanoTransaction(fee: fee, intAmount: intAmount,
|
||||
hWallet: hWallet, address: address, assetId: assetId,
|
||||
comment: output.note ?? '', zanoWallet: this);
|
||||
final transaction = PendingZanoTransaction(fee: fee, intAmount: intAmount, hWallet: hWallet, address: address, assetId: assetId, comment: output.note ?? '', zanoWallet: this);
|
||||
return transaction;
|
||||
|
||||
/*final _credentials = credentials as ZanoTransactionCreationCredentials;
|
||||
|
@ -251,14 +249,31 @@ abstract class ZanoWalletBase
|
|||
|
||||
@override
|
||||
int calculateEstimatedFee(TransactionPriority priority, [int? amount = null]) {
|
||||
return calls.getCurrentTxFee(priority.raw);
|
||||
return ApiCalls.getCurrentTxFee(priority: priority.raw);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save() async {
|
||||
await walletAddresses.updateAddressesInBox();
|
||||
await backupWalletFiles(name);
|
||||
await calls.store(hWallet);
|
||||
try {
|
||||
await walletAddresses.updateAddressesInBox();
|
||||
await backupWalletFiles(name);
|
||||
await store();
|
||||
} catch (e) {
|
||||
print('Error while saving Zano wallet file ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> store() async {
|
||||
try {
|
||||
final json = await invokeMethod(hWallet, 'store', '{}');
|
||||
final map = jsonDecode(json) as Map<String, dynamic>;
|
||||
if (map['result'] == null || map['result']['result'] == null) {
|
||||
throw 'store empty response';
|
||||
}
|
||||
final _ = StoreResult.fromJson(map['result']['result'] as Map<String, dynamic>);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -287,7 +302,7 @@ abstract class ZanoWalletBase
|
|||
|
||||
@override
|
||||
Future<void> changePassword(String password) async {
|
||||
calls.setPassword(hWallet: hWallet, password: password);
|
||||
ApiCalls.setPassword(hWallet: hWallet, password: password);
|
||||
}
|
||||
|
||||
Future<void> setAsRecovered() async {
|
||||
|
@ -310,34 +325,52 @@ abstract class ZanoWalletBase
|
|||
}
|
||||
|
||||
Future<void> _refreshTransactions() async {
|
||||
final result = await calls.getRecentTxsAndInfo(hWallet: hWallet, offset: 0, count: 30);
|
||||
final map = jsonDecode(result);
|
||||
if (map == null || map["result"] == null || map["result"]["result"] == null) {
|
||||
return;
|
||||
try {
|
||||
final result = await invokeMethod(hWallet, 'get_recent_txs_and_info', GetRecentTxsAndInfoParams(offset: 0, count: 30));
|
||||
final map = jsonDecode(result) as Map<String, dynamic>?;
|
||||
if (map == null) {
|
||||
print('get_recent_txs_and_info empty response');
|
||||
return;
|
||||
}
|
||||
|
||||
final resultData = map['result'];
|
||||
if (resultData == null) {
|
||||
print('get_recent_txs_and_info empty response');
|
||||
return;
|
||||
}
|
||||
|
||||
if (resultData['error'] != null) {
|
||||
print('get_recent_txs_and_info error ${resultData['error']}');
|
||||
return;
|
||||
}
|
||||
|
||||
final transfers = resultData['result']?['transfers'] as List<dynamic>?;
|
||||
if (transfers == null) {
|
||||
print('get_recent_txs_and_info empty transfers');
|
||||
return;
|
||||
}
|
||||
|
||||
history = transfers.map((e) => History.fromJson(e as Map<String, dynamic>)).toList();
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
if (map["result"]["result"]["transfers"] != null)
|
||||
history = (map["result"]["result"]["transfers"] as List<dynamic>)
|
||||
.map((e) => History.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, ZanoTransactionInfo>> fetchTransactions() async {
|
||||
//zano_transaction_history.refreshTransactions();
|
||||
await _refreshTransactions();
|
||||
return history
|
||||
.map<ZanoTransactionInfo>((history) => ZanoTransactionInfo.fromHistory(history))
|
||||
.fold<Map<String, ZanoTransactionInfo>>(<String, ZanoTransactionInfo>{},
|
||||
(Map<String, ZanoTransactionInfo> acc, ZanoTransactionInfo tx) {
|
||||
acc[tx.id] = tx;
|
||||
return acc;
|
||||
});
|
||||
// return _getAllTransactions(null)
|
||||
// .fold<Map<String, ZanoTransactionInfo>>(<String, ZanoTransactionInfo>{},
|
||||
// (Map<String, ZanoTransactionInfo> acc, ZanoTransactionInfo tx) {
|
||||
// acc[tx.id] = tx;
|
||||
// return acc;
|
||||
// });
|
||||
try {
|
||||
await _refreshTransactions();
|
||||
return history.map<ZanoTransactionInfo>((history) => ZanoTransactionInfo.fromHistory(history)).fold<Map<String, ZanoTransactionInfo>>(
|
||||
<String, ZanoTransactionInfo>{},
|
||||
(Map<String, ZanoTransactionInfo> acc, ZanoTransactionInfo tx) {
|
||||
acc[tx.id] = tx;
|
||||
return acc;
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateTransactions() async {
|
||||
|
@ -432,8 +465,7 @@ abstract class ZanoWalletBase
|
|||
}
|
||||
}
|
||||
|
||||
final _loadWalletNative =
|
||||
zanoApi.lookup<NativeFunction<_load_wallet>>('load_wallet').asFunction<_LoadWallet>();
|
||||
final _loadWalletNative = zanoApi.lookup<NativeFunction<_load_wallet>>('load_wallet').asFunction<_LoadWallet>();
|
||||
|
||||
String loadWallet(String path, String password) {
|
||||
print('load_wallet path $path password $password');
|
||||
|
@ -451,4 +483,22 @@ abstract class ZanoWalletBase
|
|||
calloc.free(pointer);
|
||||
return str;
|
||||
}
|
||||
|
||||
Future<String> invokeMethod(int hWallet, String methodName, Object params) async {
|
||||
var invokeResult = ApiCalls.asyncCall(methodName: 'invoke', hWallet: hWallet, params: '{"method": "$methodName","params": ${jsonEncode(params)}}');
|
||||
var map = jsonDecode(invokeResult) as Map<String, dynamic>;
|
||||
int attempts = 0;
|
||||
if (map['job_id'] != null) {
|
||||
final jobId = map['job_id'] as int;
|
||||
do {
|
||||
await Future.delayed(Duration(milliseconds: attempts < 2 ? 100 : 500));
|
||||
final result = ApiCalls.tryPullResult(jobId);
|
||||
map = jsonDecode(result) as Map<String, dynamic>;
|
||||
if (map['status'] != null && map['status'] == _statusDelivered && map['result'] != null) {
|
||||
return result;
|
||||
}
|
||||
} while (++attempts < _maxAttempts);
|
||||
}
|
||||
return invokeResult;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ import 'package:cw_core/wallet_credentials.dart';
|
|||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cw_zano/api/calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart' as calls;
|
||||
import 'package:cw_zano/api/api_calls.dart';
|
||||
import 'package:cw_zano/api/consts.dart';
|
||||
import 'package:cw_zano/api/exceptions/already_exists_exception.dart';
|
||||
import 'package:cw_zano/api/exceptions/create_wallet_exception.dart';
|
||||
|
@ -72,12 +73,12 @@ class ZanoWalletService extends WalletService<ZanoNewWalletCredentials,
|
|||
final wallet = ZanoWallet(credentials.walletInfo!);
|
||||
await wallet.connectToNode(node: Node());
|
||||
final path = await pathForWallet(name: credentials.name, type: getType());
|
||||
final result = calls.createWallet(language: "", path: path, password: credentials.password!);
|
||||
final result = ApiCalls.createWallet(language: "", path: path, password: credentials.password!);
|
||||
final map = json.decode(result) as Map<String, dynamic>;
|
||||
if (map['result'] == null) throw CreateWalletException('');
|
||||
final createWalletResult = CreateWalletResult.fromJson(map['result'] as Map<String, dynamic>);
|
||||
_parseCreateWalletResult(createWalletResult, wallet);
|
||||
await calls.store(hWallet);
|
||||
await wallet.store();
|
||||
await wallet.init(createWalletResult.wi.address);
|
||||
return wallet;
|
||||
} catch (e) {
|
||||
|
@ -91,7 +92,7 @@ class ZanoWalletService extends WalletService<ZanoNewWalletCredentials,
|
|||
Future<bool> isWalletExit(String name) async {
|
||||
try {
|
||||
final path = await pathForWallet(name: name, type: getType());
|
||||
return calls.isWalletExist(path: path);
|
||||
return ApiCalls.isWalletExist(path: path);
|
||||
} catch (e) {
|
||||
// TODO: Implement Exception for wallet list service.
|
||||
print('ZanoWalletsManager Error: $e');
|
||||
|
@ -118,7 +119,7 @@ class ZanoWalletService extends WalletService<ZanoNewWalletCredentials,
|
|||
if (map['result'] == null) throw CreateWalletException('');
|
||||
final createWalletResult = CreateWalletResult.fromJson(map['result'] as Map<String, dynamic>);
|
||||
_parseCreateWalletResult(createWalletResult, wallet);
|
||||
await calls.store(hWallet);
|
||||
await wallet.store();
|
||||
await wallet.init(createWalletResult.wi.address);
|
||||
return wallet;
|
||||
} catch (e) {
|
||||
|
@ -180,13 +181,13 @@ class ZanoWalletService extends WalletService<ZanoNewWalletCredentials,
|
|||
final wallet = ZanoWallet(credentials.walletInfo!);
|
||||
await wallet.connectToNode(node: Node());
|
||||
final path = await pathForWallet(name: credentials.name, type: getType());
|
||||
final result = calls.restoreWalletFromSeed(path, credentials.password!, credentials.mnemonic);
|
||||
final result = ApiCalls.restoreWalletFromSeed(path: path, password: credentials.password!, seed: credentials.mnemonic);
|
||||
final map = json.decode(result) as Map<String, dynamic>;
|
||||
if (map['result'] != null) {
|
||||
final createWalletResult =
|
||||
CreateWalletResult.fromJson(map['result'] as Map<String, dynamic>);
|
||||
_parseCreateWalletResult(createWalletResult, wallet);
|
||||
await calls.store(hWallet);
|
||||
await wallet.store();
|
||||
await wallet.init(createWalletResult.wi.address);
|
||||
return wallet;
|
||||
} else if (map['error'] != null) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/haven/haven.dart';
|
||||
import 'package:cake_wallet/zano/zano.dart';
|
||||
|
@ -33,8 +32,6 @@ class SeedValidator extends Validator<MnemonicItem> {
|
|||
return zano!.getWordList(language);
|
||||
case WalletType.ethereum:
|
||||
return ethereum!.getEthereumWordList(language);
|
||||
case WalletType.dummy:
|
||||
return dummy!.getDummyWordList();
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import 'package:cake_wallet/buy/onramper/onramper_buy_provider.dart';
|
|||
import 'package:cake_wallet/buy/payfura/payfura_buy_provider.dart';
|
||||
import 'package:cake_wallet/buy/robinhood/robinhood_buy_provider.dart';
|
||||
import 'package:cake_wallet/core/yat_service.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/entities/background_tasks.dart';
|
||||
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
|
||||
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||
|
@ -793,8 +792,6 @@ Future<void> setup({
|
|||
return ethereum!.createEthereumWalletService(_walletInfoSource);
|
||||
case WalletType.zano:
|
||||
return zano!.createZanoWalletService(_walletInfoSource);
|
||||
case WalletType.dummy:
|
||||
return dummy!.createDummyWalletService(_walletInfoSource);
|
||||
|
||||
default:
|
||||
throw Exception(
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
part of 'dummy.dart';
|
||||
|
||||
class CWDummy extends Dummy {
|
||||
@override
|
||||
List<String> getDummyWordList() => ["aaa", "bbb", "ccc"];
|
||||
|
||||
@override
|
||||
WalletService createDummyWalletService(Box<WalletInfo> walletInfoSource) =>
|
||||
DummyWalletService(walletInfoSource);
|
||||
|
||||
@override
|
||||
WalletCredentials createDummyNewWalletCredentials(
|
||||
{required String name, WalletInfo? walletInfo}) =>
|
||||
DummyNewWalletCredentials(name: name, walletInfo: walletInfo);
|
||||
|
||||
@override
|
||||
WalletCredentials createDummyRestoreWalletFromSeedCredentials(
|
||||
{required String name, WalletInfo? walletInfo}) =>
|
||||
DummyRestoreWalletFromSeedCredentials(name: name, walletInfo: walletInfo);
|
||||
|
||||
@override
|
||||
WalletCredentials createDummyRestoreWalletFromKeyCredentials(
|
||||
{required String name, WalletInfo? walletInfo}) =>
|
||||
DummyRestoreWalletFromKeyCredentials(name: name, walletInfo: walletInfo);
|
||||
|
||||
@override
|
||||
List<TransactionPriority> getTransactionPriorities() =>
|
||||
DummyTransactionPriority.all;
|
||||
|
||||
@override
|
||||
TransactionPriority deserializeDummyTransactionPriority(int raw) =>
|
||||
DummyTransactionPriority.deserialize(raw: raw);
|
||||
|
||||
@override
|
||||
TransactionPriority getDefaultTransactionPriority() =>
|
||||
DummyTransactionPriority.fast;
|
||||
|
||||
@override
|
||||
CryptoCurrency assetOfTransaction(TransactionInfo tx) {
|
||||
final transaction = tx as DummyTransactionInfo;
|
||||
// TODO: !!!
|
||||
return CryptoCurrency.dummy;
|
||||
}
|
||||
|
||||
@override
|
||||
String formatterDummyAmountToString({required int amount}) =>
|
||||
throw UnimplementedError();
|
||||
|
||||
@override
|
||||
TransactionPriority getDummyTransactionPrioritySlow() =>
|
||||
DummyTransactionPriority.slow;
|
||||
|
||||
@override
|
||||
TransactionPriority getDummyTransactionPriorityMedium() =>
|
||||
DummyTransactionPriority.medium;
|
||||
|
||||
@override
|
||||
double formatterDummyAmountToDouble({required int amount}) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
int formatterDummyParseAmount({required String amount}) => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Object createDummyTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority}) =>
|
||||
DummyTransactionCreationCredentials(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 DummyTransactionPriority);
|
||||
|
||||
@override
|
||||
Future<void> generateNewAddress(Object wallet) async {
|
||||
final dummyWallet = wallet as DummyWallet;
|
||||
await dummyWallet.walletAddresses.generateNewAddress();
|
||||
}
|
||||
|
||||
@override
|
||||
String getAddress(WalletBase wallet) => (wallet as DummyWallet).walletAddresses.address;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
import 'package:cake_wallet/view_model/send/output.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/output_info.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_credentials.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:cw_dummy/dummy_transaction_info.dart';
|
||||
import 'package:cw_dummy/dummy_transaction_priority.dart';
|
||||
import 'package:cw_dummy/dummy_wallet.dart';
|
||||
import 'package:cw_dummy/dummy_wallet_creation_credentials.dart';
|
||||
import 'package:cw_dummy/dummy_transaction_creation_credentials.dart';
|
||||
import 'package:cw_dummy/dummy_wallet_service.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'cw_dummy.dart';
|
||||
|
||||
Dummy? dummy = CWDummy();
|
||||
|
||||
abstract class Dummy {
|
||||
WalletCredentials createDummyNewWalletCredentials(
|
||||
{required String name, WalletInfo? walletInfo});
|
||||
WalletCredentials createDummyRestoreWalletFromKeyCredentials(
|
||||
{required String name, WalletInfo? walletInfo});
|
||||
WalletCredentials createDummyRestoreWalletFromSeedCredentials(
|
||||
{required String name, WalletInfo? walletInfo});
|
||||
WalletService createDummyWalletService(Box<WalletInfo> walletInfoSource);
|
||||
TransactionPriority deserializeDummyTransactionPriority(int raw);
|
||||
List<String> getDummyWordList();
|
||||
List<TransactionPriority> getTransactionPriorities();
|
||||
TransactionPriority getDefaultTransactionPriority();
|
||||
CryptoCurrency assetOfTransaction(TransactionInfo tx);
|
||||
double formatterDummyAmountToDouble({required int amount});
|
||||
TransactionPriority getDummyTransactionPrioritySlow();
|
||||
TransactionPriority getDummyTransactionPriorityMedium();
|
||||
int formatterDummyParseAmount({required String amount});
|
||||
Object createDummyTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
|
||||
Future<void> generateNewAddress(Object wallet);
|
||||
String getAddress(WalletBase wallet);
|
||||
}
|
|
@ -27,7 +27,6 @@ const cakeWalletLitecoinElectrumUri = 'ltc-electrum.cakewallet.com:50002';
|
|||
const havenDefaultNodeUri = 'nodes.havenprotocol.org:443';
|
||||
const ethereumDefaultNodeUri = 'ethereum.publicnode.com';
|
||||
const zanoDefaultNodeUri = 'zano.org';
|
||||
const dummyDefaultNodeUri = 'example.com';
|
||||
|
||||
Future<void> defaultSettingsMigration(
|
||||
{required int version,
|
||||
|
@ -324,12 +323,6 @@ Node? getZanoDefaultNode({required Box<Node> nodes}) {
|
|||
?? nodes.values.firstWhereOrNull((node) => node.type == WalletType.zano);
|
||||
}
|
||||
|
||||
Node? getDummyDefaultNode({required Box<Node> nodes}) {
|
||||
return nodes.values.firstWhereOrNull(
|
||||
(Node node) => node.uriRaw == dummyDefaultNodeUri)
|
||||
?? nodes.values.firstWhereOrNull((node) => node.type == WalletType.dummy);
|
||||
}
|
||||
|
||||
Node getMoneroDefaultNode({required Box<Node> nodes}) {
|
||||
final timeZone = DateTime.now().timeZoneOffset.inHours;
|
||||
var nodeUri = '';
|
||||
|
@ -530,8 +523,6 @@ Future<void> checkCurrentNodes(
|
|||
.getInt(PreferencesKey.currentEthereumNodeIdKey);
|
||||
final currentZanoNodeId = sharedPreferences
|
||||
.getInt(PreferencesKey.currentZanoNodeIdKey);
|
||||
final currentDummyNodeId = sharedPreferences
|
||||
.getInt(PreferencesKey.currentDummyNodeIdKey);
|
||||
final currentMoneroNode = nodeSource.values.firstWhereOrNull(
|
||||
(node) => node.key == currentMoneroNodeId);
|
||||
final currentBitcoinElectrumServer = nodeSource.values.firstWhereOrNull(
|
||||
|
@ -543,7 +534,6 @@ Future<void> checkCurrentNodes(
|
|||
final currentEthereumNodeServer = nodeSource.values.firstWhereOrNull(
|
||||
(node) => node.key == currentEthereumNodeId);
|
||||
final currentZanoNode = nodeSource.values.firstWhereOrNull((node) => node.key == currentZanoNodeId);
|
||||
final currentDummyNode = nodeSource.values.firstWhereOrNull((node) => node.key == currentDummyNodeId);
|
||||
|
||||
if (currentMoneroNode == null) {
|
||||
final newCakeWalletNode =
|
||||
|
@ -591,13 +581,6 @@ Future<void> checkCurrentNodes(
|
|||
await sharedPreferences.setInt(
|
||||
PreferencesKey.currentZanoNodeIdKey, node.key as int);
|
||||
}
|
||||
|
||||
if (currentDummyNode == null) {
|
||||
final node = Node(uri: dummyDefaultNodeUri, type: WalletType.dummy);
|
||||
await nodeSource.add(node);
|
||||
await sharedPreferences.setInt(
|
||||
PreferencesKey.currentDummyNodeIdKey, node.key as int);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> resetBitcoinElectrumServer(
|
||||
|
|
|
@ -6,7 +6,6 @@ class PreferencesKey {
|
|||
static const currentLitecoinElectrumSererIdKey = 'current_node_id_ltc';
|
||||
static const currentHavenNodeIdKey = 'current_node_id_xhv';
|
||||
static const currentZanoNodeIdKey = 'current_node_id_zano';
|
||||
static const currentDummyNodeIdKey = 'current_node_id_dummy';
|
||||
static const currentEthereumNodeIdKey = 'current_node_id_eth';
|
||||
static const currentFiatCurrencyKey = 'current_fiat_currency';
|
||||
static const currentTransactionPriorityKeyLegacy = 'current_fee_priority';
|
||||
|
@ -37,7 +36,6 @@ class PreferencesKey {
|
|||
static const litecoinTransactionPriority = 'current_fee_priority_litecoin';
|
||||
static const ethereumTransactionPriority = 'current_fee_priority_ethereum';
|
||||
static const zanoTransactionPriority = 'current_fee_priority_zano';
|
||||
static const dummyTransactionPriority = 'current_fee_priority_dummy';
|
||||
static const shouldShowReceiveWarning = 'should_show_receive_warning';
|
||||
static const shouldShowYatPopup = 'should_show_yat_popup';
|
||||
static const moneroWalletPasswordUpdateV1Base = 'monero_wallet_update_v1';
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/haven/haven.dart';
|
||||
import 'package:cake_wallet/monero/monero.dart';
|
||||
|
@ -21,8 +20,6 @@ List<TransactionPriority> priorityForWalletType(WalletType type) {
|
|||
return ethereum!.getTransactionPriorities();
|
||||
case WalletType.zano:
|
||||
return zano!.getTransactionPriorities();
|
||||
case WalletType.dummy:
|
||||
return dummy!.getTransactionPriorities();
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
|||
final havenIcon = Image.asset('assets/images/haven_logo.png', height: 24, width: 24);
|
||||
final ethereumIcon = Image.asset('assets/images/eth_icon.png', height: 24, width: 24);
|
||||
final zanoIcon = Image.asset('assets/images/zano_icon.png', height: 24, width: 24);
|
||||
final dummyIcon = Image.asset('assets/images/zano_icon.png', height: 24, width: 24);
|
||||
final nonWalletTypeIcon = Image.asset('assets/images/close.png', height: 24, width: 24);
|
||||
|
||||
Image _newWalletImage(BuildContext context) => Image.asset(
|
||||
|
@ -145,8 +144,6 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
|||
return ethereumIcon;
|
||||
case WalletType.zano:
|
||||
return zanoIcon;
|
||||
case WalletType.dummy:
|
||||
return dummyIcon;
|
||||
default:
|
||||
return nonWalletTypeIcon;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
this.litecoinIcon = Image.asset('assets/images/litecoin_menu.png'),
|
||||
this.havenIcon = Image.asset('assets/images/haven_menu.png'),
|
||||
this.ethereumIcon = Image.asset('assets/images/eth_icon.png'),
|
||||
this.zanoIcon = Image.asset('assets/images/zano_icon.png'),
|
||||
this.dummyIcon = Image.asset('assets/images/zano_icon.png');
|
||||
this.zanoIcon = Image.asset('assets/images/zano_icon.png');
|
||||
|
||||
final largeScreen = 731;
|
||||
|
||||
|
@ -50,7 +49,6 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
Image havenIcon;
|
||||
Image ethereumIcon;
|
||||
Image zanoIcon;
|
||||
Image dummyIcon;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -212,8 +210,6 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
return ethereumIcon;
|
||||
case WalletType.zano:
|
||||
return zanoIcon;
|
||||
case WalletType.dummy:
|
||||
return dummyIcon;
|
||||
default:
|
||||
throw Exception('No icon for ${type.toString()}');
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
final havenIcon = Image.asset('assets/images/haven_logo.png', height: 24, width: 24);
|
||||
final ethereumIcon = Image.asset('assets/images/eth_icon.png', height: 24, width: 24);
|
||||
final zanoIcon = Image.asset('assets/images/zano_icon.png', height: 24, width: 24);
|
||||
final dummyIcon = Image.asset('assets/images/zano_icon.png', height: 24, width: 24);
|
||||
final scrollController = ScrollController();
|
||||
final double tileHeight = 60;
|
||||
Flushbar<void>? _progressBar;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
|
||||
import 'package:cake_wallet/entities/buy_provider_types.dart';
|
||||
import 'package:cake_wallet/entities/cake_2fa_preset_options.dart';
|
||||
|
@ -88,7 +87,6 @@ abstract class SettingsStoreBase with Store {
|
|||
TransactionPriority? initialLitecoinTransactionPriority,
|
||||
TransactionPriority? initialEthereumTransactionPriority,
|
||||
TransactionPriority? initialZanoTransactionPriority,
|
||||
TransactionPriority? initialDummyTransactionPriority,
|
||||
})
|
||||
: nodes = ObservableMap<WalletType, Node>.of(nodes),
|
||||
_sharedPreferences = sharedPreferences,
|
||||
|
@ -153,10 +151,6 @@ abstract class SettingsStoreBase with Store {
|
|||
priority[WalletType.zano] = initialZanoTransactionPriority;
|
||||
}
|
||||
|
||||
if (initialDummyTransactionPriority != null) {
|
||||
priority[WalletType.dummy] = initialDummyTransactionPriority;
|
||||
}
|
||||
|
||||
reaction(
|
||||
(_) => fiatCurrency,
|
||||
(FiatCurrency fiatCurrency) => sharedPreferences.setString(
|
||||
|
@ -188,9 +182,6 @@ abstract class SettingsStoreBase with Store {
|
|||
case WalletType.zano:
|
||||
key = PreferencesKey.zanoTransactionPriority;
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
key = PreferencesKey.dummyTransactionPriority;
|
||||
break;
|
||||
default:
|
||||
key = null;
|
||||
}
|
||||
|
@ -538,7 +529,6 @@ abstract class SettingsStoreBase with Store {
|
|||
TransactionPriority? litecoinTransactionPriority;
|
||||
TransactionPriority? ethereumTransactionPriority;
|
||||
TransactionPriority? zanoTransactionPriority;
|
||||
TransactionPriority? dummyTransactionPriority;
|
||||
|
||||
if (sharedPreferences.getInt(PreferencesKey.havenTransactionPriority) != null) {
|
||||
havenTransactionPriority = monero?.deserializeMoneroTransactionPriority(
|
||||
|
@ -556,10 +546,6 @@ abstract class SettingsStoreBase with Store {
|
|||
zanoTransactionPriority = monero?.deserializeMoneroTransactionPriority(
|
||||
raw: sharedPreferences.getInt(PreferencesKey.zanoTransactionPriority)!);
|
||||
}
|
||||
if (sharedPreferences.getInt(PreferencesKey.dummyTransactionPriority) != null) {
|
||||
dummyTransactionPriority = dummy?.deserializeDummyTransactionPriority(
|
||||
sharedPreferences.getInt(PreferencesKey.dummyTransactionPriority)!);
|
||||
}
|
||||
|
||||
moneroTransactionPriority ??= monero?.getDefaultTransactionPriority();
|
||||
bitcoinTransactionPriority ??= bitcoin?.getMediumTransactionPriority();
|
||||
|
@ -567,7 +553,6 @@ abstract class SettingsStoreBase with Store {
|
|||
litecoinTransactionPriority ??= bitcoin?.getLitecoinTransactionPriorityMedium();
|
||||
ethereumTransactionPriority ??= ethereum?.getDefaultTransactionPriority();
|
||||
zanoTransactionPriority ??= zano?.getDefaultTransactionPriority();
|
||||
dummyTransactionPriority ??= dummy?.getDefaultTransactionPriority();
|
||||
|
||||
final currentBalanceDisplayMode = BalanceDisplayMode.deserialize(
|
||||
raw: sharedPreferences.getInt(PreferencesKey.currentBalanceDisplayModeKey)!);
|
||||
|
@ -650,14 +635,12 @@ abstract class SettingsStoreBase with Store {
|
|||
final havenNodeId = sharedPreferences.getInt(PreferencesKey.currentHavenNodeIdKey);
|
||||
final ethereumNodeId = sharedPreferences.getInt(PreferencesKey.currentEthereumNodeIdKey);
|
||||
final zanoNodeId = sharedPreferences.getInt(PreferencesKey.currentZanoNodeIdKey);
|
||||
final dummyNodeId = sharedPreferences.getInt(PreferencesKey.currentDummyNodeIdKey);
|
||||
final moneroNode = nodeSource.get(nodeId);
|
||||
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId);
|
||||
final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId);
|
||||
final havenNode = nodeSource.get(havenNodeId);
|
||||
final ethereumNode = nodeSource.get(ethereumNodeId);
|
||||
final zanoNode = nodeSource.get(zanoNodeId);
|
||||
final dummyNode = nodeSource.get(dummyNodeId);
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
final deviceName = await _getDeviceName() ?? '';
|
||||
final shouldShowYatPopup = sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true;
|
||||
|
@ -693,10 +676,6 @@ abstract class SettingsStoreBase with Store {
|
|||
nodes[WalletType.zano] = zanoNode;
|
||||
}
|
||||
|
||||
if (dummyNode != null) {
|
||||
nodes[WalletType.dummy] = dummyNode;
|
||||
}
|
||||
|
||||
final savedSyncMode = SyncMode.all.firstWhere((element) {
|
||||
return element.type.index == (sharedPreferences.getInt(PreferencesKey.syncModeKey) ?? 1);
|
||||
});
|
||||
|
@ -737,7 +716,6 @@ abstract class SettingsStoreBase with Store {
|
|||
initialHavenTransactionPriority: havenTransactionPriority,
|
||||
initialLitecoinTransactionPriority: litecoinTransactionPriority,
|
||||
initialZanoTransactionPriority: zanoTransactionPriority,
|
||||
initialDummyTransactionPriority: dummyTransactionPriority,
|
||||
initialShouldRequireTOTP2FAForAccessingWallet: shouldRequireTOTP2FAForAccessingWallet,
|
||||
initialShouldRequireTOTP2FAForSendsToContact: shouldRequireTOTP2FAForSendsToContact,
|
||||
initialShouldRequireTOTP2FAForSendsToNonContact: shouldRequireTOTP2FAForSendsToNonContact,
|
||||
|
@ -789,11 +767,6 @@ abstract class SettingsStoreBase with Store {
|
|||
raw: sharedPreferences.getInt(PreferencesKey.zanoTransactionPriority)!) ??
|
||||
priority[WalletType.zano]!;
|
||||
}
|
||||
if (sharedPreferences.getInt(PreferencesKey.dummyTransactionPriority) != null) {
|
||||
priority[WalletType.dummy] = dummy?.deserializeDummyTransactionPriority(
|
||||
sharedPreferences.getInt(PreferencesKey.dummyTransactionPriority)!) ??
|
||||
priority[WalletType.dummy]!;
|
||||
}
|
||||
|
||||
final generateSubaddresses =
|
||||
sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey);
|
||||
|
@ -881,7 +854,6 @@ abstract class SettingsStoreBase with Store {
|
|||
sharedPreferences.getInt(PreferencesKey.currentLitecoinElectrumSererIdKey);
|
||||
final havenNodeId = sharedPreferences.getInt(PreferencesKey.currentHavenNodeIdKey);
|
||||
final zanoNodeId = sharedPreferences.getInt(PreferencesKey.currentZanoNodeIdKey);
|
||||
final dummyNodeId = sharedPreferences.getInt(PreferencesKey.currentDummyNodeIdKey);
|
||||
final ethereumNodeId = sharedPreferences.getInt(PreferencesKey.currentEthereumNodeIdKey);
|
||||
final moneroNode = nodeSource.get(nodeId);
|
||||
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId);
|
||||
|
@ -889,7 +861,6 @@ abstract class SettingsStoreBase with Store {
|
|||
final havenNode = nodeSource.get(havenNodeId);
|
||||
final ethereumNode = nodeSource.get(ethereumNodeId);
|
||||
final zanoNode = nodeSource.get(zanoNodeId);
|
||||
final dummyNode = nodeSource.get(dummyNodeId);
|
||||
|
||||
if (moneroNode != null) {
|
||||
nodes[WalletType.monero] = moneroNode;
|
||||
|
@ -914,10 +885,6 @@ abstract class SettingsStoreBase with Store {
|
|||
if (zanoNode != null) {
|
||||
nodes[WalletType.zano] = zanoNode;
|
||||
}
|
||||
|
||||
if (dummyNode != null) {
|
||||
nodes[WalletType.dummy] = dummyNode;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _saveCurrentNode(Node node, WalletType walletType) async {
|
||||
|
@ -942,9 +909,6 @@ abstract class SettingsStoreBase with Store {
|
|||
case WalletType.zano:
|
||||
await _sharedPreferences.setInt(PreferencesKey.currentZanoNodeIdKey, node.key as int);
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
await _sharedPreferences.setInt(PreferencesKey.currentDummyNodeIdKey, node.key as int);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
|
@ -101,13 +100,6 @@ class TransactionListItem extends ActionListItem with Keyable {
|
|||
cryptoAmount: zano!.formatterMoneroAmountToDouble(amount: transaction.amount),
|
||||
price: price);
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
final asset = dummy!.assetOfTransaction(transaction);
|
||||
final price = balanceViewModel.fiatConvertationStore.prices[asset];
|
||||
amount = calculateFiatAmountRaw(
|
||||
cryptoAmount: dummy!.formatterDummyAmountToDouble(amount: transaction.amount),
|
||||
price: price);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'dart:collection';
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:cake_wallet/core/wallet_change_listener_view_model.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||
import 'package:cake_wallet/entities/wallet_contact.dart';
|
||||
|
@ -280,8 +279,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
return transactionPriority == bitcoin!.getLitecoinTransactionPrioritySlow();
|
||||
case WalletType.zano:
|
||||
return transactionPriority == monero!.getMoneroTransactionPrioritySlow();
|
||||
case WalletType.dummy:
|
||||
return transactionPriority == dummy!.getDummyTransactionPrioritySlow();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -698,11 +695,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
depositCurrency = CryptoCurrency.zano;
|
||||
receiveCurrency = CryptoCurrency.btc;
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
// TODO: !!!
|
||||
// depositCurrency = CryptoCurrency.dummy;
|
||||
// receiveCurrency = ???
|
||||
throw UnimplementedError();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -789,9 +781,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
case WalletType.zano:
|
||||
_settingsStore.priority[wallet.type] = monero!.getMoneroTransactionPriorityAutomatic();
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
_settingsStore.priority[wallet.type] = dummy!.getDummyTransactionPriorityMedium();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,6 @@ abstract class NodeListViewModelBase with Store {
|
|||
case WalletType.zano:
|
||||
node = getZanoDefaultNode(nodes: _nodeSource)!;
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
node = getDummyDefaultNode(nodes: _nodeSource)!;
|
||||
break;
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${_appStore.wallet!.type}');
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/entities/calculate_fiat_amount_raw.dart';
|
||||
import 'package:cake_wallet/entities/parse_address_from_domain.dart';
|
||||
import 'package:cake_wallet/entities/parsed_address.dart';
|
||||
|
@ -99,9 +98,6 @@ abstract class OutputBase with Store {
|
|||
case WalletType.zano:
|
||||
_amount = zano!.formatterMoneroParseAmount(amount: _cryptoAmount);
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
_amount = dummy!.formatterDummyParseAmount(amount: _cryptoAmount);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -143,10 +139,6 @@ abstract class OutputBase with Store {
|
|||
if (_wallet.type == WalletType.ethereum) {
|
||||
return ethereum!.formatterEthereumAmountToDouble(amount: BigInt.from(fee));
|
||||
}
|
||||
|
||||
if (_wallet.type == WalletType.dummy) {
|
||||
return dummy!.formatterDummyAmountToDouble(amount: fee);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
|
@ -256,7 +248,6 @@ abstract class OutputBase with Store {
|
|||
case WalletType.ethereum:
|
||||
maximumFractionDigits = 12;
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
case WalletType.zano:
|
||||
maximumFractionDigits = 12;
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/core/wallet_change_listener_view_model.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
|
||||
import 'package:cake_wallet/entities/transaction_description.dart';
|
||||
|
@ -387,12 +386,6 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
}
|
||||
return zano!.createZanoTransactionCreationCredentials(
|
||||
outputs: outputs, priority: priority, assetType: selectedCryptoCurrency.title);
|
||||
case WalletType.dummy:
|
||||
final priority = _settingsStore.priority[wallet.type];
|
||||
if (priority == null) {
|
||||
throw Exception('Priority is null for wallet type: ${wallet.type}');
|
||||
}
|
||||
return dummy!.createDummyTransactionCreationCredentials(outputs: outputs, priority: priority);
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${wallet.type}');
|
||||
}
|
||||
|
|
|
@ -50,9 +50,6 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
case WalletType.zano:
|
||||
_addZanoListItems(tx, dateFormat);
|
||||
break;
|
||||
case WalletType.dummy:
|
||||
_addDummyListItems(tx, dateFormat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -124,8 +121,6 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
return 'https://etherscan.io/tx/${txId}';
|
||||
case WalletType.zano:
|
||||
return 'https://testnet-explorer.zano.org/transaction/${txId}';
|
||||
case WalletType.dummy:
|
||||
return 'https://example.com/${txId}';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
@ -145,8 +140,6 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
return S.current.view_transaction_on + 'etherscan.io';
|
||||
case WalletType.zano:
|
||||
return S.current.view_transaction_on + 'zano';
|
||||
case WalletType.dummy:
|
||||
return S.current.view_transaction_on + 'dummy';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
@ -247,16 +240,4 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
]);
|
||||
}
|
||||
|
||||
void _addDummyListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
items.addAll([
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.id),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
@ -91,11 +90,6 @@ abstract class WalletAddressEditOrCreateViewModelBase with Store {
|
|||
label: label);
|
||||
await wallet.save();
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.dummy) {
|
||||
await dummy!.generateNewAddress(wallet);
|
||||
await wallet.save();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _update() async {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/core/wallet_change_listener_view_model.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||
|
@ -125,22 +124,6 @@ class ZanoURI extends PaymentURI {
|
|||
}
|
||||
}
|
||||
|
||||
class DummyURI extends PaymentURI {
|
||||
DummyURI({required String amount, required String address})
|
||||
: super(amount: amount, address: address);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
var base = 'dummy:' + address;
|
||||
|
||||
if (amount.isNotEmpty) {
|
||||
base += '?amount=${amount.replaceAll(',', '.')}';
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewModel with Store {
|
||||
WalletAddressListViewModelBase({
|
||||
required AppStore appStore,
|
||||
|
@ -214,10 +197,6 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
|||
return ZanoURI(amount: amount, address: address.address);
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.dummy) {
|
||||
return DummyURI(amount: amount, address: address.address);
|
||||
}
|
||||
|
||||
throw Exception('Unexpected type: ${type.toString()}');
|
||||
}
|
||||
|
||||
|
@ -274,12 +253,6 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
|||
addressList.add(WalletAddressListItem(isPrimary: true, name: null, address: primaryAddress));
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.dummy) {
|
||||
final primaryAddress = dummy!.getAddress(wallet);
|
||||
|
||||
addressList.add(WalletAddressListItem(isPrimary: true, name: null, address: primaryAddress));
|
||||
}
|
||||
|
||||
return addressList;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,13 +111,6 @@ abstract class WalletKeysViewModelBase with Store {
|
|||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
]);
|
||||
}
|
||||
|
||||
if (_appStore.wallet!.type == WalletType.dummy) {
|
||||
items.addAll([
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Future<int?> _currentHeight() async {
|
||||
|
@ -147,8 +140,6 @@ abstract class WalletKeysViewModelBase with Store {
|
|||
return 'ethereum-wallet';
|
||||
case WalletType.zano:
|
||||
return 'zano-wallet';
|
||||
case WalletType.dummy:
|
||||
return 'dummy-wallet';
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${_appStore.wallet!.toString()}');
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/view_model/restore/restore_wallet.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/zano/zano.dart';
|
||||
|
@ -49,8 +48,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
|||
return ethereum!.createEthereumNewWalletCredentials(name: name);
|
||||
case WalletType.zano:
|
||||
return zano!.createZanoNewWalletCredentials(name: name);
|
||||
case WalletType.dummy:
|
||||
return dummy!.createDummyNewWalletCredentials(name: name);
|
||||
default:
|
||||
throw Exception('Unexpected type: ${type.toString()}');;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/dummy/dummy.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/zano/zano.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
@ -98,9 +97,6 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
|
|||
password: password,
|
||||
height: height,
|
||||
mnemonic: seed);
|
||||
case WalletType.dummy:
|
||||
return dummy!.createDummyRestoreWalletFromSeedCredentials(
|
||||
name: name);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -151,10 +147,6 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
|
|||
password: password,
|
||||
);
|
||||
}
|
||||
|
||||
if (type == WalletType.dummy) {
|
||||
return dummy!.createDummyRestoreWalletFromKeyCredentials(name: name);
|
||||
}
|
||||
}
|
||||
|
||||
throw Exception('Unexpected type: ${type.toString()}');
|
||||
|
|
Loading…
Reference in a new issue