Reputation: 31
I am trying to call the mintNft function on the front end but it throws an error and I can't fix it
the error is: "Program log: AnchorError occurred. Error Code: InstructionFallbackNotFound. Error Number: 101. Error Message: Fallback functions are not supported."
see http response: rpc response
web.ts:
const tx = await program.rpc.mintNft(
mintKey.publicKey,
"https://arweave.net/y5e5DJsiwH0s_ayfMwYk-SnrZtVZzHLQDSTZ5dNRUHA",
"NFT Title",
{
accounts: {
mintAuthority: program.provider.wallet.publicKey,
mint: mintKey.publicKey,
tokenAccount: NftTokenAccount,
tokenProgram: TOKEN_PROGRAM_ID,
metadata: metadataAddress,
tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
payer: program.provider.wallet.publicKey,
systemProgram: SystemProgram.programId,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
masterEdition: masterEdition,
},
}
);
console.log(tx);
// console.log("Your transaction signature", tx);
Upvotes: 3
Views: 4027
Reputation: 515
The error is thrown because of capital N
in your function-name mintNft
.
Capital letters are not supported for function name in solana program.
I also found out that underscore + number is also not supported, e.g. exchange1
is valid function name, but exchange_1
is invalid function name.
Upvotes: 2
Reputation: 355
its because the instruction that you want to call is not available! could be because a couple of things, such as:
Upvotes: 3
Reputation: 671
0.24.2
, It should look like this in Cargo.toml
[dependencies]
anchor-lang = "0.24.2"
mpl-token-metadata = { version="1.2.5", features = [ "no-entrypoint" ] }
anchor-spl = "0.24.2"
package.json
{
"dependencies": {
"@project-serum/anchor": "^0.24.2",
"@solana/spl-token": "^0.2.0"
},
"devDependencies": {
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"chai": "^4.3.6",
"mocha": "^10.0.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.6.4"
}
}
migrate the code to match anchor 0.24.2
for example (too long to post here) https://github.com/katopz/metaplex-anchor-nft/commit/f54ffaf087858f3997e797133ccc6d7748309c0a
and also rpc
here https://github.com/katopz/metaplex-anchor-nft/commit/a72929548c8041ac422708c04078b8543e0f8a67
If nothing work, try run anchor test
my forked here (tested today) https://github.com/katopz/metaplex-anchor-nft
For frontend, I think you will need to pass wallet provider to make it work. Should be something like this.
anchor.setProvider(new Client(programId, wallet).provider)
Upvotes: 1