Magic Eden M2 IDL
M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7KMagic Eden M2 is the second-generation marketplace program for listing, buying, and selling NFTs on Solana. Supports fixed-price listings, auctions, collection offers, and royalty enforcement.
Instructions
Account Types
Integration Examples
Use the Magic Eden M2 IDL in your application with these code examples for TypeScript, Rust, and Python.
import { Connection, PublicKey } from "@solana/web3.js";
import { Program, AnchorProvider, Idl } from "@coral-xyz/anchor";
// Load the Magic Eden M2 IDL
import idl from "./magic eden m2.json";
const PROGRAM_ID = new PublicKey("M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7K");
// Set up the provider and program
const connection = new Connection("https://api.mainnet-beta.solana.com");
const provider = new AnchorProvider(connection, wallet, {
commitment: "confirmed",
});
const program = new Program(idl as Idl, provider);
// Fetch and decode an account
const accountData = await program.account.magic_Eden_M2
.fetch(accountPublicKey);
console.log("Account data:", accountData);
// Build and send an instruction
const tx = await program.methods
.initialize(/* ...args */)
.accounts({
/* ...required accounts */
})
.rpc();
console.log("Transaction signature:", tx);IDL JSON Preview
{
"version": "0.1.0",
"name": "m2",
"instructions": [
{
"name": "withdrawFromTreasury",
"accounts": [
{
"name": "treasuryWithdrawalDestination",
"isMut": true,
"isSigner": false
},
{
"name": "auctionHouseTreasury",
"isMut": true,
"isSigner": false
},
{
"name": "auctionHouse",
"isMut": false,
"isSigner": false
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false
}
],
"args": [
{
...Frequently Asked Questions
What is the Magic Eden M2 IDL?
The Magic Eden M2 IDL (Interface Definition Language) is a JSON schema that defines the on-chain program interface for the Magic Eden M2 smart contract on Solana. It describes all available instructions, account structures, events, and custom types that developers need to interact with the Magic Eden M2 program. This IDL contains 18 instructions, 5 account types, 0 events, and 5 type definitions.
How do I use the Magic Eden M2 IDL in my project?
Download the JSON file and import it in your project. With TypeScript, use the @coral-xyz/anchor package to create a Program instance. In Rust, use anchor-client. For Python, use anchorpy. See the integration examples above for complete code snippets in all three languages.
What is the Magic Eden M2 program address on Solana?
The Magic Eden M2 program is deployed at address M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7K on Solana mainnet. You can verify this on any Solana block explorer.
What version of the Magic Eden M2 IDL is this?
This is version 0.1.0 of the Magic Eden M2 IDL. IDL versions correspond to specific program deployments and may be updated as the protocol evolves. Always verify compatibility with the on-chain program version before integrating.