diff --git a/Cargo.lock b/Cargo.lock index 427fba74e..d920fe39a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1544,6 +1544,7 @@ dependencies = [ "lazy_static", "log", "prettytable-rs", + "qr_code", "rand 0.7.3", "remove_dir_all 0.7.0", "ring", @@ -2866,6 +2867,12 @@ dependencies = [ "unicode-xid 0.2.2", ] +[[package]] +name = "qr_code" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5520fbcd7da152a449261c5a533a1c7fad044e9e8aa9528cfec3f464786c7926" + [[package]] name = "quick-error" version = "1.2.3" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index c56942327..b07a46204 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -29,6 +29,7 @@ url = "2.1" chrono = { version = "0.4.11", features = ["serde"] } easy-jsonrpc-mw = "0.5.4" lazy_static = "1" +qr_code = "1.1.0" grin_wallet_util = { path = "../util", version = "5.2.0-alpha.1" } diff --git a/controller/src/controller.rs b/controller/src/controller.rs index 4952aff8e..3af87acf6 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -31,6 +31,7 @@ use grin_wallet_util::OnionV3Address; use hyper::body; use hyper::header::HeaderValue; use hyper::{Body, Request, Response, StatusCode}; +use qr_code::QrCode; use serde::{Deserialize, Serialize}; use serde_json; use std::collections::HashMap; @@ -351,7 +352,11 @@ where warn!("HTTP Foreign listener started."); if let Some(a) = address { - warn!("Slatepack Address is: {}", a); + let qr_string = match QrCode::new(a.to_string()) { + Ok(qr) => qr.to_string(false, 3), + Err(_) => "Failed to generate QR code!".to_string(), + }; + warn!("Slatepack Address is: {}\n{}", a, qr_string); } api_thread