estimateTokenCreationFee
Estimates rent and fees for creating a new token using local heuristics only. No transactions are sent and the estimator does not call RPC fee endpoints.
Included costs: rent for the mint + metadata account(s), rent for a 165-byte ATA, and a local per-instruction fee model for a representative creation flow (create account, init metadata pointer, init mint, init metadata, create ATA, mintTo).
Usage
page.tsx
import { useConnection } from "@solana/wallet-adapter-react";
import { estimateTokenCreationFee, type TokenData } from "@okito/sdk";
const { connection } = useConnection();
const tokenData: TokenData = {
name: "My Test Token",
symbol: "TEST",
imageUrl: "https://example.com/token-image.png",
decimals: 9,
};
const feeInfo = await estimateTokenCreationFee(connection, tokenData);Parameters
| Name | Type | Default |
|---|---|---|
connection | ConnectionSolana connection instance. | |
tokenData | TokenDataBasic token metadata used for sizing. | |
priorityFee | numberOptional priority fee in micro‑lamports. | |
Response
| Name | Type | Default |
|---|---|---|
estimatedFee | numberTotal estimated fee in lamports. | |
breakdown | FeeBreakdownComponent costs. | |
FeeBreakdown
| Name | Type | Default |
|---|---|---|
accountCreation | numberRent for mint + metadata account(s) and ATA. | |
metadata | numberIncluded in accountCreation. | |
mintTokens | numberRPC-estimated tx fee for representative instructions. | |
priorityFee | number | |
Last updated on