Skip to content

Commit

Permalink
Show QR code for listener address
Browse files Browse the repository at this point in the history
  • Loading branch information
cliik committed Jun 30, 2022
1 parent 3302d3d commit 6ed74cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions controller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
7 changes: 6 additions & 1 deletion controller/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6ed74cc

Please sign in to comment.