From 078e26b451aad1f27aee04fce4054eb0d51a20e2 Mon Sep 17 00:00:00 2001 From: Eric P Date: Sun, 9 Nov 2025 16:23:42 -0600 Subject: Fix incorrect extratlvs format in pay_keysend --- lib/nwc.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/nwc.ts b/lib/nwc.ts index d536d2c0..50b7e411 100644 --- a/lib/nwc.ts +++ b/lib/nwc.ts @@ -249,8 +249,18 @@ const handle = (method, params, ev, app, user) => }, async pay_keysend() { - const { amount: amount_msat, pubkey, tlv_records: extratlvs } = params; + const { amount: amount_msat, pubkey, tlv_records } = params; const amount = Math.round(amount_msat / 1000); + const extratlvs = {}; + + // convert tlv_records to the extratlvs format + // tlv_records: [{ type: 1, value: "asdf" }] + // extratlvs: { "1": "asdf" } + if (tlv_records && tlv_records.length) { + for (const record of tlv_records) { + extratlvs[record.type.toString()] = record.value; + } + } try { const { payment_hash } = await sendKeysend({ -- cgit v1.2.3