From 0330c198fb5c1b3227d8f705debc18b6e09d565b Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 5 Feb 2025 13:20:41 -0300 Subject: [PATCH] nip60: expose GetSatoshisAmountFromBolt11() helper. --- nip60/helpers.go | 2 +- nip60/helpers_test.go | 2 +- nip60/pay.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nip60/helpers.go b/nip60/helpers.go index 0cf5b67..55ca84a 100644 --- a/nip60/helpers.go +++ b/nip60/helpers.go @@ -200,7 +200,7 @@ func parseKeysetKeys(keys nut01.KeysMap) (map[uint64]*btcec.PublicKey, error) { return parsedKeys, nil } -func getSatoshisAmountFromBolt11(bolt11 string) (uint64, error) { +func GetSatoshisAmountFromBolt11(bolt11 string) (uint64, error) { if len(bolt11) < 50 { return 0, fmt.Errorf("invalid invoice, too short") } diff --git a/nip60/helpers_test.go b/nip60/helpers_test.go index 042aeea..4a5ee9e 100644 --- a/nip60/helpers_test.go +++ b/nip60/helpers_test.go @@ -25,7 +25,7 @@ func TestBolt11Parsing(t *testing.T) { {"lnbc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", 0, false}, } { t.Run(fmt.Sprintf("%d = %s", tc.sats, tc.bolt11), func(t *testing.T) { - sats, err := getSatoshisAmountFromBolt11(tc.bolt11) + sats, err := GetSatoshisAmountFromBolt11(tc.bolt11) if tc.hasError { require.Error(t, err) } else { diff --git a/nip60/pay.go b/nip60/pay.go index f6dc63e..626c1bb 100644 --- a/nip60/pay.go +++ b/nip60/pay.go @@ -21,7 +21,7 @@ func (w *Wallet) PayBolt11(ctx context.Context, invoice string, opts ...SendOpti opt(ss) } - invoiceAmount, err := getSatoshisAmountFromBolt11(invoice) + invoiceAmount, err := GetSatoshisAmountFromBolt11(invoice) if err != nil { return "", err }