Module js - v0.17.12

Metaplex JavaScript SDK

This SDK helps developers get started with the on-chain tools provided by Metaplex. It focuses its API on common use-cases to provide a smooth developer experience whilst allowing third parties to extend its features via plugins.

Please note that this SDK has been re-implemented from scratch and is still in active development. This means some of the core API and interfaces might change from one version to another. However, feel free to use it and provide some early feedback if you wish to contribute to the direction of this project.

Installation

npm install @metaplex-foundation/js @solana/web3.js

🔥 Pro Tip: Check out our examples and starter kits on the "JS Examples" repository.

Setup

The entry point to the JavaScript SDK is a Metaplex instance that will give you access to its API.

It accepts a Connection instance from @solana/web3.js that will be used to communicate with the cluster.

import { Metaplex } from "@metaplex-foundation/js";
import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("mainnet-beta"));
const metaplex = new Metaplex(connection);

On top of that, you can customise who the SDK should interact on behalf of and which storage provider to use when uploading assets. We refer to these as "Identity Drivers" and "Storage Drivers" respectively. You may change these drivers by calling the use method on the Metaplex instance like so. We'll see all available drivers in more detail below.

import { Metaplex, keypairIdentity, bundlrStorage } from "@metaplex-foundation/js";
import { Connection, clusterApiUrl, Keypair } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("mainnet-beta"));
const wallet = Keypair.generate();

const metaplex = Metaplex.make(connection)
.use(keypairIdentity(wallet))
.use(bundlrStorage());

Notice how you can create a Metaplex instance using Metaplex.make(...) instead of new Metaplex(...) in order to make the fluent API more readable.

Usage

Once properly configured, that Metaplex instance can be used to access modules providing different sets of features. Currently, there is only one documented NFT module that can be accessed via the nfts() method. From that module, you will be able to find, create and update NFTs with more features to come.

For instance, here is how you can fetch an NFT by its mint address.

const nft = await metaplex.nfts().findByMint({ mintAddress });

We call findByMint an Operation on the NFT Module. Each operation accepts an input object as its first argument that is defined by the operation itself. Additionally, each operation accepts a second optional argument that is shared by all operations and used for more generic options. For instance, you may pass an AbortSignal to this second argument to cancel the operation before it finishes — similarly to how you would cancel an HTTP request.

// Create an AbortController that aborts in 100ms.
const abortController = new AbortController();
setTimeout(() => abortController.abort(), 100);

// Pass the AbortController's signal to the operation.
const nft = await metaplex.nfts().findByMint({ mintAddress }, {
signal: abortController.signal
});

Now, let’s look into the NFT module in a bit more detail before moving on to the identity and storage drivers.

NFTs

The NFT module can be accessed via metaplex.nfts() and provides the following methods.

And the following model, either returned or used by the above methods.

You may also be interested in browsing the API References of that module.

findByMint

The findByMint method accepts a mintAddress public key and returns an Nft object.

const mintAddress = new PublicKey("ATe3DymKZadrUoqAMn7HSpraxE4gB88uo1L9zLGmzJeL");

const nft = await metaplex.nfts().findByMint({ mintAddress });

The returned Nft object will have its JSON metadata already loaded so you can, for instance, access its image URL like so (provided it is present in the downloaded metadata).

const imageUrl = nft.json.image;

Similarly, the Edition information of the NFT — original or printed — is also available on the object via the edition property. Its type depends on whether the NFT is the original or a printed edition.

const editionAddress = nft.edition.address;

if (nft.edition.isOriginal) {
const totalPrintedNfts = nft.edition.supply;
const maxNftsThatCanBePrinted = nft.edition.maxSupply;
} else {
const mintAddressOfOriginalNft = nft.edition.parent;
const editionNumber = nft.edition.number;
}

You can read more about the NFT model below.

findAllByMintList

The findAllByMintList operation accepts an array of mint addresses and returns an array of NFTs. However, null values will be returned for each provided mint address that is not associated with an NFT.

Note that this is much more efficient than calling findByMint for each mint in the list as the SDK can optimise the query and fetch multiple NFTs in much fewer requests.

const [nftA, nftB] = await metaplex.nfts().findAllByMintList({
mints: [mintA, mintB]
});

NFTs retrieved via findAllByMintList may be of type Metadata rather than Nft.

What this means is they won't have their JSON metadata loaded because this would require one request per NFT and could be inefficient if you provide a long list of mint addresses. Additionally, you might want to fetch these on-demand, as the NFTs are being displayed on your web app for instance. The same goes for the edition property which requires an extra account to fetch and might be irrelevant until the user clicks on the NFT.

Note that, since plugins can swap operation handlers with their own implementations, it is possible that a plugin relying on indexers return an array of Nfts directly instead of Metadatas. The default implementation though, will return Metadatas.

Thus, if you want to load the json and/or edition properties of an NFT, you need to load that Metadata into an Nft. Which you can do with the next operation.

load

For performance reasons, when fetching NFTs in bulk, you may received Metadatas which exclude the JSON Metadata and the Edition information of the NFT. In order to transform a Metadata into an Nft, you may use the load operation like so.

const nft = await metaplex.nfts().load({ metadata });

This will give you access to the json and edition properties of the NFT as explained in the NFT model documentation.

findAllByOwner

The findAllByOwner method accepts a public key and returns all NFTs owned by that public key.

const myNfts = await metaplex.nfts().findAllByOwner({
owner: metaplex.identity().publicKey
});

Similarly to findAllByMintList, the returned NFTs may be Metadatas.

findAllByCreator

