Skip to content

Commit 922ca4c

Browse files
committed
Implement sendPayment
1 parent 4e53398 commit 922ca4c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

wallets/client/protocols/spark.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@ async function withSdk (mnemonic, cb) {
2626
}
2727

2828
export async function sendPayment (bolt11, { mnemonic }, { signal }) {
29-
// TODO(spark): implement
29+
return await withSdk(
30+
mnemonic,
31+
async sdk => {
32+
const prepareResponse = await sdk.prepareSendPayment({
33+
paymentRequest: bolt11
34+
})
35+
36+
const sendResponse = await sdk.sendPayment({
37+
prepareResponse,
38+
options: { type: 'bolt11Invoice', preferSpark: false }
39+
})
40+
41+
return sendResponse.payment
42+
}
43+
)
3044
}
3145

3246
export async function testSendPayment ({ mnemonic }, { signal }) {

0 commit comments

Comments
 (0)