AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
341 stars 44 forks source link

feat: swapcli commands to manually claim/refund and for database functions #441

Closed noot closed 1 year ago

noot commented 1 year ago

new functions:

   claim                    manually call claim() in the contract for a given swap. WARNING: This should only be used if the normal swap process fails.
   refund                   manually call refund() in the contract for a given swap. WARNING: This should only be used if the normal swap process fails.
   get-contract-swap-info   Get information about a swap needed to call the contract functions. Returns the contract address, the swap's struct as represented in the contract, and the hash of the swap's struct, which is used as its contract identifier. Note: this is only useful if you plan to manually call the contract functions.
   get-swap-secret          Get the secret for a swap. WARNING: do NOT share this secret with anyone. Doing so may result in a loss of funds. You should not use this function unless you are sure of what you're doing. This function is only useful if you plan to try to manually recover funds.

I'm wondering if these should be gated under an "unsafe" or "dev" command/feature, since they shouldn't be used under normal circumstances, especially the manual claim/refund functions.

closes #439 closes #424

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 38.05% and project coverage change: -0.11 :warning:

Comparison is base (330a231) 59.74% compared to head (4fcb9a5) 59.64%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #441 +/- ## ========================================== - Coverage 59.74% 59.64% -0.11% ========================================== Files 120 121 +1 Lines 10868 11120 +252 ========================================== + Hits 6493 6632 +139 - Misses 3669 3775 +106 - Partials 706 713 +7 ``` | [Impacted Files](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [rpcclient/database.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjY2xpZW50L2RhdGFiYXNlLmdv) | `0.00% <0.00%> (ø)` | | | [protocol/xmrtaker/swap\_state.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cHJvdG9jb2wveG1ydGFrZXIvc3dhcF9zdGF0ZS5nbw==) | `66.21% <21.73%> (+0.77%)` | :arrow_up: | | [rpc/swap.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjL3N3YXAuZ28=) | `23.64% <27.58%> (+6.64%)` | :arrow_up: | | [rpcclient/swap.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjY2xpZW50L3N3YXAuZ28=) | `24.74% <40.00%> (+6.83%)` | :arrow_up: | | [cmd/swapcli/main.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y21kL3N3YXBjbGkvbWFpbi5nbw==) | `43.91% <53.12%> (+1.51%)` | :arrow_up: | | [rpc/server.go](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cnBjL3NlcnZlci5nbw==) | `75.43% <100.00%> (+0.21%)` | :arrow_up: | ... and [6 files with indirect coverage changes](https://codecov.io/gh/AthanorLabs/atomic-swap/pull/441/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.