The findAllByCreator method accepts a public key and returns all NFTs that have that public key registered as their first creator. Additionally, you may provide an optional position parameter to match the public key at a specific position in the creator list.

const nfts = await metaplex.nfts().findAllByCreator({ creator });
const nfts = await metaplex.nfts().findAllByCreator({ creator, position: 1 }); // Equivalent to the previous line.
const nfts = await metaplex.nfts().findAllByCreator({ creator, position: 2 }); // Now matching the second creator field.

Similarly to findAllByMintList, the returned NFTs may be Metadatas.

uploadMetadata

When creating or updating an NFT, you will need a URI pointing to some JSON Metadata describing the NFT. Depending on your requirement, you may do this on-chain or off-chain.

If your JSON metadata is not already uploaded, you may do this using the SDK via the uploadMetadata method. It accepts a metadata object and returns the URI of the uploaded metadata. Where exactly the metadata will be uploaded depends on the selected StorageDriver.

const { uri } = await metaplex.nfts().uploadMetadata({
name: "My NFT",
description: "My description",
image: "https://arweave.net/123",
});

console.log(uri) // https://arweave.net/789

Some properties inside that metadata object will also require you to upload some assets to provide their URI — such as the image property on the example above.

To make this process easier, the uploadMetadata method will recognise any instances of MetaplexFile within the provided object and upload them in bulk to the current storage driver. It will then create a new version of the provided metadata where all instances of MetaplexFile are replaced with their URI. Finally, it will upload that replaced metadata to the storage driver and return it.

// Assuming the user uploaded two assets via an input field of type "file".
const browserFiles = event.target.files;

const { uri, metadata } = await metaplex.nfts().uploadMetadata({
name: "My NFT",
image: await toMetaplexFileFromBrowser(browserFiles[0]),
properties: {
files: [
{
type: "video/mp4",
uri: await toMetaplexFileFromBrowser(browserFiles[1]),
},
]
}
});

console.log(metadata.image) // https://arweave.net/123
console.log(metadata.properties.files[0].uri) // https://arweave.net/456
console.log(uri) // https://arweave.net/789

Note that MetaplexFiles can be created in various different ways based on where the file is coming from. You can read more about MetaplexFile objects and how to use them here.

create

The create method accepts a variety of parameters that define the on-chain data of the NFT. The only parameters required are its name, its sellerFeeBasisPoints — i.e. royalties — and the uri pointing to its JSON metadata — remember that you can use uploadMetadata to get that URI. All other parameters are optional as the SDK will do its best to provide sensible default values.

Here's how you can create a new NFT with minimum configuration.

const { nft } = await metaplex.nfts().create({
uri: "https://arweave.net/123",
name: "My NFT",
sellerFeeBasisPoints: 500, // Represents 5.00%.
});

This will take care of creating the mint account, the associated token account, the metadata PDA and the original edition PDA (a.k.a. the master edition) for you.

Additionally, since no other optional parameters were provided, it will do its best to provide sensible default values for the rest of the parameters. Namely:

  • Since no owner, mint authority or update authority were provided, the “identity” of the SDK will be used by default for these parameters. Meaning the SDK's identity will be the owner of that new NFT.
  • It will also default to setting the identity as the first and only creator with a 100% share.
  • It will default to making the NFT mutable — meaning the update authority will be able to update it later on.

If some of these default parameters are not suitable for your use case, you may provide them explicitly when creating the NFT. Here is the exhaustive list of parameters accepted by the create method.

update

The update method accepts an Nft object and a set of parameters to update on the NFT.

For instance, here is how you would change the on-chain name of an NFT.

await metaplex.nfts().update({ 
nftOrSft: nft,
name: "My Updated Name"
});

Anything that you don’t provide in the parameters will stay unchanged. Note that it will not fetch the updated NFT in order to avoid the extra HTTP call if you don't need it. If you do need to refresh the NFT instance to access the latest data, you may do that using the refresh operation.

const updatedNft = await metaplex.nfts().refresh(nft);

If you’d like to change the JSON metadata of the NFT, you’d first need to upload a new metadata object using the uploadMetadata method and then use the provided URI to update the NFT.

const { uri: newUri } = await metaplex.nfts().uploadMetadata({
...nft.json,
name: "My Updated Metadata Name",
description: "My Updated Metadata Description",
});

await metaplex.nfts().update({
nftOrSft: nft,
uri: newUri
});

printNewEdition

The printNewEdition method requires the mint address of the original NFT and returns a brand-new NFT printed from the original edition.

This is how you would print a new edition of the originalNft NFT.

const { nft: printedNft } = await metaplex.nfts().printNewEdition({
originalMint: originalNft.mint
});

By default, it will print using the token account of the original NFT as proof of ownership, and it will do so using the current identity of the SDK. You may customise all of these parameters by providing them explicitly.

await metaplex.nfts().printNewEdition({
originalMint,
newMint, // Defaults to a brand-new Keypair.
newUpdateAuthority, // Defaults to the current identity.
newOwner, // Defaults to the current identity.
originalTokenAccountOwner, // Defaults to the current identity.
originalTokenAccount, // Defaults to the associated token account of the current identity.
});

Notice that, by default, update authority will be transfered to the metaplex identity. If you want the printed edition to retain the update authority of the original edition, you might want to provide it explicitly like so.

await metaplex.nfts().printNewEdition({
originalMint,
newUpdateAuthority: originalNft.updateAuthorityAddress,
});

useNft

The use method requires a usable NFT and will decrease the amount of uses by one. You may also provide the numberOfUses parameter, if you'd like to use it more than once in the same instruction.

