无效的帐户鉴别器下载元副词集合
我从Anchor 0.17更新到版本0.24,从那以后,获取收集帐户失败,锚误差如下: 错误:无效的帐户歧视
这是我的代码,
export const getCollectionPDA = async (candyMachineAddress: string): Promise<anchor.web3.PublicKey> => {
return (
await anchor.web3.PublicKey.findProgramAddress(
[Buffer.from("collection"), new PublicKey(candyMachineAddress).toBuffer()],
new PublicKey(CANDY_MACHINE_PROGRAM_V2)
)
)[0];
};
const provider = new AnchorProvider(connection, getmywallet(), {
preflightCommitment: "finalized",
commitment: "finalized",
});
const idl = await Program.fetchIdl(CANDY_MACHINE_PROGRAM_V2, provider);
const anchorProgram = new Program(idl, CANDY_MACHINE_PROGRAM_V2, provider);
const candyMachineId = "63gzhYWxJ4Yfc5QahLxV6NChSjJZNWW93Sy9CHz8YkCe";
const collectionPDA = await getCollectionPDA(candyMachineId);
const collectionPDAAccount = await connection.getAccountInfo(collectionPDA);
const collectionData = await anchorProgram.account.collectionPda.fetch(new PublicKey(collectionPDA.toString()));
我想知道这里发生了什么。也许收集帐户结构已更新,区块链包含旧结构?直到最近,Anchor才开始检查吗?
I updated from anchor 0.17 to version 0.24, and since then, fetching a collection account fails with an anchor error like:Error: Invalid account discriminator
This is my code
export const getCollectionPDA = async (candyMachineAddress: string): Promise<anchor.web3.PublicKey> => {
return (
await anchor.web3.PublicKey.findProgramAddress(
[Buffer.from("collection"), new PublicKey(candyMachineAddress).toBuffer()],
new PublicKey(CANDY_MACHINE_PROGRAM_V2)
)
)[0];
};
const provider = new AnchorProvider(connection, getmywallet(), {
preflightCommitment: "finalized",
commitment: "finalized",
});
const idl = await Program.fetchIdl(CANDY_MACHINE_PROGRAM_V2, provider);
const anchorProgram = new Program(idl, CANDY_MACHINE_PROGRAM_V2, provider);
const candyMachineId = "63gzhYWxJ4Yfc5QahLxV6NChSjJZNWW93Sy9CHz8YkCe";
const collectionPDA = await getCollectionPDA(candyMachineId);
const collectionPDAAccount = await connection.getAccountInfo(collectionPDA);
const collectionData = await anchorProgram.account.collectionPda.fetch(new PublicKey(collectionPDA.toString()));
I wonder what's going on here. Perhaps the Collection account struct has been updated and the blockchain contains old structs? And only recently anchor started checking for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论