Skip to content

Add support for Bubblegum leaf schema V2 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged

Conversation

danenbm
Copy link
Contributor

@danenbm danenbm commented Apr 15, 2025

Notes

  • Added fields that are in Bubblegum leaf schema V2 as optional fields.

Testing

  • Did not add CI tests as we don't have real V2 yet and its also only being indexed by one RPC on devnet.
  • Tested that a V1 asset works still (no regression)
  • Tested that a V2 asset works

V1 asset

{
  interface: 'V1_NFT',
  id: 'AJKBo9b7ouxXWmSxWzByJyKqZMV7pRkYQTkMtA6hZkaV',
  content: {
    '$schema': 'https://schema.metaplex.com/nft1.0.json',
    json_uri: 'https://example.com/my-nft.json',
    files: [],
    metadata: { name: 'My NFT', symbol: '', token_standard: 'NonFungible' },
    links: {}
  },
  authorities: [
    {
      address: '5X4iSUgEfaNBRn5HQfM24Ck5mFaTyKCUpuegytig33qR',
      scopes: [Array]
    }
  ],
  compression: {
    eligible: false,
    compressed: true,
    data_hash: 'HB6sKWxroCdwkChjxckW3CF3fWupZHhPEua62GF46Ljs',
    creator_hash: 'EKDHSGbrGztomDfuiV4iqiZ6LschDJPsFiXjZ83f92Md',
    asset_hash: 'CEzzR2XKcggEP9r24cJ6hXBm116cmmJQYA79iiy1MQVZ',
    tree: '33v2L6S9X1eZ7kHYLkwjHA6ZbTd7GJfYvUTLwDrvN8W2',
    seq: 1,
    leaf_id: 0
  },
  grouping: [],
  royalty: {
    royalty_model: 'creators',
    target: null,
    percent: 0.05,
    basis_points: 500,
    primary_sale_happened: false,
    locked: false
  },
  creators: [],
  ownership: {
    frozen: false,
    delegated: false,
    delegate: null,
    ownership_model: 'single',
    owner: '4f6qrVEi7fyiGuM74vy2WwLrGvVKDnT41WWSVWBjFEVS'
  },
  supply: { print_max_supply: 0, print_current_supply: 0, edition_nonce: null },
  mutable: true,
  burnt: false
}

V2 asset (note flags is wrong but that's true with the actual DAS indexing for this asset):

{
  interface: 'V1_NFT',
  id: 'CTs4CB81qEZCfkJeBNc4K4XyRKvAGQK5mQmmfdLenqVP',
  content: {
    '$schema': 'https://schema.metaplex.com/nft1.0.json',
    json_uri: 'https://example.com/my-nft.json',
    files: [],
    metadata: { name: 'My NFT', symbol: '', token_standard: 'NonFungible' },
    links: {}
  },
  authorities: [
    {
      address: '57Q5DBor4r19ZhM3Ffet4iLP5qMjjkRpj7GVL9YKRTMk',
      scopes: [Array]
    }
  ],
  compression: {
    eligible: false,
    compressed: true,
    data_hash: 'EHnEc36MD4gW2VvnJZ8LCDovJFRamyWSgfAh9EckHSdP',
    creator_hash: 'EKDHSGbrGztomDfuiV4iqiZ6LschDJPsFiXjZ83f92Md',
    collection_hash: '3mG2ogUZaUxX7TKRbDNDUPnesYghsd87YFAduqs4TETk',
    asset_data_hash: 'EKDHSGbrGztomDfuiV4iqiZ6LschDJPsFiXjZ83f92Md',
    flags: 0,
    asset_hash: 'B6JHK9tqzyqz5Ce8v49ob7EjFUb4ixAS3B8VGsZdsYWM',
    tree: '5srtRV8fetkPT5bH5QbrBwmAPTvoaxJ5au7grdfNJvw4',
    seq: 3,
    leaf_id: 0
  },
  grouping: [],
  royalty: {
    royalty_model: 'creators',
    target: null,
    percent: 0.05,
    basis_points: 500,
    primary_sale_happened: false,
    locked: false
  },
  creators: [],
  ownership: {
    frozen: true,
    non_transferable: false,
    delegated: true,
    delegate: '5AnsVodEgWktRJZ4b2vdfoErSQe4QnKsqx9pDavYpwUB',
    ownership_model: 'single',
    owner: '42W1H3oYFMc9UtwaAFT4Rs8ikjwf3VzLP8Sck4ScEsHL'
  },
  supply: { print_max_supply: 0, print_current_supply: 0, edition_nonce: null },
  mutable: true,
  burnt: false
}

Copy link

vercel bot commented Apr 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
digital-asset-standard-api-js-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2025 11:11pm

Copy link
Contributor

coderabbitai bot commented Apr 15, 2025

Summary by CodeRabbit

  • New Features
    • Added new optional metadata fields to asset compression and ownership information, including collection hash, asset data hash, flags, and a non-transferable indicator.

Walkthrough

The changes update type definitions in a TypeScript file by adding new optional fields to two exported types. Specifically, three optional metadata fields are added to the DasApiAssetCompression type, and an optional boolean field is added to the DasApiAssetOwnership type. These modifications expand the structure of the types to accommodate additional data.

Changes

File(s) Change Summary
clients/js/src/types.ts Added optional fields collection_hash, asset_data_hash, and flags to DasApiAssetCompression; added optional field non_transferable to DasApiAssetOwnership.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AssetCompressionType
    participant AssetOwnershipType

    Client->>AssetCompressionType: Accesses/uses new optional fields (collection_hash, asset_data_hash, flags)
    Client->>AssetOwnershipType: Accesses/uses new optional field (non_transferable)
Loading

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6aa794d and 049e9aa.

📒 Files selected for processing (1)
  • clients/js/src/types.ts (2 hunks)
🔇 Additional comments (2)
clients/js/src/types.ts (2)

458-470: V2 schema implementation looks good.

The implementation correctly adds optional fields to support Bubblegum leaf schema V2 while maintaining backward compatibility with existing V1 assets. The field types are consistent with the existing pattern.


472-479: Ownership type extension correctly handles V2 schema.

The addition of the optional non_transferable field to the ownership type properly handles the V2 schema requirement while preserving backward compatibility.

@danenbm danenbm merged commit 7d0b3f5 into main Apr 15, 2025
6 checks passed
@danenbm danenbm deleted the danenbm/leaf-schema-v2 branch April 15, 2025 23:15
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