mpl_token_metadata/state/
data.rs

1use super::*;
2
3#[repr(C)]
4#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
5#[derive(BorshSerialize, BorshDeserialize, Default, PartialEq, Eq, Debug, Clone)]
6pub struct Data {
7    /// The name of the asset
8    pub name: String,
9    /// The symbol for the asset
10    pub symbol: String,
11    /// URI pointing to JSON representing the asset
12    pub uri: String,
13    /// Royalty basis points that goes to creators in secondary sales (0-10000)
14    pub seller_fee_basis_points: u16,
15    /// Array of creators, optional
16    pub creators: Option<Vec<Creator>>,
17}
18
19#[repr(C)]
20#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
21#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)]
22pub struct DataV2 {
23    /// The name of the asset
24    pub name: String,
25    /// The symbol for the asset
26    pub symbol: String,
27    /// URI pointing to JSON representing the asset
28    pub uri: String,
29    /// Royalty basis points that goes to creators in secondary sales (0-10000)
30    pub seller_fee_basis_points: u16,
31    /// Array of creators, optional
32    pub creators: Option<Vec<Creator>>,
33    /// Collection
34    pub collection: Option<Collection>,
35    /// Uses
36    pub uses: Option<Uses>,
37}
38
39impl DataV2 {
40    pub fn to_v1(&self) -> Data {
41        let ns = self.clone();
42        Data {
43            name: ns.name,
44            symbol: ns.symbol,
45            uri: ns.uri,
46            seller_fee_basis_points: ns.seller_fee_basis_points,
47            creators: ns.creators,
48        }
49    }
50}