mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-18 16:55:58 +00:00
fix: merge fixes
This commit is contained in:
parent
bc24ed5fab
commit
aff2651cba
12 changed files with 186 additions and 103 deletions
|
@ -222,7 +222,9 @@ abstract class ElectrumWalletBase
|
||||||
throw BitcoinTransactionNoInputsException();
|
throw BitcoinTransactionNoInputsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final allAmountFee = 222;
|
final allAmountFee = transactionCredentials.feeRate != null
|
||||||
|
? feeAmountWithFeeRate(transactionCredentials.feeRate!, inputs.length, outputs.length)
|
||||||
|
: feeAmountForPriority(transactionCredentials.priority!, inputs.length, outputs.length);
|
||||||
|
|
||||||
final allAmount = allInputsAmount - allAmountFee;
|
final allAmount = allInputsAmount - allAmountFee;
|
||||||
|
|
||||||
|
@ -292,18 +294,13 @@ abstract class ElectrumWalletBase
|
||||||
|
|
||||||
for (int i = 0; i < inputs.length; i++) {
|
for (int i = 0; i < inputs.length; i++) {
|
||||||
final utx = inputs[i];
|
final utx = inputs[i];
|
||||||
leftAmount = utx.value - leftAmount;
|
leftAmount = leftAmount - utx.value;
|
||||||
totalInputAmount += utx.value;
|
totalInputAmount += utx.value;
|
||||||
|
|
||||||
if (leftAmount <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
final isSilentPayment = utx.bitcoinAddressRecord.silentPaymentTweak != null;
|
|
||||||
|
|
||||||
outpoints.add(bitcoin.Outpoint(txid: utx.hash, index: utx.vout));
|
outpoints.add(bitcoin.Outpoint(txid: utx.hash, index: utx.vout));
|
||||||
|
|
||||||
if (isSilentPayment) {
|
print(utx.bitcoinAddressRecord.silentPaymentTweak);
|
||||||
|
if (utx.bitcoinAddressRecord.silentPaymentTweak != null) {
|
||||||
// https://github.com/bitcoin/bips/blob/c55f80c53c98642357712c1839cfdc0551d531c4/bip-0352.mediawiki#user-content-Spending
|
// https://github.com/bitcoin/bips/blob/c55f80c53c98642357712c1839cfdc0551d531c4/bip-0352.mediawiki#user-content-Spending
|
||||||
final d = bitcoin.PrivateKey.fromHex(bitcoin.getSecp256k1(),
|
final d = bitcoin.PrivateKey.fromHex(bitcoin.getSecp256k1(),
|
||||||
walletAddresses.silentAddress!.spendPrivkey.toCompressedHex())
|
walletAddresses.silentAddress!.spendPrivkey.toCompressedHex())
|
||||||
|
@ -356,6 +353,10 @@ abstract class ElectrumWalletBase
|
||||||
}
|
}
|
||||||
|
|
||||||
txb.addInput(utx.hash, utx.vout, null, null, keyPair, utx.value);
|
txb.addInput(utx.hash, utx.vout, null, null, keyPair, utx.value);
|
||||||
|
|
||||||
|
if (leftAmount <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (txb.inputs.isEmpty) {
|
if (txb.inputs.isEmpty) {
|
||||||
|
@ -371,6 +372,7 @@ abstract class ElectrumWalletBase
|
||||||
final outputAmount = hasMultiDestination ? item.formattedCryptoAmount : amount;
|
final outputAmount = hasMultiDestination ? item.formattedCryptoAmount : amount;
|
||||||
final outputAddress = item.isParsedAddress ? item.extractedAddress! : item.address;
|
final outputAddress = item.isParsedAddress ? item.extractedAddress! : item.address;
|
||||||
if (outputAddress.startsWith('tsp1')) {
|
if (outputAddress.startsWith('tsp1')) {
|
||||||
|
print([outputAddress, outputAmount!]);
|
||||||
silentPaymentDestinations
|
silentPaymentDestinations
|
||||||
.add(bitcoin.SilentPaymentDestination.fromAddress(outputAddress, outputAmount!));
|
.add(bitcoin.SilentPaymentDestination.fromAddress(outputAddress, outputAmount!));
|
||||||
} else {
|
} else {
|
||||||
|
@ -390,19 +392,20 @@ abstract class ElectrumWalletBase
|
||||||
// TODO: DRY code: pubkeyToOutputScript (?)
|
// TODO: DRY code: pubkeyToOutputScript (?)
|
||||||
final point = bitcoin.ECPublic.fromHex(generatedPubkey).toTapPoint();
|
final point = bitcoin.ECPublic.fromHex(generatedPubkey).toTapPoint();
|
||||||
final p2tr = bitcoin.P2trAddress(program: point);
|
final p2tr = bitcoin.P2trAddress(program: point);
|
||||||
txb.addOutput(p2tr.toScriptPubKey().toBytes(), amount);
|
print([p2tr.toScriptPubKey().toBytes(), output.$2]);
|
||||||
|
txb.addOutput(p2tr.toScriptPubKey().toBytes(), output.$2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final estimatedSize = estimatedTransactionSize(inputs.length, outputs.length + 1);
|
final estimatedSize = estimatedTransactionSize(inputs.length, outputs.length + 1);
|
||||||
var feeAmount = 222;
|
var feeAmount = 0;
|
||||||
|
|
||||||
// if (transactionCredentials.feeRate != null) {
|
if (transactionCredentials.feeRate != null) {
|
||||||
// feeAmount = transactionCredentials.feeRate! * estimatedSize;
|
feeAmount = transactionCredentials.feeRate! * estimatedSize;
|
||||||
// } else {
|
} else {
|
||||||
// feeAmount = feeRate(transactionCredentials.priority!) * estimatedSize;
|
feeAmount = feeRate(transactionCredentials.priority!) * estimatedSize;
|
||||||
// }
|
}
|
||||||
|
|
||||||
final changeValue = totalInputAmount - amount - feeAmount;
|
final changeValue = totalInputAmount - amount - feeAmount;
|
||||||
|
|
||||||
|
@ -553,10 +556,10 @@ abstract class ElectrumWalletBase
|
||||||
runningIsolate.kill(priority: Isolate.immediate);
|
runningIsolate.kill(priority: Isolate.immediate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentChainTip <= height) {
|
// if (currentChainTip <= height) {
|
||||||
syncStatus = SyncedSyncStatus();
|
// syncStatus = SyncedSyncStatus();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
final receivePort = ReceivePort();
|
final receivePort = ReceivePort();
|
||||||
_isolate = Isolate.spawn(
|
_isolate = Isolate.spawn(
|
||||||
|
@ -578,32 +581,8 @@ abstract class ElectrumWalletBase
|
||||||
|
|
||||||
await for (var message in receivePort) {
|
await for (var message in receivePort) {
|
||||||
if (message is BitcoinUnspent) {
|
if (message is BitcoinUnspent) {
|
||||||
final myNewUnspent = message;
|
unspentCoins.add(message);
|
||||||
final hasUnspent = unspentCoins.any((element) {
|
walletAddresses.addresses.add(message.bitcoinAddressRecord);
|
||||||
if (element.address == message.address) {
|
|
||||||
unspentCoins.remove(element);
|
|
||||||
unspentCoins.add(myNewUnspent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!hasUnspent) {
|
|
||||||
unspentCoins.add(myNewUnspent);
|
|
||||||
}
|
|
||||||
|
|
||||||
final myNewAddress = message.bitcoinAddressRecord;
|
|
||||||
final hasAddress = walletAddresses.addresses.any((element) {
|
|
||||||
if (element.address == message.address) {
|
|
||||||
walletAddresses.addresses.remove(element);
|
|
||||||
walletAddresses.addresses.add(myNewAddress);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!hasAddress) {
|
|
||||||
walletAddresses.addresses.add(myNewAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
await save();
|
await save();
|
||||||
|
|
||||||
await updateUnspent();
|
await updateUnspent();
|
||||||
|
@ -722,8 +701,6 @@ abstract class ElectrumWalletBase
|
||||||
final addressHashes = <String, BitcoinAddressRecord>{};
|
final addressHashes = <String, BitcoinAddressRecord>{};
|
||||||
final normalizedHistories = <Map<String, dynamic>>[];
|
final normalizedHistories = <Map<String, dynamic>>[];
|
||||||
walletAddresses.addresses.forEach((addressRecord) {
|
walletAddresses.addresses.forEach((addressRecord) {
|
||||||
if (addressRecord.address ==
|
|
||||||
"tb1pch9qmsq87wy4my4akd60x2r2yt784zfmfwqeuk7w7g7u45za4ktq9pdnmf") {}
|
|
||||||
final sh = scriptHash(addressRecord.address, networkType: networkType);
|
final sh = scriptHash(addressRecord.address, networkType: networkType);
|
||||||
addressHashes[sh] = addressRecord;
|
addressHashes[sh] = addressRecord;
|
||||||
});
|
});
|
||||||
|
@ -998,10 +975,10 @@ class SyncResponse {
|
||||||
|
|
||||||
Future<void> startRefresh(ScanData scanData) async {
|
Future<void> startRefresh(ScanData scanData) async {
|
||||||
final currentChainTip = scanData.chainTip;
|
final currentChainTip = scanData.chainTip;
|
||||||
if (scanData.height >= currentChainTip) {
|
// if (scanData.height >= currentChainTip) {
|
||||||
scanData.sendPort.send(SyncResponse(scanData.height, SyncedSyncStatus()));
|
// scanData.sendPort.send(SyncResponse(scanData.height, SyncedSyncStatus()));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var checkpointTxPos = scanData.checkpointTxPos;
|
var checkpointTxPos = scanData.checkpointTxPos;
|
||||||
final height = scanData.height;
|
final height = scanData.height;
|
||||||
|
@ -1115,9 +1092,13 @@ Future<void> startRefresh(ScanData scanData) async {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
print("UNSPENT COIN FOUND!");
|
if (result.length > 1) {
|
||||||
|
print("MULTIPLE UNSPENT COINS FOUND!");
|
||||||
|
} else {
|
||||||
|
print("UNSPENT COIN FOUND!");
|
||||||
|
}
|
||||||
print(result);
|
print(result);
|
||||||
|
|
||||||
result.forEach((key, value) {
|
result.forEach((key, value) {
|
||||||
final outpoint = outpointsByP2TRpubkey[key];
|
final outpoint = outpointsByP2TRpubkey[key];
|
||||||
|
|
||||||
|
|
1
cw_bitcoin_cash/linux/flutter/ephemeral/.plugin_symlinks/tor
Symbolic link
1
cw_bitcoin_cash/linux/flutter/ephemeral/.plugin_symlinks/tor
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
/home/rafael/.pub-cache/git/tor-09ba92cb11d4e3cacf97256e57863b805f79f2e5/
|
|
@ -113,6 +113,15 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.4.3"
|
version: "8.4.3"
|
||||||
|
cake_backup:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "."
|
||||||
|
ref: main
|
||||||
|
resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38"
|
||||||
|
url: "https://github.com/cake-tech/cake_backup.git"
|
||||||
|
source: git
|
||||||
|
version: "1.0.0+1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -169,6 +178,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.0.2"
|
||||||
|
cryptography:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cryptography
|
||||||
|
sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.5.0"
|
||||||
|
cupertino_icons:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cupertino_icons
|
||||||
|
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.6"
|
||||||
dart_style:
|
dart_style:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -625,6 +650,14 @@ packages:
|
||||||
url: "https://github.com/cake-tech/tor.git"
|
url: "https://github.com/cake-tech/tor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
tuple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: tuple
|
||||||
|
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -113,6 +113,15 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.4.3"
|
version: "8.4.3"
|
||||||
|
cake_backup:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
path: "."
|
||||||
|
ref: main
|
||||||
|
resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38"
|
||||||
|
url: "https://github.com/cake-tech/cake_backup.git"
|
||||||
|
source: git
|
||||||
|
version: "1.0.0+1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -169,6 +178,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.0.2"
|
||||||
|
cryptography:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cryptography
|
||||||
|
sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.5.0"
|
||||||
|
cupertino_icons:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cupertino_icons
|
||||||
|
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.6"
|
||||||
cw_core:
|
cw_core:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -632,6 +657,14 @@ packages:
|
||||||
url: "https://github.com/cake-tech/tor.git"
|
url: "https://github.com/cake-tech/tor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
tuple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: tuple
|
||||||
|
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -137,6 +137,15 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.6.1"
|
version: "8.6.1"
|
||||||
|
cake_backup:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
path: "."
|
||||||
|
ref: main
|
||||||
|
resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38"
|
||||||
|
url: "https://github.com/cake-tech/cake_backup.git"
|
||||||
|
source: git
|
||||||
|
version: "1.0.0+1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -193,6 +202,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.3"
|
version: "3.0.3"
|
||||||
|
cryptography:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cryptography
|
||||||
|
sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.5.0"
|
||||||
|
cupertino_icons:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cupertino_icons
|
||||||
|
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.6"
|
||||||
cw_core:
|
cw_core:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -773,6 +798,14 @@ packages:
|
||||||
url: "https://github.com/cake-tech/tor.git"
|
url: "https://github.com/cake-tech/tor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
tuple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: tuple
|
||||||
|
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
24
lib/di.dart
24
lib/di.dart
|
@ -356,10 +356,9 @@ Future<void> setup({
|
||||||
getIt.get<KeyService>(),
|
getIt.get<KeyService>(),
|
||||||
(WalletType type) => getIt.get<WalletService>(param1: type)));
|
(WalletType type) => getIt.get<WalletService>(param1: type)));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) =>
|
getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) => WalletNewVM(
|
||||||
WalletNewVM(getIt.get<AppStore>(),
|
getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
||||||
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
type: type));
|
||||||
type: type));
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletRestorationFromQRVM, WalletType, void>((WalletType type, _) {
|
getIt.registerFactoryParam<WalletRestorationFromQRVM, WalletType, void>((WalletType type, _) {
|
||||||
return WalletRestorationFromQRVM(getIt.get<AppStore>(),
|
return WalletRestorationFromQRVM(getIt.get<AppStore>(),
|
||||||
|
@ -919,8 +918,8 @@ Future<void> setup({
|
||||||
(param1, isCreate) => NewWalletTypePage(onTypeSelected: param1, isCreate: isCreate ?? true));
|
(param1, isCreate) => NewWalletTypePage(onTypeSelected: param1, isCreate: isCreate ?? true));
|
||||||
|
|
||||||
getIt.registerFactoryParam<PreSeedPage, WalletType, AdvancedPrivacySettingsViewModel>(
|
getIt.registerFactoryParam<PreSeedPage, WalletType, AdvancedPrivacySettingsViewModel>(
|
||||||
(WalletType type, AdvancedPrivacySettingsViewModel advancedPrivacySettingsViewModel)
|
(WalletType type, AdvancedPrivacySettingsViewModel advancedPrivacySettingsViewModel) =>
|
||||||
=> PreSeedPage(type, advancedPrivacySettingsViewModel));
|
PreSeedPage(type, advancedPrivacySettingsViewModel));
|
||||||
|
|
||||||
getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
|
getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
|
||||||
TradeDetailsViewModel(
|
TradeDetailsViewModel(
|
||||||
|
@ -1014,11 +1013,10 @@ Future<void> setup({
|
||||||
|
|
||||||
getIt.registerFactory(() => YatService());
|
getIt.registerFactory(() => YatService());
|
||||||
|
|
||||||
getIt.registerFactory(() =>
|
getIt.registerFactory(() => AddressResolver(
|
||||||
AddressResolver(
|
yatService: getIt.get<YatService>(),
|
||||||
yatService: getIt.get<YatService>(),
|
wallet: getIt.get<AppStore>().wallet!,
|
||||||
wallet: getIt.get<AppStore>().wallet!,
|
settingsStore: getIt.get<SettingsStore>()));
|
||||||
settingsStore: getIt.get<SettingsStore>()));
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<FullscreenQRPage, QrViewData, void>(
|
getIt.registerFactoryParam<FullscreenQRPage, QrViewData, void>(
|
||||||
(QrViewData viewData, _) => FullscreenQRPage(qrViewData: viewData));
|
(QrViewData viewData, _) => FullscreenQRPage(qrViewData: viewData));
|
||||||
|
@ -1167,8 +1165,8 @@ Future<void> setup({
|
||||||
IoniaPaymentStatusPage(
|
IoniaPaymentStatusPage(
|
||||||
getIt.get<IoniaPaymentStatusViewModel>(param1: paymentInfo, param2: committedInfo)));
|
getIt.get<IoniaPaymentStatusViewModel>(param1: paymentInfo, param2: committedInfo)));
|
||||||
|
|
||||||
getIt.registerFactoryParam<AdvancedPrivacySettingsViewModel, void, void>(
|
getIt.registerFactoryParam<AdvancedPrivacySettingsViewModel, WalletType, void>(
|
||||||
(type, _) => AdvancedPrivacySettingsViewModel(getIt.get<SettingsStore>()));
|
(type, _) => AdvancedPrivacySettingsViewModel(type, getIt.get<SettingsStore>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletUnlockLoadableViewModel, WalletUnlockArguments, void>((args, _) {
|
getIt.registerFactoryParam<WalletUnlockLoadableViewModel, WalletUnlockArguments, void>((args, _) {
|
||||||
final currentWalletName =
|
final currentWalletName =
|
||||||
|
|
|
@ -70,15 +70,3 @@ class UnspentCoinsListFormState extends State<UnspentCoinsListForm> {
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showUnspentCoinsAlert(BuildContext context) {
|
|
||||||
showPopUp<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertWithOneAction(
|
|
||||||
alertTitle: '',
|
|
||||||
alertContent: 'Information about unspent coins',
|
|
||||||
buttonText: S.of(context).ok,
|
|
||||||
buttonAction: () => Navigator.of(context).pop());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||||
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||||
import 'package:cake_wallet/entities/seed_phrase_length.dart';
|
import 'package:cake_wallet/entities/seed_phrase_length.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
part 'advanced_privacy_settings_view_model.g.dart';
|
part 'advanced_privacy_settings_view_model.g.dart';
|
||||||
|
@ -10,7 +11,7 @@ class AdvancedPrivacySettingsViewModel = AdvancedPrivacySettingsViewModelBase
|
||||||
with _$AdvancedPrivacySettingsViewModel;
|
with _$AdvancedPrivacySettingsViewModel;
|
||||||
|
|
||||||
abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||||
AdvancedPrivacySettingsViewModelBase(this._settingsStore) : _addCustomNode = false;
|
AdvancedPrivacySettingsViewModelBase(this.type, this._settingsStore) : _addCustomNode = false;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
ExchangeApiMode get exchangeStatus => _settingsStore.exchangeStatus;
|
ExchangeApiMode get exchangeStatus => _settingsStore.exchangeStatus;
|
||||||
|
@ -21,6 +22,8 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||||
@observable
|
@observable
|
||||||
bool _addCustomNode = false;
|
bool _addCustomNode = false;
|
||||||
|
|
||||||
|
final WalletType type;
|
||||||
|
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
|
|
||||||
bool get hasSeedPhraseLengthOption =>
|
bool get hasSeedPhraseLengthOption =>
|
||||||
|
|
|
@ -28,16 +28,16 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
||||||
getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage);
|
getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage);
|
||||||
|
|
||||||
return UnspentCoinsItem(
|
return UnspentCoinsItem(
|
||||||
address: elem.address,
|
address: elem.address,
|
||||||
amount: '${formatAmountToString(elem.value)} ${wallet.currency.title}',
|
amount: '${formatAmountToString(elem.value)} ${wallet.currency.title}',
|
||||||
hash: elem.hash,
|
hash: elem.hash,
|
||||||
isFrozen: info.isFrozen,
|
isFrozen: info.isFrozen,
|
||||||
note: info.note,
|
note: info.note,
|
||||||
isSending: info.isSending,
|
isSending: info.isSending,
|
||||||
amountRaw: elem.value,
|
amountRaw: elem.value,
|
||||||
vout: elem.vout,
|
vout: elem.vout,
|
||||||
keyImage: elem.keyImage,
|
keyImage: elem.keyImage,
|
||||||
isChange: elem.isChange,
|
isChange: elem.isChange,
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -59,14 +59,33 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
UnspentCoinsInfo getUnspentCoinInfo(
|
UnspentCoinsInfo getUnspentCoinInfo(
|
||||||
String hash, String address, int value, int vout, String? keyImage) =>
|
String hash, String address, int value, int vout, String? keyImage) {
|
||||||
_unspentCoinsInfo.values.firstWhere((element) =>
|
print([wallet.id, hash, address, value, vout, keyImage]);
|
||||||
element.walletId == wallet.id &&
|
|
||||||
|
return _unspentCoinsInfo.values.firstWhere((element) {
|
||||||
|
if (element.walletId == "bitcoin_Usable Math")
|
||||||
|
print([
|
||||||
|
element.walletId,
|
||||||
|
element.walletId == wallet.id,
|
||||||
|
element.hash,
|
||||||
|
element.hash == hash,
|
||||||
|
element.address,
|
||||||
|
element.address == address,
|
||||||
|
element.value,
|
||||||
|
element.value == value,
|
||||||
|
element.vout,
|
||||||
|
element.vout == vout,
|
||||||
|
element.keyImage,
|
||||||
|
element.keyImage == keyImage,
|
||||||
|
]);
|
||||||
|
return element.walletId == wallet.id &&
|
||||||
element.hash == hash &&
|
element.hash == hash &&
|
||||||
element.address == address &&
|
element.address == address &&
|
||||||
element.value == value &&
|
// element.value == value &&
|
||||||
element.vout == vout &&
|
// element.vout == vout &&
|
||||||
element.keyImage == keyImage);
|
element.keyImage == keyImage;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String formatAmountToString(int fullBalance) {
|
String formatAmountToString(int fullBalance) {
|
||||||
if (wallet.type == WalletType.monero)
|
if (wallet.type == WalletType.monero)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include <cw_monero/cw_monero_plugin.h>
|
#include <cw_monero/cw_monero_plugin.h>
|
||||||
#include <devicelocale/devicelocale_plugin.h>
|
#include <devicelocale/devicelocale_plugin.h>
|
||||||
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
|
||||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
@ -18,9 +17,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
g_autoptr(FlPluginRegistrar) devicelocale_registrar =
|
g_autoptr(FlPluginRegistrar) devicelocale_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DevicelocalePlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DevicelocalePlugin");
|
||||||
devicelocale_plugin_register_with_registrar(devicelocale_registrar);
|
devicelocale_plugin_register_with_registrar(devicelocale_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
|
|
||||||
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
|
|
||||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
cw_monero
|
cw_monero
|
||||||
devicelocale
|
devicelocale
|
||||||
flutter_secure_storage_linux
|
|
||||||
url_launcher_linux
|
url_launcher_linux
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
tor
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import Foundation
|
||||||
import cw_monero
|
import cw_monero
|
||||||
import device_info_plus
|
import device_info_plus
|
||||||
import devicelocale
|
import devicelocale
|
||||||
import flutter_secure_storage_macos
|
|
||||||
import in_app_review
|
import in_app_review
|
||||||
import package_info_plus
|
import package_info_plus
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
|
@ -21,7 +20,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
CwMoneroPlugin.register(with: registry.registrar(forPlugin: "CwMoneroPlugin"))
|
CwMoneroPlugin.register(with: registry.registrar(forPlugin: "CwMoneroPlugin"))
|
||||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||||
DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin"))
|
DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin"))
|
||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
|
||||||
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
|
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
|
||||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
|
Loading…
Reference in a new issue