Show QR code for listener address (#650)

Co-authored-by: cliik <cliik@example.com>
This commit is contained in:
cliik 2022-07-12 09:48:45 +00:00 committed by GitHub
parent b45802aa6b
commit 7b1eab62b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,6 +31,7 @@ use grin_wallet_util::OnionV3Address;
use hyper::body; use hyper::body;
use hyper::header::HeaderValue; use hyper::header::HeaderValue;
use hyper::{Body, Request, Response, StatusCode}; use hyper::{Body, Request, Response, StatusCode};
use qr_code::QrCode;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json; use serde_json;
use std::collections::HashMap; use std::collections::HashMap;
@ -351,7 +352,11 @@ where
warn!("HTTP Foreign listener started."); warn!("HTTP Foreign listener started.");
if let Some(a) = address { 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 api_thread