Elements function: pegin
An automated function: pegin
- amount
- (optional) from_wallet [default = default spender wallet]
- (optional) to_wallet [default = default elements wallet]
Calling this function will do this:
- getpeginaddress from Liquid
- sendtoaddress from Bitcoin Core Wallet
- gettransactiondetails on Bitcoin Core
- gettxoutproof on Bitcoin Core
- watchtxid and wait 102 confirmation
- after 102 confirmations claimpegin with Liquid with BitcoinTX and txoutproof
Ideally this would also save the peginaddress alongside the mainchain txid and the sidechain txid
getpeginaddresses
returns all pegin addresses created with
- amount
- txid
- confirmations
- claimed
- unclaimed
Expected user experience outcome is that a client app calls the "pegin" api endpoint and only has to specify an amount. If there are enough funds in the Bitcoin Core wallet which is used to make the pegin, there should be nothing else the client needs to do.
The client can specify a callback URL and receive notifications about the pegin, which would include the Bitcoin txid and the liquidtxid. Client should be notified when the pegin is completed.
https://github.com/Impa10r/peerswap-web