Skip to content

Conversation

@Bijoy99roy
Copy link

Fixed sections:

  • Setting up umi With an Existing Wallet
  • Full Code Example

Setting up umi With an Existing Wallet

The loaded keypair wasn't being used as a signer

Full Code Example

Variable nftSigner was being used in console log but wasn't used as asset signer

@vercel
Copy link

vercel bot commented Nov 4, 2025

@Bijoy99roy is attempting to deploy a commit to the Metaplex Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Summary by CodeRabbit

  • Documentation
    • Updated JavaScript guide for core NFT asset creation with streamlined wallet setup examples and refined code workflows.

Walkthrough

Replaced the generated-signer workflow with a keypair-based identity in the JavaScript Core NFT guide, updated logging and explorer links to use asset.publicKey, and made minor formatting and example adjustments.

Changes

Cohort / File(s) Summary
Documentation: Core NFT Creation Guide
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
Removed generateSigner() / signer-based workflow; added loading a keypair from a wallet JSON and applying keypairIdentity(keypair) via umi.use. Replaced nftSigner.publicKey references with asset.publicKey. Minor formatting, quote-style, and example consolidation.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Guide as Doc Example
    participant Umi as Umi Client
    participant Wallet as Wallet File

    rect rgb(220,235,255)
      Note over Dev,Guide: Previous flow (signer-based)
      Dev->>Guide: call generateSigner()
      Guide->>Umi: umi.use(signerIdentity(generatedSigner))
      Umi->>Umi: signer attached
      Umi->>Umi: create asset (logs nftSigner.publicKey)
    end

    rect rgb(235,255,220)
      Note over Dev,Guide: New flow (keypair-based)
      Dev->>Wallet: read wallet JSON
      Wallet->>Guide: create Keypair.fromSecretKey(...)
      Guide->>Umi: umi.use(keypairIdentity(keypair))
      Umi->>Umi: keypair identity attached
      Umi->>Umi: create asset (logs asset.publicKey)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify imports and usage of keypairIdentity and removal of generateSigner() helpers.
  • Check wallet JSON parsing and Keypair.fromSecretKey(...) byte/encoding handling.
  • Confirm all explorer URLs and logs were updated from nftSigner.publicKey to asset.publicKey.

Possibly related PRs

Suggested reviewers

  • tonyboylehub

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: update and fix broken example' accurately reflects the main purpose of the PR, which is to fix broken documentation examples by correcting how the keypair is used as a signer and fixing variable references.
Description check ✅ Passed The description clearly explains the two sections being fixed and the specific issues resolved: keypair not being used as a signer and nftSigner variable being incorrectly referenced in a console log.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67a81e3 and 43a37b3.

