Commit Graph

953 Commits

Author SHA1 Message Date
Thomas Eizinger
d0db6cba10
Favour individual logs over one in main 2021-03-05 15:48:42 +11:00
bors[bot]
2041f367c6
Merge #288
288: Switch to public stagenet node that works r=rishflab a=rishflab

The xmr.to node has been unreliable lately. The exan.tech node seems to
working.

@da-kami is following up with making this configurable. Lets get this in so we can get a release on Friday.

Co-authored-by: rishflab <rishflab@hotmail.com>
2021-03-05 04:35:33 +00:00
rishflab
754159c9f8 Switch to public stagenet node that works
The xmr.to node has been unreliable lately. The exan.tech node seems to
working.
2021-03-05 15:11:32 +11:00
bors[bot]
b7709e1200
Merge #287
287: Properly deal with messages on kraken websocket connection r=da-kami a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-05 03:50:36 +00:00
bors[bot]
1f40de15a3
Merge #284 #286
284: Rename `latest` release to `preview` r=thomaseizinger a=thomaseizinger

The latest release should refer to the latest non-pre release.
What we are doing here is actually publishing a preview release.

Fixes #281.

286: Update Cargo.lock for new version r=thomaseizinger a=thomaseizinger

I forgot about this in the last commit ...

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-05 03:03:41 +00:00
Thomas Eizinger
b178e95f95
Redo layout of eventloop module
1. Move internal types to the bottom and make them private
2. Sort public types by their importance
2021-03-05 14:02:24 +11:00
Thomas Eizinger
1822886cd0
Provide stronger isolation of kraken module
Instead of leaking the tokio::sync::Receiver type in our
return value, we create a newtype that implements the desired
interface. This allows us to get rid of the `RateService` structs
and instead implement `LatestRate` directly on top of this struct.

Given that `LatestRate` is only used within the event_loop module,
we move the definition of this type into there.
2021-03-05 13:56:25 +11:00
Thomas Eizinger
f6ed4d65b5
Properly deal with additional messages sent from kraken 2021-03-05 13:40:39 +11:00
Thomas Eizinger
7575d412b8
Add kraken_ticker CLI for local testing of the client 2021-03-05 13:39:42 +11:00
Thomas Eizinger
5ce9e5662c
Update Cargo.lock for new version
I forgot about this in the last commit ...
2021-03-05 13:38:20 +11:00
Thomas Eizinger
60d6d50246
Extract kraken websocket client into dedicated module 2021-03-05 13:37:51 +11:00
Thomas Eizinger
3e6e746852
Rename latest release to preview
The latest release should refer to the latest non-pre release.
What we are doing here is actually publishing a preview release.

Fixes #281.
2021-03-05 12:29:29 +11:00
bors[bot]
ed6dc924c9
Merge #283
283: Prepare for next release r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-05 01:11:30 +00:00
Thomas Eizinger
25c4639689
Prepare for next release 2021-03-05 11:43:44 +11:00
bors[bot]
5cb25edea0
Merge #276
276: Use Rust cache action instead of rolling it ourselves r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-04 07:31:59 +00:00
Thomas Eizinger
52433f7412
Use Rust cache action 2021-03-04 18:02:20 +11:00
bors[bot]
20f2e56e2d
Merge #271
271: Bob can verify that the XMR lock tx was published r=da-kami a=da-kami

The Monero `txhash` log was removed. I feel the user should have the possibility to verify that the transaction was actually published so I added the tx-hash to the confirmation output. 

We could potentially print the tx-hash when receiving the transfer proof already, but that might not add much value compared to printing it with the confirmations. 

Additionally we should allow the user to at least know when the XMR can be expected in the user's wallet, otherwise the swap ends like this:

```
2021-03-04 13:49:19   INFO Monero lock tx received 5 out of 5 confirmations
```

This is just not very informative - yes, the final transaction is an implementation detail, but I don't think we should hide the transactions from the user. By printing the tx-hash for spending from the lock-tx into the user wallet we ensure the user knows that the XMR can now be expected in the user wallet. 

--- 

To add context, here the complete log (with debug enabled) **before** this change: 

