use crate::internal_prelude::*;
define_wrapped_hash!(
SchemaHash
);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Sbor)]
pub struct FullyScopedTypeId<T: AsRef<NodeId>>(pub T, pub SchemaHash, pub LocalTypeId);
impl<T: AsRef<NodeId>> FullyScopedTypeId<T> {
pub fn into_general(self) -> FullyScopedTypeId<NodeId> {
FullyScopedTypeId(*self.0.as_ref(), self.1, self.2)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Sbor)]
pub struct ScopedTypeId(pub SchemaHash, pub LocalTypeId);
impl ScopedTypeId {
pub fn under_node<T: AsRef<NodeId>>(self, node: T) -> FullyScopedTypeId<T> {
FullyScopedTypeId(node, self.0, self.1)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, ManifestSbor, ScryptoSbor)]
pub enum GenericSubstitution {
Local(ScopedTypeId),
Remote(BlueprintTypeIdentifier),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, ManifestSbor, ScryptoSbor)]
pub struct BlueprintTypeIdentifier {
pub package_address: PackageAddress,
pub blueprint_name: String,
pub type_name: String,
}