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 | Connection Solana connection instance. |
|
tokenData | TokenData Basic token metadata used for sizing. |
|
priorityFee | number Optional priority fee in micro‑lamports. |
|
Response
Name | Type | Default |
---|---|---|
estimatedFee | number Total estimated fee in lamports. |
|
breakdown | FeeBreakdown Component costs. |
|
FeeBreakdown
Name | Type | Default |
---|---|---|
accountCreation | number Rent for mint + metadata account(s) and ATA. |
|
metadata | number Included in accountCreation. |
|
mintTokens | number RPC-estimated tx fee for representative instructions. |
|
priorityFee | number |
|
Last updated on