From e9232a42112dc6571dba39c880897ef839f66ebc Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Sun, 17 Dec 2023 23:07:50 +0200 Subject: [PATCH] feat: add lnd wallet calls to get and list onchain addresses (#2938) --- .../background-script/connectors/lnc.ts | 4 ++++ .../background-script/connectors/lnd.ts | 16 ++++++++++++++++ src/i18n/locales/en/translation.json | 12 ++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/extension/background-script/connectors/lnc.ts b/src/extension/background-script/connectors/lnc.ts index c859aba264..d8d863173b 100644 --- a/src/extension/background-script/connectors/lnc.ts +++ b/src/extension/background-script/connectors/lnc.ts @@ -62,6 +62,10 @@ const methods: Record = { sendtoroute: "lnd.lightning.SendToRouteSync", verifymessage: "lnd.lightning.VerifyMessage", walletbalance: "lnd.lightning.WalletBalance", + newaddress: "lnd.lightning.NewAddress", + nextaddr: "lnd.walletKit.nextAddr", + listaddresses: "lnd.walletKit.ListAddresses", + listunspent: "lnd.walletKit.ListUnspent", }; const DEFAULT_SERVER_HOST = "mailbox.terminal.lightning.today:443"; diff --git a/src/extension/background-script/connectors/lnd.ts b/src/extension/background-script/connectors/lnd.ts index ba4cfe0ecb..d6ab7e9824 100644 --- a/src/extension/background-script/connectors/lnd.ts +++ b/src/extension/background-script/connectors/lnd.ts @@ -129,6 +129,22 @@ const methods: Record> = { path: "/v2/invoices/settle", httpMethod: "POST", }, + newaddress: { + path: "/v1/newaddress", + httpMethod: "GET", + }, + nextaddr: { + path: "/v2/wallet/address/next", + httpMethod: "POST", + }, + listaddresses: { + path: "/v2/wallet/addresses", + httpMethod: "GET", + }, + listunspent: { + path: "/v2/wallet/utxos", + httpMethod: "POST", + }, }; const pathTemplateParser = ( diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index e7a2fb17c3..af95bbea97 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -1211,7 +1211,11 @@ "routermc": "Read the internal mission control state", "addinvoice": "Create new invoices", "addholdinvoice": "Create new HODL invoices", - "settleinvoice": "Settle an accepted invoice" + "settleinvoice": "Settle an accepted invoice", + "newaddress": "Get a new onchain address", + "nextaddr": "Get the next unused address within the wallet", + "listaddresses": "Get all the addresses along with their balance", + "listunspent": "Get a list of all utxos spendable by the wallet" }, "lnc": { "getinfo": "Get the node information", @@ -1237,7 +1241,11 @@ "routermc": "Read the internal mission control state", "addinvoice": "Create new invoices", "addholdinvoice": "Create new HODL invoices", - "settleinvoice": "Settle an accepted invoice" + "settleinvoice": "Settle an accepted invoice", + "newaddress": "Get a new onchain address", + "nextaddr": "Get the next unused onchain address within the wallet", + "listaddresses": "Get all the onchain addresses along with their balance", + "listunspent": "Get a list of all utxos spendable by the wallet" } } }