```
2021-03-04 13:30:46  DEBUG Database and seed will be stored in /Users/dakami/Library/Application Support/xmr-btc-swap
2021-03-04 13:30:46  DEBUG Starting monero-wallet-rpc on port 56145
2021-03-04 13:30:51  DEBUG Requesting quote
2021-03-04 13:30:51   INFO Received quote: 1 XMR = 0.00433500 BTC
2021-03-04 13:30:51   INFO Still got 0.01018746 BTC left in wallet, swapping ...
2021-03-04 13:30:51   INFO Spot price for 0.00500000 BTC is 1.153402537485 XMR
2021-03-04 13:30:52  DEBUG Starting execution setup with 12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi
2021-03-04 13:30:55   INFO Published Bitcoin 3a6690a962191529892318819fb20e7f1ac4625400e64ee734056a9b2a17ad8f transaction as lock
2021-03-04 13:41:13  DEBUG Received Transfer Proof from 12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi
2021-03-04 13:42:11   INFO Monero lock tx received 1 out of 5 confirmations
2021-03-04 13:45:33   INFO Monero lock tx received 2 out of 5 confirmations
2021-03-04 13:47:49   INFO Monero lock tx received 3 out of 5 confirmations
2021-03-04 13:48:56   INFO Monero lock tx received 4 out of 5 confirmations
2021-03-04 13:49:19   INFO Monero lock tx received 5 out of 5 confirmations
2021-03-04 13:49:19  DEBUG Encrypted signature sent
2021-03-04 13:49:19  DEBUG Alice acknowledged encrypted signature
2021-03-04 13:49:19  DEBUG watching for tx: e5569d3f0bcccac95252dffaebe74ead0360c09b76bc762de890aaa0e51afbcf
2021-03-04 13:49:20  DEBUG Received protocol error "missing transaction" from Electrum, retrying...
2021-03-04 13:49:22  DEBUG Received protocol error "missing transaction" from Electrum, retrying...
```



Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-04 06:24:59 +00:00
bors[bot]
88b3321ec5
Merge #268
268: Introduce `quote` protocol and display it to the user before they fund r=thomaseizinger a=thomaseizinger

Fixes #255.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-04 05:58:26 +00:00
Daniel Karzel
47a31760c0 Bob can verify the Monero txs by tx-hash
Print tx-hashes for monero transactions to allow Bob to look the transaction up in block explorer.

The story of Bab:
Our famous actor Bob has a brother named Bab.
In school they were often mixed up, because their names were so similar.
Eventually Bab renamed himself into Barbara, but that was even more confusing for now he
carried a female name even though he was not female. Bob wanted to help his brother and told him he
could just go for Bub. But that did not solve anything. Fun fact: Bub is actually married to Alice.
2021-03-04 16:51:55 +11:00
Thomas Eizinger
14dcd150af
Extract determine_btc_to_swap function and test it
We also instantiate tracing in to order to quickly validate, what
the output for the different scenarios looks like.
2021-03-04 16:27:08 +11:00
Thomas Eizinger
601bf07255
Introduce quote protocol and display it to the user before they fund
Previously, the user neither knew the price nor the maximum quantity
they could trade. We now request a quote from the user and display
it to them.

Fixes #255.
2021-03-04 16:26:27 +11:00
Thomas Eizinger
3da01ea44a
Rename local variables according to new protocol name 2021-03-04 16:20:54 +11:00
Thomas Eizinger
ead5db3f45
Re-order fields to group them semantically 2021-03-04 16:20:51 +11:00
bors[bot]
d727420424
Merge #274
274: Reduce workflow duplication r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-04 05:18:44 +00:00
bors[bot]
18f968d51c
Merge #270
270: Re-configure rustfmt to organize imports differently r=thomaseizinger a=thomaseizinger

Initially, I only set out to do a follow-up PR for e3a73d105b but stumbled over this rustfmt setting that I wanted to try out for a while already.

Enjoy! I already like it because imports take up less space and reduces the chances of merge conflicts.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-04 05:07:27 +00:00
Thomas Eizinger
ab68b28fd8
Reduce workflow duplication 2021-03-04 15:43:15 +11:00
Thomas Eizinger
bc176bc4fb
Minor import optimizations 2021-03-04 14:48:28 +11:00
Thomas Eizinger
6d9b21cb47
Change imports_granularity to module
This reduces the overall amount of LoC that imports take up in our
codebase by almost 100.
It also makes merge-conflicts less likely because there is less
grouping together of imports that may lead to layout changes which
in turn can cause merge conflicts.
2021-03-04 14:48:13 +11:00
Thomas Eizinger
2c8200621d
Move pub use into pub use block 2021-03-04 14:47:47 +11:00
Thomas Eizinger
45b5e29d40
Don't format tokio-tar 2021-03-04 14:47:44 +11:00
bors[bot]
6ae8b63018
Merge #267
267: Use gtar to create release archive on Mac r=thomaseizinger a=rishflab

