Merge remote-tracking branch 'refs/remotes/origin/CW-453-silent-payments' into MrCyjaneK-cyjan-monerodart

This commit is contained in:
Konstantin Ullrich 2024-05-29 15:42:03 +02:00
commit 86d4c929a5
No known key found for this signature in database
GPG key ID: E9562A013280F5DB
7 changed files with 44 additions and 36 deletions

View file

@ -45,7 +45,7 @@ dependencies:
sp_scanner: sp_scanner:
git: git:
url: https://github.com/cake-tech/sp_scanner url: https://github.com/cake-tech/sp_scanner
ref: sp_v1.0.0 ref: sp_v2.0.0
dev_dependencies: dev_dependencies:

View file

@ -234,7 +234,7 @@ class CWBitcoin extends Bitcoin {
} }
@override @override
BitcoinReceivePageOption getSelectedAddressType(Object wallet) { ReceivePageOption getSelectedAddressType(Object wallet) {
final bitcoinWallet = wallet as ElectrumWallet; final bitcoinWallet = wallet as ElectrumWallet;
return BitcoinReceivePageOption.fromType(bitcoinWallet.walletAddresses.addressPageType); return BitcoinReceivePageOption.fromType(bitcoinWallet.walletAddresses.addressPageType);
} }
@ -246,7 +246,7 @@ class CWBitcoin extends Bitcoin {
} }
@override @override
List<BitcoinReceivePageOption> getBitcoinReceivePageOptions() => BitcoinReceivePageOption.all; List<ReceivePageOption> getBitcoinReceivePageOptions() => BitcoinReceivePageOption.all;
@override @override
BitcoinAddressType getBitcoinAddressType(ReceivePageOption option) { BitcoinAddressType getBitcoinAddressType(ReceivePageOption option) {
@ -465,18 +465,32 @@ class CWBitcoin extends Bitcoin {
} }
@override @override
List<BitcoinSilentPaymentAddressRecord> getSilentPaymentAddresses(Object wallet) { List<ElectrumSubAddress> getSilentPaymentAddresses(Object wallet) {
final bitcoinWallet = wallet as ElectrumWallet; final bitcoinWallet = wallet as ElectrumWallet;
return bitcoinWallet.walletAddresses.silentAddresses return bitcoinWallet.walletAddresses.silentAddresses
.where((addr) => addr.type != SegwitAddresType.p2tr) .where((addr) => addr.type != SegwitAddresType.p2tr)
.map((addr) => ElectrumSubAddress(
id: addr.index,
name: addr.name,
address: addr.address,
txCount: addr.txCount,
balance: addr.balance,
isChange: addr.isHidden))
.toList(); .toList();
} }
@override @override
List<BitcoinSilentPaymentAddressRecord> getSilentPaymentReceivedAddresses(Object wallet) { List<ElectrumSubAddress> getSilentPaymentReceivedAddresses(Object wallet) {
final bitcoinWallet = wallet as ElectrumWallet; final bitcoinWallet = wallet as ElectrumWallet;
return bitcoinWallet.walletAddresses.silentAddresses return bitcoinWallet.walletAddresses.silentAddresses
.where((addr) => addr.type == SegwitAddresType.p2tr) .where((addr) => addr.type == SegwitAddresType.p2tr)
.map((addr) => ElectrumSubAddress(
id: addr.index,
name: addr.name,
address: addr.address,
txCount: addr.txCount,
balance: addr.balance,
isChange: addr.isHidden))
.toList(); .toList();
} }

View file

@ -336,17 +336,17 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
if (isElectrumWallet) { if (isElectrumWallet) {
if (bitcoin!.hasSelectedSilentPayments(wallet)) { if (bitcoin!.hasSelectedSilentPayments(wallet)) {
final addressItems = bitcoin!.getSilentPaymentAddresses(wallet).map((address) { final addressItems = bitcoin!.getSilentPaymentAddresses(wallet).map((address) {
final isPrimary = address.index == 0; final isPrimary = address.id == 0;
return WalletAddressListItem( return WalletAddressListItem(
id: address.index, id: address.id,
isPrimary: isPrimary, isPrimary: isPrimary,
name: address.name, name: address.name,
address: address.address, address: address.address,
txCount: address.txCount, txCount: address.txCount,
balance: AmountConverter.amountIntToString( balance: AmountConverter.amountIntToString(
walletTypeToCryptoCurrency(type), address.balance), walletTypeToCryptoCurrency(type), address.balance),
isChange: address.isHidden, isChange: address.isChange,
); );
}); });
addressList.addAll(addressItems); addressList.addAll(addressItems);
@ -355,14 +355,14 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
final receivedAddressItems = final receivedAddressItems =
bitcoin!.getSilentPaymentReceivedAddresses(wallet).map((address) { bitcoin!.getSilentPaymentReceivedAddresses(wallet).map((address) {
return WalletAddressListItem( return WalletAddressListItem(
id: address.index, id: address.id,
isPrimary: false, isPrimary: false,
name: address.name, name: address.name,
address: address.address, address: address.address,
txCount: address.txCount, txCount: address.txCount,
balance: AmountConverter.amountIntToString( balance: AmountConverter.amountIntToString(
walletTypeToCryptoCurrency(type), address.balance), walletTypeToCryptoCurrency(type), address.balance),
isChange: address.isHidden, isChange: address.isChange,
isOneTimeReceiveAddress: true, isOneTimeReceiveAddress: true,
); );
}); });

View file

@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_ANDROID_TYPE=$1 APP_ANDROID_TYPE=$1
MONERO_COM_NAME="Monero.com" MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.14.0" MONERO_COM_VERSION="1.15.0"
MONERO_COM_BUILD_NUMBER=89 MONERO_COM_BUILD_NUMBER=90
MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_BUNDLE_ID="com.monero.app"
MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_PACKAGE="com.monero.app"
MONERO_COM_SCHEME="monero.com" MONERO_COM_SCHEME="monero.com"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.17.0" CAKEWALLET_VERSION="4.18.0"
CAKEWALLET_BUILD_NUMBER=215 CAKEWALLET_BUILD_NUMBER=216
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
CAKEWALLET_SCHEME="cakewallet" CAKEWALLET_SCHEME="cakewallet"

View file

@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_IOS_TYPE=$1 APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com" MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.14.0" MONERO_COM_VERSION="1.15.0"
MONERO_COM_BUILD_NUMBER=87 MONERO_COM_BUILD_NUMBER=88
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.18.0" CAKEWALLET_VERSION="4.18.0"
CAKEWALLET_BUILD_NUMBER=247 CAKEWALLET_BUILD_NUMBER=248
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven" HAVEN_NAME="Haven"

View file

@ -16,13 +16,13 @@ if [ -n "$1" ]; then
fi fi
MONERO_COM_NAME="Monero.com" MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.4.0" MONERO_COM_VERSION="1.5.0"
MONERO_COM_BUILD_NUMBER=20 MONERO_COM_BUILD_NUMBER=21
MONERO_COM_BUNDLE_ID="com.cakewallet.monero" MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.10.0" CAKEWALLET_VERSION="1.11.0"
CAKEWALLET_BUILD_NUMBER=77 CAKEWALLET_BUILD_NUMBER=78
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then

View file

@ -71,30 +71,26 @@ Future<void> generateBitcoin(bool hasImplementation) async {
final outputFile = File(bitcoinOutputPath); final outputFile = File(bitcoinOutputPath);
const bitcoinCommonHeaders = """ const bitcoinCommonHeaders = """
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:cw_core/node.dart'; import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart'; import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cw_core/hardware/hardware_account_data.dart'; import 'package:cw_core/hardware/hardware_account_data.dart';
import 'package:cw_core/node.dart';
import 'package:cw_core/output_info.dart';
import 'package:cw_core/pending_transaction.dart'; import 'package:cw_core/pending_transaction.dart';
import 'package:cw_core/receive_page_option.dart'; import 'package:cw_core/receive_page_option.dart';
import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/unspent_transaction_output.dart'; import 'package:cw_core/unspent_transaction_output.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/output_info.dart';
import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/wallet_service.dart'; import 'package:cw_core/wallet_service.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:ledger_flutter/ledger_flutter.dart'; import 'package:ledger_flutter/ledger_flutter.dart';
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as btc; import 'package:bitcoin_flutter/bitcoin_flutter.dart' as btc;
import 'package:bip32/bip32.dart' as bip32;
import 'package:bip39/bip39.dart' as bip39; import 'package:bip39/bip39.dart' as bip39;
import 'package:hive/hive.dart';
"""; """;
const bitcoinCWHeaders = """ const bitcoinCWHeaders = """
import 'package:cw_bitcoin/utils.dart'; import 'package:cw_bitcoin/utils.dart';
@ -115,9 +111,7 @@ import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
import 'package:cw_bitcoin/litecoin_wallet_service.dart'; import 'package:cw_bitcoin/litecoin_wallet_service.dart';
import 'package:cw_core/get_height_by_date.dart'; import 'package:cw_core/get_height_by_date.dart';
import 'package:cw_core/node.dart';
import 'package:cw_bitcoin/script_hash.dart'; import 'package:cw_bitcoin/script_hash.dart';
import 'package:cw_bitcoin/pending_bitcoin_transaction.dart';
import 'package:cw_bitcoin/bitcoin_hardware_wallet_service.dart'; import 'package:cw_bitcoin/bitcoin_hardware_wallet_service.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
"""; """;
@ -167,8 +161,8 @@ abstract class Bitcoin {
Object createBitcoinTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate}); Object createBitcoinTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate});
String getAddress(Object wallet); String getAddress(Object wallet);
List<BitcoinSilentPaymentAddressRecord> getSilentPaymentAddresses(Object wallet); List<ElectrumSubAddress> getSilentPaymentAddresses(Object wallet);
List<BitcoinSilentPaymentAddressRecord> getSilentPaymentReceivedAddresses(Object wallet); List<ElectrumSubAddress> getSilentPaymentReceivedAddresses(Object wallet);
Future<int> estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority); Future<int> estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority);
List<ElectrumSubAddress> getSubAddresses(Object wallet); List<ElectrumSubAddress> getSubAddresses(Object wallet);
@ -193,8 +187,8 @@ abstract class Bitcoin {
Future<List<DerivationInfo>> getDerivationsFromMnemonic( Future<List<DerivationInfo>> getDerivationsFromMnemonic(
{required String mnemonic, required Node node, String? passphrase}); {required String mnemonic, required Node node, String? passphrase});
Future<void> setAddressType(Object wallet, dynamic option); Future<void> setAddressType(Object wallet, dynamic option);
BitcoinReceivePageOption getSelectedAddressType(Object wallet); ReceivePageOption getSelectedAddressType(Object wallet);
List<BitcoinReceivePageOption> getBitcoinReceivePageOptions(); List<ReceivePageOption> getBitcoinReceivePageOptions();
BitcoinAddressType getBitcoinAddressType(ReceivePageOption option); BitcoinAddressType getBitcoinAddressType(ReceivePageOption option);
bool hasSelectedSilentPayments(Object wallet); bool hasSelectedSilentPayments(Object wallet);
bool isBitcoinReceivePageOption(ReceivePageOption option); bool isBitcoinReceivePageOption(ReceivePageOption option);