pub struct NftInfo {
pub launcher_id: Bytes32,
pub metadata: HashedPtr,
pub metadata_updater_puzzle_hash: Bytes32,
pub current_owner: Option<Bytes32>,
pub royalty_puzzle_hash: Bytes32,
pub royalty_basis_points: u16,
pub p2_puzzle_hash: Bytes32,
}
Expand description
Information needed to construct the outer puzzle of an NFT. It does not include the inner puzzle, which must be stored separately.
This type can be used on its own for parsing, or as part of the Nft
primitive.
Fields§
§launcher_id: Bytes32
The coin id of the launcher coin that created this NFT’s singleton.
metadata: HashedPtr
The metadata stored in the NftStateLayer
. This can only be updated by
going through the metadata_updater_puzzle_hash
.
metadata_updater_puzzle_hash: Bytes32
The puzzle hash of the metadata updater. This is used to update the metadata of the NFT.
This is typically NFT_METADATA_UPDATER_DEFAULT_HASH
,
which ensures the NftMetadata
object remains immutable
except for prepending additional URIs.
A custom metadata updater can be used, however support in existing wallets and display services may be limited.
current_owner: Option<Bytes32>
The current assigned owner of the NFT, if any. This is managed by the NftOwnershipLayer
.
Historically this was always a DID, although it’s possible to assign any singleton including a vault.
It’s intended to unassign the owner after transferring to an external wallet or creating an offer.
royalty_puzzle_hash: Bytes32
The puzzle hash to which royalties will be paid out to in offers involving this NFT.
This is required even if the royalty is 0. Currently, all NFTs must use the default RoyaltyTransferLayer
,
however this may change in the future.
royalty_basis_points: u16
The royalty percentage to be paid out to the owner in offers involving this NFT. This is represented as hundredths of a percent, so 300 is 3%.
p2_puzzle_hash: Bytes32
The hash of the inner puzzle to this NFT. If you encode this puzzle hash as bech32m, it’s the same as the current owner’s address.
Implementations§
Source§impl NftInfo
impl NftInfo
pub fn new( launcher_id: Bytes32, metadata: HashedPtr, metadata_updater_puzzle_hash: Bytes32, current_owner: Option<Bytes32>, royalty_puzzle_hash: Bytes32, royalty_basis_points: u16, p2_puzzle_hash: Bytes32, ) -> Self
Sourcepub fn parse(
allocator: &Allocator,
puzzle: Puzzle,
) -> Result<Option<(Self, Puzzle)>, DriverError>
pub fn parse( allocator: &Allocator, puzzle: Puzzle, ) -> Result<Option<(Self, Puzzle)>, DriverError>
Parses an NftInfo
from a Puzzle
by extracting the NftStateLayer
and NftOwnershipLayer
.
This will return a tuple of the NftInfo
and its p2 puzzle.
If the puzzle is not an NFT, this will return None
instead of an error.
However, if the puzzle should have been an NFT but had a parsing error, this will return an error.
pub fn from_layers<I>(layers: &StandardNftLayers<HashedPtr, I>) -> Selfwhere
I: ToTreeHash,
pub fn into_layers<I>(self, p2_puzzle: I) -> StandardNftLayers<HashedPtr, I>
Sourcepub fn child_from_p2_spend(
&self,
allocator: &mut Allocator,
spend: Spend,
) -> Result<(Self, CreateCoin<NodePtr>), DriverError>
pub fn child_from_p2_spend( &self, allocator: &mut Allocator, spend: Spend, ) -> Result<(Self, CreateCoin<NodePtr>), DriverError>
Trait Implementations§
Source§impl SingletonInfo for NftInfo
impl SingletonInfo for NftInfo
fn launcher_id(&self) -> Bytes32
Source§fn inner_puzzle_hash(&self) -> TreeHash
fn inner_puzzle_hash(&self) -> TreeHash
Source§fn puzzle_hash(&self) -> TreeHash
fn puzzle_hash(&self) -> TreeHash
SingletonLayer
.impl Copy for NftInfo
impl Eq for NftInfo
impl StructuralPartialEq for NftInfo
Auto Trait Implementations§
impl Freeze for NftInfo
impl RefUnwindSafe for NftInfo
impl Send for NftInfo
impl Sync for NftInfo
impl Unpin for NftInfo
impl UnwindSafe for NftInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.