This commit is contained in:
RafiaChy 2022-01-14 14:41:49 +06:00
commit 354f166834
16 changed files with 150 additions and 153 deletions

View file

@ -46,7 +46,7 @@ android {
defaultConfig { defaultConfig {
applicationId appProperties['id'] applicationId appProperties['id']
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 30
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -329,11 +329,15 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
}); });
int feeRate(TransactionPriority priority) { int feeRate(TransactionPriority priority) {
if (priority is BitcoinTransactionPriority) { try {
return _feeRates[priority.raw]; if (priority is BitcoinTransactionPriority) {
} return _feeRates[priority.raw];
}
return 0; return 0;
} catch(_) {
return 0;
}
} }
int feeAmountForPriority(BitcoinTransactionPriority priority, int inputsCount, int feeAmountForPriority(BitcoinTransactionPriority priority, int inputsCount,

View file

@ -36,7 +36,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
ObservableList<BitcoinAddressRecord> addresses; ObservableList<BitcoinAddressRecord> addresses;
List<BitcoinAddressRecord> get availableAddresses => addresses List<BitcoinAddressRecord> get availableAddresses => addresses
.where((addr) => addr.isHidden) .where((addr) => !addr.isHidden)
.toList(); .toList();
int accountIndex; int accountIndex;

View file

@ -29,6 +29,38 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.5.0"
bech32:
dependency: transitive
description:
path: "."
ref: cake
resolved-ref: "02fef082f20af13de00b4e64efb93a2c1e5e1cf2"
url: "https://github.com/cake-tech/bech32.git"
source: git
version: "0.2.0"
bip32:
dependency: transitive
description:
name: bip32
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.7"
bip39:
dependency: transitive
description:
name: bip39
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
bitcoin_flutter:
dependency: "direct main"
description:
path: "."
ref: cake
resolved-ref: cbabfd87b6ce3cae6051a3e86ddb56e7a934e188
url: "https://github.com/cake-tech/bitcoin_flutter.git"
source: git
version: "2.0.2"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -36,6 +68,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
bs58check:
dependency: transitive
description:
name: bs58check
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
build: build:
dependency: transitive dependency: transitive
description: description:
@ -147,14 +186,14 @@ packages:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "2.1.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "2.1.5"
cw_core: cw_core:
dependency: "direct main" dependency: "direct main"
description: description:
@ -175,7 +214,7 @@ packages:
name: dartx name: dartx
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.0" version: "0.5.0"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -235,13 +274,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.2.0"
hex:
dependency: transitive
description:
name: hex
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
hive: hive:
dependency: transitive dependency: transitive
description: description:
name: hive name: hive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.0-nullsafety.2" version: "1.4.4+1"
hive_generator: hive_generator:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -410,6 +456,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
pointycastle:
dependency: transitive
description:
name: pointycastle
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@ -438,6 +491,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.8" version: "0.1.8"
rxdart:
dependency: "direct main"
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.26.0"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
@ -519,7 +579,7 @@ packages:
name: time name: time
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "1.4.1"
timing: timing:
dependency: transitive dependency: transitive
description: description:

View file

@ -18,7 +18,12 @@ dependencies:
intl: ^0.17.0 intl: ^0.17.0
cw_core: cw_core:
path: ../cw_core path: ../cw_core
bitcoin_flutter:
git:
url: https://github.com/cake-tech/bitcoin_flutter.git
ref: cake
rxdart: ^0.26.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter

View file

@ -35,6 +35,9 @@ class CWBitcoin extends Bitcoin {
List<TransactionPriority> getTransactionPriorities() List<TransactionPriority> getTransactionPriorities()
=> BitcoinTransactionPriority.all; => BitcoinTransactionPriority.all;
List<TransactionPriority> getLitecoinTransactionPriorities()
=> LitecoinTransactionPriority.all;
@override @override
TransactionPriority deserializeBitcoinTransactionPriority(int raw) TransactionPriority deserializeBitcoinTransactionPriority(int raw)
=> BitcoinTransactionPriority.deserialize(raw: raw); => BitcoinTransactionPriority.deserialize(raw: raw);

View file

@ -1,61 +0,0 @@
//import 'package:mobx/mobx.dart';
//import 'package:cw_core/sync_status.dart';
//import 'package:cake_wallet/entities/transaction_history.dart';
//import 'package:cw_core/wallet_type.dart';
//import 'package:cake_wallet/entities/transaction_creation_credentials.dart';
//import 'package:cake_wallet/entities/pending_transaction.dart';
//import 'package:cw_core/balance.dart';
//import 'package:cw_core/node.dart';
//abstract class Wallet {
// WalletType getType();
// WalletType walletType;
// Observable<Balance> onBalanceChange;
// Observable<SyncStatus> syncStatus;
// Observable<String> get onNameChange;
// Observable<String> get onAddressChange;
// String get name;
// String get address;
// Future updateInfo();
// Future<String> getFilename();
// Future<String> getName();
// Future<String> getAddress();
// Future<String> getSeed();
// Future<Map<String, String>> getKeys();
// Future<String> getFullBalance();
// Future<String> getUnlockedBalance();
// Future<int> getCurrentHeight();
// Future<int> getNodeHeight();
// Future<bool> isConnected();
// Future close();
// TransactionHistory getHistory();
// Future connectToNode({Node node, bool useSSL = false, bool isLightWallet = false});
// Future startSync();
// Future<PendingTransaction> createTransaction(
// TransactionCreationCredentials credentials);
// Future rescan({int restoreHeight = 0});
//}

View file

@ -1,18 +0,0 @@
// import 'package:cake_wallet/entities/wallet.dart';
// import 'package:cake_wallet/entities/wallet_description.dart';
// abstract class WalletsManager {
// Future<Wallet> create(String name, String password, String language);
// Future<Wallet> restoreFromSeed(
// String name, String password, String seed, int restoreHeight);
// Future<Wallet> restoreFromKeys(String name, String password, String language,
// int restoreHeight, String address, String viewKey, String spendKey);
// Future<Wallet> openWallet(String name, String password);
// Future<bool> isWalletExit(String name);
// Future remove(WalletDescription wallet);
// }Remote2434

View file

@ -27,7 +27,6 @@ class AddressPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
addressListViewModel.generateRandomAddress();
autorun((_) async { autorun((_) async {
if (!walletViewModel.isOutdatedElectrumWallet if (!walletViewModel.isOutdatedElectrumWallet
|| !walletViewModel.settingsStore.shouldShowReceiveWarning) { || !walletViewModel.settingsStore.shouldShowReceiveWarning) {

View file

@ -66,28 +66,28 @@ class YatSending extends BasePage {
color: Colors.black, color: Colors.black,
child: Stack( child: Stack(
children: [ children: [
Center( //Center(
child:FutureBuilder<String>( // child:FutureBuilder<String>(
future: visualisationForEmojiId(sendViewModel.outputs.first.address), // future: visualisationForEmojiId(sendViewModel.outputs.first.address),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { // builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
switch (snapshot.connectionState) { // switch (snapshot.connectionState) {
case ConnectionState.done: // case ConnectionState.done:
if (snapshot.hasError || snapshot.data.isEmpty) { // if (snapshot.hasError || snapshot.data.isEmpty) {
return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white); // return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
} // }
return Image.network( // return Image.network(
snapshot.data, // snapshot.data,
scale: 0.7, // scale: 0.7,
loadingBuilder: (Object z, Widget child, ImageChunkEvent loading) // loadingBuilder: (Object z, Widget child, ImageChunkEvent loading)
=> loading != null // => loading != null
? CupertinoActivityIndicator(animating: true) // ? CupertinoActivityIndicator(animating: true)
: child); // : child);
default: // default:
return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white); // return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
} // }
}), // }),
), // ),
Positioned( Positioned(
bottom: 20, bottom: 20,
child: Container( child: Container(

View file

@ -43,6 +43,7 @@ class YatLink {
} }
Future<List<String>> fetchYatAddress(String emojiId, String ticker) async { Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
throw Exception();
//final url = YatLink.emojiIdUrl + emojiId + '/payment'; //final url = YatLink.emojiIdUrl + emojiId + '/payment';
//final response = await get(url); //final response = await get(url);
@ -71,6 +72,7 @@ Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
} }
Future<String> fetchYatAccessToken(String refreshToken) async { Future<String> fetchYatAccessToken(String refreshToken) async {
throw Exception();
//try { //try {
// final url = YatLink.apiUrl + '/auth/token/refresh'; // final url = YatLink.apiUrl + '/auth/token/refresh';
// final bodyJson = json.encode({'refresh_token': refreshToken}); // final bodyJson = json.encode({'refresh_token': refreshToken});
@ -95,6 +97,7 @@ Future<String> fetchYatAccessToken(String refreshToken) async {
} }
Future<String> fetchYatApiKey(String accessKey) async { Future<String> fetchYatApiKey(String accessKey) async {
throw Exception();
//try { //try {
// final url = YatLink.apiUrl + '/api_keys'; // final url = YatLink.apiUrl + '/api_keys';
// final bodyJson = json.encode({'name': 'CW'}); // final bodyJson = json.encode({'name': 'CW'});
@ -120,6 +123,7 @@ Future<String> fetchYatApiKey(String accessKey) async {
} }
Future<void> updateEmojiIdAddress(String emojiId, String address, String apiKey, WalletType type) async { Future<void> updateEmojiIdAddress(String emojiId, String address, String apiKey, WalletType type) async {
throw Exception();
//final url = YatLink.emojiIdUrl + emojiId; //final url = YatLink.emojiIdUrl + emojiId;
//final cur = walletTypeToCryptoCurrency(type); //final cur = walletTypeToCryptoCurrency(type);
//final curFormatted = cur.toString().toUpperCase(); //final curFormatted = cur.toString().toUpperCase();
@ -152,6 +156,7 @@ Future<void> updateEmojiIdAddress(String emojiId, String address, String apiKey,
} }
Future<String> visualisationForEmojiId(String emojiId) async { Future<String> visualisationForEmojiId(String emojiId) async {
throw Exception();
//final url = YatLink.emojiIdUrl + emojiId + '/json/VisualizerFileLocations'; //final url = YatLink.emojiIdUrl + emojiId + '/json/VisualizerFileLocations';
//final response = await get(url); //final response = await get(url);
//final responseJSON = json.decode(response.body) as Map<String, dynamic>; //final responseJSON = json.decode(response.body) as Map<String, dynamic>;
@ -167,9 +172,9 @@ abstract class YatStoreBase with Store {
YatStoreBase({@required this.appStore, @required this.secureStorage}) { YatStoreBase({@required this.appStore, @required this.secureStorage}) {
_wallet ??= appStore.wallet; _wallet ??= appStore.wallet;
emoji = _wallet?.walletInfo?.yatEmojiId ?? ''; emoji = _wallet?.walletInfo?.yatEmojiId ?? '';
reaction((_) => appStore.wallet, _onWalletChange); //reaction((_) => appStore.wallet, _onWalletChange);
reaction((_) => emoji, (String _) => _onEmojiChange()); //reaction((_) => emoji, (String _) => _onEmojiChange());
reaction((_) => refreshToken, (String _) => _onRefreshTokenChange()); //reaction((_) => refreshToken, (String _) => _onRefreshTokenChange());
emojiIncommingSC = StreamController<String>.broadcast(); emojiIncommingSC = StreamController<String>.broadcast();
} }
@ -246,18 +251,21 @@ abstract class YatStoreBase with Store {
@action @action
Future<void> _onRefreshTokenChange() async { Future<void> _onRefreshTokenChange() async {
try { throw Exception();
await secureStorage.write(key: yatRefreshTokenKey(_wallet.walletInfo.name), value: refreshToken);
accessToken = await fetchYatAccessToken(refreshToken); //try {
await secureStorage.write(key: yatAccessTokenKey(_wallet.walletInfo.name), value: accessToken); // await secureStorage.write(key: yatRefreshTokenKey(_wallet.walletInfo.name), value: refreshToken);
apiKey = await fetchYatApiKey(accessToken); // accessToken = await fetchYatAccessToken(refreshToken);
await secureStorage.write(key: yatApiKey(_wallet.walletInfo.name), value: accessToken); // await secureStorage.write(key: yatAccessTokenKey(_wallet.walletInfo.name), value: accessToken);
} catch (e) { // apiKey = await fetchYatApiKey(accessToken);
print(e.toString()); // await secureStorage.write(key: yatApiKey(_wallet.walletInfo.name), value: accessToken);
} //} catch (e) {
// print(e.toString());
//}
} }
String defineQueryParameters() { String defineQueryParameters() {
throw Exception();
//final result = <String, String>{}; //final result = <String, String>{};
//final tags = YatLink.tags[_wallet.currency.toString().toUpperCase()]; //final tags = YatLink.tags[_wallet.currency.toString().toUpperCase()];
//String tag = tags.first; //String tag = tags.first;

View file

@ -42,7 +42,7 @@ List<TransactionPriority> priorityForWalletType(WalletType type) {
case WalletType.bitcoin: case WalletType.bitcoin:
return bitcoin.getTransactionPriorities(); return bitcoin.getTransactionPriorities();
case WalletType.litecoin: case WalletType.litecoin:
return bitcoin.getTransactionPriorities(); return bitcoin.getLitecoinTransactionPriorities();
default: default:
return []; return [];
} }
@ -69,29 +69,29 @@ abstract class SettingsViewModelBase with Store {
_settingsStore.priority[wallet.type] = priorities.first; _settingsStore.priority[wallet.type] = priorities.first;
} }
var connectYatUrl = YatLink.baseUrl + YatLink.signInSuffix; //var connectYatUrl = YatLink.baseUrl + YatLink.signInSuffix;
final connectYatUrlParameters = //final connectYatUrlParameters =
_yatStore.defineQueryParameters(); // _yatStore.defineQueryParameters();
if (connectYatUrlParameters.isNotEmpty) { //if (connectYatUrlParameters.isNotEmpty) {
connectYatUrl += YatLink.queryParameter + connectYatUrlParameters; // connectYatUrl += YatLink.queryParameter + connectYatUrlParameters;
} //}
var manageYatUrl = YatLink.baseUrl + YatLink.managePath; //var manageYatUrl = YatLink.baseUrl + YatLink.managePath;
final manageYatUrlParameters = //final manageYatUrlParameters =
_yatStore.defineQueryParameters(); // _yatStore.defineQueryParameters();
if (manageYatUrlParameters.isNotEmpty) { //if (manageYatUrlParameters.isNotEmpty) {
manageYatUrl += YatLink.queryParameter + manageYatUrlParameters; // manageYatUrl += YatLink.queryParameter + manageYatUrlParameters;
} //}
var createNewYatUrl = YatLink.startFlowUrl; //var createNewYatUrl = YatLink.startFlowUrl;
final createNewYatUrlParameters = //final createNewYatUrlParameters =
_yatStore.defineQueryParameters(); // _yatStore.defineQueryParameters();
if (createNewYatUrlParameters.isNotEmpty) { //if (createNewYatUrlParameters.isNotEmpty) {
createNewYatUrl += '?sub1=' + createNewYatUrlParameters; // createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
} //}
sections = [ sections = [

View file

@ -45,10 +45,6 @@ dependencies:
crypto: ^2.1.5 crypto: ^2.1.5
password: ^1.0.0 password: ^1.0.0
basic_utils: ^2.0.3 basic_utils: ^2.0.3
bitcoin_flutter:
git:
url: https://github.com/cake-tech/bitcoin_flutter.git
ref: cake
get_it: ^6.0.0 get_it: ^6.0.0
connectivity: ^3.0.3 connectivity: ^3.0.3
keyboard_actions: ^3.3.0 keyboard_actions: ^3.3.0

View file

@ -19,9 +19,9 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_PACKAGE="com.monero.app"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.2.9" CAKEWALLET_VERSION="4.3.0"
CAKEWALLET_BUILD_NUMBER=70 CAKEWALLET_BUILD_NUMBER=71
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_ANDROID_TYPE} " ]]; then if ! [[ " ${TYPES[*]} " =~ " ${APP_ANDROID_TYPE} " ]]; then

View file

@ -17,8 +17,8 @@ MONERO_COM_BUILD_NUMBER=6
MONERO_COM_BUNDLE_ID="com.cakewallet.monero" MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.2.9" CAKEWALLET_VERSION="4.3.0"
CAKEWALLET_BUILD_NUMBER=70 CAKEWALLET_BUILD_NUMBER=72
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_IOS_TYPE} " ]]; then if ! [[ " ${TYPES[*]} " =~ " ${APP_IOS_TYPE} " ]]; then

View file

@ -70,6 +70,7 @@ abstract class Bitcoin {
List<String> getWordList(); List<String> getWordList();
Map<String, String> getWalletKeys(Object wallet); Map<String, String> getWalletKeys(Object wallet);
List<TransactionPriority> getTransactionPriorities(); List<TransactionPriority> getTransactionPriorities();
List<TransactionPriority> getLitecoinTransactionPriorities();
TransactionPriority deserializeBitcoinTransactionPriority(int raw); TransactionPriority deserializeBitcoinTransactionPriority(int raw);
int getFeeRate(Object wallet, TransactionPriority priority); int getFeeRate(Object wallet, TransactionPriority priority);
Future<void> generateNewAddress(Object wallet); Future<void> generateNewAddress(Object wallet);