RGB-Tools / rgb-lightning-node

MIT License
17 stars 19 forks source link

decide how to show swaps info #30

Closed zoedberg closed 4 months ago

zoedberg commented 4 months ago

While fixing and improving swap tests we've noticed that currently the taker has no way to see if a trade happened.

Therefore we think we should add more info to the existing listtrades API, which currently returns two lists (maker and taker) of Trades, where each trade has info about the qty_from, the qty_to, the from_asset, the to_asset and the payment_hash. By adding a status field to the Trade object (which value could be whitelisted, expired, pending, failed or succeeded) both maker and taker will be able to reconstruct information about the swaps they made or took (or tried to). About this proposal we don't have many doubts but if someone thinks there are better solutions we'll be happy to hear more proposals.

Then there's another question: currently when a swap gets executed the listpayments API returns 2 payments on the maker side (one outbound and the other inbound), but no payment on the taker side. While this reflects what techically happens when a swap gets executed, we are worried this could cause confusion to the end-user. Here we are not sure what is the best solution, the possibilities we see are:

@bitwalt we would appreciate your opinion on this since right now you're probably the only swap user we have

bitwalt commented 4 months ago

Hi! thank you for your support. On the first point, I agree that it would be very useful to add a status field to the trade to provide more information to users.

For the second point, I am still unsure what the best solution might be. A trade involves two payments (one outbound and one inbound), so it would seem logical to also track both for the taker in listpayments (with the addition of a flag to specify the nature of the payment). However, considering that this change does not add substantial additional information, it might be more sensible to remove the swap payments from the maker side and maintain a logical separation between trade and payment. This would help clarify the distinction between trading activities and payment transactions.

zoedberg commented 4 months ago

@bitwalt thanks for sharing your opinion on this. We decided to remove the payments from the maker side and have addressed this, so closing. Just a note: instead of Whitelisted we preferred using Waiting