我正在铸造 Solana NFT。糖果机 v2 最近发布,v1 已弃用。
如果我创建一个 v2 糖果机并铸造一些 NFT,我以后如何从所有铸造的代币中找到哈希值?
我从锚点 0.17 更新到版本 0.24,从那时起,获取收款帐户失败并出现锚点错误,如下所示:
Error: Invalid account discriminator
这是我的代码
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()));
Run Code Online (Sandbox Code Playgroud)
我想知道这是怎么回事。也许集合帐户结构已更新并且区块链包含旧结构?直到最近主播才开始检查这一点?
我正在尝试获取来自大师版 NFT 的所有版本。根据文档,有一个 PDA 可以将该版本链接回主版本,但我无法通过 Metaplex/Solana sdk 以编程方式找到这种关系。
我当前的解决方案是解析主版本的所有交易并通过查找创建的版本进行过滤:
import {JsonMetadata, Metadata, Metaplex, TaskStatus} from "@metaplex-foundation/js";
import {Connection, PublicKey, ConfirmedSignatureInfo} from "@solana/web3.js";
import * as fs from "fs";
const RPC_URL = 'https://...';
const MASTER_EDITION_ADDRESS = '';
(async () => {
const connection = new Connection(RPC_URL);
const metaplex = new Metaplex(connection);
const start = new Date().toISOString()
// Paginate transactions from Master Edition
const signatures: { signature: string; }[] = []
let before: string | undefined = undefined;
while (true) {
const …Run Code Online (Sandbox Code Playgroud) 我想使用 Metaplex SDK 和 React 创建一个 NFT。但是当我执行这个函数时,它会抛出以下错误:
AccountNotFoundError:
The account of type [MintAccount] was not found at the provided address
[7SYH47nGcK5fnMmf6zoW75BWpdxDAyq8DBRbagMdsPKJ].
Run Code Online (Sandbox Code Playgroud)
这是我试图执行的函数:
async function mint() {
const links = await uploadMetadata();
console.log("Cover: " + links.cover);
console.log("Text: " + links.text);
console.log("Metadata: " + links.metadata);
const { nft } = await metaplex.nfts().create({
uri: links.metadata,
name: title,
sellerFeeBasisPoints: 500, // Represents 5.00%.
});
console.log(nft);
}```
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个锚代码,以便我可以从主版 ntf 中创建新版本 nft。我查看了 Metaplex 文档和 rust api 文档,得出了下面的代码,但不确定为什么会收到此消息“错误:发送交易失败:交易模拟失败:处理指令 0 时出错:指令所需的帐户”丢失”消息。
供您参考,这里我提供了 lib.rs 中的程序脚本和 ts 文件中的测试脚本
库文件
use anchor_lang::prelude::*;
use anchor_lang::solana_program::program::invoke;
use anchor_spl::token;
use anchor_spl::token::{MintTo, Token};
use mpl_token_metadata::instruction::{create_master_edition_v3, create_metadata_accounts_v2,mint_new_edition_from_master_edition_via_token,};
declare_id!("4kYKrkgyuRppwg6bxxKkirQ5wtddZQpkLA2Xp9Fo2YNn");
#[program]
pub mod solana_blockchain {
use super::*;
pub fn mint_nft(ctx: Context<MintNFT>) -> Result<()> {
msg!("Initializing Mint NFT");
let cpi_accounts = MintTo {
mint: ctx.accounts.mint.to_account_info(),
to: ctx.accounts.token_account.to_account_info(),
authority: ctx.accounts.payer.to_account_info(),
};
msg!("CPI Accounts Assigned");
let cpi_program = ctx.accounts.token_program.to_account_info();
msg!("CPI Program Assigned");
let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
msg!("CPI Context Assigned");
token::mint_to(cpi_ctx, 1)?;
msg!("Token …Run Code Online (Sandbox Code Playgroud) 自2022年6月20日起,注册代币的规则发生变化: https: //github.com/solana-labs/token-list
我已经尝试过以下方法:
1)。通过服务创建新令牌:
创建这些代币并尝试通过网络应用程序(web3js)将它们转移到另一个钱包后,它们被定义为 NFT:
同样在 Solscan 上,这些令牌显示为“无法识别的令牌”:
2)。然后我尝试通过 Metaplex 注册令牌,但不断遇到各种错误。我的代码(JavaScript):
import { createCreateMetadataAccountV2Instruction} from '@metaplex-foundation/mpl-token-metadata';
const tokenMetadata = {
name: 'EUR demo-stablecoin',
symbol: 'EURX',
uri: {
name: 'EUR demo-stablecoin',
symbol: 'EURX',
description: 'Fully for testing purposes only',
image: 'https://raw.githubusercontent.com/.../logo.png',
},
sellerFeeBasisPoints: 0,
creators: null,
collection: null,
uses: null,
};
const createNewTokenTransaction = new solanaWeb3.Transaction().add(
createCreateMetadataAccountV2Instruction(
{
metadata: 'https://vxmxabesb3yfewwf4jcplmstg2fe3cngsphlgnrvwp46iftqdm.arweave.net/.../arweave-metadata-JSON',
mint: mintKeypair.publicKey,
mintAuthority: provider.publicKey,
payer: provider.publicKey,
updateAuthority: provider.publicKey,
},
{
createMetadataAccountArgsV2:
{
data: tokenMetadata, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 @metaplex/js 进行一些 NFT 铸造。通常我的 .js 文件可以正常工作,但是当我运行该文件时会出现此错误。
bigint:加载绑定失败,将使用纯JS(尝试npm runrebuild?)
我实在不明白这意味着什么。因此,我尝试运行 npm runrebuild 但据说重建是一个丢失的脚本,我找不到安装它的方法。
这是我的代码:
import { Connection, programs} from "@metaplex/js";
import { Loader } from "@solana/web3.js";
const { metadata: {Metadata}} = programs;
const connection = new Connection("devnet");
const tokenPublicKey = 'my_adress';
const run = async() => {
try{
const ownedMetadata = await Metadata.Loader(connection,tokenPublicKey)
console.log(ownedMetadata)
}
catch{
console.log('Failed to fetch')
}
};
run();
Run Code Online (Sandbox Code Playgroud)
如果您有任何想法,或者只是解释我的错误的含义,我将不胜感激。
我一直使用Solana-labs / token-listGithub 上的存储库 ( https://github.com/solana-labs/token-list ) 将图像和名称上传到我通过控制台创建的令牌,这非常好且简单。但是,当我昨晚上传新的时,我注意到截至 6 月 20 日,该存储库是只读的。我想知道另一种方法是获取与我现有的 WL SPL 令牌关联的名称和图像,这样它就不会出现问题。在人们的钱包里,它似乎不为人知。
我总是使用以下命令在控制台中创建与糖果机一起使用的白名单令牌:
spl-token create-token --decimals 0
spl-token create-account <token-key>
spl-token mint <token-key> 5 <token-wallet>
然后将其用作 config.json 中的白名单密钥。
有没有办法在其他地方以同样的方式注册?自述文件中提到的两个当前选项(https://app.strataprotocol.com/launchpad/manual/new和https://token-creator-lac.vercel.app/)旨在帮助您创建一个新令牌尚未注册。但是如果我希望这个令牌成为糖果机中使用的白名单令牌,我可以走这条路吗?
我认为这是我目前为止的最后一个障碍。我只是想确认有人知道在实时铸币期间可以使用的另一条路线,以确保白名单按预期工作。一如既往地感谢任何帮助。
我试图通过上传测试内容
ts-node src/candy-machine-cli.ts upload assets --env devnet --keypair "~\.config\solana\devnet.json" -n 10
Run Code Online (Sandbox Code Playgroud)
并遇到下面的错误
事务模拟失败:错误处理指令1:程序无法完成程序11111111111111111111111111111111调用[1]程序1111111111111111111111111111111成功程序cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WX Z 调用 [1] 程序日志:错误:内存分配失败,内存不足 程序 cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ 消耗了 200000 个计算单元(共 200000 个) 程序失败完成:BPF 程序出现恐慌 程序 cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ 失败:程序无法完成
我认为该消息可能会产生误导,因为我只处理 10 张图像。但不确定到底出了什么问题。