Create Token Mint
Creates a new SPL token mint with specified parameters.
Returns: Promise<Address>
Options
mintAuthority
:KeyPairSigner
- Authority that can mint new tokensdecimals
:number
- Number of decimal places for the tokenname
:string
- Name of the tokensymbol
:string
- Symbol of the tokenuri
:string
- URI pointing to the token’s metadata (eg: “https://arweave.net/abc123 ”)additionalMetadata
:Record<string, string> | Map<string, string>
(optional) - Additional metadata fields
Examples
Create a token with additional metadata:
const mintAddress = await connection.createTokenMint({
mintAuthority: wallet,
decimals: 9,
name: "My Token",
symbol: "TKN",
uri: "https://example.com/token-metadata.json",
additionalMetadata: {
description: "A sample token",
website: "https://example.com",
},
});
A metadata.json
file, and any images inside, should be hosted at a decentralized storage service . The file itself is at minimum:
{
"image": "https://raw.githubusercontent.com/solana-developers/opos-asset/main/assets/CompressedCoil/image.png"
}
Images should be square, and either 512x512 or 1024x1024 pixels, and less than 100kb if possible.
See also: Get Token Account Address, Mint Tokens, Get Mint
Last updated on