📒 Files selected for processing (1)
  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md (11 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/pages/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Markdoc processes .md files in pages directory

Files:

  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
🧠 Learnings (2)
📚 Learning: 2025-07-17T14:26:47.063Z
Learnt from: MarkSackerberg
Repo: metaplex-foundation/developer-hub PR: 378
File: src/pages/core/plugins/freeze-execute.md:453-458
Timestamp: 2025-07-17T14:26:47.063Z
Learning: For MPL Core plugins, the create function (for assets) uses plugin structure without data wrapper (e.g., { type: 'FreezeExecute', frozen: false }), similar to createCollection, while addPlugin uses plugin structure with data wrapper (e.g., { type: 'FreezeExecute', data: { frozen: false } }).

Applied to files:

  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
📚 Learning: 2025-07-17T14:20:54.727Z
Learnt from: MarkSackerberg
Repo: metaplex-foundation/developer-hub PR: 378
File: src/pages/core/plugins/freeze-execute.md:169-178
Timestamp: 2025-07-17T14:20:54.727Z
Learning: For MPL Core plugins, createCollection uses plugin structure without data wrapper (e.g., { type: 'FreezeExecute', frozen: false }), while addPlugin uses plugin structure with data wrapper (e.g., { type: 'FreezeExecute', data: { frozen: false } }).

Applied to files:

  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
🪛 LanguageTool
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md

[grammar] ~10-~10: Ensure spelling is correct
Context: ...ore NFT Asset** using the Metaplex Core onchain program. {% callout title="What is Cor...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (2)
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md (2)

73-75: Import and use keypairIdentity for existing wallet setup.

The "With an Existing Wallet" section now correctly loads a keypair from the filesystem and applies it as the identity via keypairIdentity(keypair), ensuring the loaded keypair is used as a signer. The added imports appropriately support both the new-wallet (signerIdentity) and existing-wallet (keypairIdentity) flows.

Also applies to: 147-150


305-306: Use asset.publicKey in explorer links.

The console logs now correctly reference asset.publicKey (the variable defined at line 452/285) instead of the undefined nftSigner. This aligns the examples and ensures the created asset's public key is displayed in the Metaplex Explorer URL.

Also applies to: 470-472


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Bijoy99roy Bijoy99roy changed the title Fix example code docs: update and fix broken example Nov 4, 2025
@tonyboylehub
Copy link
Contributor

tonyboylehub commented Nov 4, 2025

Hi @Bijoy99roy,

What was the purpose of changing from keypair identity to signer identity?
Umi just requires a single identity loading in, currently it's loaded in from a keypairIdentity() but the way you added it in is by adding extra steps to make it a signerIdentity() which becomes the same outcome. Can you explain more about this change?

With nftSigner it would be better to just change the log to asset instead of nftSigner in the rest of the code.

@Bijoy99roy
Copy link
Author

Hi @tonyboylehub ,

The original intention wasn't to change it from keypairIdentity() to signerIdentity() but to use the unused keypair variable as a signer. I have user signerIdentity() in my code so mistakenly I changed it in the doc too. I'll fix that and remove the extra step.

For the nftSigner variable in the full code example, I'll replace it with asset.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md (1)

70-79: Missing import: keypairIdentity is used but not imported.

Line 149 references keypairIdentity(keypair) in the "With an Existing Wallet" section, but this function is not imported from @metaplex-foundation/umi. This will cause a runtime error.

Add keypairIdentity to the import statement:

 import {
   createGenericFile,
   generateSigner,
+  keypairIdentity,
   signerIdentity,
   sol,
 } from '@metaplex-foundation/umi'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53ac53c and 719b5e7.

📒 Files selected for processing (1)
  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md (10 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/pages/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Markdoc processes .md files in pages directory

Files:

  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
🧠 Learnings (2)
📚 Learning: 2025-07-17T14:26:47.063Z
Learnt from: MarkSackerberg
Repo: metaplex-foundation/developer-hub PR: 378
File: src/pages/core/plugins/freeze-execute.md:453-458
Timestamp: 2025-07-17T14:26:47.063Z
Learning: For MPL Core plugins, the create function (for assets) uses plugin structure without data wrapper (e.g., { type: 'FreezeExecute', frozen: false }), similar to createCollection, while addPlugin uses plugin structure with data wrapper (e.g., { type: 'FreezeExecute', data: { frozen: false } }).

Applied to files:

  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
📚 Learning: 2025-07-17T14:20:54.727Z
Learnt from: MarkSackerberg
Repo: metaplex-foundation/developer-hub PR: 378
File: src/pages/core/plugins/freeze-execute.md:169-178
Timestamp: 2025-07-17T14:20:54.727Z
Learning: For MPL Core plugins, createCollection uses plugin structure without data wrapper (e.g., { type: 'FreezeExecute', frozen: false }), while addPlugin uses plugin structure with data wrapper (e.g., { type: 'FreezeExecute', data: { frozen: false } }).

Applied to files:

  • src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
🪛 LanguageTool
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md

[grammar] ~10-~10: Ensure spelling is correct
Context: ...ore NFT Asset** using the Metaplex Core onchain program. {% callout title="What is Cor...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (1)
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md (1)

104-125: Verify: "With a New Wallet" section may not reflect stated changes.

Per the PR review comments, the author (Bijoy99roy) acknowledged mistakenly introducing signerIdentity() and stated they would revert those changes. However, the "With a New Wallet" section (lines 117–119) still uses the generateSigner() + signerIdentity() pattern. Please confirm whether this section was intentionally left unchanged or if additional fixes are needed.

---

This guide will demonstrate the use of the `@metaplex-foundation/mpl-core` Javascript SDK package to create a **Core NFT Asset** using the Metaplex Core onchain program.
This guide will demonstrate the use of the `@metaplex-foundation/mpl-core` Javascript SDK package to create a **Core NFT Asset** using the Metaplex Core onchain program.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Fix spelling: "onchain" should be "on-chain".

The standard convention uses a hyphen for the adjective form.

-This guide will demonstrate the use of the `@metaplex-foundation/mpl-core` Javascript SDK package to create a **Core NFT Asset** using the Metaplex Core onchain program.
+This guide will demonstrate the use of the `@metaplex-foundation/mpl-core` Javascript SDK package to create a **Core NFT Asset** using the Metaplex Core on-chain program.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
This guide will demonstrate the use of the `@metaplex-foundation/mpl-core` Javascript SDK package to create a **Core NFT Asset** using the Metaplex Core onchain program.
This guide will demonstrate the use of the `@metaplex-foundation/mpl-core` Javascript SDK package to create a **Core NFT Asset** using the Metaplex Core on-chain program.
🧰 Tools
🪛 LanguageTool

[grammar] ~10-~10: Ensure spelling is correct
Context: ...ore NFT Asset** using the Metaplex Core onchain program. {% callout title="What is Cor...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
In
src/pages/core/guides/javascript/how-to-create-a-core-nft-asset-with-javascript.md
around line 10, the phrase "onchain" should be corrected to the hyphenated
adjective form "on‑chain"; update the sentence to use "on-chain program" to
follow standard convention and consistency across the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants