chia_sdk_driver/primitives/nft/
nft_mint.rs1use chia_protocol::Bytes32;
2use chia_puzzles::NFT_METADATA_UPDATER_DEFAULT_HASH;
3use chia_sdk_types::conditions::TransferNft;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub struct NftMint<M> {
7 pub metadata: M,
8 pub metadata_updater_puzzle_hash: Bytes32,
9 pub royalty_puzzle_hash: Bytes32,
10 pub royalty_basis_points: u16,
11 pub p2_puzzle_hash: Bytes32,
12 pub transfer_condition: Option<TransferNft>,
13}
14
15impl<M> NftMint<M> {
16 pub fn new(
17 metadata: M,
18 p2_puzzle_hash: Bytes32,
19 royalty_basis_points: u16,
20 transfer_condition: Option<TransferNft>,
21 ) -> Self {
22 Self {
23 metadata,
24 metadata_updater_puzzle_hash: NFT_METADATA_UPDATER_DEFAULT_HASH.into(),
25 royalty_puzzle_hash: p2_puzzle_hash,
26 royalty_basis_points,
27 p2_puzzle_hash,
28 transfer_condition,
29 }
30 }
31
32 #[must_use]
33 pub fn with_royalty_puzzle_hash(self, royalty_puzzle_hash: Bytes32) -> Self {
34 Self {
35 royalty_puzzle_hash,
36 ..self
37 }
38 }
39
40 #[must_use]
41 pub fn with_custom_metadata_updater(self, metadata_updater_puzzle_hash: Bytes32) -> Self {
42 Self {
43 metadata_updater_puzzle_hash,
44 ..self
45 }
46 }
47}