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

Update iota client 2.0.1 rc.3 #1062

Merged
merged 9 commits into from
Oct 28, 2022
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
4 changes: 1 addition & 3 deletions bindings/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
12 changes: 6 additions & 6 deletions bindings/wasm/docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ The default Tangle network (`"iota"`).
<a name="IotaDID.fromAliasId"></a>

### IotaDID.fromAliasId(aliasId, network) ⇒ [<code>IotaDID</code>](#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 [<code>IotaDID</code>](#IotaDID)
Expand Down Expand Up @@ -2012,7 +2012,7 @@ Deserializes an instance from a JSON object.
* _static_
* [.newWithId(id)](#IotaDocument.newWithId) ⇒ [<code>IotaDocument</code>](#IotaDocument)
* [.unpackFromOutput(did, aliasOutput, allowEmpty, tokenSupply)](#IotaDocument.unpackFromOutput) ⇒ [<code>IotaDocument</code>](#IotaDocument)
* [.unpackFromBlock(network, block, protocolParametersJSON)](#IotaDocument.unpackFromBlock) ⇒ [<code>Array.&lt;IotaDocument&gt;</code>](#IotaDocument)
* [.unpackFromBlock(network, block, protocolResponseJson)](#IotaDocument.unpackFromBlock) ⇒ [<code>Array.&lt;IotaDocument&gt;</code>](#IotaDocument)
* [.fromJSON(json)](#IotaDocument.fromJSON) ⇒ [<code>IotaDocument</code>](#IotaDocument)

<a name="new_IotaDocument_new"></a>
Expand Down Expand Up @@ -2438,21 +2438,21 @@ encoded in the `AliasId` alone.

<a name="IotaDocument.unpackFromBlock"></a>

### IotaDocument.unpackFromBlock(network, block, protocolParametersJSON) ⇒ [<code>Array.&lt;IotaDocument&gt;</code>](#IotaDocument)
### IotaDocument.unpackFromBlock(network, block, protocolResponseJson) ⇒ [<code>Array.&lt;IotaDocument&gt;</code>](#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 [<code>IotaDocument</code>](#IotaDocument)

| Param | Type |
| --- | --- |
| network | <code>string</code> |
| block | <code>IBlock</code> |
| protocolParametersJSON | <code>string</code> |
| protocolResponseJson | <code>string</code> |

<a name="IotaDocument.fromJSON"></a>

Expand Down Expand Up @@ -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 |
Expand Down
14 changes: 7 additions & 7 deletions bindings/wasm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bindings/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions bindings/wasm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,16 @@ impl From<serde_json::Error> for WasmError<'_> {
impl From<identity_iota::iota::block::Error> 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<bee_api_types::error::Error> for WasmError<'_> {
fn from(error: bee_api_types::error::Error) -> Self {
impl From<iota_types::api::error::Error> 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()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/src/iota/identity_client_ext.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/src/iota/iota_did.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 4 additions & 4 deletions bindings/wasm/src/iota/iota_document.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -431,7 +431,7 @@ impl WasmIotaDocument {
#[wasm_bindgen(js_name = unpackFromBlock)]
pub fn unpack_from_block(network: String, block: &IBlock, protocolResponseJson: String) -> Result<ArrayIotaDocument> {
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))
Expand All @@ -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))
})
Expand Down
2 changes: 1 addition & 1 deletion examples/1_advanced/1_did_issues_nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/1_advanced/2_nft_owns_did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/1_advanced/3_did_issues_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/1_advanced/5_alias_output_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
2 changes: 1 addition & 1 deletion identity_diff/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::fmt::Formatter;
use crate::Diff;

/// A `DiffOption<T>` type which represents a Diffed `Option<T>`. By default this value is untagged for `serde`. It
/// also converts `to` and `from` Option<T> when serialized/deserialized
/// also converts `to` and `from` `Option<T>` when serialized/deserialized
#[derive(Clone, PartialEq, Deserialize, Serialize)]
#[serde(untagged, into = "Option<T>", from = "Option<T>")]
pub enum DiffOption<T: Diff> {
Expand Down
7 changes: 3 additions & 4 deletions identity_iota_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion identity_iota_core/src/client/iota_client.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion identity_iota_core/src/document/iota_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions identity_iota_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down