await mx.nfts().use({ mintAddress: nft.address }); // Use once.
await mx.nfts().use({ mintAddress: nft.address, numberOfUses: 3 }); // Use three times.

The Nft model

All of the methods above either return or interact with an Nft object. The Nft object is a read-only data representation of your NFT that contains all the information you need at the top level.

Here is an overview of the properties that are available on the Nft object.

type Nft = Readonly<{
model: 'nft';
address: PublicKey;
metadataAddress: Pda;
updateAuthorityAddress: PublicKey;
json: Option<Json>;
jsonLoaded: boolean;
name: string;
symbol: string;
uri: string;
isMutable: boolean;
primarySaleHappened: boolean;
sellerFeeBasisPoints: number;
editionNonce: Option<number>;
creators: Creator[];
tokenStandard: Option<TokenStandard>;
collection: Option<{
address: PublicKey;
verified: boolean;
}>;
collectionDetails: Option<{
version: 'V1';
size: BigNumber;
}>;
uses: Option<{
useMethod: UseMethod;
remaining: BigNumber;
total: BigNumber;
}>;
mint: {
model: 'mint';
address: PublicKey;
mintAuthorityAddress: Option<PublicKey>;
freezeAuthorityAddress: Option<PublicKey>;
decimals: number;
supply: SplTokenAmount;
isWrappedSol: boolean;
currency: SplTokenCurrency;
};
edition:
| {
model: 'nftEdition';
isOriginal: true;
address: PublicKey;
supply: BigNumber;
maxSupply: Option<BigNumber>;
}
| {
model: 'nftEdition';
isOriginal: false;
address: PublicKey;
parent: PublicKey;
number: BigNumber;
};
}>

Additionally, The SDK may sometimes return a Metadata instead of an Nft object. The Metadata model contains the same data as the Nft model but it excludes the following properties: json, mint and edition. This is because they are not always needed and/or can be expensive to load. Therefore, the SDK uses the following rule of thumb:

  • If you're only fetching one NFT — e.g. by using findByMint — then you will receive an Nft object containing these properties.
  • If you're fetching multiple NFTs — e.g. by using findAllByMintLint — then you will receive an array of Metadata that do not contain these properties.

You may obtain an Nft object from a Metadata object by using the load method explained above,

Candy Machines

The Candy Machine module can be accessed via metaplex.candyMachinesV2() and provides the following documented methods.

The Candy Machine actually contains more features and models but we are still in the process of documenting them.

findMintedNfts

The findMintedNfts method accepts the public key of a Candy Machine and returns all NFTs that have been minted from that Candy Machine so far.

By default, it will assume you're providing the public key of a Candy Machine v2. If you want to use a different version, you can provide the version as the second parameter.

const nfts = await metaplex.candyMachinesV2().findMintedNfts({ candyMachine });
const nfts = await metaplex.candyMachinesV2().findMintedNfts({ candyMachine, version: 2 }); // Equivalent to the previous line.
const nfts = await metaplex.candyMachinesV2().findMintedNfts({ candyMachine, version: 1 }); // Now finding NFTs for Candy Machine v1.

Note that the current implementation of this method delegates to nfts().findAllByCreator() whilst fetching the appropriate PDA for Candy Machines v2.

Similarly to findAllByMintList, the returned NFTs may be Metadatas.

Identity

The current identity of a Metaplex instance can be accessed via metaplex.identity() and provide information on the wallet we are acting on behalf of when interacting with the SDK.

This method returns an identity client with the following interface.

class IdentityClient {
driver(): IdentityDriver;
setDriver(newDriver: IdentityDriver): void;
publicKey: PublicKey;
secretKey?: Uint8Array;
signMessage(message: Uint8Array): Promise<Uint8Array>;
verifyMessage(message: Uint8Array, signature: Uint8Array): boolean;
signTransaction(transaction: Transaction): Promise<Transaction>;
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
equals(that: Signer | PublicKey): boolean;
hasSecretKey(): this is KeypairSigner;
}

The IdentityClient delegates to whichever IdentityDriver is currently set to provide this set of methods. Thus, the implementation of these methods depends on the concrete identity driver being used. For instance, in the CLI, these methods will directly use a key pair whereas, in the browser, they will delegate to a wallet adapter.

Let’s have a quick look at the concrete identity drivers available to us.

guestIdentity

The guestIdentity driver is the default driver and requires no parameter. It is essentially a null driver that can be useful when we don’t need to send any signed transactions.

import { guestIdentity } from "@metaplex-foundation/js";

metaplex.use(guestIdentity());

If we try to sign a message or a transaction using this driver, an error will be thrown.

keypairIdentity

The keypairIdentity driver accepts a Keypair object as a parameter. This is useful when using the SDK locally such as within CLI applications.

import { keypairIdentity } from "@metaplex-foundation/js";
import { Keypair } from "@solana/web3.js";

// Load a local keypair.
const keypairFile = fs.readFileSync('/Users/username/.config/solana/id.json');
const keypair = Keypair.fromSecretKey(Buffer.from(JSON.parse(keypairFile.toString())));

// Use it in the SDK.
metaplex.use(keypairIdentity(keypair));

walletAdapterIdentity

The walletAdapterIdentity driver accepts a wallet adapter as defined by the “wallet-adapter” repo from Solana Labs. This is useful when using the SDK in a web application that requires the user to manually approve transactions.

import { walletAdapterIdentity } from "@metaplex-foundation/js";
import { useWallet } from '@solana/wallet-adapter-react';

const wallet = useWallet();
metaplex.use(walletAdapterIdentity(wallet));

Storage

You may access the storage client using metaplex.storage() which will give you access to the following interface.

