From b6d14544abf82a43291762bd71641606b324ed3d Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Mon, 20 Nov 2023 18:22:28 +0100 Subject: [PATCH] Update feature types (#1654) * Update feature types * fmt --------- Co-authored-by: Thibault Martinez --- .../nodejs/lib/types/block/output/feature.ts | 12 +++++++++--- bindings/python/iota_sdk/types/feature.py | 18 ++++++++++-------- sdk/src/types/block/output/anchor.rs | 6 +----- .../types/block/output/feature/block_issuer.rs | 2 +- .../types/block/output/feature/native_token.rs | 2 +- sdk/src/types/block/output/feature/staking.rs | 2 +- sdk/src/types/block/output/feature/tag.rs | 2 +- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/bindings/nodejs/lib/types/block/output/feature.ts b/bindings/nodejs/lib/types/block/output/feature.ts index ba396da321..b7860615a5 100644 --- a/bindings/nodejs/lib/types/block/output/feature.ts +++ b/bindings/nodejs/lib/types/block/output/feature.ts @@ -21,10 +21,16 @@ enum FeatureType { Issuer = 1, /** A Metadata feature. */ Metadata = 2, + /** A StateMetadata feature. */ + StateMetadata = 3, /** A Tag feature. */ - Tag = 3, - BlockIssuer = 4, - Staking = 5, + Tag = 4, + /** A NativeToken feature. */ + NativeToken = 5, + /** A BlockIssuer feature. */ + BlockIssuer = 6, + /** A Staking feature. */ + Staking = 7, } /** The base class for features. */ diff --git a/bindings/python/iota_sdk/types/feature.py b/bindings/python/iota_sdk/types/feature.py index cb4064f4ac..4908be3b02 100644 --- a/bindings/python/iota_sdk/types/feature.py +++ b/bindings/python/iota_sdk/types/feature.py @@ -17,18 +17,20 @@ class FeatureType(IntEnum): Sender (0): The sender feature. Issuer (1): The issuer feature. Metadata (2): The metadata feature. - Tag (3): The tag feature. - NativeToken (4): The native token feature. - BlockIssuer (5): The block issuer feature. - Staking (6): The staking feature. + StateMetadata (3): The state metadata feature. + Tag (4): The tag feature. + NativeToken (5): The native token feature. + BlockIssuer (6): The block issuer feature. + Staking (7): The staking feature. """ Sender = 0 Issuer = 1 Metadata = 2 - Tag = 3 - NativeToken = 4 - BlockIssuer = 5 - Staking = 6 + StateMetadata = 3 + Tag = 4 + NativeToken = 5 + BlockIssuer = 6 + Staking = 7 @json diff --git a/sdk/src/types/block/output/anchor.rs b/sdk/src/types/block/output/anchor.rs index 0a07857446..0485a67528 100644 --- a/sdk/src/types/block/output/anchor.rs +++ b/sdk/src/types/block/output/anchor.rs @@ -42,11 +42,7 @@ impl From<&OutputId> for AnchorId { impl AnchorId { /// pub fn or_from_output_id(self, output_id: &OutputId) -> Self { - if self.is_null() { - Self::from(output_id) - } else { - self - } + if self.is_null() { Self::from(output_id) } else { self } } } diff --git a/sdk/src/types/block/output/feature/block_issuer.rs b/sdk/src/types/block/output/feature/block_issuer.rs index c544d936f1..545d1b4f13 100644 --- a/sdk/src/types/block/output/feature/block_issuer.rs +++ b/sdk/src/types/block/output/feature/block_issuer.rs @@ -210,7 +210,7 @@ pub struct BlockIssuerFeature { impl BlockIssuerFeature { /// The [`Feature`](crate::types::block::output::Feature) kind of a [`BlockIssuerFeature`]. - pub const KIND: u8 = 5; + pub const KIND: u8 = 6; /// Creates a new [`BlockIssuerFeature`]. #[inline(always)] diff --git a/sdk/src/types/block/output/feature/native_token.rs b/sdk/src/types/block/output/feature/native_token.rs index 52e298edff..191fec2070 100644 --- a/sdk/src/types/block/output/feature/native_token.rs +++ b/sdk/src/types/block/output/feature/native_token.rs @@ -10,7 +10,7 @@ pub struct NativeTokenFeature(NativeToken); impl NativeTokenFeature { /// The [`Feature`](crate::types::block::output::Feature) kind of [`NativeTokenFeature`]. - pub const KIND: u8 = 4; + pub const KIND: u8 = 5; /// Creates a new [`NativeTokenFeature`]. pub fn new(native_token: NativeToken) -> Self { diff --git a/sdk/src/types/block/output/feature/staking.rs b/sdk/src/types/block/output/feature/staking.rs index 9ab86dfd3d..34d8da0094 100644 --- a/sdk/src/types/block/output/feature/staking.rs +++ b/sdk/src/types/block/output/feature/staking.rs @@ -21,7 +21,7 @@ pub struct StakingFeature { impl StakingFeature { /// The [`Feature`](crate::types::block::output::Feature) kind of [`StakingFeature`]. - pub const KIND: u8 = 6; + pub const KIND: u8 = 7; /// Creates a new [`StakingFeature`]. pub fn new( diff --git a/sdk/src/types/block/output/feature/tag.rs b/sdk/src/types/block/output/feature/tag.rs index d062da26bf..01c84d79cd 100644 --- a/sdk/src/types/block/output/feature/tag.rs +++ b/sdk/src/types/block/output/feature/tag.rs @@ -39,7 +39,7 @@ impl TryFrom> for TagFeature { impl TagFeature { /// The [`Feature`](crate::types::block::output::Feature) kind of an [`TagFeature`]. - pub const KIND: u8 = 3; + pub const KIND: u8 = 4; /// Valid lengths for an [`TagFeature`]. pub const LENGTH_RANGE: RangeInclusive = 1..=64;