Skip to content

Commit 1462364

Browse files
committed
Fix SP
1 parent 7c66883 commit 1462364

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/navigation/SP.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { UTXOType, UTXO } from "silent-payments";
33

44
// Silent payment address generation using Diffie-Hellman
55
function generateSilentPaymentAddress(
6-
recipientPublicKey: bitcoin.ECPairInterface,
7-
senderPrivateKey: bitcoin.ECPairInterface
6+
recipientPublicKey: bitcoin.ECPair.ECPairInterface,
7+
senderPrivateKey: bitcoin.ECPair.ECPairInterface
88
): string { // Changed return type from bitcoin.Address to string
99
try {
1010
// Validate inputs
@@ -39,7 +39,6 @@ function generateSilentPaymentAddress(
3939
throw new Error(`Silent payment address generation failed: ${error.message}`);
4040
}
4141
}
42-
4342
// Example usage of silent payment address generation
4443
try {
4544
const recipientKey = bitcoin.ECPair.makeRandom(); // For demo - replace with actual key
@@ -129,7 +128,7 @@ try {
129128
const feeRate = 20; // Satoshis per byte
130129
const sampleUTXOs: UTXO[] = [
131130
// Replace with real UTXO data
132-
{ txid: "1234...", index: 0, txout: { value: 100000 } }
131+
{ txid: "1234...", vout: 0, txout: { value: 100000 } }
133132
];
134133
const sampleOutputs: TransactionOutput[] = [
135134
{ address: "bc1q...", amount: 50000 }
@@ -142,7 +141,12 @@ try {
142141
feeRate,
143142
changeAddress
144143
);
145-
console.log("Transaction created successfully");
146-
} catch (error) {
147-
console.error(error.message);
144+
145+
146+
console.log("Transaction created successfully:", transactionWithFee);
147+
} catch (error) { if (error instanceof Error) {
148+
console.error(error.message);
149+
} else {
150+
console.error("An unknown error occurred");
151+
}
148152
}

0 commit comments

Comments
 (0)