diff --git a/Cargo.lock b/Cargo.lock index 4684ce228f..4b6f1c5f31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3195,6 +3195,15 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + [[package]] name = "is-terminal" version = "0.4.9" @@ -3206,6 +3215,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + [[package]] name = "itertools" version = "0.9.0" @@ -4115,6 +4134,17 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfabf1927dce4d6fdf563d63328a0a506101ced3ec780ca2135747336c98cef8" +dependencies = [ + "is-wsl", + "libc", + "pathdiff", +] + [[package]] name = "openssl" version = "0.10.56" @@ -4325,6 +4355,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "pbkdf2" version = "0.6.0" @@ -7123,7 +7159,7 @@ checksum = "e7141e445af09c8919f1d5f8a20dae0b20c3b57a45dee0d5823c6ed5d237f15a" dependencies = [ "bitflags 1.3.2", "chrono", - "rustc_version 0.2.3", + "rustc_version 0.4.0", ] [[package]] @@ -8278,6 +8314,7 @@ dependencies = [ "log", "metrics 0.12.1", "num-bigint 0.3.3", + "open", "r2d2", "rand 0.8.5", "serde", diff --git a/core/payment/Cargo.toml b/core/payment/Cargo.toml index 0232b9f8f2..beeceacc7d 100644 --- a/core/payment/Cargo.toml +++ b/core/payment/Cargo.toml @@ -51,6 +51,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" structopt = "0.3" thiserror = "1.0" +open = "5.0" tokio = { version = "1", features = ["fs", "signal", "macros"] } tokio-util = { version = "0.7.9", features = ["rt"] } uint = "0.7" diff --git a/core/payment/src/cli.rs b/core/payment/src/cli.rs index faa46de68a..74b8027de5 100644 --- a/core/payment/src/cli.rs +++ b/core/payment/src/cli.rs @@ -22,6 +22,11 @@ pub enum PaymentCli { /// List active payment accounts Accounts, + /// Open onboarding url + Onboard { + #[structopt(flatten)] + account: pay::AccountCli, + }, /// Supply payment account with funds Fund { #[structopt(flatten)] @@ -128,6 +133,14 @@ pub enum InvoiceCommand { impl PaymentCli { pub async fn run_command(self, ctx: &CliCtx) -> anyhow::Result { match self { + PaymentCli::Onboard { account } => { + let address = resolve_address(account.address()).await?; + open::that(format!( + "https://golemfactory.github.io/onboarding_production/?yagnaAddress={}", + address + ))?; + Ok(CommandOutput::NoOutput) + } PaymentCli::Fund { account } => { let address = resolve_address(account.address()).await?;