pub fn mint_simple<'info>(
token_name: String,
token_symbol: String,
token_uri: String,
token_tax: u16,
payer: AccountInfo<'info>,
token_metadata_program: AccountInfo<'info>,
update_authority: AccountInfo<'info>,
metadata: AccountInfo<'info>,
mint_authority: AccountInfo<'info>,
system_program: AccountInfo<'info>,
rent: AccountInfo<'info>,
token_program: AccountInfo<'info>,
mint: AccountInfo<'info>,
to: AccountInfo<'info>,
owner: AccountInfo<'info>,
signer_seeds: &[&[u8]],
amount: u64,
) -> Result<()>Expand description
Mints new SPL tokens with associated metadata.
This function creates metadata for a new token using the mpl_token_metadata
program, and mints the specified number of tokens to the to account.
§Arguments
token_name- The name of the token to be minted.token_symbol- The symbol for the token.token_uri- A URI pointing to the token’s metadata (e.g., hosted image or metadata information).token_tax- The seller fee basis points (bps) for token transactions.payer- The account responsible for paying transaction fees.token_metadata_program- The account for the token metadata program.update_authority- The account authorized to update the token’s metadata.metadata- The metadata account for the token.mint_authority- The account authorized to mint the tokens.system_program- The system program account.rent- The rent sysvar account.token_program- The SPL token program account.mint- The token mint account.to- The account where the minted tokens will be transferred to.owner- The owner of thetoaccount.signer_seeds- The seeds used to sign the transaction.amount- The number of tokens to mint.
§Example
use simplespl::mint_simple;
use anchor_lang::solana_program::account_info::AccountInfo;
let result = mint_simple(
"TokenName".to_string(),
"TKN".to_string(),
"https://example.com/token-metadata".to_string(),
500, // 5% seller fee
payer_account_info,
token_metadata_program_info,
update_authority_info,
metadata_account_info,
mint_authority_info,
system_program_info,
rent_sysvar_info,
token_program_info,
mint_account_info,
to_account_info,
owner_account_info,
&[&signer_seeds],
1000 // Mint 1000 tokens
).unwrap();