# Use Metaplex

The `Use Metaplex` tool, part of AgentiPy, allows users to interact with the Metaplex protocol on Solana for creating and managing Non-Fungible Tokens (NFTs) and collections. It provides functionalities to deploy new NFT collections, mint NFTs (standard Metaplex and Metaplex Core), and retrieve asset information. These operations are routed through an Agentipy proxy service.

## Functionality

This tool is implemented in the `DeployCollectionManager` class (though it contains methods beyond just deploying collections, suggesting the class name might be historical or a misnomer for its broader Metaplex functionalities). All methods interact with an Agentipy proxy service (`agent.base_proxy_url`), sending encrypted private keys and an OpenAI API key with each request.

### Key Methods:

* `deploy_collection(agent: SolanaAgentKit, name: str, uri: str, royalty_basis_points: int, creator_address: str) -> Optional[Dict[str, Any]]`:
  * Deploys a new Metaplex NFT collection.
  * Parameters: `name` of the collection, metadata `uri` (pointing to JSON with collection details), `royalty_basis_points` (e.g., 500 for 5%), and the `creator_address`.
  * Returns a dictionary with the transaction details from the proxy or an error.
* `mint_metaplex_core_nft(agent: SolanaAgentKit, collectionMint: str, name: str, uri: str, sellerFeeBasisPoints: Optional[int] = None, address: Optional[str] = None, share: Optional[str] = None, recipient: Optional[str] = None) -> Optional[Dict[str, Any]]`:
  * Mints an NFT using the newer Metaplex Core standard.
  * Parameters: `collectionMint` (address of the Core collection), `name` of the NFT, metadata `uri`.
  * Optional: `sellerFeeBasisPoints` (royalties), creator `address` and `share`, and `recipient` of the NFT (defaults to agent's wallet).
  * Returns a dictionary with the transaction details or an error.
* `get_metaplex_asset(agent: SolanaAgentKit, assetId: str) -> Optional[Dict[str, Any]]`:
  * Fetches detailed information about a specific Metaplex asset (NFT) using its `assetId` (mint address).
  * Returns a dictionary with asset details or an error.
* `get_metaplex_assets_by_creator(agent: SolanaAgentKit, creator: str, onlyVerified: bool = False, ... ) -> Optional[Dict[str, Any]]`:
  * Fetches assets created by a specific `creator` address. Supports pagination and sorting.
  * `onlyVerified` flag filters for assets from verified creators.
  * Returns a dictionary with the list of assets or an error.
* `get_metaplex_assets_by_authority(agent: SolanaAgentKit, authority: str, ... ) -> Optional[Dict[str, Any]]`:
  * Fetches assets where the specified `authority` address is the update authority. Supports pagination and sorting.
  * Returns a dictionary with the list of assets or an error.

##

**Important Considerations:**

* **Proxy Service:** This tool relies on an Agentipy proxy service. The availability, authentication (including the role of the OpenAI API key), and terms of use for this proxy are critical.
* **On-Chain Costs:** Deploying collections and minting NFTs are on-chain transactions that incur SOL fees. Metadata often needs to be stored on decentralized storage like Arweave, which also has costs.
* **Metaplex Standards:** Metaplex has different NFT standards (e.g., original Token Metadata, Core). This tool seems to support both deploying standard collections and minting Core NFTs. Ensure you use the correct methods for your desired standard and have valid collection addresses if minting into an existing one.
* **Metadata URIs:** Valid URIs pointing to JSON metadata files (conforming to Metaplex standards) are crucial for both collections and individual NFTs.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_metaplex.py>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentipy.fun/tools/use-metaplex.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