class StorageClient {
driver(): StorageDriver
setDriver(newDriver: StorageDriver): void;
getUploadPriceForBytes(bytes: number): Promise<Amount>;
getUploadPriceForFile(file: MetaplexFile): Promise<Amount>;
getUploadPriceForFiles(files: MetaplexFile[]): Promise<Amount>;
upload(file: MetaplexFile): Promise<string>;
uploadAll(files: MetaplexFile[]): Promise<string[]>;
uploadJson<T extends object = object>(json: T): Promise<string>;
download(uri: string, options?: RequestInit): Promise<MetaplexFile>;
downloadJson<T extends object = object>(uri: string, options?: RequestInit): Promise<T>;
}

Similarly to the IdentityClient, the StorageClient delegates to the current StorageDriver when executing these methods. We'll take a look at the storage drivers available to us, but first, let's talk about the MetaplexFile type which is being used throughout the StorageClient API.

MetaplexFile

The MetaplexFile type is a simple wrapper around Buffer that adds additional context relevant to files and assets such as their filename, content type, extension, etc. It contains the following data.

type MetaplexFile = Readonly<{
buffer: Buffer;
fileName: string;
displayName: string;
uniqueName: string;
contentType: string | null;
extension: string | null;
tags: MetaplexFileTag[];
}>

You may use the toMetaplexFile function to create a MetaplexFile object from a Buffer instance (or content string) and a filename. The filename is necessary to infer the extension and the mime type of the provided file.

const file = toMetaplexFile('The content of my file', 'my-file.txt');

You may also explicitly provide these options by passing a third parameter to the constructor.

const file = toMetaplexFile('The content of my file', 'my-file.txt', {
displayName = 'A Nice Title For My File'; // Defaults to the filename.
uniqueName = 'my-company/files/some-identifier'; // Defaults to a random string.
contentType = 'text/plain'; // Infer it from filename by default.
extension = 'txt'; // Infer it from filename by default.
tags = [{ name: 'my-tag', value: 'some-value' }]; // Defaults to [].
});

Note that if you want to create a MetaplexFile directly from a JSON object, there's a toMetaplexFileFromJson helper method that you can use like so.

const file = toMetaplexFileFromJson({ foo: 42 });

In practice, you will most likely be creating MetaplexFiles from files either present on your computer or uploaded by some user on the browser. You can do the former by using fs.readFileSync.

const buffer = fs.readFileSync('/path/to/my-file.txt');
const file = toMetaplexFile(buffer, 'my-file.txt');

And the latter by using the toMetaplexFileFromBrowser helper method which accepts a File object as defined in the browser.

const browserFile: File = event.target.files[0];
const file: MetaplexFile = await toMetaplexFileFromBrowser(browserFile);

Okay, now let’s talk about the concrete storage drivers available to us and how to set them up.

bundlrStorage

The bundlrStorage driver is the default driver and uploads assets on Arweave using the Bundlr network.

By default, it will use the same RPC endpoint used by the Metaplex instance as a providerUrl and the mainnet address "https://node1.bundlr.network" as the Bundlr address.

You may customise these by passing a parameter object to the bundlrStorage method. For instance, here’s how you can use Bundlr on devnet.

import { bundlrStorage } from "@metaplex-foundation/js";

metaplex.use(bundlrStorage({
address: 'https://devnet.bundlr.network',
providerUrl: 'https://api.devnet.solana.com',
timeout: 60000,
}));

To fund your bundlr storage account you can cast it in TypeScript like so:

const bundlrStorage = metaplex.storage().driver() as BundlrStorageDriver;

This gives you access to useful public methods such as:

bundlrStorage.fund([metaplexFile1, metaplexFile2]); // Fund using file size.
bundlrStorage.fund(1000); // Fund using byte size.
(await bundlrStorage.bundlr()).fund(1000); // Fund using lamports directly.

mockStorage

The mockStorage driver is a fake driver mostly used for testing purposes. It will not actually upload the assets anywhere but instead will generate random URLs and keep track of their content in a local dictionary. That way, once uploaded, an asset can be retrieved using the download method.

import { mockStorage } from "@metaplex-foundation/js";

metaplex.use(mockStorage());

Additional Storage Drivers

The following storage drivers are available as separate packages and must be installed separately.

Index

Classes

Type Aliases

MetaplexOptions AuctionHouse AuctioneerAuctionHouse LazyBid LazyListing Purchase LazyPurchase BundlrOptions BundlrWalletAdapter AddressGateGuardSettings AllowListGuardSettings AllowListGuardRouteSettings BotTaxGuardSettings CandyGuardManifest MintSettingsParserInput RouteSettingsParserInput CandyGuardsSettings CandyGuardsMintSettings CandyGuardsRouteSettings CandyGuardsRemainingAccount DefaultCandyGuardSettings DefaultCandyGuardMintSettings DefaultCandyGuardRouteSettings EndDateGuardSettings FreezeSolPaymentGuardSettings FreezeSolPaymentGuardRouteSettings FreezeTokenPaymentGuardSettings FreezeTokenPaymentGuardRouteSettings GatekeeperGuardSettings GatekeeperGuardMintSettings MintLimitGuardSettings NftBurnGuardSettings NftBurnGuardMintSettings NftGateGuardSettings NftGateGuardMintSettings NftPaymentGuardSettings NftPaymentGuardMintSettings ProgramGateGuardSettings RedeemedAmountGuardSettings SolPaymentGuardSettings StartDateGuardSettings ThirdPartySignerGuardSettings ThirdPartySignerGuardMintSettings TokenBurnGuardSettings TokenGateGuardSettings TokenPaymentGuardSettings CreateCandyMachineV2InputWithoutConfigs IdentityDriver HasMintAddress ConfirmTransactionResponse SendAndConfirmTransactionResponse MetaplexFile MetaplexFileContent MetaplexFileTag MetaplexFileOptions StorageDriver StorageDownloadOptions WalletAdapter AccountInfo Account MaybeAccount UnparsedAccount UnparsedMaybeAccount AccountParsingFunction AccountParsingAndAssertingFunction Amount Currency SplTokenCurrency SplTokenAmount SolCurrency SolAmount UsdCurrency UsdAmount BigNumber BigNumberValues Cluster DateTimeString DateTimeValues DateTime FeatureFlags HasDriver HasMetaplex MetaplexPlugin Model KeyOfOperation InputOfOperation OutputOfOperation Operation OperationConstructor OperationOptions OperationScope OperationHandler ErrorWithLogs ErrorWithCode Program PublicKeyString PublicKeyValues Serializer SolitaType Signer KeypairSigner IdentitySigner SignerHistogram DisposableScope GmaBuilderOptions GpaSortCallback TaskStatus TaskCallback TaskOptions InstructionWithSigners TransactionBuilderOptions WalkOptions PartialKeys RequiredKeys Option Opaque

