Protected Readonly metaplexYou may use the builders() client to access the
underlying Transaction Builders of this module.
const buildersClient = metaplex.tokens().builders();
You may use the pdas() client to build PDAs related to this module.
const pdasClient = metaplex.tokens().pdas();
Finds a mint account by its address.
const mint = await metaplex.tokens().findMintByAddress({ address });
Optional options: OperationOptionsFinds a token account by its address.
const token = await metaplex.tokens().findTokenByAddress({ address });
Optional options: OperationOptionsFinds a token account and its associated mint account by providing the token address.
const tokenWithMint = await metaplex.tokens().findTokenWithMintByAddress({ address });
Optional options: OperationOptionsFinds a token account and its associated mint account by providing the mint address and either:
const tokenWithMint = await metaplex
.tokens()
.findTokenWithMintByMint({ mint, address: tokenAddress, type: "token" };
const tokenWithMint = await metaplex
.tokens()
.findTokenWithMintByMint({ mint, address: ownerAddress, type: "owner" };
Optional options: OperationOptionsCreates a new mint account.
const { mint } = await metaplex.tokens().createMint();
Optional options: OperationOptionsCreates a new token account.
const { token } = await metaplex.tokens().createToken({ mint });
Optional options: OperationOptionsCreates both mint and token accounts in the same transaction.
const { token } = await metaplex.tokens().createTokenWithMint();
const mint = token.mint;
Optional options: OperationOptionsMint tokens to an account.
await metaplex
.tokens()
.mint({
mintAddress,
toOwner,
amount: token(100),
};
Optional options: OperationOptionsSend tokens from one account to another.
await metaplex
.tokens()
.send({
mintAddress,
toOwner,
amount: token(100),
};
Optional options: OperationOptionsFreezes a token account.
await metaplex.tokens().freeze({ mintAddress, freezeAuthority });
Optional options: OperationOptionsThaws a token account.
await metaplex.tokens().thaw({ mintAddress, freezeAuthority });
Optional options: OperationOptionsApproves a delegate authority for a token account.
await metaplex
.tokens()
.approveDelegateAuthority({
delegateAuthority,
mintAddress,
};
Optional options: OperationOptionsRevokes the current delegate authority for a token account.
await metaplex
.tokens()
.revokeDelegateAuthority({ mintAddress };
Optional options: OperationOptionsGenerated using TypeDoc
This is a client for the Token module.
It enables us to interact with the SPL Token program in order to create, send, freeze, thaw, and mint tokens.
You may access this client via the
tokens()method of yourMetaplexinstance.Example
You can create a new mint account with an associated token account like so. The owner of this token account will, by default, be the current identity of the metaplex instance.