-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from breez/savage-lnurl-drain
Add LNURL-pay drain docs
- Loading branch information
Showing
13 changed files
with
266 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,17 @@ async fn prepare_pay(sdk: Arc<LiquidSdk>) -> Result<()> { | |
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf | ||
let lnurl_pay_url = "[email protected]"; | ||
|
||
if let Ok(InputType::LnUrlPay { data: pd }) = sdk.parse(lnurl_pay_url).await { | ||
let amount_msat = pd.min_sendable; | ||
if let Ok(InputType::LnUrlPay { data }) = sdk.parse(lnurl_pay_url).await { | ||
let amount = PayAmount::Bitcoin { | ||
receiver_amount_sat: 5_000, | ||
}; | ||
let optional_comment = Some("<comment>".to_string()); | ||
let optional_validate_success_action_url = Some(true); | ||
|
||
let prepare_response = sdk | ||
.prepare_lnurl_pay(PrepareLnUrlPayRequest { | ||
data: pd, | ||
amount_msat, | ||
data, | ||
amount, | ||
comment: optional_comment, | ||
validate_success_action_url: optional_validate_success_action_url, | ||
}) | ||
|
@@ -33,6 +35,24 @@ async fn prepare_pay(sdk: Arc<LiquidSdk>) -> Result<()> { | |
Ok(()) | ||
} | ||
|
||
async fn prepare_pay_drain(sdk: Arc<LiquidSdk>, data: LnUrlPayRequestData) -> Result<()> { | ||
// ANCHOR: prepare-lnurl-pay-drain | ||
let amount = PayAmount::Drain; | ||
let optional_comment = Some("<comment>".to_string()); | ||
let optional_validate_success_action_url = Some(true); | ||
|
||
let prepare_response = sdk | ||
.prepare_lnurl_pay(PrepareLnUrlPayRequest { | ||
data, | ||
amount, | ||
comment: optional_comment, | ||
validate_success_action_url: optional_validate_success_action_url, | ||
}) | ||
.await?; | ||
// ANCHOR_END: prepare-lnurl-pay-drain | ||
Ok(()) | ||
} | ||
|
||
async fn pay(sdk: Arc<LiquidSdk>, prepare_response: PrepareLnUrlPayResponse) -> Result<()> { | ||
// ANCHOR: lnurl-pay | ||
let result = sdk.lnurl_pay(LnUrlPayRequest { prepare_response }).await?; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.