diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index aa55989348..753cc18342 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -17,11 +17,9 @@ crate-type = ["cdylib", "rlib"] [dependencies] async-trait = { version = "0.1", default-features = false } -bee-api-types = { version = "1.0", default-features = false } -# Ensure bee-block always matches the version used by iota-client. -bee-block = { version = "1.0", default-features = false, features = ["dto"] } console_error_panic_hook = { version = "0.1" } futures = { version = "0.3" } +iota-types = { version = "1.0.0-rc.1", default-features = false, features = ["block", "api", "dto", "std"] } js-sys = { version = "0.3.60" } proc_typescript = { version = "0.1.0", path = "./proc_typescript" } serde = { version = "1.0", features = ["derive"] } diff --git a/bindings/wasm/docs/api-reference.md b/bindings/wasm/docs/api-reference.md index a6a90aa9f2..06e2ba3a0b 100644 --- a/bindings/wasm/docs/api-reference.md +++ b/bindings/wasm/docs/api-reference.md @@ -1773,7 +1773,7 @@ The default Tangle network (`"iota"`). ### IotaDID.fromAliasId(aliasId, network) ⇒ [IotaDID](#IotaDID) -Constructs a new `IotaDID` from a hex representation of the tag and the given +Constructs a new `IotaDID` from a hex representation of an Alias Id and the given network name. **Kind**: static method of [IotaDID](#IotaDID) @@ -2012,7 +2012,7 @@ Deserializes an instance from a JSON object. * _static_ * [.newWithId(id)](#IotaDocument.newWithId) ⇒ [IotaDocument](#IotaDocument) * [.unpackFromOutput(did, aliasOutput, allowEmpty, tokenSupply)](#IotaDocument.unpackFromOutput) ⇒ [IotaDocument](#IotaDocument) - * [.unpackFromBlock(network, block, protocolParametersJSON)](#IotaDocument.unpackFromBlock) ⇒ [Array.<IotaDocument>](#IotaDocument) + * [.unpackFromBlock(network, block, protocolResponseJson)](#IotaDocument.unpackFromBlock) ⇒ [Array.<IotaDocument>](#IotaDocument) * [.fromJSON(json)](#IotaDocument.fromJSON) ⇒ [IotaDocument](#IotaDocument) @@ -2438,13 +2438,13 @@ encoded in the `AliasId` alone. -### IotaDocument.unpackFromBlock(network, block, protocolParametersJSON) ⇒ [Array.<IotaDocument>](#IotaDocument) +### IotaDocument.unpackFromBlock(network, block, protocolResponseJson) ⇒ [Array.<IotaDocument>](#IotaDocument) Returns all DID documents of the Alias Outputs contained in the block's transaction payload outputs, if any. Errors if any Alias Output does not contain a valid or empty DID Document. -protocolParametersJSON can be obtained from a `Client`. +`protocolResponseJson` can be obtained from a `Client`. **Kind**: static method of [IotaDocument](#IotaDocument) @@ -2452,7 +2452,7 @@ protocolParametersJSON can be obtained from a `Client`. | --- | --- | | network | string | | block | IBlock | -| protocolParametersJSON | string | +| protocolResponseJson | string | @@ -3676,7 +3676,7 @@ Constructs a new `Resolver`. # Errors If both a `client` is given and the `handlers` map contains the "iota" key the construction process -will throw an error as it is then ambiguous what should be . +will throw an error because the handler for the "iota" method then becomes ambiguous. | Param | Type | diff --git a/bindings/wasm/package-lock.json b/bindings/wasm/package-lock.json index 580d75a741..b2bb6c17a6 100644 --- a/bindings/wasm/package-lock.json +++ b/bindings/wasm/package-lock.json @@ -39,7 +39,7 @@ "node": ">=16" }, "peerDependencies": { - "@iota/iota-client-wasm": "^0.5.0-alpha.4", + "@iota/iota-client-wasm": "^0.5.0-alpha.5", "@iota/iota.js": "^1.9.0-stardust.25" } }, @@ -191,9 +191,9 @@ } }, "node_modules/@iota/iota-client-wasm": { - "version": "0.5.0-alpha.4", - "resolved": "https://registry.npmjs.org/@iota/iota-client-wasm/-/iota-client-wasm-0.5.0-alpha.4.tgz", - "integrity": "sha512-nz2vgtol3go+pjNlvrU7QoETXlkPEKd1cJN3S8eV09BL4pcnF+Y5EzkLyJuaPxqH7hc7wZAA9KebMUeKkWE+vQ==", + "version": "0.5.0-alpha.5", + "resolved": "https://registry.npmjs.org/@iota/iota-client-wasm/-/iota-client-wasm-0.5.0-alpha.5.tgz", + "integrity": "sha512-FzyHMxBtwcPcCqLYk4um5pLk8KqCIWiSdE3c1bX4iTv0IH7EdM9G9js/GILFc2KlzWKYZK2L08xG0ogcrCPIHA==", "peer": true, "dependencies": { "@iota/types": "^1.0.0-beta.11", @@ -7123,9 +7123,9 @@ } }, "@iota/iota-client-wasm": { - "version": "0.5.0-alpha.4", - "resolved": "https://registry.npmjs.org/@iota/iota-client-wasm/-/iota-client-wasm-0.5.0-alpha.4.tgz", - "integrity": "sha512-nz2vgtol3go+pjNlvrU7QoETXlkPEKd1cJN3S8eV09BL4pcnF+Y5EzkLyJuaPxqH7hc7wZAA9KebMUeKkWE+vQ==", + "version": "0.5.0-alpha.5", + "resolved": "https://registry.npmjs.org/@iota/iota-client-wasm/-/iota-client-wasm-0.5.0-alpha.5.tgz", + "integrity": "sha512-FzyHMxBtwcPcCqLYk4um5pLk8KqCIWiSdE3c1bX4iTv0IH7EdM9G9js/GILFc2KlzWKYZK2L08xG0ogcrCPIHA==", "peer": true, "requires": { "@iota/types": "^1.0.0-beta.11", diff --git a/bindings/wasm/package.json b/bindings/wasm/package.json index c764f76bf1..f561e99c0c 100644 --- a/bindings/wasm/package.json +++ b/bindings/wasm/package.json @@ -54,11 +54,11 @@ "node/*" ], "devDependencies": { - "big-integer": "^1.6.51", "@iota/crypto.js": "^1.9.0-stardust.6", "@iota/util.js": "^1.9.0-stardust.5", "@transmute/did-key-ed25519": "0.3.0-unstable.9", "@types/mocha": "^9.1.0", + "big-integer": "^1.6.51", "concurrently": "^7.0.0", "copy-webpack-plugin": "^7.0.0", "cypress": "^10.6.0", @@ -81,7 +81,7 @@ "node-fetch": "^2.6.7" }, "peerDependencies": { - "@iota/iota-client-wasm": "^0.5.0-alpha.4", + "@iota/iota-client-wasm": "^0.5.0-alpha.5", "@iota/iota.js": "^1.9.0-stardust.25" }, "engines": { diff --git a/bindings/wasm/src/error.rs b/bindings/wasm/src/error.rs index a7f01ce7e5..afa05c5131 100644 --- a/bindings/wasm/src/error.rs +++ b/bindings/wasm/src/error.rs @@ -160,16 +160,16 @@ impl From for WasmError<'_> { impl From for WasmError<'_> { fn from(error: identity_iota::iota::block::Error) -> Self { Self { - name: Cow::Borrowed("bee_block::Error"), + name: Cow::Borrowed("iota_types::block::Error"), message: Cow::Owned(error.to_string()), } } } -impl From for WasmError<'_> { - fn from(error: bee_api_types::error::Error) -> Self { +impl From for WasmError<'_> { + fn from(error: iota_types::api::error::Error) -> Self { Self { - name: Cow::Borrowed("bee_api_types::Error"), + name: Cow::Borrowed("iota_types::api::Error"), message: Cow::Owned(error.to_string()), } } diff --git a/bindings/wasm/src/iota/identity_client_ext.rs b/bindings/wasm/src/iota/identity_client_ext.rs index 492354a757..d173d59dee 100644 --- a/bindings/wasm/src/iota/identity_client_ext.rs +++ b/bindings/wasm/src/iota/identity_client_ext.rs @@ -1,7 +1,6 @@ // Copyright 2020-2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use bee_block::output::RentStructureBuilder; use identity_iota::iota::block::address::dto::AddressDto; use identity_iota::iota::block::address::Address; use identity_iota::iota::block::output::dto::AliasOutputDto; @@ -10,6 +9,7 @@ use identity_iota::iota::block::output::RentStructure; use identity_iota::iota::IotaDID; use identity_iota::iota::IotaDocument; use identity_iota::iota::IotaIdentityClientExt; +use iota_types::block::output::RentStructureBuilder; use js_sys::Promise; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; diff --git a/bindings/wasm/src/iota/iota_did.rs b/bindings/wasm/src/iota/iota_did.rs index cfacfb41a7..423b047102 100644 --- a/bindings/wasm/src/iota/iota_did.rs +++ b/bindings/wasm/src/iota/iota_did.rs @@ -1,11 +1,11 @@ // Copyright 2020-2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use bee_block::output::AliasId; use identity_iota::did::DIDError; use identity_iota::did::DID; use identity_iota::iota::IotaDID; use identity_iota::iota::NetworkName; +use iota_types::block::output::AliasId; use wasm_bindgen::prelude::*; use crate::error::Result; diff --git a/bindings/wasm/src/iota/iota_document.rs b/bindings/wasm/src/iota/iota_document.rs index c64e7c1d5e..b49ddf954f 100644 --- a/bindings/wasm/src/iota/iota_document.rs +++ b/bindings/wasm/src/iota/iota_document.rs @@ -1,8 +1,6 @@ // Copyright 2020-2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use bee_api_types::responses::ProtocolResponse; -use bee_block::protocol::ProtocolParameters; use identity_iota::core::FromJson; use identity_iota::core::OneOrMany; use identity_iota::core::OrderedSet; @@ -22,6 +20,8 @@ use identity_iota::iota::IotaDocument; use identity_iota::iota::IotaVerificationMethod; use identity_iota::iota::NetworkName; use identity_iota::iota::StateMetadataEncoding; +use iota_types::api::response::ProtocolResponse; +use iota_types::block::protocol::ProtocolParameters; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; @@ -431,7 +431,7 @@ impl WasmIotaDocument { #[wasm_bindgen(js_name = unpackFromBlock)] pub fn unpack_from_block(network: String, block: &IBlock, protocolResponseJson: String) -> Result { let network_name: NetworkName = NetworkName::try_from(network).wasm_result()?; - let block_dto: bee_block::BlockDto = block + let block_dto: iota_types::block::BlockDto = block .into_serde() .map_err(|err| { identity_iota::iota::Error::JsError(format!("unpackFromBlock failed to deserialize BlockDto: {}", err)) @@ -440,7 +440,7 @@ impl WasmIotaDocument { let protocol_response: ProtocolResponse = ProtocolResponse::from_json(&protocolResponseJson).wasm_result()?; let protocol_parameters: ProtocolParameters = ProtocolParameters::try_from(protocol_response).wasm_result()?; - let block: bee_block::Block = bee_block::Block::try_from_dto(&block_dto, &protocol_parameters) + let block: iota_types::block::Block = iota_types::block::Block::try_from_dto(&block_dto, &protocol_parameters) .map_err(|err| { identity_iota::iota::Error::JsError(format!("unpackFromBlock failed to convert BlockDto: {}", err)) }) diff --git a/examples/1_advanced/1_did_issues_nft.rs b/examples/1_advanced/1_did_issues_nft.rs index a10d2ad26c..66aa7ec60e 100644 --- a/examples/1_advanced/1_did_issues_nft.rs +++ b/examples/1_advanced/1_did_issues_nft.rs @@ -9,7 +9,7 @@ use identity_iota::iota::IotaDID; use identity_iota::iota::IotaDocument; use identity_iota::iota::IotaIdentityClientExt; use identity_iota::iota::NetworkName; -use iota_client::api_types::responses::OutputResponse; +use iota_client::api_types::response::OutputResponse; use iota_client::block::address::Address; use iota_client::block::address::AliasAddress; use iota_client::block::output::feature::IssuerFeature; diff --git a/examples/1_advanced/2_nft_owns_did.rs b/examples/1_advanced/2_nft_owns_did.rs index 00c99bce9a..d8a45d727f 100644 --- a/examples/1_advanced/2_nft_owns_did.rs +++ b/examples/1_advanced/2_nft_owns_did.rs @@ -12,7 +12,7 @@ use identity_iota::iota::IotaClientExt; use identity_iota::iota::IotaDocument; use identity_iota::iota::IotaIdentityClientExt; use identity_iota::iota::NetworkName; -use iota_client::api_types::responses::OutputResponse; +use iota_client::api_types::response::OutputResponse; use iota_client::block::address::Address; use iota_client::block::output::unlock_condition::AddressUnlockCondition; use iota_client::block::output::NftId; diff --git a/examples/1_advanced/3_did_issues_tokens.rs b/examples/1_advanced/3_did_issues_tokens.rs index b4ec7ef87e..3deea29f13 100644 --- a/examples/1_advanced/3_did_issues_tokens.rs +++ b/examples/1_advanced/3_did_issues_tokens.rs @@ -18,7 +18,7 @@ use identity_iota::iota::IotaDID; use identity_iota::iota::IotaDocument; use identity_iota::iota::IotaIdentityClientExt; use identity_iota::iota::NetworkName; -use iota_client::api_types::responses::OutputResponse; +use iota_client::api_types::response::OutputResponse; use iota_client::block::address::Address; use iota_client::block::address::AliasAddress; use iota_client::block::output::unlock_condition::ImmutableAliasAddressUnlockCondition; diff --git a/examples/1_advanced/5_alias_output_history.rs b/examples/1_advanced/5_alias_output_history.rs index b68384c354..da24b3e7d6 100644 --- a/examples/1_advanced/5_alias_output_history.rs +++ b/examples/1_advanced/5_alias_output_history.rs @@ -21,7 +21,7 @@ use identity_iota::iota::IotaDocument; use identity_iota::iota::IotaIdentityClient; use identity_iota::iota::IotaIdentityClientExt; use identity_iota::iota::IotaService; -use iota_client::api_types::responses::OutputMetadataResponse; +use iota_client::api_types::response::OutputMetadataResponse; use iota_client::block::input::Input; use iota_client::block::output::AliasId; use iota_client::block::output::AliasOutput; diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 28351154c0..276614e7c0 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -9,8 +9,8 @@ publish = false anyhow = "1.0.62" did-key = { version = "0.1.1", default-features = false } identity_iota = { path = "../identity_iota" } -iota-client = { version = "2.0.1-rc.1", default-features = false, features = ["tls", "stronghold"] } -primitive-types = "0.11.1" +iota-client = { version = "2.0.1-rc.3", default-features = false, features = ["tls", "stronghold"] } +primitive-types = "0.12.1" rand = "0.8.5" tokio = { version = "1.20.1", default-features = false, features = ["rt"] } diff --git a/identity_diff/src/option.rs b/identity_diff/src/option.rs index 0fa760dd28..887890de46 100644 --- a/identity_diff/src/option.rs +++ b/identity_diff/src/option.rs @@ -10,7 +10,7 @@ use std::fmt::Formatter; use crate::Diff; /// A `DiffOption` type which represents a Diffed `Option`. By default this value is untagged for `serde`. It -/// also converts `to` and `from` Option when serialized/deserialized +/// also converts `to` and `from` `Option` when serialized/deserialized #[derive(Clone, PartialEq, Deserialize, Serialize)] #[serde(untagged, into = "Option", from = "Option")] pub enum DiffOption { diff --git a/identity_iota_core/Cargo.toml b/identity_iota_core/Cargo.toml index c91e208c51..e5e1ac902b 100644 --- a/identity_iota_core/Cargo.toml +++ b/identity_iota_core/Cargo.toml @@ -12,15 +12,14 @@ rust-version = "1.62" description = "An IOTA Ledger integration for the IOTA DID Method." [dependencies] -# Ensure bee-block always matches the version used by iota-client. -bee-block = { version = "1.0", default-features = false, features = ["std"], optional = true } identity_core = { version = "=0.7.0-alpha.2", path = "../identity_core", default-features = false } identity_credential = { version = "=0.7.0-alpha.2", path = "../identity_credential", default-features = false, features = ["validator"] } identity_did = { version = "=0.7.0-alpha.2", path = "../identity_did", default-features = false } +iota-types = { version = "1.0.0-rc.1", default-features = false, features = ["block", "std"], optional = true } async-trait = { version = "0.1.56", default-features = false, optional = true } futures = { version = "0.3" } -iota-client = { version = "2.0.1-rc.1", default-features = false, features = ["tls"], optional = true } +iota-client = { version = "2.0.1-rc.3", default-features = false, features = ["tls"], optional = true } num-derive = { version = "0.3", default-features = false } num-traits = { version = "0.2", default-features = false, features = ["std"] } once_cell = { version = "1", default-features = false, features = ["std"] } @@ -44,7 +43,7 @@ rustdoc-args = ["--cfg", "docsrs"] [features] default = ["client", "iota-client", "revocation-bitmap", "send-sync-client-ext"] # Exposes the `IotaIdentityClient` and `IotaIdentityClientExt` traits. -client = ["dep:async-trait", "dep:bee-block"] +client = ["dep:async-trait", "dep:iota-types"] # Enables the iota-client dependency, the client trait implementations for it, and the `IotaClientExt` trait. iota-client = ["dep:iota-client", "client"] # Enables revocation with `RevocationBitmap2022`. diff --git a/identity_iota_core/src/client/iota_client.rs b/identity_iota_core/src/client/iota_client.rs index 3ce7ac5ba9..be87ae197f 100644 --- a/identity_iota_core/src/client/iota_client.rs +++ b/identity_iota_core/src/client/iota_client.rs @@ -1,7 +1,7 @@ // Copyright 2020-2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_client::api_types::responses::OutputResponse; +use iota_client::api_types::response::OutputResponse; use iota_client::secret::SecretManager; use iota_client::Client; diff --git a/identity_iota_core/src/document/iota_document.rs b/identity_iota_core/src/document/iota_document.rs index a872ce19d3..f4932b628a 100644 --- a/identity_iota_core/src/document/iota_document.rs +++ b/identity_iota_core/src/document/iota_document.rs @@ -475,7 +475,6 @@ impl TryMethod for IotaDocument { #[cfg(test)] mod tests { - use bee_block::protocol::ProtocolParameters; use identity_core::common::Timestamp; use identity_core::convert::FromJson; use identity_core::convert::ToJson; @@ -485,6 +484,7 @@ mod tests { use identity_did::verifiable::VerifiableProperties; use identity_did::verification::MethodData; use identity_did::verification::MethodType; + use iota_types::block::protocol::ProtocolParameters; use crate::block::address::Address; use crate::block::address::AliasAddress; diff --git a/identity_iota_core/src/lib.rs b/identity_iota_core/src/lib.rs index 8ce27a8e30..f4559974b6 100644 --- a/identity_iota_core/src/lib.rs +++ b/identity_iota_core/src/lib.rs @@ -4,11 +4,11 @@ #![forbid(unsafe_code)] #![allow(clippy::upper_case_acronyms)] -// Re-export the `bee_block` crate for implementer convenience. -#[cfg(all(feature = "client", not(feature = "iota-client")))] -pub use bee_block as block; #[cfg(feature = "iota-client")] pub use iota_client::block; +// Re-export the `iota_types::block` module for implementer convenience. +#[cfg(all(feature = "client", not(feature = "iota-client")))] +pub use iota_types::block; #[cfg(feature = "client")] pub use client::*;