Struct chia_sdk_driver::Nft
source · pub struct Nft<M> {
pub coin: Coin,
pub proof: Proof,
pub info: NftInfo<M>,
}
Expand description
Everything that is required to spend an NFT coin.
Fields§
§coin: Coin
The coin that holds this NFT.
proof: Proof
The lineage proof for the singleton.
info: NftInfo<M>
The info associated with the NFT, including the metadata.
Implementations§
source§impl<M> Nft<M>
impl<M> Nft<M>
pub fn new(coin: Coin, proof: Proof, info: NftInfo<M>) -> Self
sourcepub fn child_lineage_proof(&self) -> LineageProofwhere
M: ToTreeHash,
pub fn child_lineage_proof(&self) -> LineageProofwhere
M: ToTreeHash,
Returns the lineage proof that would be used by the child.
sourcepub fn create_child(
&self,
p2_puzzle_hash: Bytes32,
new_owner: Option<Option<Bytes32>>,
) -> Selfwhere
M: ToTreeHash + Clone,
pub fn create_child(
&self,
p2_puzzle_hash: Bytes32,
new_owner: Option<Option<Bytes32>>,
) -> Selfwhere
M: ToTreeHash + Clone,
Creates a new spendable NFT for the child.
pub fn with_metadata<N>(self, metadata: N) -> Nft<N>
pub fn with_hashed_metadata( &self, allocator: &mut Allocator, ) -> Result<Nft<TreeHash>, DriverError>
source§impl<M> Nft<M>
impl<M> Nft<M>
sourcepub fn spend(
&self,
ctx: &mut SpendContext,
inner_spend: Spend,
) -> Result<CoinSpend, DriverError>
pub fn spend( &self, ctx: &mut SpendContext, inner_spend: Spend, ) -> Result<CoinSpend, DriverError>
Creates a coin spend for this NFT.
pub fn transfer( self, ctx: &mut SpendContext, owner_synthetic_key: PublicKey, p2_puzzle_hash: Bytes32, extra_conditions: Conditions, ) -> Result<(CoinSpend, Nft<M>), DriverError>
pub fn transfer_to_did( self, ctx: &mut SpendContext, owner_synthetic_key: PublicKey, p2_puzzle_hash: Bytes32, new_did_owner: &TransferNft, extra_conditions: Conditions, ) -> Result<(CoinSpend, Conditions, Nft<M>), DriverError>
Trait Implementations§
source§impl<M> Primitive for Nft<M>
impl<M> Primitive for Nft<M>
impl<M: Copy> Copy for Nft<M>
impl<M: Eq> Eq for Nft<M>
impl<M> StructuralPartialEq for Nft<M>
Auto Trait Implementations§
impl<M> Freeze for Nft<M>where
M: Freeze,
impl<M> RefUnwindSafe for Nft<M>where
M: RefUnwindSafe,
impl<M> Send for Nft<M>where
M: Send,
impl<M> Sync for Nft<M>where
M: Sync,
impl<M> Unpin for Nft<M>where
M: Unpin,
impl<M> UnwindSafe for Nft<M>where
M: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)