Skip to content

Missing Discriminator trait of CoreAsset and CoreCollection for Anchor 0.30.0 #151

@alphafitz11

Description

@alphafitz11

Anchor 0.30.0 require CoreAsset and CoreCollection to implement the Discriminator trait to build IDL.
When using anchor 0.30.0, compiling IDL will encounter the following errors:

error[E0599]: no function or associated item named `create_type` found for struct `mpl_core::CoreAsset` in the current scope
  --> programs/solana-marketplace/src/ins/mpl/mpl_core/core_sell_nft.rs:20:10
   |
20 | #[derive(Accounts)]
   |          ^^^^^^^^ function or associated item not found in `CoreAsset`
   |
  ::: programs/solana-marketplace/src/ins/mpl/mpl_core/mod.rs:20:1
   |
20 | pub struct CoreAsset(mpl_core::accounts::BaseAssetV1);
   | -------------------- function or associated item `create_type` not found for this struct
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `create_type`, perhaps you need to implement it:
           candidate #1: `anchor_lang::IdlBuild`
   = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `mpl_core::CoreAsset: Discriminator` is not satisfied
  --> programs/solana-marketplace/src/ins/mpl/mpl_core/core_sell_nft.rs:56:40
   |
56 |     pub core_asset: Box<Account<'info, CoreAsset>>,
   |                                        ^^^^^^^^^ the trait `Discriminator` is not implemented for `mpl_core::CoreAsset`
   |
   = help: the following other types implement trait `Discriminator`:
             BuyCnft
             CancelBuyCnft
             CancelCollectionBuyCnft
             CancelSellCnft
             CollectionBuyCnft
             ExecuteBuyCnft
             ExecuteCollectionBuyCnft
             ExecuteSellCnft
           and 49 others

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions