Skip to content

Commit

Permalink
Fix iota-client dependency (#371)
Browse files Browse the repository at this point in the history
* Update dependency versions

Fix iota-client dependency resolution error in GitHub Actions.
Update minor dependencies.

* Fix Rust examples CI failures

Prevent private_tangle examples returning an error on publish when no
private Tangle is running locally.

* Update wasm bindings resolver to version 2

Removes mio dependency which cannot be compiled to the wasm target. It
was brought in by tokio features in dev-dependencies, hence why the new
resolver works.

* Update iota-client dependency pinned commit

Fix Wasm compilation.
  • Loading branch information
cycraig committed Aug 26, 2021
1 parent 971f832 commit c8dda71
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions bindings/wasm/Cargo.toml
Expand Up @@ -9,6 +9,7 @@ repository = "https://github.com/iotaledger/identity.rs"
license = "Apache-2.0"
keywords = ["iota", "tangle", "identity", "wasm"]
homepage = "https://www.iota.org"
resolver = "2"

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Expand Up @@ -8,7 +8,7 @@ publish = false
identity = { path = "../identity", features = ["account"] }
pretty_env_logger = { version = "0.4" }
rand = { version = "0.8" }
tokio = { version = "1.5", features = ["full"] }
tokio = { version = "1.10", features = ["full"] }

[[example]]
name = "getting_started"
Expand Down
15 changes: 13 additions & 2 deletions examples/account/private_tangle.rs
Expand Up @@ -26,21 +26,32 @@ async fn main() -> Result<()> {
let network = Network::from_name(network_name)?;

// Create a new Account with the default configuration
let private_node_url = "http://127.0.0.1:14265/";
let account: Account = Account::builder()
// Configure a client for the private network.
// Also set the URL that points to the REST API
// of the locally running hornet node.
.client(network, |builder| {
// unwrap is safe, we provided a valid node URL
builder.node("http://127.0.0.1:14265/").unwrap()
builder.node(private_node_url).unwrap()
})
.build()
.await?;

let id_create = IdentityCreate::new().network(network_name);

// Create a new Identity with default settings
let snapshot: IdentitySnapshot = account.create_identity(id_create).await?;
let snapshot: IdentitySnapshot = match account.create_identity(id_create).await {
Ok(snapshot) => snapshot,
Err(err) => {
eprintln!("[Example] Error: {:?} {}", err, err.to_string());
eprintln!(
"[Example] Is your private Tangle node listening on {}?",
private_node_url
);
return Ok(());
}
};

// Retrieve the DID from the newly created Identity state.
let document: &IotaDID = snapshot.identity().try_did()?;
Expand Down
12 changes: 10 additions & 2 deletions examples/low-level-api/private_tangle.rs
Expand Up @@ -23,9 +23,10 @@ pub async fn main() -> Result<()> {

// Set the network and the URL that points to
// the REST API of the locally running hornet node.
let private_node_url = "http://127.0.0.1:14265/";
let client = ClientBuilder::new()
.network(network)
.node("http://127.0.0.1:14265/")?
.node(private_node_url)?
.build()
.await?;

Expand All @@ -45,7 +46,14 @@ pub async fn main() -> Result<()> {
println!("DID Document JSON > {:#}", document);

// Publish the DID Document to the Tangle.
let receipt: Receipt = client.publish_document(&document).await?;
let receipt: Receipt = match client.publish_document(&document).await {
Ok(receipt) => receipt,
Err(err) => {
eprintln!("Error > {:?} {}", err, err.to_string());
eprintln!("Is your private Tangle node listening on {}?", private_node_url);
return Ok(());
}
};

println!("Publish Receipt > {:#?}", receipt);

Expand Down
4 changes: 2 additions & 2 deletions identity-account/Cargo.toml
Expand Up @@ -13,7 +13,7 @@ homepage = "https://www.iota.org"
[dependencies]
async-trait = { version = "0.1", default-features = false }
futures = { version = "0.3" }
hashbrown = { version = "0.9", features = ["serde"] }
hashbrown = { version = "0.11", features = ["serde"] }
identity-core = { version = "=0.3.0", path = "../identity-core" }
identity-credential = { version = "=0.3.0", path = "../identity-credential" }
identity-did = { version = "=0.3.0", path = "../identity-did" }
Expand All @@ -31,7 +31,7 @@ slog = { version = "2.7" }
strum = { version = "0.21", features = ["derive"] }
thiserror = { version = "1.0" }
tokio = { version = "1.5", features = ["sync"] }
zeroize = { version = "1.3" }
zeroize = { version = "1.4" }

[dependencies.iota-crypto]
version = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion identity-core/Cargo.toml
Expand Up @@ -26,7 +26,7 @@ strum = { version = "0.21", features = ["derive"] }
thiserror = { version = "1.0", default-features = false }
typenum = { version = "1.13", default-features = false }
url = { version = "2.2", default-features = false, features = ["serde"] }
zeroize = { version = "1.3", default-features = false }
zeroize = { version = "1.4", default-features = false }

[dependencies.iota-crypto]
version = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion identity-iota/Cargo.toml
Expand Up @@ -26,7 +26,7 @@ thiserror = { version = "1.0", default-features = false }

[dependencies.iota-client]
git = "https://github.com/iotaledger/iota.rs"
rev = "0a011ec37f70874358cf530d3b8e4817c69c9a4c"
rev = "e8c050a749a2e7c13633e97b3372b38388f48c37"
default-features = false

[dependencies.iota-crypto]
Expand Down

0 comments on commit c8dda71

Please sign in to comment.