From 6743d9788d2312fb84d16db0f79ff2a52963d46b Mon Sep 17 00:00:00 2001 From: George Tsagkarelis Date: Wed, 13 Nov 2024 16:28:26 +0100 Subject: [PATCH 1/2] lndclient: add listaliases call --- lightning_client.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lightning_client.go b/lightning_client.go index 34f52af..a47ff47 100644 --- a/lightning_client.go +++ b/lightning_client.go @@ -303,6 +303,11 @@ type LightningClient interface { // from the signature. VerifyMessage(ctx context.Context, data []byte, signature string) (bool, string, error) + + // ListAliases returns the set of all aliases that have ever existed + // with their confirmed SCID (if it exists) and/or the base SCID (in the + // case of zero conf). + ListAliases(ctx context.Context) ([]*lnrpc.AliasMap, error) } // Info contains info about the connected lnd node. @@ -4427,3 +4432,17 @@ func (s *lightningClient) SubscribeTransactions( return txChan, errChan, nil } + +// ListAliases returns the set of all aliases that have ever existed with their +// confirmed SCID (if it exists) and/or the base SCID (in the case of zero +// conf). +func (s *lightningClient) ListAliases( + ctx context.Context) ([]*lnrpc.AliasMap, error) { + + res, err := s.client.ListAliases(ctx, &lnrpc.ListAliasesRequest{}) + if err != nil { + return nil, err + } + + return res.AliasMaps, nil +} From 9af44b7a39da88c94279ac6c112f363f5a654787 Mon Sep 17 00:00:00 2001 From: George Tsagkarelis Date: Thu, 14 Nov 2024 10:23:39 +0100 Subject: [PATCH 2/2] rpc: add permissions for ListAliases --- testdata/permissions.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testdata/permissions.json b/testdata/permissions.json index d385379..e8ef641 100644 --- a/testdata/permissions.json +++ b/testdata/permissions.json @@ -696,6 +696,14 @@ } ] }, + "/lnrpc.Lightning/ListAliases": { + "permissions": [ + { + "entity": "offchain", + "action": "read" + } + ] + }, "/neutrinorpc.NeutrinoKit/AddPeer": { "permissions": [ {