From 294b658f4327f4b8a2c68e72c347eba622f5d4d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:04:18 +0000 Subject: [PATCH 1/7] build(deps): bump qrcode from 0.14.0 to 0.14.1 Bumps [qrcode](https://github.com/kennytm/qrcode-rust) from 0.14.0 to 0.14.1. - [Release notes](https://github.com/kennytm/qrcode-rust/releases) - [Commits](https://github.com/kennytm/qrcode-rust/commits/v0.14.1) --- updated-dependencies: - dependency-name: qrcode dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb3ea136..94cf9a78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3243,9 +3243,9 @@ dependencies = [ [[package]] name = "qrcode" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e719ca51966ff9f5a8436edb00d6115b3c606a0bb27c8f8ca74a38ff2b036d" +checksum = "d68782463e408eb1e668cf6152704bd856c78c5b6417adaee3203d8f4c1fc9ec" dependencies = [ "image", ] From ab1001a18c190c83cdfc333b037b41b07d0c5609 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:04:38 +0000 Subject: [PATCH 2/7] build(deps): bump serde from 1.0.203 to 1.0.204 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.203 to 1.0.204. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.203...v1.0.204) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb3ea136..80f28d22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3995,9 +3995,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] @@ -4024,9 +4024,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", From cd29870e11ae06faf3b238c1ac3bb037af490682 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:04:55 +0000 Subject: [PATCH 3/7] build(deps): bump async-trait from 0.1.80 to 0.1.81 Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.80 to 0.1.81. - [Release notes](https://github.com/dtolnay/async-trait/releases) - [Commits](https://github.com/dtolnay/async-trait/compare/0.1.80...0.1.81) --- updated-dependencies: - dependency-name: async-trait dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb3ea136..9591db36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", From 2af22c1aba19ec9daab9bf8e505b36cda1de04f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:08:29 +0000 Subject: [PATCH 4/7] build(deps): bump uuid from 1.9.1 to 1.10.0 Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.9.1 to 1.10.0. - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](https://github.com/uuid-rs/uuid/compare/1.9.1...1.10.0) --- updated-dependencies: - dependency-name: uuid dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- swap/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dfd9f239..b4ecc30e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5327,9 +5327,9 @@ checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" [[package]] name = "uuid" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom 0.2.11", "serde", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 5c754a53..a52f79a5 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -67,7 +67,7 @@ tracing-appender = "0.2" tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] } tracing-subscriber = { version = "0.3", default-features = false, features = [ "fmt", "ansi", "env-filter", "time", "tracing-log", "json" ] } url = { version = "2", features = [ "serde" ] } -uuid = { version = "1.9", features = [ "serde", "v4" ] } +uuid = { version = "1.10", features = [ "serde", "v4" ] } void = "1" [target.'cfg(not(windows))'.dependencies] From 47f8a652090b0318fbcd7488e1d72e23c6e09a5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:19:16 +0000 Subject: [PATCH 5/7] build(deps): bump hyper from 1.3.1 to 1.4.1 Bumps [hyper](https://github.com/hyperium/hyper) from 1.3.1 to 1.4.1. - [Release notes](https://github.com/hyperium/hyper/releases) - [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/hyper/compare/v1.3.1...v1.4.1) --- updated-dependencies: - dependency-name: hyper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 12 ++++++------ swap/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4ecc30e..a5b9e009 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1763,9 +1763,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -1789,7 +1789,7 @@ checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", "http 1.0.0", - "hyper 1.3.1", + "hyper 1.4.1", "hyper-util", "rustls 0.23.10", "rustls-pki-types", @@ -1810,7 +1810,7 @@ dependencies = [ "futures-util", "http 1.0.0", "http-body 1.0.0", - "hyper 1.3.1", + "hyper 1.4.1", "pin-project-lite 0.2.13", "socket2 0.5.5", "tokio", @@ -3497,7 +3497,7 @@ dependencies = [ "http 1.0.0", "http-body 1.0.0", "http-body-util", - "hyper 1.3.1", + "hyper 1.4.1", "hyper-rustls", "hyper-util", "ipnet", @@ -4541,7 +4541,7 @@ dependencies = [ "futures", "get-port", "hex", - "hyper 1.3.1", + "hyper 1.4.1", "itertools 0.13.0", "jsonrpsee", "jsonrpsee-core", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index a52f79a5..8c657d62 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -79,7 +79,7 @@ zip = "0.5" [dev-dependencies] bitcoin-harness = { git = "https://github.com/delta1/bitcoin-harness-rs.git", rev = "80cc8d05db2610d8531011be505b7bee2b5cdf9f" } get-port = "3" -hyper = "1.3" +hyper = "1.4" jsonrpsee = { version = "0.16.2", features = [ "ws-client" ] } mockito = "1.4" monero-harness = { path = "../monero-harness" } From dcb4edf58520c11c887de6da7b8ffcbde67cafb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:19:33 +0000 Subject: [PATCH 6/7] build(deps): bump vergen from 8.3.1 to 8.3.2 Bumps [vergen](https://github.com/rustyhorde/vergen) from 8.3.1 to 8.3.2. - [Release notes](https://github.com/rustyhorde/vergen/releases) - [Commits](https://github.com/rustyhorde/vergen/commits) --- updated-dependencies: - dependency-name: vergen dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4ecc30e..997c31fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1483,9 +1483,9 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git2" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ "bitflags 2.4.0", "libc", @@ -2128,9 +2128,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" -version = "0.16.1+1.7.1" +version = "0.17.0+1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" dependencies = [ "cc", "libc", @@ -5355,9 +5355,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "vergen" -version = "8.3.1" +version = "8.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" +checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" dependencies = [ "anyhow", "cfg-if 1.0.0", From 4115a452e303a64c223c512b1a90c783d73ae7ca Mon Sep 17 00:00:00 2001 From: Einliterflasche <81313171+Einliterflasche@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:19:41 +0200 Subject: [PATCH 7/7] allow --change-address to be omitted and default to internal wallet address (#1709) allow --change-address to be omitted and default to internal wallet address (#1709) Co-authored-by: binarybaron <86064887+binarybaron@users.noreply.github.com> Co-authored-by: Byron Hambly --- CHANGELOG.md | 2 ++ docs/cli/README.md | 2 +- swap/src/api.rs | 4 ++++ swap/src/cli/command.rs | 46 +++++++++++++++++++++++++++++------------ 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2baf45..1b4776b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- CLI: `--change-address` can now be omitted. In that case, any change is refunded to the internal bitcoin wallet. + ## [0.13.2] - 2024-07-02 - CLI: Buffer received transfer proofs for later processing if we're currently running a different swap diff --git a/docs/cli/README.md b/docs/cli/README.md index d95d90ef..eff9d072 100644 --- a/docs/cli/README.md +++ b/docs/cli/README.md @@ -75,7 +75,7 @@ OPTIONS: This command has three core options: -- `--change-address`: A Bitcoin address you control. Will be used for refunds of any kind. +- `--change-address`: A Bitcoin address you control. Will be used for refunds of any kind. You can also omit this flag which will refund any change to the internal wallet. - `--receive-address`: A Monero address you control. This is where you will receive the Monero after the swap. - `--seller`: The multiaddress of the seller you want to swap with. diff --git a/swap/src/api.rs b/swap/src/api.rs index 340c2e39..fb071cd4 100644 --- a/swap/src/api.rs +++ b/swap/src/api.rs @@ -267,6 +267,10 @@ impl Context { tasks: Arc::new(PendingTaskList::default()), } } + + pub fn bitcoin_wallet(&self) -> Option> { + self.bitcoin_wallet.clone() + } } impl fmt::Debug for Context { diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index af72df1b..f3d61c92 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -69,6 +69,37 @@ where monero_receive_address, tor, } => { + let context = Context::build( + Some(bitcoin), + Some(monero), + Some(tor), + data, + is_testnet, + debug, + json, + None, + ) + .await?; + + // when no refund address was provided we default to the internal wallet + let bitcoin_change_address = match bitcoin_change_address { + Some(addr) => addr, + None => { + let internal_wallet_address = context + .bitcoin_wallet() + .expect("bitcoin wallet should exist") + .new_address() + .await?; + + tracing::info!( + internal_wallet_address=%internal_wallet_address, + "No --change-address supplied. Any change will be received to the internal wallet." + ); + + internal_wallet_address + } + }; + let monero_receive_address = monero_address::validate_is_testnet(monero_receive_address, is_testnet)?; let bitcoin_change_address = @@ -81,17 +112,6 @@ where swap_id: Uuid::new_v4(), }); - let context = Context::build( - Some(bitcoin), - Some(monero), - Some(tor), - data, - is_testnet, - debug, - json, - None, - ) - .await?; (context, request) } CliCommand::History => { @@ -300,10 +320,10 @@ enum CliCommand { #[structopt( long = "change-address", - help = "The bitcoin address where any form of change or excess funds should be sent to", + help = "The bitcoin address where any form of change or excess funds should be sent to. If omitted they will be sent to the internal wallet.", parse(try_from_str = bitcoin_address::parse) )] - bitcoin_change_address: bitcoin::Address, + bitcoin_change_address: Option, #[structopt(flatten)] monero: Monero,