chik_sdk_driver/primitives/nft/
nft_owner.rs

1use chik_protocol::Bytes32;
2use klvm_utils::ToTreeHash;
3
4use crate::DidInfo;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub struct NftOwner {
8    pub launcher_id: Bytes32,
9    pub singleton_inner_puzzle_hash: Bytes32,
10}
11
12impl NftOwner {
13    pub fn new(launcher_id: Bytes32, singleton_inner_puzzle_hash: Bytes32) -> Self {
14        Self {
15            launcher_id,
16            singleton_inner_puzzle_hash,
17        }
18    }
19
20    pub fn from_did_info<M>(did_info: &DidInfo<M>) -> Self
21    where
22        M: ToTreeHash,
23    {
24        Self {
25            launcher_id: did_info.launcher_id,
26            singleton_inner_puzzle_hash: did_info.inner_puzzle_hash().into(),
27        }
28    }
29}