mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-18 22:34:19 +01:00
Fix python examples
This commit is contained in:
@@ -127,7 +127,7 @@ try {
|
|||||||
```python
|
```python
|
||||||
# Endpoint can also be of the form:
|
# Endpoint can also be of the form:
|
||||||
# keyauth://domain.com/auth?key=val
|
# keyauth://domain.com/auth?key=val
|
||||||
lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
|
lnurl_auth_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parsed_input = breez_sdk.parse_input(lnurl_auth_url)
|
parsed_input = breez_sdk.parse_input(lnurl_auth_url)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ try {
|
|||||||
lnurl_withdraw_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
|
lnurl_withdraw_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parsed_input = parse_input(lnurl_withdraw_url)
|
parsed_input = breez_sdk.parse_input(lnurl_withdraw_url)
|
||||||
if isinstance(parsed_input, breez_sdk.InputType.LN_URL_WITHDRAW):
|
if isinstance(parsed_input, breez_sdk.InputType.LN_URL_WITHDRAW):
|
||||||
amount_sats = parsed_input.data.min_withdrawable
|
amount_sats = parsed_input.data.min_withdrawable
|
||||||
result = sdk_services.withdraw_lnurl(parsed_input.data, amount_sats, "comment")
|
result = sdk_services.withdraw_lnurl(parsed_input.data, amount_sats, "comment")
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ try:
|
|||||||
swap_info = sdk_services.receive_onchain(breez_sdk.ReceiveOnchainRequest())
|
swap_info = sdk_services.receive_onchain(breez_sdk.ReceiveOnchainRequest())
|
||||||
|
|
||||||
# Send your funds to the below bitcoin address
|
# Send your funds to the below bitcoin address
|
||||||
address = sdk_services.swap_info.bitcoin_address
|
address = swap_info.bitcoin_address
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
# Handle error
|
# Handle error
|
||||||
```
|
```
|
||||||
@@ -405,13 +405,12 @@ try {
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
destination_address = "..."
|
destination_address = "..."
|
||||||
sat_per_vbyte = <refund tx fee rate>
|
sat_per_vbyte = 5
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = sdk_services.refund(
|
result = sdk_services.refund(swap_address=refundable.bitcoin_address,
|
||||||
swap_address=refundable.bitcoin_address,
|
to_address=destination_address,
|
||||||
to_address=to_address,
|
sat_per_vbyte=sat_per_vbyte)
|
||||||
sat_per_vbyte=sat_per_vbyte)
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
# Handle error
|
# Handle error
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ try {
|
|||||||
try:
|
try:
|
||||||
current_fees = sdk_services.fetch_reverse_swap_fees(
|
current_fees = sdk_services.fetch_reverse_swap_fees(
|
||||||
breez_sdk.ReverseSwapFeesRequest(send_amount_sat=50000))
|
breez_sdk.ReverseSwapFeesRequest(send_amount_sat=50000))
|
||||||
print("Total estimated fees for reverseswap:", current_fees.total_estimated_fees)
|
print("Total estimated fees for reverseswap: ", current_fees.total_estimated_fees)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
# Handle error
|
# Handle error
|
||||||
```
|
```
|
||||||
@@ -294,16 +294,13 @@ try {
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
destination_address = "bc1.."
|
destination_address = "bc1.."
|
||||||
amount_sat = current_fees.min
|
amount_sat = 50000
|
||||||
fee_hash = current_fees.fee_hash
|
sat_per_vbyte = 5
|
||||||
sat_per_vbyte = <fee rate>
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sdk_services.send_onchain(
|
sdk_services.send_onchain(amount_sat=amount_sat,
|
||||||
amount_sat=amount_msats,
|
onchain_recipient_address=destination_address,
|
||||||
onchain_recipient_address="...",
|
pair_hash=current_fees.fee_hash,
|
||||||
pair_hash=current_fees.fee_hash,
|
sat_per_vbyte=sat_per_vbyte)
|
||||||
sat_per_vbyte=sat_per_vbyte)
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
# Handle erorr
|
# Handle erorr
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user