can anyone help with this error. happens after i try run my javascript that i compiled from typescript, to add metadata to my existing solana token.
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?) Error updating metadata: Error: failed to get info about account 35a57yb7LfwQcAj5QTkAw3M9T62wGiZjXc1aiz2j9WGg: TypeError: fetch failed at Connection.getAccountInfo (/home/SENSITIVE-INFO/Desktop/SENSITIVE-INFO/node_modules/@solana/web3.js/lib/index.cjs.js:6252:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.getAccount (/home/SENSITIVE-INFO/Desktop/SENSITIVE-INFO/node_modules/@metaplex-foundation/umi-rpc-web3js/dist/cjs/createWeb3JsRpc.cjs:25:21) at async fetchMetadata (/home/SENSITIVE-INFO/Desktop/SENSITIVE-INFO/node_modules/@metaplex-foundation/mpl-token-metadata/dist/src/generated/accounts/metadata.js:40:26)
Here is the typescript.
const fs = require('fs');
const {
Connection,
PublicKey,
clusterApiUrl,
Keypair,
} = require('@solana/web3.js');
const { updateV1, fetchMetadataFromSeeds } = require('@metaplex-foundation/mpl-token-metadata');
// Import the createUmi function from the Umi bundle defaults
const { createUmi } = require('@metaplex-foundation/umi-bundle-defaults');
// Create a new Umi instance to interact with the Solana blockchain
const umi = createUmi('https://api.mainnet-beta.solana.com');
async function updateTokenMetadata() {
try {
// Connect to the Solana mainnet
const connection = new Connection(clusterApiUrl('mainnet-beta'), 'confirmed');
// Specify your token's mint address
const mintAddress = new PublicKey('SENSITIVE-INFO');
// Load the payer's Keypair from a file
const payerSecretKey = JSON.parse(fs.readFileSync('/home/SENSITIVE-INFO/.config/SENSITIVE-INFO/id.json', 'utf8'));
const payer = Keypair.fromSecretKey(new Uint8Array(payerSecretKey));
// Fetch the initial metadata for the token
const initialMetadata = await fetchMetadataFromSeeds(umi, { mint: mintAddress });
// Update the metadata attributes
const updatedData = {
name: "SENSITIVE-INFO",
symbol: "SENSITIVE-INFO",
uri: "https://raw.githubusercontent.com/SENSITIVE-INFO/SENSITIVE-INFO/main/token.json",
sellerFeeBasisPoints: 500, // This is just an example value
creators: null,
...initialMetadata,
};
// Load the update authority's Keypair from a file
const updateAuthorityPath = './updateAuthority.json'; // Path to updateAuthority.json file
const updateAuthoritySecretKey = JSON.parse(fs.readFileSync(updateAuthorityPath, 'utf8'));
const updateAuthority = Keypair.fromSecretKey(new Uint8Array(updateAuthoritySecretKey));
// Initiate the metadata update transaction
await updateV1(umi, {
mint: mintAddress,
authority: updateAuthority, // You need to define updateAuthority
data: updatedData,
}).sendAndConfirm(umi);
console.log("Metadata updated successfully.");
} catch (error) {
console.error("Error updating metadata:", error);
}
}
// Call the function to update the token metadata
updateTokenMetadata();