Errors

BundlrError FailedToInitializeBundlrError FailedToConnectToBundlrAddressError AssetUploadFailedError BundlrWithdrawError MetaplexError MetaplexErrorSource ProgramError ParsedProgramError UnknownProgramError RpcError FailedToSendTransactionError FailedToConfirmTransactionError FailedToConfirmTransactionWithResponseError SdkError OperationHandlerMissingError DriverNotProvidedError UnexpectedCurrencyError CurrencyMismatchError InvalidJsonVariableError InvalidJsonStringError OperationUnauthorizedForGuestsError UninitializedWalletAdapterError OperationNotSupportedByWalletAdapterError TaskIsAlreadyRunningError AssetNotFoundError AccountNotFoundError UnexpectedAccountError UnexpectedTypeError ExpectedSignerError ProgramNotRecognizedError NoInstructionsToSendError FailedToSerializeDataError FailedToDeserializeDataError MissingInputDataError NotYetImplementedError UnreachableCaseError AuctionHouseError TreasuryDestinationOwnerRequiredError AuctioneerAuthorityRequiredError AuctioneerPartialSaleNotSupportedError BidAndListingHaveDifferentAuctionHousesError BidAndListingHaveDifferentMintsError CanceledBidIsNotAllowedError CanceledListingIsNotAllowedError CreateListingRequiresSignerError WithdrawFromBuyerAccountRequiresSignerError PartialPriceMismatchError FindAllSupportsOnlyThreeFiltersMaxError CandyMachineV3Error UnregisteredCandyGuardError CandyMachineIsFullError CandyMachineCannotAddAmountError CandyMachineItemTextTooLongError CandyMachineBotTaxError GuardGroupRequiredError SelectedGuardGroupDoesNotExistError GuardMintSettingsMissingError GuardRouteNotSupportedError CandyGuardRequiredOnCandyMachineError GuardNotEnabledError GuardGroupLabelTooLongError UnrecognizePathForRouteInstructionError MintOwnerMustBeMintPayerError MaximumOfFiveAdditionalProgramsError CandyMachineV2Error CandyMachineV2IsFullError CandyMachineV2IsEmptyError CandyMachineV2CannotAddAmountError CandyMachineV2AddItemConstraintsViolatedError CandyMachineV2NotLiveError CandyMachineV2EndedError CandyMachineV2BotTaxError DerivedIdentityError UninitializedDerivedIdentityError NftError ParentCollectionMissingError TokenError MintAuthorityMustBeSignerToMintInitialSupplyError TokenAndMintDoNotMatchError AssertionError

Module Builders

Modules

Module Pdas

Accounts

Account Helpers

Model Helpers

Models

Functions

isPurchase assertPurchase toPurchase isLazyPurchase assertLazyPurchase toLazyPurchase isBundlrStorageDriver bundlrStorage toCandyMachineData getCandyMachineSize isCandyGuardProgram assertCandyGuardProgram countCandyMachineV2Items parseCandyMachineV2Items getCandyMachineV2AccountSizeFromData getCandyMachineV2UuidFromAddress corePlugins keypairIdentity mockStorage toMintAddress getAssetsFromJsonMetadata replaceAssetsWithUris toMetaplexFile toMetaplexFileFromBrowser toMetaplexFileFromJson parseMetaplexFileContent getBytesFromMetaplexFiles getBrowserFileFromMetaplexFile isMetaplexFile transferSolOperation transferSolBuilder walletAdapterIdentity getAccountParsingFunction getAccountParsingAndAssertingFunction assertAccountExists toAccountInfo amount lamports sol usd token isSol sameAmounts sameCurrencies assertCurrency assertSol assertSameCurrencies addAmounts subtractAmounts multiplyAmount divideAmount absoluteAmount compareAmounts isEqualToAmount isLessThanAmount isLessThanOrEqualToAmount isGreaterThanAmount isGreaterThanOrEqualToAmount isZeroAmount isPositiveAmount isNegativeAmount formatAmount toBigNumber toOptionBigNumber isBigNumber assertBigNumber resolveClusterFromConnection resolveClusterFromEndpoint toDateTime now toOptionDateTime isDateTime assertDateTime formatDateTime serializeFeatureFlags deserializeFeatureFlags isModel assertModel makeConfirmOptionsFinalizedOnMainnet isErrorWithLogs toPublicKey mapSerializer createSerializerFromBeet createSerializerFromSolitaType serialize deserialize deserializeAccount serializeDiscriminator isSigner isKeypairSigner isIdentitySigner getSignerHistogram assertObjectHasDefinedKeys removeEmptyChars padEmptyChars tryOr tryOrNull chunk zipMap randomStr getContentType getExtension walk removeUndefinedAttributes logErrorDebug logInfoDebug logDebug logTrace logError logInfo getMerkleTree getMerkleRoot getMerkleProof getMerkleProofAtIndex

