mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +00:00
submarine swaps: add normal swaps to GUI, various minor fixes
This commit is contained in:
parent
eb9f6ce293
commit
7d2979d776
2 changed files with 11 additions and 4 deletions
|
@ -123,9 +123,11 @@ class SwapDialog(WindowModalDialog):
|
||||||
self.get_pairs()
|
self.get_pairs()
|
||||||
if not self.exec_():
|
if not self.exec_():
|
||||||
return
|
return
|
||||||
amount_sat = self.send_amount_e.get_amount()
|
|
||||||
if self.is_reverse:
|
if self.is_reverse:
|
||||||
|
amount_sat = self.send_amount_e.get_amount()
|
||||||
coro = ss.reverse_swap(amount_sat, self.window.wallet, self.network)
|
coro = ss.reverse_swap(amount_sat, self.window.wallet, self.network)
|
||||||
asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop)
|
|
||||||
else:
|
else:
|
||||||
pass
|
amount_sat = self.recv_amount_e.get_amount()
|
||||||
|
password = self.window.protect(lambda x: x, [])
|
||||||
|
coro = ss.normal_swap(amount_sat, self.window.wallet, self.network, password)
|
||||||
|
asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop)
|
||||||
|
|
|
@ -9,7 +9,11 @@ from .transaction import script_GetOp, match_script_against_template, OPPushData
|
||||||
from .transaction import Transaction
|
from .transaction import Transaction
|
||||||
from .util import log_exceptions
|
from .util import log_exceptions
|
||||||
from .bitcoin import dust_threshold
|
from .bitcoin import dust_threshold
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .network import Network
|
||||||
|
from .wallet import Abstract_Wallet
|
||||||
|
|
||||||
API_URL = 'http://ecdsa.org:9001'
|
API_URL = 'http://ecdsa.org:9001'
|
||||||
|
|
||||||
|
@ -132,6 +136,7 @@ async def normal_swap(amount_sat, wallet: 'Abstract_Wallet', network: 'Network',
|
||||||
lnaddr = lnworker._check_invoice(invoice, amount_sat)
|
lnaddr = lnworker._check_invoice(invoice, amount_sat)
|
||||||
payment_hash = lnaddr.paymenthash
|
payment_hash = lnaddr.paymenthash
|
||||||
preimage = lnworker.get_preimage(payment_hash)
|
preimage = lnworker.get_preimage(payment_hash)
|
||||||
|
address = wallet.get_unused_address()
|
||||||
request_data = {
|
request_data = {
|
||||||
"type": "submarine",
|
"type": "submarine",
|
||||||
"pairId": "BTC/BTC",
|
"pairId": "BTC/BTC",
|
||||||
|
@ -148,7 +153,7 @@ async def normal_swap(amount_sat, wallet: 'Abstract_Wallet', network: 'Network',
|
||||||
response_id = data["id"]
|
response_id = data["id"]
|
||||||
zeroconf = data["acceptZeroConf"]
|
zeroconf = data["acceptZeroConf"]
|
||||||
onchain_amount = data["expectedAmount"]
|
onchain_amount = data["expectedAmount"]
|
||||||
locktime = data["timeoutBlockHeight"],
|
locktime = data["timeoutBlockHeight"]
|
||||||
lockup_address = data["address"]
|
lockup_address = data["address"]
|
||||||
redeem_script = data["redeemScript"]
|
redeem_script = data["redeemScript"]
|
||||||
# verify redeem_script is built with our pubkey and preimage
|
# verify redeem_script is built with our pubkey and preimage
|
||||||
|
|
Loading…
Add table
Reference in a new issue