Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
chore: rename custom_records to tlv_records (#448)
Browse files Browse the repository at this point in the history
Co-authored-by: Roland Bewick <[email protected]>
  • Loading branch information
bumi and rolznz authored Jun 17, 2024
1 parent d06b421 commit 6bf900e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import (

"github.com/getAlby/ldk-node-go/ldk_node"
// "github.com/getAlby/nostr-wallet-connect/ldk_node"
b64 "encoding/base64"

"encoding/hex"

decodepay "github.com/nbd-wtf/ln-decodepay"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -1009,11 +1010,15 @@ func (ls *LDKService) ldkPaymentToTransaction(payment *ldk_node.PaymentDetails)
if spontaneousPaymentKind.Preimage != nil {
preimage = *spontaneousPaymentKind.Preimage
}
customRecords := map[string]string{}

tlvRecords := []lnclient.TLVRecord{}
for _, tlv := range spontaneousPaymentKind.CustomTlvs {
customRecords[strconv.FormatUint(tlv.Type, 10)] = b64.StdEncoding.EncodeToString(tlv.Value)
tlvRecords = append(tlvRecords, lnclient.TLVRecord{
Type: tlv.Type,
Value: hex.EncodeToString(tlv.Value),
})
}
metadata["custom_records"] = customRecords
metadata["tlv_records"] = tlvRecords
}

var amount uint64 = 0
Expand Down
3 changes: 2 additions & 1 deletion lnclient/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
)

type TLVRecord struct {
Type uint64 `json:"type"`
Type uint64 `json:"type"`
// hex-encoded value
Value string `json:"value"`
}

Expand Down

0 comments on commit 6bf900e

Please sign in to comment.