diff --git a/Cargo.lock b/Cargo.lock index f0b2b32d3..9c1a6e360 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -318,9 +318,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.12.3" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" [[package]] name = "byteorder" @@ -936,6 +936,18 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "getset" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "h2" version = "0.3.15" @@ -971,6 +983,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash 0.8.2", + "serde", ] [[package]] @@ -1318,9 +1331,9 @@ dependencies = [ [[package]] name = "iota-pow" -version = "1.0.0-rc.2" +version = "1.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f49910d74ef88979bf7bd373b6e46fa7ac850389fed62b444a47380e027e570" +checksum = "73b3ffe5d6ada4c62fa5e5d0a7622893af02ad431d6a6144979686662eee5f1c" dependencies = [ "instant", "iota-crypto", @@ -1330,14 +1343,15 @@ dependencies = [ [[package]] name = "iota-types" -version = "1.0.0-rc.4" +version = "1.0.0-rc.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a9b56dca23cabbce1f39f1b7e5cd7a01048141a29d47cd592c1ca64418f65d" +checksum = "4ac00be923ed4f7ae33c03628d24d03c920f0d6c27806daae57ce735ac240f96" dependencies = [ "bech32", "bitflags", "bytemuck", "derive_more", + "getset", "hashbrown 0.13.2", "hex", "iota-crypto", @@ -1350,6 +1364,7 @@ dependencies = [ "serde", "serde-big-array", "serde_json", + "serde_repr", "thiserror", ] @@ -2306,6 +2321,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" diff --git a/Cargo.toml b/Cargo.toml index 478147665..b059f8be6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ futures = { version = "0.3", default-features = false } humantime = { version = "2.1.0", default-features = false } humantime-serde = { version = "1.1", default-features = false } iota-crypto = { version = "0.15", default-features = false, features = [ "blake2b" ] } -iota-types = { version = "1.0.0-rc.4", default-features = false, features = [ "api", "block", "std" ] } +iota-types = { version = "1.0.0-rc.5", default-features = false, features = [ "api", "block", "std" ] } mongodb = { version = "2.3", default-features = false, features = [ "tokio-runtime" ] } packable = { version = "0.7", default-features = false } pin-project = { version = "1.0", default-features = false } @@ -76,7 +76,7 @@ inx = { version = "1.0.0-beta.8", default-features = false, optional = true } tonic = { version = "0.8", default-features = false, optional = true } [dev-dependencies] -iota-types = { version = "1.0.0-rc.4", default-features = false, features = [ "api", "block", "std", "rand" ] } +iota-types = { version = "1.0.0-rc.5", default-features = false, features = [ "api", "block", "std", "rand" ] } rand = { version = "0.8", default-features = false, features = [ "std" ] } [features] diff --git a/src/bin/inx-chronicle/api/stardust/core/responses.rs b/src/bin/inx-chronicle/api/stardust/core/responses.rs index c04e19cc5..a24176521 100644 --- a/src/bin/inx-chronicle/api/stardust/core/responses.rs +++ b/src/bin/inx-chronicle/api/stardust/core/responses.rs @@ -1,7 +1,7 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_types::{api::response as iota, block::protocol::dto::ProtocolParametersDto}; +use iota_types::{api::core::response as iota, block::protocol::dto::ProtocolParametersDto}; use serde::{Deserialize, Serialize}; use crate::api::responses::impl_success_response; @@ -20,7 +20,7 @@ pub struct InfoResponse { impl_success_response!(InfoResponse); /// A wrapper struct that allows us to implement [`IntoResponse`](axum::response::IntoResponse) for the foreign -/// responses from [`iota_types`](iota_types::api::response). +/// responses from [`iota_types`](iota_types::api::core::response). #[derive(Clone, Debug, Serialize, derive_more::From)] pub struct IotaResponse(T); @@ -31,7 +31,7 @@ impl axum::response::IntoResponse for IotaResponse { } /// A wrapper struct that allows us to implement [`IntoResponse`](axum::response::IntoResponse) for the foreign -/// raw responses from [`iota_types`](iota_types::api::response). +/// raw responses from [`iota_types`](iota_types::api::core::response). #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(untagged)] pub enum IotaRawResponse { diff --git a/src/bin/inx-chronicle/api/stardust/core/routes.rs b/src/bin/inx-chronicle/api/stardust/core/routes.rs index 120a85b50..35470eba9 100644 --- a/src/bin/inx-chronicle/api/stardust/core/routes.rs +++ b/src/bin/inx-chronicle/api/stardust/core/routes.rs @@ -31,16 +31,16 @@ use chronicle::{ }; use futures::TryStreamExt; use iota_types::{ - api::{ + api::core::{ dto::ReceiptDto, response::{ self as iota, BaseTokenResponse, BlockMetadataResponse, ConfirmedMilestoneResponse, - LatestMilestoneResponse, OutputMetadataResponse, OutputWithMetadataResponse, ReceiptsResponse, - StatusResponse, TreasuryResponse, UtxoChangesResponse, + LatestMilestoneResponse, OutputWithMetadataResponse, ReceiptsResponse, StatusResponse, TreasuryResponse, + UtxoChangesResponse, }, }, block::{ - output::dto::RentStructureDto, + output::dto::{OutputMetadataDto, RentStructureDto}, payload::{dto::MilestonePayloadDto, milestone::option::dto::MilestoneOptionDto}, protocol::dto::ProtocolParametersDto, BlockDto, @@ -246,11 +246,8 @@ async fn block_metadata( Ok(create_block_metadata_response(block_id, metadata).into()) } -fn create_output_metadata_response( - metadata: OutputMetadataResult, - ledger_index: MilestoneIndex, -) -> iota::OutputMetadataResponse { - iota::OutputMetadataResponse { +fn create_output_metadata_response(metadata: OutputMetadataResult, ledger_index: MilestoneIndex) -> OutputMetadataDto { + OutputMetadataDto { block_id: metadata.block_id.to_hex(), transaction_id: metadata.output_id.transaction_id.to_hex(), output_index: metadata.output_id.index, @@ -313,7 +310,7 @@ async fn output( async fn output_metadata( database: Extension, Path(output_id): Path, -) -> ApiResult> { +) -> ApiResult> { let ledger_index = database .collection::() .get_ledger_index() diff --git a/src/types/ledger/inclusion_state.rs b/src/types/ledger/inclusion_state.rs index 6a622af1e..6b37068e5 100644 --- a/src/types/ledger/inclusion_state.rs +++ b/src/types/ledger/inclusion_state.rs @@ -1,7 +1,7 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_types::api::dto as iota; +use iota_types::api::core::dto as iota; use mongodb::bson::Bson; use serde::{Deserialize, Serialize};