Fix python examples

This commit is contained in:
Ross Savage
2023-10-07 14:07:14 +02:00
parent d0a2bfab5d
commit 5f73890749
4 changed files with 14 additions and 18 deletions

View File

@@ -127,7 +127,7 @@ try {
```python
# Endpoint can also be of the form:
# keyauth://domain.com/auth?key=val
lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
lnurl_auth_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
try:
parsed_input = breez_sdk.parse_input(lnurl_auth_url)

View File

@@ -117,7 +117,7 @@ try {
lnurl_withdraw_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
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):
amount_sats = parsed_input.data.min_withdrawable
result = sdk_services.withdraw_lnurl(parsed_input.data, amount_sats, "comment")

View File

@@ -88,7 +88,7 @@ try:
swap_info = sdk_services.receive_onchain(breez_sdk.ReceiveOnchainRequest())
# Send your funds to the below bitcoin address
address = sdk_services.swap_info.bitcoin_address
address = swap_info.bitcoin_address
except Exception as error:
# Handle error
```
@@ -405,13 +405,12 @@ try {
```python
destination_address = "..."
sat_per_vbyte = <refund tx fee rate>
sat_per_vbyte = 5
try:
result = sdk_services.refund(
swap_address=refundable.bitcoin_address,
to_address=to_address,
sat_per_vbyte=sat_per_vbyte)
result = sdk_services.refund(swap_address=refundable.bitcoin_address,
to_address=destination_address,
sat_per_vbyte=sat_per_vbyte)
except Exception as error:
# Handle error
```

View File

@@ -86,7 +86,7 @@ try {
try:
current_fees = sdk_services.fetch_reverse_swap_fees(
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:
# Handle error
```
@@ -294,16 +294,13 @@ try {
```python
destination_address = "bc1.."
amount_sat = current_fees.min
fee_hash = current_fees.fee_hash
sat_per_vbyte = <fee rate>
amount_sat = 50000
sat_per_vbyte = 5
try:
sdk_services.send_onchain(
amount_sat=amount_msats,
onchain_recipient_address="...",
pair_hash=current_fees.fee_hash,
sat_per_vbyte=sat_per_vbyte)
sdk_services.send_onchain(amount_sat=amount_sat,
onchain_recipient_address=destination_address,
pair_hash=current_fees.fee_hash,
sat_per_vbyte=sat_per_vbyte)
except Exception as error:
# Handle erorr
```