Skip to content
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

init: static schemas package #2225

Merged
merged 6 commits into from
Nov 21, 2024
Merged

init: static schemas package #2225

merged 6 commits into from
Nov 21, 2024

Conversation

aramikm
Copy link
Collaborator

@aramikm aramikm commented Nov 19, 2024

Goal

The goal of this PR is create a new js package for schema name and ID mappings

Closes #2176

Discussion

  • This only generates data for dsnp schemas from chain. The issue is that currently there is no easy way to get all schema names without providing namespaces. We can get all using raw state but then we would need to scale decode it.

Copy link
Collaborator

@wilwade wilwade left a comment

Choose a reason for hiding this comment

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

Some fixes for the exports and a few other notes, but looking good.

js/schemas/README.md Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
js/schemas/scripts/package-lock.json Outdated Show resolved Hide resolved
js/schemas/index.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@enddynayn enddynayn left a comment

Choose a reason for hiding this comment

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

👍 LGTM

Copy link
Collaborator

@wilwade wilwade left a comment

Choose a reason for hiding this comment

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

🥅

  • Tested build locally
  • Imported in typescript ✅
  • Imported in cjs ✅

js/schemas/README.md Outdated Show resolved Hide resolved
Comment on lines +1 to +2
// Only way to silence PolkadotJS API warnings we don't want
console.warn = () => {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

💯

Co-authored-by: Joe Caputo <joseph.caputo@unfinished.com>
Copy link
Collaborator

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

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

Looks great--however I think we're missing a couple of key functions:

  1. Should have a method that can retrieve all versions of a given schema name
  2. Should be able to query <schema.fullname>@latest to get the latest version

Granted, these are easy enough for anyone to do with access to the underlying array, but I think this package should provide those lookups as a convenience.

Copy link
Collaborator

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

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

Please respond to:
#2225 (review)

Copy link
Collaborator

@mattheworris mattheworris left a comment

Choose a reason for hiding this comment

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

  • Read through changes
    🚢 it!

@aramikm aramikm requested a review from JoeCap08055 November 21, 2024 00:43
@aramikm aramikm dismissed JoeCap08055’s stale review November 21, 2024 19:02

Added requested functionality. Have to dismiss it here to be able to merge

@aramikm aramikm merged commit 0c34adc into main Nov 21, 2024
28 checks passed
@aramikm aramikm deleted the schemas_package branch November 21, 2024 19:03
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.

[Feature]: Static Schemas package
5 participants