I extract the lib.rs file from the Metaplex candy machine folder. Created a new anchor project via anchor init
, pasted the smart contract then I run anchor keys list
and pasted the key in declare_id
in lib.rs and updated the key in Anchor.toml
as well. I build and deployed Solana Program successfully on devnet. Now form the front end side it gives me an error
Error: Account does not exist 6iTW2keSEsGDEV7r1TGFTSYHKJKW5HKWZa1oR8Yg5yCX
The Project works fine with the previous Solana Program. I just redeployed the rust program using my wallet keys and replaced the idl.json file.
export const _getState = async (provider, wallet) => {
const programID = new PublicKey(idl.metadata.address);
const program = new Program(idl, programID, provider);
const _program = await web3.PublicKey.findProgramAddress(
[Buffer.from(utils.bytes.utf8.encode('teacher_minting'))],
program.programId
);
console.log(_program.toString());
const [stakingPubkey] = _program;
const [userstakingPubkey] =
await web3.PublicKey.findProgramAddress(
[wallet.publicKey.toBuffer()],
program.programId
);
console.log("=====================", stakingPubkey.toBase58());
const testdata = await program.account.mintingAccount.fetch(stakingPubkey);
let userdata = [];
try {
userdata = await program.account.userMintingAccount.fetch(userstakingPubkey);
}catch (err) {
console.log(err);
}
console.log("ud:", userdata, testdata);
}
Deployed Program: https://explorer.solana.com/address/CcSFrh2CQdKRCtpJp6mnFZem67GdLU8jJ1MfwEVoLDRm?cluster=devnet