Skip to Content
NFTcreateNFT

createNFT

This function creates an NFT on the Solana blockchain with metadata support.

Usage

page.tsx
import { useConnection, useWallet } from "@solana/wallet-adapter-react"; import { createNFT } from "@okito/sdk"; const {connection} = useConnection(); const wallet = useWallet(); const nftData = { name: "My NFT", // Name of the NFT symbol: "MNFT", // Symbol of the NFT description: "This is my NFT", // Description of the NFT imageUrl: "https://example.com/image.png", // Image URL of the NFT externalUrl: "https://example.com", // (optional) External URL for the NFT attributes: [ // (optional) Array of attributes { trait_type: "Background", value: "Blue" }, { trait_type: "Eyes", value: "Green" } ], collection: { name: "My Collection", family: "My Family" } } const productionResult = await createNFT(connection, wallet, nftData, { enableLogging: true, // Detailed operation tracking enableSimulation: true, // Pre-flight transaction testing maxRetries: 3, // Automatic retry on failure confirmationStrategy: 'confirmed' });

Capabilities

  • Metadata fields (name, symbol, description, image URL)
  • Optional external URL, attributes, and collection info
  • Optional pre-flight simulation
  • Clear error messages and safer defaults

Parameters

NameTypeDefault
connection
Connection
Solana connection instance.
wallet
SignerWallet
Wallet with signing capabilities.
data
NFTData
NFT metadata fields.
config
NFTConfig
See <a href="/OperationConfig">OperationConfig</a>.

NFTConfig

NameTypeDefault
enableFreezeAuthority
boolean
Whether to enable freeze authority.
royaltyBasisPoints
number
Royalty basis points.
OperationConfig
OperationConfig
See <a href="/OperationConfig">OperationConfig</a>.

Response

Returns OperationResult.

NameTypeDefault
OperationResult
OperationResult
The result of the NFT creation.
mintAddress
string
Last updated on