Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set explorer_url in private Tangle example #454

Merged
merged 3 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/account/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ async fn main() -> Result<()> {
// As an example we are treating the devnet as a `private-tangle`, so we use `dev`.
// Replace this with `tangle` if you run this against a one-click private tangle.
let network_name = "dev";
let network = Network::try_from_name(network_name)?;
let mut network = Network::try_from_name(network_name)?;

// If you deployed an explorer locally this would usually be `http://127.0.0.1:8082/identity-resolver`
network.set_explorer_url("https://explorer.iota.org/devnet/identity-resolver".parse()?)?;

// In a locally running one-click tangle, this would often be `http://127.0.0.1:14265/`
let private_node_url = "https://api.lb-0.h.chrysalis-devnet.iota.cafe";

Expand All @@ -46,7 +50,7 @@ async fn main() -> Result<()> {
})
// Configure a client for the private network, here `dev`
// Also set the URL that points to the REST API of the node
.client(network, |builder| {
.client(network.clone(), |builder| {
// unwrap is safe, we provided a valid node URL
builder.node(private_node_url).unwrap()
})
Expand All @@ -70,8 +74,8 @@ async fn main() -> Result<()> {

// Prints the Identity Resolver Explorer URL, the entire history can be observed on this page by "Loading History".
println!(
"[Example] Explore the DID Document = {}/{}",
iota_did.network()?.explorer_url().unwrap().to_string(),
"[Example] Explore the DID Document = {}{}",
network.explorer_url().expect("no explorer url was set").to_string(),
iota_did.to_string()
);

Expand Down
2 changes: 1 addition & 1 deletion examples/account/create_did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn main() -> Result<()> {

// Prints the Identity Resolver Explorer URL, the entire history can be observed on this page by "Loading History".
println!(
"[Example] Explore the DID Document = {}/{}",
"[Example] Explore the DID Document = {}{}",
iota_did.network()?.explorer_url().unwrap().to_string(),
iota_did.to_string()
);
Expand Down
2 changes: 1 addition & 1 deletion examples/account/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async fn main() -> Result<()> {

// Prints the Identity Resolver Explorer URL, the entire history can be observed on this page by "Loading History".
println!(
"[Example] Explore the DID Document = {}/{}",
"[Example] Explore the DID Document = {}{}",
iota_did.network()?.explorer_url().unwrap().to_string(),
iota_did.to_string()
);
Expand Down
2 changes: 1 addition & 1 deletion examples/account/manipulate_did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async fn main() -> Result<()> {

// Prints the Identity Resolver Explorer URL, the entire history can be observed on this page by "Loading History".
println!(
"[Example] Explore the DID Document = {}/{}",
"[Example] Explore the DID Document = {}{}",
iota_did.network()?.explorer_url().unwrap().to_string(),
iota_did.to_string()
);
Expand Down
2 changes: 1 addition & 1 deletion examples/account/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async fn main() -> Result<()> {

// Prints the Identity Resolver Explorer URL, the entire history can be observed on this page by "Loading History".
println!(
"[Example] Explore the DID Document = {}/{}",
"[Example] Explore the DID Document = {}{}",
iota_did.network()?.explorer_url().unwrap().to_string(),
iota_did.to_string()
);
Expand Down