updateTokenImage
Updates the metadata URI (image URL) for an existing token.
Usage
page.tsx
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
import { updateTokenImage } from "@okito/sdk";
const {connection} = useConnection();
const wallet = useWallet();
const mintAddress = ""; // Token mint address
const newImageUrl = ""; // New image URL
const result = await updateTokenImage(wallet, connection, mintAddress, newImageUrl, {
enableLogging: true,
maxRetries: 3,
confirmationStrategy: 'confirmed'
});Parameters
| Name | Type | Default |
|---|---|---|
connection | ConnectionSolana connection instance. | |
wallet | SignerWalletWallet with authority to update metadata. | |
mint | stringToken mint address. | |
newImageUrl | stringNew image URL to set as the token URI. | |
config | OperationConfigGeneral options such as logging, retries, timeouts, and confirmation level. | |
Response
Returns OperationResult.
| Name | Type | Default |
|---|---|---|
success | booleanWhether the update succeeded. | |
mintAddress | string | nullMint address for reference. | |
transactionId | string | nullSignature of the update transaction. | |
error | string | nullError message if any. | |
estimatedFee | number | nullEstimated fee (if available). | |
actualFee | number | nullActual network fee (if available). | |
confirmationTime | number | nullTime to confirm in ms. | |
Last updated on