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