Operations - Constructors

cancelBidOperation cancelListingOperation createAuctionHouseOperation createBidOperation createListingOperation depositToBuyerAccountOperation directBuyOperation directSellOperation executeSaleOperation findAuctionHouseByAddressOperation findAuctionHouseByCreatorAndMintOperation findBidByReceiptOperation findBidByTradeStateOperation findBidsOperation findListingByReceiptOperation findListingByTradeStateOperation findListingsOperation findPurchaseByReceiptOperation findPurchaseByTradeStateOperation findPurchasesOperation getBuyerBalanceOperation loadBidOperation loadListingOperation loadPurchaseOperation updateAuctionHouseOperation withdrawFromBuyerAccountOperation withdrawFromFeeAccountOperation withdrawFromTreasuryAccountOperation callCandyGuardRouteOperation createCandyGuardOperation createCandyMachineOperation deleteCandyGuardOperation deleteCandyMachineOperation findCandyGuardByAddressOperation findCandyGuardsByAuthorityOperation findCandyMachineByAddressOperation insertCandyMachineItemsOperation mintFromCandyMachineOperation unwrapCandyGuardOperation updateCandyGuardOperation updateCandyMachineOperation wrapCandyGuardOperation createCandyMachineV2Operation deleteCandyMachineV2Operation findCandyMachineV2ByAddressOperation findCandyMachinesV2ByPublicKeyFieldOperation findMintedNftsByCandyMachineV2Operation insertItemsToCandyMachineV2Operation mintCandyMachineV2Operation updateCandyMachineV2Operation approveNftCollectionAuthorityOperation approveNftUseAuthorityOperation createNftOperation createSftOperation deleteNftOperation findNftByMetadataOperation findNftByMintOperation findNftByTokenOperation findNftsByCreatorOperation findNftsByMintListOperation findNftsByOwnerOperation findNftsByUpdateAuthorityOperation freezeDelegatedNftOperation loadMetadataOperation migrateToSizedCollectionNftOperation printNewEditionOperation revokeNftCollectionAuthorityOperation revokeNftUseAuthorityOperation thawDelegatedNftOperation unverifyNftCollectionOperation unverifyNftCreatorOperation updateNftOperation uploadMetadataOperation useNftOperation verifyNftCollectionOperation verifyNftCreatorOperation createAccountOperation approveTokenDelegateAuthorityOperation createMintOperation createTokenOperation createTokenWithMintOperation findMintByAddressOperation findTokenByAddressOperation findTokenWithMintByAddressOperation findTokenWithMintByMintOperation freezeTokensOperation mintTokensOperation revokeTokenDelegateAuthorityOperation sendTokensOperation thawTokensOperation useOperation

Operations - Types

CancelBidOperation CancelListingOperation CreateAuctionHouseOperation CreateBidOperation CreateListingOperation DepositToBuyerAccountOperation DirectBuyOperation DirectSellOperation ExecuteSaleOperation FindAuctionHouseByAddressOperation FindAuctionHouseByCreatorAndMintOperation FindBidByReceiptOperation FindBidByTradeStateOperation FindBidsOperation FindListingByReceiptOperation FindListingByTradeStateOperation FindListingsOperation FindPurchaseByReceiptOperation FindPurchaseByTradeStateOperation FindPurchasesOperation GetBuyerBalanceOperation LoadBidOperation LoadListingOperation LoadPurchaseOperation UpdateAuctionHouseOperation WithdrawFromBuyerAccountOperation WithdrawFromFeeAccountOperation WithdrawFromTreasuryAccountOperation CallCandyGuardRouteOperation CreateCandyGuardOperation CreateCandyMachineOperation DeleteCandyGuardOperation DeleteCandyMachineOperation FindCandyGuardByAddressOperation FindCandyGuardsByAuthorityOperation FindCandyMachineByAddressOperation InsertCandyMachineItemsOperation MintFromCandyMachineOperation UnwrapCandyGuardOperation UpdateCandyGuardOperation UpdateCandyMachineOperation WrapCandyGuardOperation CreateCandyMachineV2Operation DeleteCandyMachineV2Operation FindCandyMachineV2ByAddressOperation FindCandyMachinesV2ByPublicKeyFieldOperation FindMintedNftsByCandyMachineV2Operation InsertItemsToCandyMachineV2Operation MintCandyMachineV2Operation UpdateCandyMachineV2Operation ApproveNftCollectionAuthorityOperation ApproveNftUseAuthorityOperation CreateNftOperation CreateSftOperation DeleteNftOperation FindNftByMetadataOperation FindNftByMintOperation FindNftByTokenOperation FindNftsByCreatorOperation FindNftsByMintListOperation FindNftsByOwnerOperation FindNftsByUpdateAuthorityOperation FreezeDelegatedNftOperation LoadMetadataOperation MigrateToSizedCollectionNftOperation PrintNewEditionOperation RevokeNftCollectionAuthorityOperation RevokeNftUseAuthorityOperation ThawDelegatedNftOperation UnverifyNftCollectionOperation UnverifyNftCreatorOperation UpdateNftOperation UploadMetadataOperation UseNftOperation VerifyNftCollectionOperation VerifyNftCreatorOperation CreateAccountOperation TransferSolOperation ApproveTokenDelegateAuthorityOperation CreateMintOperation CreateTokenOperation CreateTokenWithMintOperation FindMintByAddressOperation FindTokenByAddressOperation FindTokenWithMintByAddressOperation FindTokenWithMintByMintOperation FreezeTokensOperation MintTokensOperation RevokeTokenDelegateAuthorityOperation SendTokensOperation ThawTokensOperation

