Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default trampoline to true #182

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion snippets/csharp/LnurlPay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void LnurlPay(BlockingBreezServices sdk)
if (input is InputType.LnUrlPay lnurlp)
{
var amountMsat = lnurlp.data.minSendable;
var useTrampoline = false;
var useTrampoline = true;
var optionalComment = "<comment>";
var optionalPaymentLabel = "<label>";

Expand Down
2 changes: 1 addition & 1 deletion snippets/csharp/SendPayment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public void SendPayment(BlockingBreezServices sdk)
{
// ANCHOR: send-payment
var bolt11 = "...";
var useTrampoline = false;
var useTrampoline = true;
ulong optionalAmountMsat = 3_000_000;
var optionalLabel = "<label>";

Expand Down
2 changes: 1 addition & 1 deletion snippets/dart_snippets/lib/lnurl_pay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Future<void> lnurlPay() async {
InputType inputType = await breezSDK.parseInput(input: lnurlPayUrl);
if (inputType is InputType_LnUrlPay) {
int amountMsat = inputType.data.minSendable;
bool useTrampoline = false;
bool useTrampoline = true;
String optionalComment = "<comment>";
String optionalPaymentLabel = "<label>";
LnUrlPayRequest req = LnUrlPayRequest(
Expand Down
2 changes: 1 addition & 1 deletion snippets/dart_snippets/lib/send_payment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Future<SendPaymentResponse> sendPayment({required String bolt11}) async {
// ANCHOR: send-payment
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
bool useTrampoline = false;
bool useTrampoline = true;
int optionalAmountMsat = 3000000;
String optionalLabel = "<label>";

Expand Down
2 changes: 1 addition & 1 deletion snippets/go/lnurl_pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func LnurlPay() {
if input, err := breez_sdk.ParseInput(lnurlPayUrl); err != nil {
switch inputType := input.(type) {
case breez_sdk.InputTypeLnUrlPay:
useTrampoline := false
useTrampoline := true
amountMsat := inputType.Data.MinSendable
optionalComment := "<comment>"
optionalPaymentLabel := "<label>"
Expand Down
2 changes: 1 addition & 1 deletion snippets/go/send_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func SendPayment() {
// ANCHOR: send-payment
bolt11 := "bolt11 invoice"
useTrampoline := false
useTrampoline := true
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
optionalAmountMsat := uint64(3_000_000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LnurlPay {
val inputType = parseInput(lnurlPayUrl)
if (inputType is InputType.LnUrlPay) {
val requestData = inputType.data
val useTrampoline = false;
val useTrampoline = true;
val amountMsat = requestData.minSendable
val optionalComment = "<comment>";
val optionalPaymentLabel = "<label>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SendPayment {
// ANCHOR: send-payment
val bolt11 = "..."
try {
val useTrampoline = false
val useTrampoline = true
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
val optionalAmountMsat = 3_000_000.toULong()
Expand Down
2 changes: 1 addition & 1 deletion snippets/python/src/lnurl_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def pay(sdk_services):
parsed_input = breez_sdk.parse_input(lnurl_pay_url)
if isinstance(parsed_input, breez_sdk.InputType.LN_URL_PAY):
amount_msat = parsed_input.data.min_sendable
use_trampoline = False
use_trampoline = True
optional_comment = "<comment>"
optional_payment_label = "<label>"
req = breez_sdk.LnUrlPayRequest(parsed_input.data, amount_msat, use_trampoline, optional_comment, optional_payment_label)
Expand Down
2 changes: 1 addition & 1 deletion snippets/python/src/send_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def send_payment(sdk_services):
# ANCHOR: send-payment
bolt11 = "..."
try:
use_trampoline = False
use_trampoline = True
# The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
# The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
optional_amount_msat = 3000000
Expand Down
2 changes: 1 addition & 1 deletion snippets/react-native/lnurl_pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const exampleLnurlPay = async () => {
const input = await parseInput(lnurlPayUrl)
if (input.type === InputTypeVariant.LN_URL_PAY) {
const amountMsat = input.data.minSendable
const useTrampoline = false
const useTrampoline = true
const optionalComment = '<comment>'
const optionalPaymentLabel = '<label>'
const lnUrlPayResult = await payLnurl({
Expand Down
2 changes: 1 addition & 1 deletion snippets/react-native/send_payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const exampleSendLightningPayment = async () => {
// ANCHOR: send-payment
try {
const bolt11 = 'bolt11 invoice'
const useTrampoline = false
const useTrampoline = true
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
const optionalAmountMsat = 3000000
Expand Down
2 changes: 1 addition & 1 deletion snippets/rust/src/lnurl_pay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn pay(sdk: Arc<BreezServices>) -> Result<()> {

if let Ok(LnUrlPay { data: pd }) = parse(lnurl_pay_url).await {
let amount_msat = pd.min_sendable;
let use_trampoline = false;
let use_trampoline = true;
let optional_comment = Some("<comment>".to_string());
let optional_payment_label = Some("<label>".to_string());

Expand Down
2 changes: 1 addition & 1 deletion snippets/rust/src/send_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use breez_sdk_core::*;

async fn send_payment(sdk: Arc<BreezServices>) -> Result<()> {
// ANCHOR: send-payment
let use_trampoline = false;
let use_trampoline = true;
// The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
let optional_amount_msat: Option<u64> = None;
Expand Down
2 changes: 1 addition & 1 deletion snippets/swift/BreezSDKExamples/Sources/LnurlPay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func pay(sdk: BlockingBreezServices) -> LnUrlPayResult? {
if let inputType = try? parseInput(s: lnurlPayUrl) {
if case let .lnUrlPay(data) = inputType {
let amountMsat = data.minSendable
let useTrampoline = false
let useTrampoline = true
let optionalComment = "<comment>"
let optionalPaymentLabel = "<label>"
let req = LnUrlPayRequest(data: data, amountMsat: amountMsat, useTrampoline: useTrampoline, comment: optionalComment, paymentLabel: optionalPaymentLabel)
Expand Down
2 changes: 1 addition & 1 deletion snippets/swift/BreezSDKExamples/Sources/SendPayment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BreezSDK

func sendPayment(sdk: BlockingBreezServices) -> SendPaymentResponse? {
// ANCHOR: send-payment
let useTrampoline = false
let useTrampoline = true
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
let optionalAmountMsat: UInt64 = 3_000_000
Expand Down
2 changes: 1 addition & 1 deletion src/guide/lnurl_pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

## Trampoline payments

In the above example, the `use_trampoline` flag can be set to `true` to enable
In the above example, the `use_trampoline` flag is set to `true` to enable
trampoline payments. See
[Trampoline payments](send_payment.md#trampoline-payments) for more details.

Expand Down
9 changes: 7 additions & 2 deletions src/guide/send_payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Once you have outbound liquidity you can start sending payments too.

## Trampoline payments

In the above example, the `use_trampoline` flag can be set to `true` to enable
In the above example, the `use_trampoline` flag is set to `true` to enable
trampoline payments. With trampoline, pathfinding through the lightning network
is outsourced to the LSP.

Expand All @@ -79,7 +79,12 @@ This has several benefits:
network topology and can find good routes faster.
- There is less interaction between the user's app and the user's node in the
cloud, improving payment speed.
- Fees for lightning payments are fixed. That means fees can be displayed to the
user before paying.

The trade-offs are:
- The payment can be more expensive as the LSP will take a fee for its services.
- The payment is less private as the LSP will learn the payment destination.

To disable trampoline payments, set `use_trampoline` to `false`. The user's node
will then attempt to find routes directly, without outsourcing pathfinding to
the LSP.
Loading