diff --git a/Cargo.lock b/Cargo.lock index ed9f0028..5dd5ce79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2281,7 +2281,7 @@ dependencies = [ [[package]] name = "mpl-core" -version = "0.6.0" +version = "0.6.1" dependencies = [ "anchor-lang", "assert_matches", diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml index 4121aed3..039b8829 100644 --- a/clients/rust/Cargo.toml +++ b/clients/rust/Cargo.toml @@ -2,7 +2,7 @@ name = "mpl-core" description = "A flexible digital asset standard for Solana" repository = "https://github.com/metaplex-foundation/mpl-core" -version = "0.6.0" +version = "0.6.1" edition = "2021" readme = "README.md" license-file = "../../LICENSE" diff --git a/clients/rust/src/hooked/advanced_types.rs b/clients/rust/src/hooked/advanced_types.rs index 5475f9d8..273e660d 100644 --- a/clients/rust/src/hooked/advanced_types.rs +++ b/clients/rust/src/hooked/advanced_types.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "anchor")] +use anchor_lang::prelude::AnchorDeserialize; +#[cfg(not(feature = "anchor"))] use borsh::BorshDeserialize; use solana_program::pubkey::Pubkey; use std::{cmp::Ordering, io::ErrorKind}; diff --git a/clients/rust/src/hooked/asset.rs b/clients/rust/src/hooked/asset.rs index 82513b34..7ce08d7c 100644 --- a/clients/rust/src/hooked/asset.rs +++ b/clients/rust/src/hooked/asset.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "anchor")] +use anchor_lang::prelude::AnchorSerialize; +#[cfg(not(feature = "anchor"))] use borsh::BorshSerialize; use crate::{ diff --git a/clients/rust/src/hooked/collection.rs b/clients/rust/src/hooked/collection.rs index 5aa9e51a..82ca0877 100644 --- a/clients/rust/src/hooked/collection.rs +++ b/clients/rust/src/hooked/collection.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "anchor")] +use anchor_lang::prelude::AnchorSerialize; +#[cfg(not(feature = "anchor"))] use borsh::BorshSerialize; use crate::{ diff --git a/clients/rust/src/hooked/mod.rs b/clients/rust/src/hooked/mod.rs index ecf95a51..aa5e2a6a 100644 --- a/clients/rust/src/hooked/mod.rs +++ b/clients/rust/src/hooked/mod.rs @@ -10,7 +10,12 @@ pub use asset::*; pub mod collection; pub use collection::*; -use borsh::{BorshDeserialize, BorshSerialize}; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{ + AnchorDeserialize as CrateDeserialize, AnchorSerialize as CrateSerialize, +}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize as CrateDeserialize, BorshSerialize as CrateSerialize}; use num_traits::FromPrimitive; use std::{cmp::Ordering, mem::size_of}; @@ -110,7 +115,7 @@ pub fn load_key(account: &AccountInfo, offset: usize) -> Result usize; /// Get the current size of the data blob. @@ -118,7 +123,7 @@ pub trait DataBlob: BorshSerialize + BorshDeserialize { } /// A trait for Solana accounts. -pub trait SolanaAccount: BorshSerialize + BorshDeserialize { +pub trait SolanaAccount: CrateSerialize + CrateDeserialize { /// Get the discriminator key for the account. fn key() -> Key; diff --git a/clients/rust/src/hooked/plugin.rs b/clients/rust/src/hooked/plugin.rs index ef98c6a8..2bbbbab3 100644 --- a/clients/rust/src/hooked/plugin.rs +++ b/clients/rust/src/hooked/plugin.rs @@ -1,4 +1,7 @@ -use borsh::BorshDeserialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::AnchorDeserialize as CrateDeserialize; +#[cfg(not(feature = "anchor"))] +use borsh::BorshDeserialize as CrateDeserialize; use num_traits::FromPrimitive; use solana_program::account_info::AccountInfo; @@ -17,7 +20,7 @@ use crate::{ }; /// Fetch the plugin from the registry. -pub fn fetch_plugin( +pub fn fetch_plugin( account: &AccountInfo, plugin_type: PluginType, ) -> Result<(PluginAuthority, U, usize), std::io::Error> { diff --git a/clients/rust/src/indexable_asset.rs b/clients/rust/src/indexable_asset.rs index bd3c0147..38f11bd4 100644 --- a/clients/rust/src/indexable_asset.rs +++ b/clients/rust/src/indexable_asset.rs @@ -1,4 +1,7 @@ +#[cfg(feature = "anchor")] +use anchor_lang::prelude::AnchorDeserialize; use base64::prelude::*; +#[cfg(not(feature = "anchor"))] use borsh::BorshDeserialize; use num_traits::FromPrimitive; use solana_program::pubkey::Pubkey;