Commit Graph

22 Commits

Author SHA1 Message Date
Daniel Karzel
04b49d7117 Add command to print Bitcoin and Monero balance 2021-04-06 09:19:43 +10:00
Daniel Karzel
96008ec130 Add command to withdraw BTC
If no amount is given the wallet will be drained.
2021-04-06 09:19:43 +10:00
Daniel Karzel
2135a6e53e
Alice resumes swaps 2021-04-01 16:09:13 +11:00
Thomas Eizinger
393ed45b9e
Say who we are in the --help message
The message now says:

swap 0.3.0
The COMIT guys <hello@comit.network>
CLI for swapping BTC for XMR

USAGE:
    swap [FLAGS] [OPTIONS] <SUBCOMMAND>

...
2021-03-26 14:31:14 +11:00
Daniel Karzel
105e291e67 Update the application name for --version print
swap --version
xmr-btc-swap 0.3.0

asb --version
xmr-btc-asb 0.3.0
2021-03-18 12:24:10 +11:00
rishflab
e5c0158597
Greatly reduce load onto the Electrum backend
We achieve our optimizations in three ways:

1. Batching calls instead of making them individually.

To get access to the batch calls, we replace all our
calls to the HTTP interface with RPC calls.

2. Never directly make network calls based on function
calls on the wallet.

Instead, inquiring about the status of a script always
just returns information based on local data. With every
call, we check when we last refreshed the local data and
do so if the data is considered to be too old. This
interval is configurable.

3. Use electrum's notification feature to get updated
with the latest blockheight.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Rishab Sharma <rishflab@hotmail.com>
2021-03-16 19:24:31 +11:00
Thomas Eizinger
4138039ea0
Make sure all error messages start with an uppercase letter
These might potentially be shown to a user, let's make them all
consistent.
2021-03-05 15:49:15 +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
60d6d50246
Extract kraken websocket client into dedicated module 2021-03-05 13:37:51 +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
2440964385
Allow ASB to be configured with max BTC buy amount
This will make it easier to also configure the CLI to display an appropriate max amount the user has to deal with.
2021-03-03 16:56:34 +11:00
Daniel Karzel
019d6c725a Maximum sell amount for ASB that defaults to 0.5 XMR 2021-02-26 16:48:27 +11:00
Daniel Karzel
1f1b3a95bc Logging for different scenarios when reading from rate stream 2021-02-26 12:44:49 +11:00
Daniel Karzel
fc2c08c7c9 Error only on close message when fetching the rate
Messages Ping, Pong and Binary are ignored and not reported as error.
2021-02-25 12:52:38 +11:00
Daniel Karzel
151f33ba10 Rename variables to add to understanding the code 2021-02-22 15:38:14 +11:00
Daniel Karzel
9496dce917 Skip heartbeat messages 2021-02-22 14:51:22 +11:00
Thomas Eizinger
a8bfc1d686 Make LatestRate::Error require std::error::Error trait bound
This allows us to use .context instead of .map_err when calling
`latest_rate()`. For the static rate module, we simply fill in
`Infallible` which is actually better suited because it describes
that we are never using this error.
2021-02-22 13:27:47 +11:00
Thomas Eizinger
b47b06aa23 Import anyhow::Result across the codebase
There is no need to fully qualify this type because it is a type
alias for std::Result. We can mix and match the two as we want.
2021-02-22 13:26:56 +11:00
Franck Royer
519d1a5701 Log rate and amounts for Alice when doing execution setup 2021-02-22 13:26:27 +11:00
Franck Royer
644f4c1732 Bubble up ws error to consumer
Note that because we are using `watch` channel, only a reference to the
channel value can be returned.
Hence, using custom Error that can be cloned to be able to
pass `Result` through the channel.
2021-02-22 13:26:27 +11:00
Franck Royer
92b3df4158 Introduce dynamic rates 2021-02-22 13:24:59 +11:00
Daniel Karzel
fe3d6f1fef Rename nectar to asb (automated swap backend) 2021-02-22 10:24:11 +11:00