I'm trying to update metadata (logo, name) of solana token I have created. It is just for learning, nothing commercial.
Here is try catch that throws error:
try {
const txid = await web3.sendAndConfirmTransaction(connection, tx, [myKeypair]);
console.log(txid);
} catch (error) {
console.log(error);
}
Error is:
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x3f
at Connection.sendEncodedTransaction (F:\Projekti\Crypto\FatBoyToken\node_modules\@solana\web3.js\src\connection.ts:5054:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Connection.sendRawTransaction (F:\Projekti\Crypto\FatBoyToken\node_modules\@solana\web3.js\src\connection.ts:5013:20)
at async Connection.sendTransaction (F:\Projekti\Crypto\FatBoyToken\node_modules\@solana\web3.js\src\connection.ts:5001:12)
at async Object.sendAndConfirmTransaction (F:\Projekti\Crypto\FatBoyToken\node_modules\@solana\web3.js\src\utils\send-and-confirm-transaction.ts:31:21)
at async main (F:\Projekti\Crypto\FatBoyToken\main.ts:75:22) {
logs: [
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
'Program log: Instruction: Update Metadata Accounts v2',
'Program log: Data type mismatch',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3723 of 200000 compute units',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x3f'
]
connection is:
const connection = new web3.Connection("https://api.mainnet-beta.solana.com");
and tx is:
const tx = new web3.Transaction();
for myKeypar creatin I have used function:
export function loadWalletKey(keypairFile: string): web3.Keypair {
const fs = require("fs");
const loaded = web3.Keypair.fromSecretKey(
new Uint8Array(JSON.parse(fs.readFileSync(keypairFile).toString())),
);
return loaded;
}
I am also new to TS/JS. I assume that 'Data type mismatch' needs to give me answer but I don't understand which data that is? And is there anything else that can give me error?
Error message is saying "Error processing Instruction 0". you are not passing instruction. you have to define an instruction and add it to the transaction. chekc the example here