mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
wip
This commit is contained in:
parent
a9df2ee285
commit
cde1274def
4 changed files with 18 additions and 8 deletions
|
@ -352,7 +352,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
|||
as PendingBitcoinTransaction;
|
||||
|
||||
final payjoinUri = credentials.payjoinUri;
|
||||
if (payjoinUri == null) return tx;
|
||||
if (payjoinUri == null && !tx.shouldCommitUR()) return tx;
|
||||
|
||||
final transaction = await buildPsbt(
|
||||
utxos: tx.utxos,
|
||||
|
@ -372,7 +372,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
|||
publicKeys: tx.publicKeys!,
|
||||
masterFingerprint: Uint8List(0));
|
||||
|
||||
if (tx.isViewOnly) {
|
||||
if (tx.shouldCommitUR()) {
|
||||
tx.unsignedPsbt = transaction.serialize();
|
||||
return tx;
|
||||
}
|
||||
|
@ -381,8 +381,8 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
|||
await signPsbt(base64.encode(transaction.asPsbtV0()), getUtxoWithPrivateKeys());
|
||||
|
||||
tx.commitOverride = () async {
|
||||
final sender = await payjoinManager.initSender(
|
||||
payjoinUri, originalPsbt, int.parse(tx.feeRate));
|
||||
final sender =
|
||||
await payjoinManager.initSender(payjoinUri!, originalPsbt, int.parse(tx.feeRate));
|
||||
payjoinManager.spawnNewSender(
|
||||
sender: sender, pjUrl: payjoinUri, amount: BigInt.from(tx.amount));
|
||||
};
|
||||
|
|
|
@ -681,7 +681,7 @@ abstract class ElectrumWalletBase
|
|||
);
|
||||
spendsSilentPayment = true;
|
||||
isSilentPayment = true;
|
||||
} else if (!isHardwareWallet) {
|
||||
} else if (!isHardwareWallet && false) {
|
||||
privkey =
|
||||
generateECPrivate(hd: hd, index: utx.bitcoinAddressRecord.index, network: network);
|
||||
}
|
||||
|
@ -1154,6 +1154,7 @@ abstract class ElectrumWalletBase
|
|||
bool hasTaprootInputs = false;
|
||||
|
||||
final transaction = txb.buildTransaction((txDigest, utxo, publicKey, sighash) {
|
||||
return "";
|
||||
String error = "Cannot find private key.";
|
||||
|
||||
ECPrivateInfo? key;
|
||||
|
|
|
@ -179,13 +179,21 @@ class PendingBitcoinTransaction with PendingTransaction {
|
|||
outputAddresses: outputAddresses,
|
||||
fee: fee);
|
||||
|
||||
@override
|
||||
bool shouldCommitUR() => isViewOnly;
|
||||
|
||||
@override
|
||||
Future<String?> commitUR() {
|
||||
var sourceBytes = unsignedPsbt!;
|
||||
var cborEncoder = CBOREncoder();
|
||||
cborEncoder.encodeBytes(sourceBytes);
|
||||
var ur = UR("psbt", cborEncoder.getBytes());
|
||||
var encoded = UREncoder.encode(ur);
|
||||
return Future.value(encoded);
|
||||
var ur = UR("psbt", cborEncoder.getBytes());
|
||||
// var ur = UR("psbt", Uint8List.fromList(List.generate(64*1024, (int x) => x % 256)));
|
||||
var encoded = UREncoder(ur, 120);
|
||||
List<String> values = [];
|
||||
while (!encoded.isComplete) {
|
||||
values.add(encoded.nextPart());
|
||||
}
|
||||
return Future.value(values.join("\n"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
|||
String get feeFormatted => AmountConverter.amountIntToString(
|
||||
CryptoCurrency.xmr, pendingTransactionDescription.fee);
|
||||
|
||||
@override
|
||||
bool shouldCommitUR() => isViewOnly;
|
||||
|
||||
@override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue