Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to serialize or deserialize account data: Unknown #2306

Open
web-full-stack-developer opened this issue Feb 19, 2024 · 1 comment
Open

Comments

@web-full-stack-developer

I was creating spl token with metadata using createCreateMetadataAccountV3Instruction function of "@metaplex-foundation/mpl-token-metadata": "^2.5.2"
I got error like SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Failed to serialize or deserialize account data: Unknown at Connection.sendEncodedTransaction (E:\02-08 (token-create-app)\mint\node_modules\@solana\web3.js\src\connection.ts:5921:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async Connection.sendRawTransaction (E:\02-08 (token-create-app)\mint\node_modules\@solana\web3.js\src\connection.ts:5880:20) at async Object.sendTransaction (E:\02-08 (token-create-app)\mint\node_modules\@metaplex-foundation\umi-rpc-web3js\src\createWeb3JsRpc.ts:327:25) { logs: [ 'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]', 'Program log: Error: BorshIoError', 'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 2755 of 200000 compute units', 'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: **Failed to serialize or deserialize account data: Unknown'** ] }

my script is

import { Keypair, clusterApiUrl, Connection, PublicKey, Transaction, sendAndConfirmTransaction, SystemProgram } from "@solana/web3.js";
import { createCreateMetadataAccountV3Instruction, PROGRAM_ID } from "@metaplex-foundation/mpl-token-metadata";
import { MINT_SIZE, TOKEN_PROGRAM_ID, createInitializeMintInstruction, getMinimumBalanceForRentExemptMint, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createMintToInstruction } from '@solana/spl-token';
const connection = new Connection(clusterApiUrl('testnet'), 'confirmed');
import secret from './guideSecret.json';
const payer = Keypair.fromSecretKey(new Uint8Array(secret));
const run = async () => {
    const mintKeypair = new PublicKey("GKaVDS9kJYkXMYqwbLMqK3au1nyp1HKhcGYRnzJ2ErKs");
	const metaPDA = PublicKey.findProgramAddressSync(
		[
			Buffer.from("metadata"),
			PROGRAM_ID.toBuffer(),
			mintKeypair.toBuffer(),
		],
		PROGRAM_ID,
	)[0];
	console.log(metaPDA.toBase58());
	const createMetadataInstruction = createCreateMetadataAccountV3Instruction(
		{
			metadata: metaPDA,
			mint: mintKeypair,
			mintAuthority: payer.publicKey,
			payer: payer.publicKey,
			updateAuthority: payer.publicKey,
			systemProgram: SystemProgram.programId
		},
		{
			createMetadataAccountArgsV3: {
				data: {
					name: "This is test",
					symbol: "TTT",
					uri: "",
					creators: null,
					sellerFeeBasisPoints: 0,
					uses: null,
					collection: null,
				},
				isMutable: false,
				collectionDetails: null,
			},
		},
	);
	const createNewTokenTransaction = new Transaction().add(
		createMetadataInstruction
	);
	sendAndConfirmTransaction(
		connection,
		createNewTokenTransaction,
		[payer],
	).then(signature => {
		console.log('SIGNATURE', signature);
	})
}
run();

This script was working well on devnet, was not working on testnet, mainnet-beta
Please fix it for me

@Tgcohce
Copy link

Tgcohce commented Jul 31, 2024

You should check the transaction you are signing and if you are using .serialize() for the signed transaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants