diff --git a/sdk/src/client/node_api/core/routes.rs b/sdk/src/client/node_api/core/routes.rs index 486d4237c6..04351d165e 100644 --- a/sdk/src/client/node_api/core/routes.rs +++ b/sdk/src/client/node_api/core/routes.rs @@ -214,7 +214,7 @@ impl ClientInner { Ok(response.block_id) } - /// Finds a block by its BlockId. This method returns the given block object. + /// Finds a block by its ID and returns it as object. /// GET /api/core/v3/blocks/{BlockId} pub async fn get_block(&self, block_id: &BlockId) -> Result { let path = &format!("api/core/v3/blocks/{block_id}"); @@ -229,7 +229,7 @@ impl ClientInner { Ok(Block::try_from_dto(dto, &self.get_protocol_parameters().await?)?) } - /// Finds a block by its BlockId. This method returns the given block raw data. + /// Finds a block by its ID and returns it as raw bytes. /// GET /api/core/v3/blocks/{BlockId} pub async fn get_block_raw(&self, block_id: &BlockId) -> Result> { let path = &format!("api/core/v3/blocks/{block_id}"); @@ -255,7 +255,7 @@ impl ClientInner { // UTXO routes. - /// Finds an output, as JSON, by its OutputId (TransactionId + output_index). + /// Finds an output by its ID and returns it as object. /// GET /api/core/v3/outputs/{outputId} pub async fn get_output(&self, output_id: &OutputId) -> Result { let path = &format!("api/core/v3/outputs/{output_id}"); @@ -274,7 +274,7 @@ impl ClientInner { Ok(OutputWithMetadata::new(output, metadata)) } - /// Finds an output, as raw bytes, by its OutputId (TransactionId + output_index). + /// Finds an output by its ID and returns it as raw bytes. /// GET /api/core/v3/outputs/{outputId} pub async fn get_output_raw(&self, output_id: &OutputId) -> Result> { let path = &format!("api/core/v3/outputs/{output_id}"); @@ -286,7 +286,7 @@ impl ClientInner { .await } - /// Get the metadata for a given `OutputId` (TransactionId + output_index). + /// Finds output metadata by output ID. /// GET /api/core/v3/outputs/{outputId}/metadata pub async fn get_output_metadata(&self, output_id: &OutputId) -> Result { let path = &format!("api/core/v3/outputs/{output_id}/metadata"); @@ -301,7 +301,7 @@ impl ClientInner { Ok(OutputMetadata::try_from(metadata)?) } - /// Returns the block, as object, that was included in the ledger for a given TransactionId. + /// Returns the block that was included in the ledger for a given transaction ID, as object. /// GET /api/core/v3/transactions/{transactionId}/included-block pub async fn get_included_block(&self, transaction_id: &TransactionId) -> Result { let path = &format!("api/core/v3/transactions/{transaction_id}/included-block"); @@ -316,7 +316,7 @@ impl ClientInner { Ok(Block::try_from_dto(dto, &self.get_protocol_parameters().await?)?) } - /// Returns the block, as raw bytes, that was included in the ledger for a given TransactionId. + /// Returns the block that was included in the ledger for a given transaction ID, as object, as raw bytes. /// GET /api/core/v3/transactions/{transactionId}/included-block pub async fn get_included_block_raw(&self, transaction_id: &TransactionId) -> Result> { let path = &format!("api/core/v3/transactions/{transaction_id}/included-block"); @@ -342,7 +342,7 @@ impl ClientInner { // Commitments routes. - /// Gets the slot commitment by the given slot commitment id. + /// Finds a slot commitment by its ID and returns it as object. /// GET /api/core/v3/commitments/{commitmentId} pub async fn get_slot_commitment_by_id(&self, slot_commitment_id: &SlotCommitmentId) -> Result { let path = &format!("api/core/v3/commitments/{slot_commitment_id}"); @@ -354,7 +354,7 @@ impl ClientInner { .await } - /// Gets the slot commitment, as raw bytes, by the given slot commitment id. + /// Finds a slot commitment by its ID and returns it as raw bytes. /// GET /api/core/v3/commitments/{commitmentId} pub async fn get_slot_commitment_by_id_raw(&self, slot_commitment_id: &SlotCommitmentId) -> Result> { let path = &format!("api/core/v3/commitments/{slot_commitment_id}"); @@ -366,7 +366,7 @@ impl ClientInner { .await } - /// Gets the slot commitment by the given slot index. + /// Finds a slot commitment by slot index and returns it as object. /// GET /api/core/v3/commitments/by-index/{index} pub async fn get_slot_commitment_by_index(&self, slot_index: &SlotIndex) -> Result { let path = &format!("api/core/v3/commitments/by-index/{slot_index}"); @@ -378,7 +378,7 @@ impl ClientInner { .await } - /// Gets the slot commitment, as raw bytes, by the given slot index. + /// Finds a slot commitment by slot index and returns it as raw bytes. /// GET /api/core/v3/commitments/by-index/{index} pub async fn get_slot_commitment_by_index_raw(&self, slot_index: &SlotIndex) -> Result> { let path = &format!("api/core/v3/commitments/by-index/{slot_index}"); diff --git a/sdk/src/types/block/output/metadata.rs b/sdk/src/types/block/output/metadata.rs index 5475006aea..9408be13a7 100644 --- a/sdk/src/types/block/output/metadata.rs +++ b/sdk/src/types/block/output/metadata.rs @@ -1,7 +1,7 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use crate::types::block::{output::OutputId, payload::transaction::TransactionId, BlockId}; +use crate::types::block::{output::OutputId, payload::transaction::TransactionId, slot::SlotCommitmentId, BlockId}; /// Metadata of an [`Output`](crate::types::block::output::Output). #[derive(Clone, Debug, Eq, PartialEq, Hash)] @@ -11,27 +11,23 @@ use crate::types::block::{output::OutputId, payload::transaction::TransactionId, serde(rename_all = "camelCase") )] pub struct OutputMetadata { - /// The identifier of the block in which the output was included. + /// The ID of the block in which the output was included. block_id: BlockId, - /// The identifier of the output. + /// The ID of the output. output_id: OutputId, /// Whether the output is spent or not. is_spent: bool, - /// If spent, the index of the milestone in which the output was spent. + // Commitment ID that includes the spent output. #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - milestone_index_spent: Option, - /// If spent, the timestamp of the milestone in which the output was spent. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - milestone_timestamp_spent: Option, - /// If spent, the identifier of the transaction that spent the output. + commitment_id_spent: Option, + // Transaction ID that spent the output. #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] transaction_id_spent: Option, - /// The index of the milestone that booked the output. - milestone_index_booked: u32, - /// The timestamp of the milestone that booked the output. - milestone_timestamp_booked: u32, - /// The index of ledger when the output was fetched. - ledger_index: u32, + /// Commitment ID that includes the output. + #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] + included_commitment_id: Option, + /// Latest commitment ID of the node. + latest_commitment_id: SlotCommitmentId, } impl OutputMetadata { @@ -41,37 +37,33 @@ impl OutputMetadata { block_id: BlockId, output_id: OutputId, is_spent: bool, - milestone_index_spent: Option, - milestone_timestamp_spent: Option, + commitment_id_spent: Option, transaction_id_spent: Option, - milestone_index_booked: u32, - milestone_timestamp_booked: u32, - ledger_index: u32, + included_commitment_id: Option, + latest_commitment_id: SlotCommitmentId, ) -> Self { Self { block_id, output_id, is_spent, - milestone_index_spent, - milestone_timestamp_spent, + commitment_id_spent, transaction_id_spent, - milestone_index_booked, - milestone_timestamp_booked, - ledger_index, + included_commitment_id, + latest_commitment_id, } } - /// Returns the block id of the [`OutputMetadata`]. + /// Returns the block ID of the [`OutputMetadata`]. pub fn block_id(&self) -> &BlockId { &self.block_id } - /// Returns the output id of the [`OutputMetadata`]. + /// Returns the output ID of the [`OutputMetadata`]. pub fn output_id(&self) -> &OutputId { &self.output_id } - /// Returns the transaction id of the [`OutputMetadata`]. + /// Returns the transaction ID of the [`OutputMetadata`]. pub fn transaction_id(&self) -> &TransactionId { self.output_id.transaction_id() } @@ -91,34 +83,24 @@ impl OutputMetadata { self.is_spent = spent; } - /// Returns the milestone index spent of the [`OutputMetadata`]. - pub fn milestone_index_spent(&self) -> Option { - self.milestone_index_spent - } - - /// Returns the milestone timestamp spent of the [`OutputMetadata`]. - pub fn milestone_timestamp_spent(&self) -> Option { - self.milestone_timestamp_spent + /// Returns the commitment ID spent of the [`OutputMetadata`]. + pub fn commitment_id_spent(&self) -> Option<&SlotCommitmentId> { + self.commitment_id_spent.as_ref() } - /// Returns the transaction id spent of the [`OutputMetadata`]. + /// Returns the transaction ID spent of the [`OutputMetadata`]. pub fn transaction_id_spent(&self) -> Option<&TransactionId> { self.transaction_id_spent.as_ref() } - /// Returns the milestone index booked of the [`OutputMetadata`]. - pub fn milestone_index_booked(&self) -> u32 { - self.milestone_index_booked - } - - /// Returns the milestone timestamp booked of the [`OutputMetadata`]. - pub fn milestone_timestamp_booked(&self) -> u32 { - self.milestone_timestamp_booked + /// Returns the included commitment ID of the [`OutputMetadata`]. + pub fn included_commitment_id(&self) -> Option<&SlotCommitmentId> { + self.included_commitment_id.as_ref() } - /// Returns the ledger index of the [`OutputMetadata`]. - pub fn ledger_index(&self) -> u32 { - self.ledger_index + /// Returns the latest commitment ID of the [`OutputMetadata`]. + pub fn latest_commitment_id(&self) -> &SlotCommitmentId { + &self.latest_commitment_id } } @@ -141,14 +123,12 @@ pub mod dto { pub output_index: u16, pub is_spent: bool, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub milestone_index_spent: Option, + pub commitment_id_spent: Option, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub milestone_timestamp_spent: Option, + pub transaction_id_spent: Option, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub transaction_id_spent: Option, - pub milestone_index_booked: u32, - pub milestone_timestamp_booked: u32, - pub ledger_index: u32, + pub included_commitment_id: Option, + pub latest_commitment_id: SlotCommitmentId, } impl OutputMetadataDto { @@ -169,16 +149,10 @@ pub mod dto { response.output_index, )?, is_spent: response.is_spent, - milestone_index_spent: response.milestone_index_spent, - milestone_timestamp_spent: response.milestone_timestamp_spent, - transaction_id_spent: response - .transaction_id_spent - .as_ref() - .map(|s| TransactionId::from_str(s)) - .transpose()?, - milestone_index_booked: response.milestone_index_booked, - milestone_timestamp_booked: response.milestone_timestamp_booked, - ledger_index: response.ledger_index, + commitment_id_spent: response.commitment_id_spent, + transaction_id_spent: response.transaction_id_spent, + included_commitment_id: response.included_commitment_id, + latest_commitment_id: response.latest_commitment_id, }) } } @@ -190,12 +164,10 @@ pub mod dto { transaction_id: output_metadata.transaction_id().to_string(), output_index: output_metadata.output_index(), is_spent: output_metadata.is_spent(), - milestone_index_spent: output_metadata.milestone_index_spent(), - milestone_timestamp_spent: output_metadata.milestone_timestamp_spent(), - transaction_id_spent: output_metadata.transaction_id_spent().map(|t| t.to_string()), - milestone_index_booked: output_metadata.milestone_index_booked(), - milestone_timestamp_booked: output_metadata.milestone_timestamp_booked(), - ledger_index: output_metadata.ledger_index(), + commitment_id_spent: output_metadata.commitment_id_spent().cloned(), + transaction_id_spent: output_metadata.transaction_id_spent().cloned(), + included_commitment_id: output_metadata.included_commitment_id().cloned(), + latest_commitment_id: *output_metadata.latest_commitment_id(), } } } diff --git a/sdk/src/types/block/rand/mod.rs b/sdk/src/types/block/rand/mod.rs index 2cab7907d1..9cac72a1fe 100644 --- a/sdk/src/types/block/rand/mod.rs +++ b/sdk/src/types/block/rand/mod.rs @@ -23,6 +23,8 @@ pub mod parents; pub mod payload; /// Module providing random signature generation utilities. pub mod signature; +/// Module providing random slot generation utilities. +pub mod slot; /// Module providing random string generation utilities. pub mod string; /// Module providing random transaction generation utilities. diff --git a/sdk/src/types/block/rand/output/metadata.rs b/sdk/src/types/block/rand/output/metadata.rs index 289f8b5622..0a5223a41f 100644 --- a/sdk/src/types/block/rand/output/metadata.rs +++ b/sdk/src/types/block/rand/output/metadata.rs @@ -4,8 +4,8 @@ use crate::types::block::{ output::OutputMetadata, rand::{ - block::rand_block_id, bool::rand_bool, number::rand_number, option::rand_option, output::rand_output_id, - transaction::rand_transaction_id, + block::rand_block_id, bool::rand_bool, option::rand_option, output::rand_output_id, + slot::rand_slot_commitment_id, transaction::rand_transaction_id, }, }; @@ -15,11 +15,9 @@ pub fn rand_output_metadata() -> OutputMetadata { rand_block_id(), rand_output_id(), rand_bool(), - rand_option(rand_number()), - rand_option(rand_number()), + rand_option(rand_slot_commitment_id()), rand_option(rand_transaction_id()), - rand_number(), - rand_number(), - rand_number(), + rand_option(rand_slot_commitment_id()), + rand_slot_commitment_id(), ) } diff --git a/sdk/src/types/block/rand/slot.rs b/sdk/src/types/block/rand/slot.rs new file mode 100644 index 0000000000..6965444ce7 --- /dev/null +++ b/sdk/src/types/block/rand/slot.rs @@ -0,0 +1,9 @@ +// Copyright 2023 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use crate::types::block::{rand::bytes::rand_bytes_array, slot::SlotCommitmentId}; + +/// Generates a random slot commitment id. +pub fn rand_slot_commitment_id() -> SlotCommitmentId { + SlotCommitmentId::new(rand_bytes_array()) +} diff --git a/sdk/src/wallet/account/mod.rs b/sdk/src/wallet/account/mod.rs index 9b97837c53..7a67509d54 100644 --- a/sdk/src/wallet/account/mod.rs +++ b/sdk/src/wallet/account/mod.rs @@ -354,16 +354,17 @@ impl AccountInner { _ => {} } - if let Some(lower_bound_booked_timestamp) = filter.lower_bound_booked_timestamp { - if output.metadata.milestone_timestamp_booked() < lower_bound_booked_timestamp { - continue; - } - } - if let Some(upper_bound_booked_timestamp) = filter.upper_bound_booked_timestamp { - if output.metadata.milestone_timestamp_booked() > upper_bound_booked_timestamp { - continue; - } - } + // TODO check if we can still filter since milestone_timestamp_booked is gone + // if let Some(lower_bound_booked_timestamp) = filter.lower_bound_booked_timestamp { + // if output.metadata.milestone_timestamp_booked() < lower_bound_booked_timestamp { + // continue; + // } + // } + // if let Some(upper_bound_booked_timestamp) = filter.upper_bound_booked_timestamp { + // if output.metadata.milestone_timestamp_booked() > upper_bound_booked_timestamp { + // continue; + // } + // } if let Some(output_types) = &filter.output_types { if !output_types.contains(&output.output.kind()) { @@ -457,10 +458,12 @@ pub(crate) fn build_transaction_from_payload_and_inputs( .first() .and_then(|i| BlockId::from_str(&i.metadata.block_id).ok()), inclusion_state: InclusionState::Confirmed, - timestamp: inputs - .first() - .and_then(|i| i.metadata.milestone_timestamp_spent.map(|t| t as u128 * 1000)) - .unwrap_or_else(|| crate::utils::unix_timestamp_now().as_millis()), + timestamp: 0, + // TODO check if we keep a timestamp in Transaction since milestone_timestamp_spent is gone + // inputs + // .first() + // .and_then(|i| i.metadata.milestone_timestamp_spent.map(|t| t as u128 * 1000)) + // .unwrap_or_else(|| crate::utils::unix_timestamp_now().as_millis()), transaction_id: tx_id, network_id: tx_essence.network_id(), incoming: true, diff --git a/sdk/tests/client/input_selection/alias_outputs.rs b/sdk/tests/client/input_selection/alias_outputs.rs index 5479bf5eeb..a0b014b708 100644 --- a/sdk/tests/client/input_selection/alias_outputs.rs +++ b/sdk/tests/client/input_selection/alias_outputs.rs @@ -12,10 +12,10 @@ use iota_sdk::{ address::Address, output::{ unlock_condition::{GovernorAddressUnlockCondition, StateControllerAddressUnlockCondition}, - AliasId, AliasOutputBuilder, AliasTransition, Output, OutputMetadata, + AliasId, AliasOutputBuilder, AliasTransition, Output, }, protocol::protocol_parameters, - rand::{block::rand_block_id, output::rand_output_id}, + rand::output::rand_output_metadata, }, }; @@ -2326,7 +2326,7 @@ fn new_state_metadata() { let inputs = [InputSigningData { output: alias_output.clone(), - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }]; @@ -2372,7 +2372,7 @@ fn new_state_metadata_but_same_state_index() { let inputs = [InputSigningData { output: alias_output.clone(), - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }]; diff --git a/sdk/tests/client/input_selection/foundry_outputs.rs b/sdk/tests/client/input_selection/foundry_outputs.rs index f6684359be..f613b1be80 100644 --- a/sdk/tests/client/input_selection/foundry_outputs.rs +++ b/sdk/tests/client/input_selection/foundry_outputs.rs @@ -12,11 +12,10 @@ use iota_sdk::{ address::{Address, AliasAddress}, output::{ unlock_condition::{GovernorAddressUnlockCondition, StateControllerAddressUnlockCondition}, - AliasId, AliasOutputBuilder, AliasTransition, FoundryId, Output, OutputMetadata, SimpleTokenScheme, - TokenId, + AliasId, AliasOutputBuilder, AliasTransition, FoundryId, Output, SimpleTokenScheme, TokenId, }, protocol::protocol_parameters, - rand::{block::rand_block_id, output::rand_output_id}, + rand::output::rand_output_metadata, }, }; @@ -247,7 +246,7 @@ fn melt_native_tokens() { .unwrap(); inputs.push(InputSigningData { output: alias_output, - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }); let outputs = build_outputs([Foundry( @@ -502,7 +501,7 @@ fn simple_foundry_transition_basic_not_needed() { .unwrap(); inputs.push(InputSigningData { output: alias_output, - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }); @@ -577,7 +576,7 @@ fn simple_foundry_transition_basic_not_needed_with_remainder() { .unwrap(); inputs.push(InputSigningData { output: alias_output, - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }); let outputs = build_outputs([Foundry( @@ -727,7 +726,7 @@ fn mint_and_burn_at_the_same_time() { .unwrap(); inputs.push(InputSigningData { output: alias_output, - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }); @@ -784,7 +783,7 @@ fn take_amount_from_alias_and_foundry_to_fund_basic() { .unwrap(); inputs.push(InputSigningData { output: alias_output, - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }); let outputs = build_outputs([Basic( @@ -998,7 +997,7 @@ fn foundry_in_outputs_and_required() { .unwrap(); inputs.push(InputSigningData { output: alias_output, - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }); let outputs = build_outputs([Foundry( diff --git a/sdk/tests/client/input_selection/nft_outputs.rs b/sdk/tests/client/input_selection/nft_outputs.rs index cfc449d908..ac3e9549b5 100644 --- a/sdk/tests/client/input_selection/nft_outputs.rs +++ b/sdk/tests/client/input_selection/nft_outputs.rs @@ -10,12 +10,9 @@ use iota_sdk::{ }, types::block::{ address::Address, - output::{ - feature::MetadataFeature, unlock_condition::AddressUnlockCondition, NftId, NftOutputBuilder, Output, - OutputMetadata, - }, + output::{feature::MetadataFeature, unlock_condition::AddressUnlockCondition, NftId, NftOutputBuilder, Output}, protocol::protocol_parameters, - rand::{block::rand_block_id, output::rand_output_id}, + rand::output::rand_output_metadata, }, }; @@ -1199,7 +1196,7 @@ fn changed_immutable_metadata() { let inputs = [InputSigningData { output: nft_output.clone(), - output_metadata: OutputMetadata::new(rand_block_id(), rand_output_id(), false, None, None, None, 0, 0, 0), + output_metadata: rand_output_metadata(), chain: None, }]; diff --git a/sdk/tests/client/input_signing_data.rs b/sdk/tests/client/input_signing_data.rs index e4696e4dfc..00c9694b22 100644 --- a/sdk/tests/client/input_signing_data.rs +++ b/sdk/tests/client/input_signing_data.rs @@ -12,7 +12,9 @@ use iota_sdk::{ types::block::{ address::Address, output::{unlock_condition::AddressUnlockCondition, BasicOutput, OutputId, OutputMetadata}, + payload::transaction::TransactionId, protocol::protocol_parameters, + slot::SlotCommitmentId, BlockId, }, }; @@ -36,12 +38,25 @@ fn input_signing_data_conversion() { BlockId::from_str("0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda").unwrap(), OutputId::from_str("0xbce525324af12eda02bf7927e92cea3a8e8322d0f41966271443e6c3b245a4400000").unwrap(), false, - None, - None, - None, - 0, - 0, - 0, + Some( + SlotCommitmentId::from_str( + "0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d82bf96689", + ) + .unwrap(), + ), + Some( + TransactionId::from_str("0x24a1f46bdb6b2bf38f1c59f73cdd4ae5b418804bb231d76d06fbf246498d5883").unwrap(), + ), + Some( + SlotCommitmentId::from_str( + "0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d82bf96689", + ) + .unwrap(), + ), + SlotCommitmentId::from_str( + "0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d82bf96689", + ) + .unwrap(), ), chain: Some(bip44_chain), }; @@ -53,7 +68,7 @@ fn input_signing_data_conversion() { InputSigningData::try_from_dto(input_signing_data_dto.clone(), protocol_parameters.token_supply()).unwrap(); assert_eq!(input_signing_data, restored_input_signing_data); - let input_signing_data_dto_str = r#"{"output":{"type":3,"amount":"1000000","unlockConditions":[{"type":0,"address":{"type":0,"pubKeyHash":"0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]},"outputMetadata":{"blockId":"0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda","transactionId":"0xbce525324af12eda02bf7927e92cea3a8e8322d0f41966271443e6c3b245a440","outputIndex":0,"isSpent":false,"milestoneIndexBooked":0,"milestoneTimestampBooked":0,"ledgerIndex":0},"chain":{"coinType":4219,"account":0,"change":0,"addressIndex":0}}"#; + let input_signing_data_dto_str = r#"{"output":{"type":3,"amount":"1000000","unlockConditions":[{"type":0,"address":{"type":0,"pubKeyHash":"0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]},"outputMetadata":{"blockId":"0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda","transactionId":"0xbce525324af12eda02bf7927e92cea3a8e8322d0f41966271443e6c3b245a440","outputIndex":0,"isSpent":false,"commitmentIdSpent":"0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d82bf96689","transactionIdSpent":"0x24a1f46bdb6b2bf38f1c59f73cdd4ae5b418804bb231d76d06fbf246498d5883","includedCommitmentId":"0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d82bf96689","latestCommitmentId":"0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d82bf96689"},"chain":{"coinType":4219,"account":0,"change":0,"addressIndex":0}}"#; assert_eq!( serde_json::to_string(&input_signing_data_dto).unwrap(), input_signing_data_dto_str diff --git a/sdk/tests/client/mod.rs b/sdk/tests/client/mod.rs index 047be11c11..3fb3c42d93 100644 --- a/sdk/tests/client/mod.rs +++ b/sdk/tests/client/mod.rs @@ -37,7 +37,7 @@ use iota_sdk::{ AliasId, AliasOutputBuilder, BasicOutputBuilder, FoundryOutputBuilder, NativeToken, NativeTokens, NftId, NftOutputBuilder, Output, OutputId, OutputMetadata, SimpleTokenScheme, TokenId, TokenScheme, }, - rand::{block::rand_block_id, transaction::rand_transaction_id}, + rand::{block::rand_block_id, slot::rand_slot_commitment_id, transaction::rand_transaction_id}, }, }; @@ -318,9 +318,7 @@ fn build_inputs<'a>(outputs: impl IntoIterator>) -> Vec