Skip to content

Commit

Permalink
fix: Add Breez SDK trampoline payments support (lnbits#2905)
Browse files Browse the repository at this point in the history
* fix: add support for trampoline payments in Breez integration

- Introduced `BREEZ_USE_TRAMPOLINE` configuration in `.env.example`.
- Updated `BreezSdkFundingSource` to include `breez_use_trampoline` setting.
- Modified payment request in `breez.py` to utilize the trampoline setting when sending payments.

* Update .env.example

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>

* Update lnbits/settings.py

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>

* refactor: streamline payment request formatting in Breez integration

---------

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
  • Loading branch information
timheide and prusnak authored Jan 25, 2025
1 parent cb5cc1e commit 8633891
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ BREEZ_GREENLIGHT_SEED=SEED
BREEZ_GREENLIGHT_INVITE_CODE=CODE
BREEZ_GREENLIGHT_DEVICE_KEY="/path/to/breezsdk/device.pem" # or BASE64/HEXSTRING
BREEZ_GREENLIGHT_DEVICE_CERT="/path/to/breezsdk/device.crt" # or BASE64/HEXSTRING
# BREEZ_USE_TRAMPOLINE=true


######################################
####### Auth Configurations ##########
Expand Down
1 change: 1 addition & 0 deletions lnbits/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ class BreezSdkFundingSource(LNbitsSettings):
breez_greenlight_invite_code: Optional[str] = Field(default=None)
breez_greenlight_device_key: Optional[str] = Field(default=None)
breez_greenlight_device_cert: Optional[str] = Field(default=None)
breez_use_trampoline: bool = Field(default=True)


class BoltzFundingSource(LNbitsSettings):
Expand Down
4 changes: 3 additions & 1 deletion lnbits/wallets/breez.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ async def pay_invoice(
invoice = lnbits_bolt11.decode(bolt11)

try:
send_payment_request = breez_sdk.SendPaymentRequest(bolt11=bolt11)
send_payment_request = breez_sdk.SendPaymentRequest(
bolt11=bolt11, use_trampoline=settings.breez_use_trampoline
)
send_payment_response: breez_sdk.SendPaymentResponse = (
self.sdk_services.send_payment(send_payment_request)
)
Expand Down

0 comments on commit 8633891

Please sign in to comment.