Commit Graph

76 Commits (b9d2e9c3aed01c724e392c7b202a9c07d6c7e400)

Author SHA1 Message Date
rishflab e517c5934e Move asb tracing initializer to asb module 4 years ago
Thomas Eizinger a99d12b9df
Add a configurable spread to the ASB
Fixes #381.
4 years ago
Thomas Eizinger 3e0301a9d4
Move `FixedRate` into event_loop module
This is where these types are used, they can be defined in there.
4 years ago
Thomas Eizinger cfc530e8ab
Make `ask` field of `Rate` private 4 years ago
Daniel Karzel 04b49d7117 Add command to print Bitcoin and Monero balance 4 years ago
Daniel Karzel 96008ec130 Add command to withdraw BTC
If no amount is given the wallet will be drained.
4 years ago
Daniel Karzel 2135a6e53e
Alice resumes swaps 4 years ago
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>

...
4 years ago
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
4 years ago
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>
4 years ago
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.
4 years ago
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.
4 years ago
Thomas Eizinger 60d6d50246
Extract kraken websocket client into dedicated module 4 years ago
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.
4 years ago
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.
4 years ago
Daniel Karzel 019d6c725a Maximum sell amount for ASB that defaults to 0.5 XMR 4 years ago
Daniel Karzel 1f1b3a95bc Logging for different scenarios when reading from rate stream 4 years ago
Daniel Karzel fc2c08c7c9 Error only on close message when fetching the rate
Messages Ping, Pong and Binary are ignored and not reported as error.
4 years ago
Daniel Karzel 151f33ba10 Rename variables to add to understanding the code 4 years ago
Daniel Karzel 9496dce917 Skip heartbeat messages 4 years ago
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.
4 years ago
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.
4 years ago
Franck Royer 519d1a5701 Log rate and amounts for Alice when doing execution setup 4 years ago
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.
4 years ago
Franck Royer 92b3df4158 Introduce dynamic rates 4 years ago
Daniel Karzel fe3d6f1fef Rename nectar to asb (automated swap backend) 4 years ago