wrap bolt12 response

This commit is contained in:
kiwiidb
2022-03-21 12:01:13 +01:00
parent c91bc0c4c3
commit fcbee32d76

View File

@@ -16,21 +16,24 @@ func (svc *LndhubService) FetchBolt12Invoice(ctx context.Context, offer, memo st
func (svc *LndhubService) PayBolt12Invoice(ctx context.Context, invoice *lnd.Bolt12) (result *lnrpc.SendResponse, err error) {
return nil, err
}
func (svc *LndhubService) TransformBolt12(bolt12 *lnd.Bolt12) (*lnrpc.PayReq, error) {
func (svc *LndhubService) TransformBolt12(bolt12 *lnd.Bolt12) (*lnd.LNPayReq, error) {
//todo see if CLN really can't return an int here
msatAmt, err := strconv.Atoi(strings.Trim(bolt12.AmountMsat, "msat"))
if err != nil {
return nil, err
}
return &lnrpc.PayReq{
Destination: bolt12.NodeID,
PaymentHash: bolt12.PaymentHash,
NumSatoshis: int64(msatAmt / lnd.MSAT_PER_SAT),
Timestamp: bolt12.Timestamp,
Expiry: bolt12.RelativeExpiry,
Description: bolt12.Description,
DescriptionHash: "", // not supported by bolt 12?
NumMsat: int64(msatAmt),
return &lnd.LNPayReq{
PayReq: &lnrpc.PayReq{
Destination: bolt12.NodeID,
PaymentHash: bolt12.PaymentHash,
NumSatoshis: int64(msatAmt / lnd.MSAT_PER_SAT),
Timestamp: bolt12.Timestamp,
Expiry: bolt12.RelativeExpiry,
Description: bolt12.Description,
DescriptionHash: "", // not supported by bolt 12?
NumMsat: int64(msatAmt),
},
Keysend: false,
}, nil
}