Follow up commit uses 7zip to create a zip for windows and appends the binary with a .exe

Here are the releases produced by this PR on my fork:
https://github.com/rishflab/xmr-btc-swap/releases/tag/0.34.0
I have tested the above releases to work up to asking for a btc deposit on :
- [x] macOS
- [x] windows
- [ ] ubuntu

Fixes #251.

Co-authored-by: rishflab <rishflab@hotmail.com>
2021-03-04 03:47:03 +00:00
bors[bot]
d1363d130c
Merge #265
265: Replace quote with spot-price protocol r=thomaseizinger a=thomaseizinger

This is essentially functionally equivalent but includes some
cleanups by removing a layer of abstraction: `spot_price::Behaviour`
is now just a type-alias for a request-response behaviour.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-04 02:52:06 +00:00
bors[bot]
18980f4b8a
Merge #269
269: Monero address validity check r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-04 02:36:52 +00:00
Daniel Karzel
7504c6ceee Context for monero address parsing errors
Most of the errors are not user friendly, thus added context to tell the user the given address is incorrect.
2021-03-04 13:36:10 +11:00
rishflab
95b1558c8e Add create release archive action for ubuntu
gtar is not installed on ubuntu so tar has to be used
2021-03-04 12:29:35 +11:00
rishflab
13764161a3 Add create release archive action for windows
Windows users may not have a tar extractor installed by default so 7z
was used to create a zip archive. I attempted to add the action names to
 the strategy matrix so we dont need if statements to choose the
 appropriate create release archive action but github did not like when
 I passed a field under strategy.matrix.include into steps.uses.
2021-03-04 12:29:33 +11:00
Daniel Karzel
35d0e246d8 Monero address network check
Add a network check to ensure the given monero address is on the configured network.
2021-03-04 10:46:12 +11:00
rishflab
d88a235883 Use gtar to create release archive
tar was producing an archived that binary that was failing to execute on
 developer machines. Since gtar is not available on windows or ubuntu,
 the windows and ubuntu releases was removed.
2021-03-04 09:00:24 +11:00
bors[bot]
cba9f119b6
Merge #261
261: Sweep xmr funds from generated temp wallet r=da-kami a=da-kami

Fixes #252

Please review by commit :)
Did a few cleanups before actually doing the feature.

Please note the comment that influenced this solution: https://github.com/comit-network/xmr-btc-swap/issues/252#issuecomment-789387074



Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-03 06:29:37 +00:00
Daniel Karzel
2e3c2d8edf Remove Arcs in favour of references 2021-03-03 17:23:07 +11:00
Daniel Karzel
0b4c0758bb Turbofish syntax
This way, we are co-locating the type with the expression that requires it.
This makes it easier to take this expression and compose it with other ones
without having to touch the type hint on the variable.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-03 17:15:37 +11:00
Daniel Karzel
5d807e9647 Reorder: Move utility functionality to bottom 2021-03-03 17:15:37 +11:00
Daniel Karzel
862c29f1a8 Reorder: Move sweep_all after transfer 2021-03-03 17:15:37 +11:00
Daniel Karzel
5a43b3453e Reorder: Move create after open 2021-03-03 17:15:37 +11:00
Daniel Karzel
b17e6cbd94 Reorder: Move open to top 2021-03-03 17:15:37 +11:00
Daniel Karzel
d63790c2a6 Remove unnecessary monero wallet trait abstractions 2021-03-03 17:15:37 +11:00
Daniel Karzel
1041212a60 Work in review comments 2021-03-03 17:15:37 +11:00
Daniel Karzel
66c8401c95 Sweep all from generated wallet to user wallet
The default implementation for the command was removed because it does not
add additional value if we have a mandatory parameter anyway.
2021-03-03 17:15:37 +11:00
Thomas Eizinger
7042ed9441
Replace quote with spot-price protocol
This is essentially functionally equivalent but includes some
cleanups by removing a layer of abstraction: `spot_price::Behaviour`
is now just a type-alias for a request-response behaviour.
2021-03-03 17:09:38 +11:00
bors[bot]
cca9808b8e
Merge #257
257: Allow ASB to be configured with max BTC buy amount r=thomaseizinger a=thomaseizinger

This will make it easier to also configure the CLI to display an appropriate max amount the user has to deal with.

This is the first step in working towards https://github.com/comit-network/xmr-btc-swap/issues/255.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-03 06:07:48 +00:00