I'm following this article as a practice.
ts-node packages/cli/src/candy-machine-cli.ts verify --env devnet --keypair "C:\Windows\System32\~\.config\solana\devnet.json"
While trying to verify candy machine, I ran into
TypeError: Cannot read properties of undefined (reading '_bn') at isPublicKeyData (C:\Users\my-userName\Source\Repos\metaplex\js\node_modules@solana\web3.js\src\publickey.ts:29:35) at new PublicKey (C:\Users\my-userName\Source\Repos\metaplex\js\node_modules@solana\web3.js\src\publickey.ts:45:9) at C:\Users\my-userName\Source\Repos\metaplex\js\packages\cli\src\candy-machine-cli.ts:326:27 at step (C:\Users\my-userName\Source\Repos\metaplex\js\packages\cli\src\candy-machine-cli.ts:64:23) at Object.next (C:\Users\my-userName\Source\Repos\metaplex\js\packages\cli\src\candy-machine-cli.ts:45:53) at fulfilled (C:\Users\my-userName\Source\Repos\metaplex\js\packages\cli\src\candy-machine-cli.ts:36:58) at processTicksAndRejections (node:internal/process/task_queues:96:5)
By a quick search on the inte.net, some people say I need to first create the candy machine. So I ran
ts-node packages/cli/src/candy-machine-cli.ts create_candy_machine --env devnet --keypair "C:\Windows\System32\~\.config\solana\devnet.json"
But it gave me the same error.
Appreciate any advice about how I may solve this.
For anyone who sees this from now on (at least until any other update makes this obsolete), you can also get this error simply because you're trying to create a Candy Machine v1, which I was told on the Metaplex discord won't work anymore.
Make sure you follow the steps for using v2 (as of the date I write this), as covered in the official docs here: https://docs.metaplex.com/candy-machine-v2/configuration . You'll simply use a different command for the v2 package.
Look over the docs to check to confirm you're ready, but as reassurance, if your assets are set up and ready to go, do start here on Step 2 configuration (you can create the config file anywhere as long as you paste the correct path to it once it's required), then go to Step 4.
While trying to resolve another issue, I found the problem has something to do with the ts-node
version that I was using.
Problem solved after update with command below
npm i ts-node@latest
This didn't work for me, I did have updates though thank you!
It is this I am getting as error: return (value as PublicKeyData)._bn;== undefined;
Nobody seems to have answer on Git either. Please let me know if anyone figures this one out!
You need to provide a public key for getNameAccountKey
, eg
import { Connection, PublicKey } from '@solana/web3.js';
import { getHashedName, getNameAccountKey, NameRegistryState } from '@solana/spl-name-service';
...
class SomeClass {
constructor(private readonly configService: ConfigService) {
this.publicKey = new PublicKey(
this.configService.get('SOLANA_NAME_SERVICE_PUBLIC_KEY'), // that public key taken from `.env` config file
);
}
...
private async resolveSnsName(name: string, connection: Connection): Promise<string> {
try {
const parsedName = name.replace('.sol', '');
const hashedName = await getHashedName(parsedName);
const domainKey = await getNameAccountKey(hashedName, undefined, this.publicKey);
const registry = await NameRegistryState.retrieve(connection, domainKey);
return registry.owner.toBase58();
} catch {
return null;
}
}
}
Same problem here.. did you find how to solve it?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.