Operations - Inputs

CancelBidInput CancelListingInput CreateAuctionHouseInput CreateBidInput CreateListingInput DepositToBuyerAccountInput DirectBuyInput DirectSellInput ExecuteSaleInput FindAuctionHouseByAddressInput FindAuctionHouseByCreatorAndMintInput FindBidByReceiptInput FindBidByTradeStateInput FindBidsInput FindListingByReceiptInput FindListingByTradeStateInput FindListingsInput FindPurchaseByReceiptInput FindPurchaseByTradeStateInput FindPurchasesInput GetBuyerBalanceInput LoadBidInput LoadListingInput LoadPurchaseInput UpdateAuctionHouseInput WithdrawFromBuyerAccountInput WithdrawFromFeeAccountInput WithdrawFromTreasuryAccountInput CallCandyGuardRouteInput CreateCandyGuardInput CreateCandyMachineInput DeleteCandyGuardInput DeleteCandyMachineInput FindCandyGuardByAddressInput FindCandyGuardsByAuthorityInput FindCandyMachineByAddressInput InsertCandyMachineItemsInput MintFromCandyMachineInput UnwrapCandyGuardInput UpdateCandyGuardInput UpdateCandyMachineInput WrapCandyGuardInput CreateCandyMachineV2Input DeleteCandyMachineV2Input FindCandyMachineV2ByAddressInput FindCandyMachinesV2ByPublicKeyFieldInput FindMintedNftsByCandyMachineV2Input InsertItemsToCandyMachineV2Input MintCandyMachineV2Input UpdateCandyMachineV2Input ApproveNftCollectionAuthorityInput ApproveNftUseAuthorityInput CreateNftInput CreateSftInput DeleteNftInput FindNftByMetadataInput FindNftByMintInput FindNftByTokenInput FindNftsByCreatorInput FindNftsByMintListInput FindNftsByOwnerInput FindNftsByUpdateAuthorityInput FreezeDelegatedNftInput LoadMetadataInput MigrateToSizedCollectionNftInput PrintNewEditionInput RevokeNftCollectionAuthorityInput RevokeNftUseAuthorityInput ThawDelegatedNftInput UnverifyNftCollectionInput UnverifyNftCreatorInput UpdateNftInput UploadMetadataInput UseNftInput VerifyNftCollectionInput VerifyNftCreatorInput CreateAccountInput TransferSolInput ApproveTokenDelegateAuthorityInput CreateMintInput CreateTokenInput CreateTokenWithMintInput FindMintByAddressInput FindTokenByAddressInput FindTokenWithMintByAddressInput FindTokenWithMintByMintInput FreezeTokensInput MintTokensInput RevokeTokenDelegateAuthorityInput SendTokensInput ThawTokensInput CreatorInput

Operations - Outputs

CancelBidOutput CancelListingOutput CreateAuctionHouseOutput CreateBidOutput CreateListingOutput DepositToBuyerAccountOutput DirectBuyOutput DirectSellOutput ExecuteSaleOutput FindBidsOutput FindListingsOutput FindPurchasesOutput GetBuyerBalanceOutput UpdateAuctionHouseOutput WithdrawFromBuyerAccountOutput WithdrawFromFeeAccountOutput WithdrawFromTreasuryAccountOutput CallCandyGuardRouteOutput CreateCandyGuardOutput CreateCandyMachineOutput DeleteCandyGuardOutput DeleteCandyMachineOutput InsertCandyMachineItemsOutput MintFromCandyMachineOutput UnwrapCandyGuardOutput UpdateCandyGuardOutput UpdateCandyMachineOutput WrapCandyGuardOutput CreateCandyMachineV2Output DeleteCandyMachineV2Output FindMintedNftsByCandyMachineV2Output InsertItemsToCandyMachineV2Output MintCandyMachineV2Output UpdateCandyMachineV2Output ApproveNftCollectionAuthorityOutput ApproveNftUseAuthorityOutput CreateNftOutput CreateSftOutput DeleteNftOutput FindNftByMetadataOutput FindNftByMintOutput FindNftByTokenOutput FindNftsByCreatorOutput FindNftsByMintListOutput FindNftsByOwnerOutput FindNftsByUpdateAuthorityOutput FreezeDelegatedNftOutput LoadMetadataOutput MigrateToSizedCollectionNftOutput PrintNewEditionOutput RevokeNftCollectionAuthorityOutput RevokeNftUseAuthorityOutput ThawDelegatedNftOutput UnverifyNftCollectionOutput UnverifyNftCreatorOutput UpdateNftOutput UploadMetadataOutput UseNftOutput VerifyNftCollectionOutput VerifyNftCreatorOutput CreateAccountOutput TransferSolOutput ApproveTokenDelegateAuthorityOutput CreateMintOutput CreateTokenOutput CreateTokenWithMintOutput FreezeTokensOutput MintTokensOutput RevokeTokenDelegateAuthorityOutput SendTokensOutput ThawTokensOutput

Operations - Handlers

