From 6863eb7d0260328b7446ac85e0334996c0412a46 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 4 Sep 2024 17:51:18 +0100 Subject: [PATCH] chore: linter and revert change --- dan_layer/engine_types/src/substate.rs | 25 ++++++++++++--------- dan_layer/transaction_manifest/src/value.rs | 4 ++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/dan_layer/engine_types/src/substate.rs b/dan_layer/engine_types/src/substate.rs index 46ad1f483..4d565bde4 100644 --- a/dan_layer/engine_types/src/substate.rs +++ b/dan_layer/engine_types/src/substate.rs @@ -30,8 +30,13 @@ use tari_bor::{decode, decode_exact, encode, BorError}; use tari_common_types::types::FixedHash; use tari_template_lib::{ models::{ - ComponentAddress, NonFungibleAddress, NonFungibleIndexAddress, ObjectKey, ResourceAddress, - UnclaimedConfidentialOutputAddress, VaultId, + ComponentAddress, + NonFungibleAddress, + NonFungibleIndexAddress, + ObjectKey, + ResourceAddress, + UnclaimedConfidentialOutputAddress, + VaultId, }, prelude::PUBLIC_IDENTITY_RESOURCE_ADDRESS, Hash, @@ -147,14 +152,14 @@ impl SubstateId { /// Returns true for any substate that has is "versionable" i.e. can have a version > 0, otherwise false. pub fn is_versioned(&self) -> bool { match self { - SubstateId::Component(_) - | SubstateId::Resource(_) - | SubstateId::Vault(_) - | SubstateId::NonFungibleIndex(_) - | SubstateId::NonFungible(_) => true, - SubstateId::UnclaimedConfidentialOutput(_) - | SubstateId::TransactionReceipt(_) - | SubstateId::FeeClaim(_) => false, + SubstateId::Component(_) | + SubstateId::Resource(_) | + SubstateId::Vault(_) | + SubstateId::NonFungibleIndex(_) | + SubstateId::NonFungible(_) => true, + SubstateId::UnclaimedConfidentialOutput(_) | + SubstateId::TransactionReceipt(_) | + SubstateId::FeeClaim(_) => false, } } diff --git a/dan_layer/transaction_manifest/src/value.rs b/dan_layer/transaction_manifest/src/value.rs index 267948f1e..d05754882 100644 --- a/dan_layer/transaction_manifest/src/value.rs +++ b/dan_layer/transaction_manifest/src/value.rs @@ -49,6 +49,10 @@ impl FromStr for ManifestValue { SubstateId::from_str(s) .ok() .map(ManifestValue::SubstateId) + .or_else(|| { + let id = NonFungibleId::try_from_canonical_string(s).ok()?; + Some(ManifestValue::NonFungibleId(id)) + }) .or_else(|| { let tokens = s.parse().ok()?; let lit = parse2(tokens).ok()?;