mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Merge branch 'main' into electrum_utxo_fixes
This commit is contained in:
commit
b8adb82320
15 changed files with 82 additions and 32 deletions
|
@ -1705,7 +1705,7 @@ abstract class ElectrumWalletBase
|
|||
try {
|
||||
final blockHash = await http.get(
|
||||
Uri.parse(
|
||||
"http://mempool.cakewallet.com:8999/api/v1/block-height/$height",
|
||||
"https://mempool.cakewallet.com/api/v1/block-height/$height",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ abstract class ElectrumWalletBase
|
|||
jsonDecode(blockHash.body) != null) {
|
||||
final blockResponse = await http.get(
|
||||
Uri.parse(
|
||||
"http://mempool.cakewallet.com:8999/api/v1/block/${blockHash.body}",
|
||||
"https://mempool.cakewallet.com/api/v1/block/${blockHash.body}",
|
||||
),
|
||||
);
|
||||
if (blockResponse.statusCode == 200 &&
|
||||
|
|
|
@ -270,7 +270,7 @@ const bitcoinDates = {
|
|||
Future<int> getBitcoinHeightByDateAPI({required DateTime date}) async {
|
||||
final response = await http.get(
|
||||
Uri.parse(
|
||||
"http://mempool.cakewallet.com:8999/api/v1/mining/blocks/timestamp/${(date.millisecondsSinceEpoch / 1000).round()}",
|
||||
"https://mempool.cakewallet.com/api/v1/mining/blocks/timestamp/${(date.millisecondsSinceEpoch / 1000).round()}",
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -203,9 +203,30 @@ class Node extends HiveObject with Keyable {
|
|||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode(body),
|
||||
);
|
||||
|
||||
client.close();
|
||||
|
||||
if ((
|
||||
response.body.contains("400 Bad Request") // Some other generic error
|
||||
|| response.body.contains("plain HTTP request was sent to HTTPS port") // Cloudflare
|
||||
|| response.headers["location"] != null // Generic reverse proxy
|
||||
|| response.body.contains("301 Moved Permanently") // Poorly configured generic reverse proxy
|
||||
) && !(useSSL??false)
|
||||
) {
|
||||
|
||||
final oldUseSSL = useSSL;
|
||||
useSSL = true;
|
||||
try {
|
||||
final ret = await requestMoneroNode();
|
||||
if (ret == true) {
|
||||
await save();
|
||||
return ret;
|
||||
}
|
||||
useSSL = oldUseSSL;
|
||||
} catch (e) {
|
||||
useSSL = oldUseSSL;
|
||||
}
|
||||
}
|
||||
|
||||
final resBody = json.decode(response.body) as Map<String, dynamic>;
|
||||
return !(resBody['result']['offline'] as bool);
|
||||
} catch (_) {
|
||||
|
|
|
@ -2,14 +2,14 @@ group 'com.cakewallet.cw_haven'
|
|||
version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
ext.kotlin_version = '2.0.21'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
classpath 'com.android.tools.build:gradle:8.7.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,20 @@ apply plugin: 'com.android.library'
|
|||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
compileSdkVersion 33
|
||||
|
||||
if (project.android.hasProperty("namespace")) {
|
||||
namespace 'com.cakewallet.cw_haven'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
}
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ String getTxKey(String txId) {
|
|||
final status = monero.Wallet_status(wptr!);
|
||||
if (status != 0) {
|
||||
final error = monero.Wallet_errorString(wptr!);
|
||||
return txId+"_"+error;
|
||||
return "";
|
||||
}
|
||||
return txKey;
|
||||
}
|
||||
|
@ -91,12 +91,19 @@ Future<PendingTransactionDescription> createTransactionSync(
|
|||
List<String> preferredInputs = const []}) async {
|
||||
|
||||
final amt = amount == null ? 0 : monero.Wallet_amountFromString(amount);
|
||||
|
||||
|
||||
final waddr = wptr!.address;
|
||||
|
||||
// force reconnection in case the os killed the connection?
|
||||
// fixes failed to get block height error.
|
||||
Isolate.run(() async {
|
||||
monero.Wallet_synchronized(Pointer.fromAddress(waddr));
|
||||
});
|
||||
|
||||
final address_ = address.toNativeUtf8();
|
||||
final paymentId_ = paymentId.toNativeUtf8();
|
||||
final preferredInputs_ = preferredInputs.join(monero.defaultSeparatorStr).toNativeUtf8();
|
||||
|
||||
final waddr = wptr!.address;
|
||||
final addraddr = address_.address;
|
||||
final paymentIdAddr = paymentId_.address;
|
||||
final preferredInputsAddr = preferredInputs_.address;
|
||||
|
@ -357,16 +364,7 @@ class Transaction {
|
|||
confirmations = monero.TransactionInfo_confirmations(txInfo),
|
||||
fee = monero.TransactionInfo_fee(txInfo),
|
||||
description = monero.TransactionInfo_description(txInfo),
|
||||
key = getTxKey(txInfo);
|
||||
|
||||
static String getTxKey(monero.TransactionInfo txInfo) {
|
||||
final txKey = monero.Wallet_getTxKey(wptr!, txid: monero.TransactionInfo_hash(txInfo));
|
||||
final status = monero.Wallet_status(wptr!);
|
||||
if (status != 0) {
|
||||
return "";
|
||||
}
|
||||
return txKey;
|
||||
}
|
||||
key = getTxKey(monero.TransactionInfo_hash(txInfo));
|
||||
|
||||
Transaction.dummy({
|
||||
required this.displayLabel,
|
||||
|
|
|
@ -150,14 +150,15 @@ final storeMutex = Mutex();
|
|||
|
||||
int lastStorePointer = 0;
|
||||
int lastStoreHeight = 0;
|
||||
void storeSync() async {
|
||||
void storeSync({bool force = false}) async {
|
||||
final addr = wptr!.address;
|
||||
final synchronized = await Isolate.run(() {
|
||||
return monero.Wallet_synchronized(Pointer.fromAddress(addr));
|
||||
});
|
||||
if (lastStorePointer == wptr!.address &&
|
||||
lastStoreHeight + 5000 > monero.Wallet_blockChainHeight(wptr!) &&
|
||||
!synchronized) {
|
||||
!synchronized &&
|
||||
!force) {
|
||||
return;
|
||||
}
|
||||
lastStorePointer = wptr!.address;
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:cw_core/crypto_currency.dart';
|
|||
import 'package:cw_core/amount_converter.dart';
|
||||
|
||||
import 'package:cw_core/pending_transaction.dart';
|
||||
import 'package:cw_monero/api/wallet.dart';
|
||||
|
||||
class DoubleSpendException implements Exception {
|
||||
DoubleSpendException();
|
||||
|
@ -53,6 +54,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
|||
|
||||
rethrow;
|
||||
}
|
||||
storeSync(force: true);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -25,7 +25,20 @@ apply plugin: 'com.android.library'
|
|||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 33
|
||||
|
||||
if (project.android.hasProperty("namespace")) {
|
||||
namespace 'com.cakewallet.cw_shared_external'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
|
|
|
@ -159,7 +159,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
case WalletType.monero:
|
||||
return 'https://monero.com/tx/${txId}';
|
||||
case WalletType.bitcoin:
|
||||
return 'https://mempool.space/${wallet.isTestnet ? "testnet/" : ""}tx/${txId}';
|
||||
return 'https://mempool.cakewallet.com/${wallet.isTestnet ? "testnet/" : ""}tx/${txId}';
|
||||
case WalletType.litecoin:
|
||||
return 'https://blockchair.com/litecoin/transaction/${txId}';
|
||||
case WalletType.bitcoinCash:
|
||||
|
|
|
@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
sp_scanner
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
|
|
@ -6,6 +6,7 @@ import FlutterMacOS
|
|||
import Foundation
|
||||
|
||||
import connectivity_plus
|
||||
import cw_mweb
|
||||
import device_info_plus
|
||||
import devicelocale
|
||||
import fast_scanner
|
||||
|
@ -23,6 +24,7 @@ import wakelock_plus
|
|||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
|
||||
CwMwebPlugin.register(with: registry.registrar(forPlugin: "CwMwebPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin"))
|
||||
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
||||
|
|
|
@ -26,7 +26,7 @@ dependencies:
|
|||
share_plus: ^10.0.0
|
||||
# date_range_picker: ^1.0.6
|
||||
#https://api.flutter.dev/flutter/material/showDateRangePicker.html
|
||||
dio: ^4.0.6
|
||||
dio: ^5.7.0
|
||||
hive: ^2.2.3
|
||||
hive_flutter: ^1.1.0
|
||||
local_auth_android: ^1.0.46
|
||||
|
|
|
@ -6,10 +6,10 @@ if [ -z "$APP_ANDROID_TYPE" ]; then
|
|||
fi
|
||||
|
||||
cd ../..
|
||||
universal_sed "0,/version:/ {s/version:.*/version: ${APP_ANDROID_VERSION}+${APP_ANDROID_BUILD_NUMBER}/;}" ./pubspec.yaml
|
||||
universal_sed "0,/version:/ {s/__APP_PACKAGE__/${APP_ANDROID_PACKAGE}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
universal_sed "0,/__APP_SCHEME__/ {s/__APP_SCHEME__/${APP_ANDROID_SCHEME}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
universal_sed "0,/version:/ {s/__versionCode__/${APP_ANDROID_BUILD_NUMBER}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
universal_sed "0,/version:/ {s/__versionName__/${APP_ANDROID_VERSION}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
|
||||
set -x
|
||||
universal_sed "1,/version:/ {s/version:.*/version: ${APP_ANDROID_VERSION}+${APP_ANDROID_BUILD_NUMBER}/;}" ./pubspec.yaml
|
||||
universal_sed "1,/version:/ {s/__APP_PACKAGE__/${APP_ANDROID_PACKAGE}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
universal_sed "1,/__APP_SCHEME__/ {s/__APP_SCHEME__/${APP_ANDROID_SCHEME}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
universal_sed "1,/version:/ {s/__versionCode__/${APP_ANDROID_BUILD_NUMBER}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
universal_sed "1,/version:/ {s/__versionName__/${APP_ANDROID_VERSION}/;}" ./android/app/src/main/AndroidManifest.xml
|
||||
cd scripts/android
|
||||
|
|
|
@ -43,7 +43,6 @@ case $APP_IOS_TYPE in
|
|||
CONFIG_ARGS="--haven"
|
||||
;;
|
||||
esac
|
||||
CONFIG_ARGS="--monero --ethereum --polygon --nano --solana --tron --wownero"
|
||||
|
||||
cp -rf pubspec_description.yaml pubspec.yaml
|
||||
flutter pub get
|
||||
|
|
|
@ -14,6 +14,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
sp_scanner
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
|
Loading…
Reference in a new issue