cancelBidOperationHandler cancelListingOperationHandler createAuctionHouseOperationHandler createBidOperationHandler createListingOperationHandler depositToBuyerAccountOperationHandler directBuyOperationHandler directSellOperationHandler findAuctionHouseByAddressOperationHandler findAuctionHouseByCreatorAndMintOperationHandler findBidByReceiptOperationHandler findBidByTradeStateOperationHandler findBidsOperationHandler findListingByReceiptOperationHandler findListingByTradeStateOperationHandler findListingsOperationHandler findPurchaseByReceiptOperationHandler findPurchaseByTradeStateOperationHandler findPurchasesOperationHandler getBuyerBalanceOperationHandler loadBidOperationHandler loadListingOperationHandler loadPurchaseOperationHandler updateAuctionHouseOperationHandler withdrawFromBuyerAccountOperationHandler withdrawFromFeeAccountOperationHandler withdrawFromTreasuryAccountOperationHandler callCandyGuardRouteOperationHandler createCandyGuardOperationHandler createCandyMachineOperationHandler deleteCandyGuardOperationHandler deleteCandyMachineOperationHandler findCandyGuardByAddressOperationHandler findCandyGuardsByAuthorityOperationHandler findCandyMachineByAddressOperationHandler insertCandyMachineItemsOperationHandler mintFromCandyMachineOperationHandler unwrapCandyGuardOperationHandler updateCandyGuardOperationHandler updateCandyMachineOperationHandler wrapCandyGuardOperationHandler createCandyMachineV2OperationHandler deleteCandyMachineV2OperationHandler findCandyMachineV2ByAddressOperationHandler findCandyMachinesV2ByPublicKeyFieldOperationHandler findMintedNftsByCandyMachineV2OperationHandler InsertItemsToCandyMachineV2OperationHandler mintCandyMachineV2OperationHandler updateCandyMachineV2OperationHandler approveNftCollectionAuthorityOperationHandler approveNftUseAuthorityOperationHandler createNftOperationHandler createSftOperationHandler deleteNftOperationHandler findNftByMetadataOperationHandler findNftByMintOperationHandler findNftByTokenOperationHandler findNftsByCreatorOperationHandler findNftsByMintListOperationHandler findNftsByOwnerOperationHandler findNftsByUpdateAuthorityOperationHandler freezeDelegatedNftOperationHandler loadMetadataOperationHandler migrateToSizedCollectionNftOperationHandler printNewEditionOperationHandler revokeNftCollectionAuthorityOperationHandler revokeNftUseAuthorityOperationHandler thawDelegatedNftOperationHandler unverifyNftCollectionOperationHandler unverifyNftCreatorOperationHandler updateNftOperationHandler uploadMetadataOperationHandler useNftOperationHandler verifyNftCollectionOperationHandler verifyNftCreatorOperationHandler createAccountOperationHandler transferSolOperationHandler approveTokenDelegateAuthorityOperationHandler createMintOperationHandler createTokenOperationHandler createTokenWithMintOperationHandler findMintByAddressOperationHandler findTokenByAddressOperationHandler findTokenWithMintByAddressOperationHandler findTokenWithMintByMintOperationHandler freezeTokensOperationHandler mintTokensOperationHandler revokeTokenDelegateAuthorityOperationHandler sendTokensOperationHandler thawTokensOperationHandler

Transaction Builders - Constructors

Transaction Builders - Inputs

CancelBidBuilderParams CancelListingBuilderParams CreateAuctionHouseBuilderParams CreateBidBuilderParams DepositToBuyerAccountBuilderParams DirectBuyBuilderParams DirectSellBuilderParams ExecuteSaleBuilderParams UpdateAuctionHouseBuilderParams WithdrawFromBuyerAccountBuilderParams WithdrawFromFeeAccountBuilderParams WithdrawFromTreasuryAccountBuilderParams CallCandyGuardRouteBuilderParams CreateCandyGuardBuilderParams CreateCandyMachineBuilderParams DeleteCandyGuardBuilderParams DeleteCandyMachineBuilderParams InsertCandyMachineItemsBuilderParams MintFromCandyMachineBuilderParams UnwrapCandyGuardBuilderParams UpdateCandyGuardBuilderParams UpdateCandyMachineBuilderParams WrapCandyGuardBuilderParams CreateCandyMachineV2BuilderParams DeleteCandyMachineV2BuilderParams InsertItemsToCandyMachineV2BuilderParams MintCandyMachineV2BuilderParams UpdateCandyMachineV2BuilderParams ApproveNftCollectionAuthorityBuilderParams ApproveNftUseAuthorityBuilderParams CreateNftBuilderParams CreateSftBuilderParams DeleteNftBuilderParams FreezeDelegatedNftBuilderParams MigrateToSizedCollectionNftBuilderParams PrintNewEditionBuilderParams RevokeNftCollectionAuthorityBuilderParams RevokeNftUseAuthorityBuilderParams ThawDelegatedNftBuilderParams UnverifyNftCollectionBuilderParams UnverifyNftCreatorBuilderParams UpdateNftBuilderParams UseNftBuilderParams VerifyNftCollectionBuilderParams VerifyNftCreatorBuilderParams CreateAccountBuilderParams TransferSolBuilderParams ApproveTokenDelegateAuthorityBuilderParams CreateMintBuilderParams CreateTokenBuilderParams CreateTokenIfMissingBuilderParams CreateTokenWithMintBuilderParams FreezeTokensBuilderParams MintTokensBuilderParams RevokeTokenDelegateAuthorityBuilderParams SendTokensBuilderParams ThawTokensBuilderParams

Transaction Builders - Contexts

Plugins

Module

Programs

Pdas

Constants

Generated using TypeDoc