fixup! Add the list-sellers command to the CLI

This commit is contained in:
Daniel Karzel 2021-06-30 15:13:47 +10:00
parent a679cdee34
commit 0e3e0fb4cb
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E
2 changed files with 9 additions and 6 deletions

View File

@ -281,7 +281,7 @@ async fn main() -> Result<()> {
.context("Failed to read in seed file")?; .context("Failed to read in seed file")?;
let identity = seed.derive_libp2p_identity(); let identity = seed.derive_libp2p_identity();
let makers = list_sellers( let sellers = list_sellers(
rendezvous_node_peer_id, rendezvous_node_peer_id,
rendezvous_node_addr, rendezvous_node_addr,
namespace, namespace,
@ -290,8 +290,11 @@ async fn main() -> Result<()> {
) )
.await?; .await?;
for maker in makers { for seller in sellers {
tracing::info!(peer_id=%maker.peer_id, multiaddr=%maker.multiaddr, price=%maker.quote.price, max_quantity=%maker.quote.max_quantity, min_quantity=%maker.quote.min_quantity); // TODO: Do not use tracing for printing this information
// TODO: Print on stdout
// TODO: Decide if the json flag should still be honoured
tracing::info!(peer_id=%seller.peer_id, multiaddr=%seller.multiaddr, price=%seller.quote.price, max_quantity=%seller.quote.max_quantity, min_quantity=%seller.quote.min_quantity);
} }
} }
}; };

View File

@ -31,9 +31,9 @@ pub async fn list_sellers(
rendezvous_node_addr, rendezvous_node_addr,
namespace, namespace,
); );
let makers = event_loop.run().await; let sellers = event_loop.run().await;
Ok(makers) Ok(sellers)
} }
pub struct Seller { pub struct Seller {
@ -223,7 +223,7 @@ impl EventLoop {
.collect::<Result<Vec<_>, _>>(); .collect::<Result<Vec<_>, _>>();
match all_quotes_fetched { match all_quotes_fetched {
Ok(makers) => break makers, Ok(sellers) => break sellers,
Err(StillPending {}) => continue, Err(StillPending {}) => continue,
} }
} }