Skip to content

Commit

Permalink
chore: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 13, 2023
1 parent 848e96e commit 0accfeb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions alby.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (svc *AlbyOAuthService) SendKeysend(ctx context.Context, senderPubkey strin
"payeePubkey": destination,
"appId": app.ID,
"userId": app.User.ID,
}).Info("Processing payment request")
}).Info("Processing keysend request")
tok, err := svc.FetchUserToken(ctx, app)
if err != nil {
return "", err
Expand All @@ -464,11 +464,11 @@ func (svc *AlbyOAuthService) SendKeysend(ctx context.Context, senderPubkey strin
for _, record := range custom_records {
customRecordsMap[strconv.FormatUint(record.Type, 10)] = record.Value
}

body := bytes.NewBuffer([]byte{})
payload := &KeysendRequest{
Amount: amount,
Destination: destination,
Amount: amount,
Destination: destination,
CustomRecords: customRecordsMap,
}
err = json.NewEncoder(body).Encode(payload)
Expand Down Expand Up @@ -506,7 +506,7 @@ func (svc *AlbyOAuthService) SendKeysend(ctx context.Context, senderPubkey strin
"appId": app.ID,
"userId": app.User.ID,
"paymentHash": responsePayload.PaymentHash,
}).Info("Payment successful")
}).Info("Keysend payment successful")
return responsePayload.Preimage, nil
}

Expand Down
3 changes: 2 additions & 1 deletion models.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
NIP_47_ERROR_EXPIRED = "EXPIRED"
NIP_47_ERROR_RESTRICTED = "RESTRICTED"
NIP_47_OTHER = "OTHER"
NIP_47_CAPABILITIES = "pay_invoice,get_balance,get_info,make_invoice,lookup_invoice"
NIP_47_CAPABILITIES = "pay_invoice,pay_keysend,get_balance,get_info,make_invoice,lookup_invoice"
)

const (
Expand Down Expand Up @@ -181,6 +181,7 @@ type Identity struct {
Privkey string
}

// TODO: move to models/Nip47
type Nip47Request struct {
Method string `json:"method"`
Params json.RawMessage `json:"params"`
Expand Down
2 changes: 0 additions & 2 deletions service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,10 @@ type MockLn struct {
}

func (mln *MockLn) SendPaymentSync(ctx context.Context, senderPubkey string, payReq string) (preimage string, err error) {
//todo more advanced behaviour
return "123preimage", nil
}

func (mln *MockLn) SendKeysend(ctx context.Context, senderPubkey string, amount int64, destination, preimage string, custom_records []TLVRecord) (preImage string, err error) {
//todo more advanced behaviour
return "123preimage", nil
}

Expand Down

0 comments on commit 0accfeb

Please sign in to comment.