mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 20:09:24 +00:00
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into CW2
This commit is contained in:
commit
354f166834
16 changed files with 150 additions and 153 deletions
|
@ -46,7 +46,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId appProperties['id']
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 30
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
|
|
@ -329,11 +329,15 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
|||
});
|
||||
|
||||
int feeRate(TransactionPriority priority) {
|
||||
if (priority is BitcoinTransactionPriority) {
|
||||
return _feeRates[priority.raw];
|
||||
}
|
||||
try {
|
||||
if (priority is BitcoinTransactionPriority) {
|
||||
return _feeRates[priority.raw];
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
} catch(_) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int feeAmountForPriority(BitcoinTransactionPriority priority, int inputsCount,
|
||||
|
|
|
@ -36,7 +36,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
|
|||
ObservableList<BitcoinAddressRecord> addresses;
|
||||
|
||||
List<BitcoinAddressRecord> get availableAddresses => addresses
|
||||
.where((addr) => addr.isHidden)
|
||||
.where((addr) => !addr.isHidden)
|
||||
.toList();
|
||||
|
||||
int accountIndex;
|
||||
|
|
|
@ -29,6 +29,38 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -36,6 +68,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
bs58check:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bs58check
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -147,14 +186,14 @@ packages:
|
|||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "2.1.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "2.1.5"
|
||||
cw_core:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -175,7 +214,7 @@ packages:
|
|||
name: dartx
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
version: "0.5.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -235,13 +274,20 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
hex:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hex
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
hive:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0-nullsafety.2"
|
||||
version: "1.4.4+1"
|
||||
hive_generator:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
@ -410,6 +456,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
pointycastle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -438,6 +491,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.8"
|
||||
rxdart:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: rxdart
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.26.0"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -519,7 +579,7 @@ packages:
|
|||
name: time
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "1.4.1"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -18,7 +18,12 @@ dependencies:
|
|||
intl: ^0.17.0
|
||||
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:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
|
|
@ -35,6 +35,9 @@ class CWBitcoin extends Bitcoin {
|
|||
List<TransactionPriority> getTransactionPriorities()
|
||||
=> BitcoinTransactionPriority.all;
|
||||
|
||||
List<TransactionPriority> getLitecoinTransactionPriorities()
|
||||
=> LitecoinTransactionPriority.all;
|
||||
|
||||
@override
|
||||
TransactionPriority deserializeBitcoinTransactionPriority(int raw)
|
||||
=> BitcoinTransactionPriority.deserialize(raw: raw);
|
||||
|
|
|
@ -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});
|
||||
//}
|
|
@ -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
|
|
@ -27,7 +27,6 @@ class AddressPage extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
addressListViewModel.generateRandomAddress();
|
||||
autorun((_) async {
|
||||
if (!walletViewModel.isOutdatedElectrumWallet
|
||||
|| !walletViewModel.settingsStore.shouldShowReceiveWarning) {
|
||||
|
|
|
@ -66,28 +66,28 @@ class YatSending extends BasePage {
|
|||
color: Colors.black,
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child:FutureBuilder<String>(
|
||||
future: visualisationForEmojiId(sendViewModel.outputs.first.address),
|
||||
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
|
||||
switch (snapshot.connectionState) {
|
||||
case ConnectionState.done:
|
||||
if (snapshot.hasError || snapshot.data.isEmpty) {
|
||||
return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
|
||||
}
|
||||
//Center(
|
||||
// child:FutureBuilder<String>(
|
||||
// future: visualisationForEmojiId(sendViewModel.outputs.first.address),
|
||||
// builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
|
||||
// switch (snapshot.connectionState) {
|
||||
// case ConnectionState.done:
|
||||
// if (snapshot.hasError || snapshot.data.isEmpty) {
|
||||
// return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
|
||||
// }
|
||||
|
||||
return Image.network(
|
||||
snapshot.data,
|
||||
scale: 0.7,
|
||||
loadingBuilder: (Object z, Widget child, ImageChunkEvent loading)
|
||||
=> loading != null
|
||||
? CupertinoActivityIndicator(animating: true)
|
||||
: child);
|
||||
default:
|
||||
return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
|
||||
}
|
||||
}),
|
||||
),
|
||||
// return Image.network(
|
||||
// snapshot.data,
|
||||
// scale: 0.7,
|
||||
// loadingBuilder: (Object z, Widget child, ImageChunkEvent loading)
|
||||
// => loading != null
|
||||
// ? CupertinoActivityIndicator(animating: true)
|
||||
// : child);
|
||||
// default:
|
||||
// return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
|
||||
// }
|
||||
// }),
|
||||
// ),
|
||||
Positioned(
|
||||
bottom: 20,
|
||||
child: Container(
|
||||
|
|
|
@ -43,6 +43,7 @@ class YatLink {
|
|||
}
|
||||
|
||||
Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
|
||||
throw Exception();
|
||||
//final url = YatLink.emojiIdUrl + emojiId + '/payment';
|
||||
//final response = await get(url);
|
||||
|
||||
|
@ -71,6 +72,7 @@ Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
|
|||
}
|
||||
|
||||
Future<String> fetchYatAccessToken(String refreshToken) async {
|
||||
throw Exception();
|
||||
//try {
|
||||
// final url = YatLink.apiUrl + '/auth/token/refresh';
|
||||
// final bodyJson = json.encode({'refresh_token': refreshToken});
|
||||
|
@ -95,6 +97,7 @@ Future<String> fetchYatAccessToken(String refreshToken) async {
|
|||
}
|
||||
|
||||
Future<String> fetchYatApiKey(String accessKey) async {
|
||||
throw Exception();
|
||||
//try {
|
||||
// final url = YatLink.apiUrl + '/api_keys';
|
||||
// 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 {
|
||||
throw Exception();
|
||||
//final url = YatLink.emojiIdUrl + emojiId;
|
||||
//final cur = walletTypeToCryptoCurrency(type);
|
||||
//final curFormatted = cur.toString().toUpperCase();
|
||||
|
@ -152,6 +156,7 @@ Future<void> updateEmojiIdAddress(String emojiId, String address, String apiKey,
|
|||
}
|
||||
|
||||
Future<String> visualisationForEmojiId(String emojiId) async {
|
||||
throw Exception();
|
||||
//final url = YatLink.emojiIdUrl + emojiId + '/json/VisualizerFileLocations';
|
||||
//final response = await get(url);
|
||||
//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}) {
|
||||
_wallet ??= appStore.wallet;
|
||||
emoji = _wallet?.walletInfo?.yatEmojiId ?? '';
|
||||
reaction((_) => appStore.wallet, _onWalletChange);
|
||||
reaction((_) => emoji, (String _) => _onEmojiChange());
|
||||
reaction((_) => refreshToken, (String _) => _onRefreshTokenChange());
|
||||
//reaction((_) => appStore.wallet, _onWalletChange);
|
||||
//reaction((_) => emoji, (String _) => _onEmojiChange());
|
||||
//reaction((_) => refreshToken, (String _) => _onRefreshTokenChange());
|
||||
emojiIncommingSC = StreamController<String>.broadcast();
|
||||
}
|
||||
|
||||
|
@ -246,18 +251,21 @@ abstract class YatStoreBase with Store {
|
|||
|
||||
@action
|
||||
Future<void> _onRefreshTokenChange() async {
|
||||
try {
|
||||
await secureStorage.write(key: yatRefreshTokenKey(_wallet.walletInfo.name), value: refreshToken);
|
||||
accessToken = await fetchYatAccessToken(refreshToken);
|
||||
await secureStorage.write(key: yatAccessTokenKey(_wallet.walletInfo.name), value: accessToken);
|
||||
apiKey = await fetchYatApiKey(accessToken);
|
||||
await secureStorage.write(key: yatApiKey(_wallet.walletInfo.name), value: accessToken);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
throw Exception();
|
||||
|
||||
//try {
|
||||
// await secureStorage.write(key: yatRefreshTokenKey(_wallet.walletInfo.name), value: refreshToken);
|
||||
// accessToken = await fetchYatAccessToken(refreshToken);
|
||||
// await secureStorage.write(key: yatAccessTokenKey(_wallet.walletInfo.name), value: accessToken);
|
||||
// apiKey = await fetchYatApiKey(accessToken);
|
||||
// await secureStorage.write(key: yatApiKey(_wallet.walletInfo.name), value: accessToken);
|
||||
//} catch (e) {
|
||||
// print(e.toString());
|
||||
//}
|
||||
}
|
||||
|
||||
String defineQueryParameters() {
|
||||
throw Exception();
|
||||
//final result = <String, String>{};
|
||||
//final tags = YatLink.tags[_wallet.currency.toString().toUpperCase()];
|
||||
//String tag = tags.first;
|
||||
|
|
|
@ -42,7 +42,7 @@ List<TransactionPriority> priorityForWalletType(WalletType type) {
|
|||
case WalletType.bitcoin:
|
||||
return bitcoin.getTransactionPriorities();
|
||||
case WalletType.litecoin:
|
||||
return bitcoin.getTransactionPriorities();
|
||||
return bitcoin.getLitecoinTransactionPriorities();
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
@ -69,29 +69,29 @@ abstract class SettingsViewModelBase with Store {
|
|||
_settingsStore.priority[wallet.type] = priorities.first;
|
||||
}
|
||||
|
||||
var connectYatUrl = YatLink.baseUrl + YatLink.signInSuffix;
|
||||
final connectYatUrlParameters =
|
||||
_yatStore.defineQueryParameters();
|
||||
//var connectYatUrl = YatLink.baseUrl + YatLink.signInSuffix;
|
||||
//final connectYatUrlParameters =
|
||||
// _yatStore.defineQueryParameters();
|
||||
|
||||
if (connectYatUrlParameters.isNotEmpty) {
|
||||
connectYatUrl += YatLink.queryParameter + connectYatUrlParameters;
|
||||
}
|
||||
//if (connectYatUrlParameters.isNotEmpty) {
|
||||
// connectYatUrl += YatLink.queryParameter + connectYatUrlParameters;
|
||||
//}
|
||||
|
||||
var manageYatUrl = YatLink.baseUrl + YatLink.managePath;
|
||||
final manageYatUrlParameters =
|
||||
_yatStore.defineQueryParameters();
|
||||
//var manageYatUrl = YatLink.baseUrl + YatLink.managePath;
|
||||
//final manageYatUrlParameters =
|
||||
// _yatStore.defineQueryParameters();
|
||||
|
||||
if (manageYatUrlParameters.isNotEmpty) {
|
||||
manageYatUrl += YatLink.queryParameter + manageYatUrlParameters;
|
||||
}
|
||||
//if (manageYatUrlParameters.isNotEmpty) {
|
||||
// manageYatUrl += YatLink.queryParameter + manageYatUrlParameters;
|
||||
//}
|
||||
|
||||
var createNewYatUrl = YatLink.startFlowUrl;
|
||||
final createNewYatUrlParameters =
|
||||
_yatStore.defineQueryParameters();
|
||||
//var createNewYatUrl = YatLink.startFlowUrl;
|
||||
//final createNewYatUrlParameters =
|
||||
// _yatStore.defineQueryParameters();
|
||||
|
||||
if (createNewYatUrlParameters.isNotEmpty) {
|
||||
createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
|
||||
}
|
||||
//if (createNewYatUrlParameters.isNotEmpty) {
|
||||
// createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
|
||||
//}
|
||||
|
||||
|
||||
sections = [
|
||||
|
|
|
@ -45,10 +45,6 @@ dependencies:
|
|||
crypto: ^2.1.5
|
||||
password: ^1.0.0
|
||||
basic_utils: ^2.0.3
|
||||
bitcoin_flutter:
|
||||
git:
|
||||
url: https://github.com/cake-tech/bitcoin_flutter.git
|
||||
ref: cake
|
||||
get_it: ^6.0.0
|
||||
connectivity: ^3.0.3
|
||||
keyboard_actions: ^3.3.0
|
||||
|
|
|
@ -19,9 +19,9 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
|
|||
MONERO_COM_PACKAGE="com.monero.app"
|
||||
|
||||
CAKEWALLET_NAME="Cake Wallet"
|
||||
CAKEWALLET_VERSION="4.2.9"
|
||||
CAKEWALLET_BUILD_NUMBER=70
|
||||
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
|
||||
CAKEWALLET_VERSION="4.3.0"
|
||||
CAKEWALLET_BUILD_NUMBER=71
|
||||
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
|
||||
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
|
||||
|
||||
if ! [[ " ${TYPES[*]} " =~ " ${APP_ANDROID_TYPE} " ]]; then
|
||||
|
|
|
@ -17,8 +17,8 @@ MONERO_COM_BUILD_NUMBER=6
|
|||
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
|
||||
|
||||
CAKEWALLET_NAME="Cake Wallet"
|
||||
CAKEWALLET_VERSION="4.2.9"
|
||||
CAKEWALLET_BUILD_NUMBER=70
|
||||
CAKEWALLET_VERSION="4.3.0"
|
||||
CAKEWALLET_BUILD_NUMBER=72
|
||||
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
|
||||
|
||||
if ! [[ " ${TYPES[*]} " =~ " ${APP_IOS_TYPE} " ]]; then
|
||||
|
|
|
@ -70,6 +70,7 @@ abstract class Bitcoin {
|
|||
List<String> getWordList();
|
||||
Map<String, String> getWalletKeys(Object wallet);
|
||||
List<TransactionPriority> getTransactionPriorities();
|
||||
List<TransactionPriority> getLitecoinTransactionPriorities();
|
||||
TransactionPriority deserializeBitcoinTransactionPriority(int raw);
|
||||
int getFeeRate(Object wallet, TransactionPriority priority);
|
||||
Future<void> generateNewAddress(Object wallet);
|
||||
|
|
Loading…
Reference in a new issue