Created
January 8, 2022 01:14
-
-
Save bhgames/26c5423b6446d7160d8befe9441d04df to your computer and use it in GitHub Desktop.
Rough idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[repr(C)] | |
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)] | |
pub enum CollectionStatus { | |
Unverified, | |
Verified, | |
CollectionMasterEdition, | |
} | |
#[repr(C)] | |
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)] | |
pub enum UseType { | |
Burn, | |
Multiple, | |
Single, | |
} | |
#[repr(C)] | |
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)] | |
pub enum TokenType { | |
NonFungible, | |
SemiFungible, | |
Fungible, | |
Edition, | |
} | |
#[repr(C)] | |
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)] | |
pub struct Uses { | |
pub use_type: UseType, | |
pub uses: u64, | |
pub available_uses: u64, | |
} | |
#[repr(C)] | |
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)] | |
pub struct Collection { | |
pub status: CollectionStatus, | |
pub collection_key: Pubkey, | |
} | |
#[repr(C)] | |
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)] | |
pub struct DataV2 { | |
/// The name of the asset | |
pub name: String, | |
/// The symbol for the asset | |
pub symbol: String, | |
/// URI pointing to JSON representing the asset | |
pub uri: String, | |
/// Royalty basis points that goes to creators in secondary sales (0-10000) | |
pub seller_fee_basis_points: u16, | |
/// Array of creators, optional | |
pub creators: Option<Vec<Creator>>, | |
/// Collection | |
pub collection: Option<Collection>, | |
/// Uses | |
pub uses: Option<Uses>, | |
} | |
#[repr(C)] | |
#[derive(Clone, BorshSerialize, BorshDeserialize, Debug)] | |
pub struct Metadata { | |
pub key: Key, | |
pub update_authority: Pubkey, | |
pub mint: Pubkey, | |
pub data: Data, | |
// Immutable, once flipped, all sales of this metadata are considered secondary. | |
pub primary_sale_happened: bool, | |
// Whether or not the data struct is mutable, default is not | |
pub is_mutable: bool, | |
/// nonce for easy calculation of editions, if present | |
pub edition_nonce: Option<u8>, | |
/// Since we cannot easily change Metadata, we add the new DataV2 fields here at the end. | |
/// Collection | |
pub collection: Option<Collection>, | |
/// Uses | |
pub uses: Option<Uses>, | |
/// Token type is deterministic and will change from SemiFungible to NonFungible if | |
/// you call the create master edition call and it succeeds. | |
pub token_type: Option<TokenType>, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment