> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spark.money/llms.txt
> Use this file to discover all available pages before exploring further.

# Mint Tokens

Minting creates new tokens and deposits them directly into your issuer wallet. From there, you can transfer them to users or hold them in reserve. Only the issuer wallet that created the token can mint.

<Frame className="chill">
  <img className="block dark:hidden" src="https://mintcdn.com/lightspark/OQ3nooAPVcDN2i7X/images/issuance/token-management-light.png?fit=max&auto=format&n=OQ3nooAPVcDN2i7X&q=85&s=6507c7503881ac8f48b5517e9b16a9ec" alt="Mint Tokens" width="3840" height="2160" data-path="images/issuance/token-management-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/lightspark/OQ3nooAPVcDN2i7X/images/issuance/token-management.png?fit=max&auto=format&n=OQ3nooAPVcDN2i7X&q=85&s=5977ebf4229b26e21e5fd6ae1551b958" alt="Mint Tokens" width="3840" height="2160" data-path="images/issuance/token-management.png" />
</Frame>

## Mint

```typescript theme={null}
const [tokenIdentifier] = await wallet.getIssuerTokenIdentifiers();
if (!tokenIdentifier) throw new Error("No token identifiers found for this issuer");

// Mint 10,000 tokens (6 decimals)
await wallet.mintTokens({
  tokenIdentifier,
  tokenAmount: 10_000_000000n
});
```

The amount is in base units. If your token has 6 decimals, multiply the human-readable amount by 1,000,000.

```typescript theme={null}
function toBaseUnits(amount: string, decimals: number): bigint {
  const [whole, fraction = ""] = amount.split(".");
  const fractionPadded = (fraction + "0".repeat(decimals)).slice(0, decimals);
  return BigInt(whole || "0") * 10n ** BigInt(decimals) + BigInt(fractionPadded || "0");
}

await wallet.mintTokens({
  tokenIdentifier,
  tokenAmount: toBaseUnits("10000", 6)
});
```

## Check Your Balance

After minting, tokens appear in your wallet immediately:

```typescript theme={null}
const { tokenBalances } = await wallet.getBalance();
for (const [tokenId, info] of tokenBalances) {
  console.log(tokenId, info.ownedBalance);
}
```

## Max Supply

If you set a `maxSupply` when creating your token, minting fails once you reach it. With unlimited supply (`maxSupply: 0n`), you can mint indefinitely.

```typescript theme={null}
const [tokenIdentifier] = await wallet.getIssuerTokenIdentifiers();
if (!tokenIdentifier) throw new Error("No token identifiers found for this issuer");

const [metadata] = await wallet.getIssuerTokensMetadata([tokenIdentifier]);
if (!metadata) throw new Error(`No metadata found for token ${tokenIdentifier}`);

if (metadata.maxSupply === 0n) {
  console.log("Unlimited supply");
} else {
  console.log("Max supply:", metadata.maxSupply);
}
```
