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

Fix some errors when compiling types only #1611

Merged
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
35 changes: 16 additions & 19 deletions sdk/src/types/block/output/account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use alloc::{collections::BTreeSet, vec::Vec};
use alloc::collections::BTreeSet;

use hashbrown::HashMap;
use packable::{
Expand All @@ -11,24 +11,19 @@ use packable::{
Packable,
};

use crate::types::{
block::{
address::{AccountAddress, Address},
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{
verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions,
},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier,
},
payload::signed_transaction::TransactionCapabilityFlag,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
use crate::types::block::{
address::{AccountAddress, Address},
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier,
},
ValidationParams,
payload::signed_transaction::TransactionCapabilityFlag,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
};

crate::impl_id!(
Expand Down Expand Up @@ -623,13 +618,15 @@ fn verify_unlock_conditions(unlock_conditions: &UnlockConditions, account_id: &A

#[cfg(feature = "serde")]
pub(crate) mod dto {
use alloc::vec::Vec;

use serde::{Deserialize, Serialize};

use super::*;
use crate::{
types::{
block::{output::unlock_condition::dto::UnlockConditionDto, Error},
TryFromDto,
TryFromDto, ValidationParams,
},
utils::serde::string,
};
Expand Down
31 changes: 13 additions & 18 deletions sdk/src/types/block/output/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@ use packable::{
Packable,
};

use crate::types::{
block::{
address::{Address, AnchorAddress},
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{
verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions,
},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier,
},
payload::signed_transaction::TransactionCapabilityFlag,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
use crate::types::block::{
address::{Address, AnchorAddress},
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier,
},
ValidationParams,
payload::signed_transaction::TransactionCapabilityFlag,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
};

crate::impl_id!(
Expand Down Expand Up @@ -711,7 +706,7 @@ pub(crate) mod dto {
use crate::{
types::{
block::{output::unlock_condition::dto::UnlockConditionDto, Error},
TryFromDto,
TryFromDto, ValidationParams,
},
utils::serde::{prefix_hex_bytes, string},
};
Expand Down
29 changes: 12 additions & 17 deletions sdk/src/types/block/output/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@ use alloc::collections::BTreeSet;

use packable::Packable;

use crate::types::{
block::{
address::Address,
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{
verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions,
},
verify_output_amount_min, verify_output_amount_packable, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure,
},
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
use crate::types::block::{
address::Address,
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions},
verify_output_amount_min, verify_output_amount_packable, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure,
},
ValidationParams,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
};

/// Builder for a [`BasicOutput`].
Expand Down Expand Up @@ -361,7 +356,7 @@ pub(crate) mod dto {
use crate::{
types::{
block::{output::unlock_condition::dto::UnlockConditionDto, Error},
TryFromDto,
TryFromDto, ValidationParams,
},
utils::serde::string,
};
Expand Down
31 changes: 13 additions & 18 deletions sdk/src/types/block/output/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@ use alloc::collections::BTreeSet;

use packable::Packable;

use crate::types::{
block::{
address::{AccountAddress, Address},
output::{
chain_id::ChainId,
unlock_condition::{
verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions,
},
verify_output_amount_min, verify_output_amount_packable, Output, OutputBuilderAmount, OutputId, Rent,
RentStructure, StateTransitionError, StateTransitionVerifier,
},
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
slot::EpochIndex,
unlock::Unlock,
Error,
use crate::types::block::{
address::{AccountAddress, Address},
output::{
chain_id::ChainId,
unlock_condition::{verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions},
verify_output_amount_min, verify_output_amount_packable, Output, OutputBuilderAmount, OutputId, Rent,
RentStructure, StateTransitionError, StateTransitionVerifier,
},
ValidationParams,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
slot::EpochIndex,
unlock::Unlock,
Error,
};

crate::impl_id!(
Expand Down Expand Up @@ -442,7 +437,7 @@ pub(crate) mod dto {
output::{unlock_condition::dto::UnlockConditionDto, OutputBuilderAmount},
Error,
},
TryFromDto,
TryFromDto, ValidationParams,
},
utils::serde::string,
};
Expand Down
35 changes: 15 additions & 20 deletions sdk/src/types/block/output/foundry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,21 @@ use packable::{
};
use primitive_types::U256;

use crate::types::{
block::{
address::{AccountAddress, Address},
output::{
account::AccountId,
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{
verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions,
},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier, TokenId,
TokenScheme,
},
payload::signed_transaction::{TransactionCapabilities, TransactionCapabilityFlag},
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
use crate::types::block::{
address::{AccountAddress, Address},
output::{
account::AccountId,
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier, TokenId,
TokenScheme,
},
ValidationParams,
payload::signed_transaction::{TransactionCapabilities, TransactionCapabilityFlag},
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
};

crate::impl_id!(
Expand Down Expand Up @@ -679,7 +674,7 @@ pub(crate) mod dto {
use crate::{
types::{
block::{output::unlock_condition::dto::UnlockConditionDto, Error},
TryFromDto,
TryFromDto, ValidationParams,
},
utils::serde::string,
};
Expand Down
31 changes: 13 additions & 18 deletions sdk/src/types/block/output/nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,19 @@ use packable::{
Packable,
};

use crate::types::{
block::{
address::{Address, NftAddress},
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{
verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions,
},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier,
},
payload::signed_transaction::TransactionCapabilityFlag,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
use crate::types::block::{
address::{Address, NftAddress},
output::{
feature::{verify_allowed_features, Feature, FeatureFlags, Features},
unlock_condition::{verify_allowed_unlock_conditions, UnlockCondition, UnlockConditionFlags, UnlockConditions},
verify_output_amount_min, verify_output_amount_packable, ChainId, NativeToken, NativeTokens, Output,
OutputBuilderAmount, OutputId, Rent, RentStructure, StateTransitionError, StateTransitionVerifier,
},
ValidationParams,
payload::signed_transaction::TransactionCapabilityFlag,
protocol::ProtocolParameters,
semantic::{SemanticValidationContext, TransactionFailureReason},
unlock::Unlock,
Error,
};

crate::impl_id!(
Expand Down Expand Up @@ -541,7 +536,7 @@ pub(crate) mod dto {
use crate::{
types::{
block::{output::unlock_condition::dto::UnlockConditionDto, Error},
TryFromDto,
TryFromDto, ValidationParams,
},
utils::serde::string,
};
Expand Down
1 change: 1 addition & 0 deletions sdk/src/types/block/unlock/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl AccountUnlock {
}
}

#[cfg(feature = "serde")]
mod dto {
use serde::{Deserialize, Serialize};

Expand Down
1 change: 1 addition & 0 deletions sdk/src/types/block/unlock/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl AnchorUnlock {
}
}

#[cfg(feature = "serde")]
mod dto {
use serde::{Deserialize, Serialize};

Expand Down
1 change: 1 addition & 0 deletions sdk/src/types/block/unlock/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ impl EmptyUnlock {
pub const KIND: u8 = 6;
}

#[cfg(feature = "serde")]
mod dto {
use serde::{Deserialize, Serialize};

Expand Down
5 changes: 4 additions & 1 deletion sdk/src/types/block/unlock/multi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use alloc::{boxed::Box, vec::Vec};
use alloc::boxed::Box;

use derive_more::Deref;
use packable::{prefix::BoxedSlicePrefix, Packable};
Expand Down Expand Up @@ -46,7 +46,10 @@ fn verify_unlocks<const VERIFY: bool>(unlocks: &[Unlock], _visitor: &()) -> Resu
}
}

#[cfg(feature = "serde")]
mod dto {
use alloc::vec::Vec;

use serde::{Deserialize, Serialize};

use super::*;
Expand Down
Loading