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

[Feature]: Static Schemas package #2176

Open
1 task done
wilwade opened this issue Oct 4, 2024 · 0 comments
Open
1 task done

[Feature]: Static Schemas package #2176

wilwade opened this issue Oct 4, 2024 · 0 comments

Comments

@wilwade
Copy link
Collaborator

wilwade commented Oct 4, 2024

Feature Description

Details

Always fetching the schema ids from the chain works, but usually it is not needed as the values are static.

Let's publish a package (suggested at @frequency-chain/schemas) that has the following:

  • A way to get the schema id from the schema namespace, name, and version. (see below for example)
  • A way to get the schema namespace, name, and version from the id
  • Have zero dependencies
  • Placed in the js/schemas folder
  • Releases should be tagged only when the contents change, but this should still work to release at the same time as the node image with the mainnet schema included.
  • Perhaps a generator to generate from the mainet schema data
// This has already applied the transformation from the v1.13.0 migration
export const SCHEMA_NAME_TO_ID = new Map<string, number>([
  ['dsnp.broadcast@v1', 2],
  ['dsnp.broadcast@v2', 17],
  ['dsnp.dsnp-content-attribute-set@v1', 12],
  ['dsnp.ext-content-attribute-set@v1', 13],
  ['dsnp.private-connections@v1', 10],
  ['dsnp.private-follows@v1', 9],
  ['dsnp.profile-resources@v1', 15],
  ['dsnp.profile@v1', 6],
  ['dsnp.public-follows@v1', 8],
  ['dsnp.public-key-assertion-method@v1', 14],
  ['dsnp.public-key-key-agreement@v1', 7],
  ['dsnp.reaction@v1', 4],
  ['dsnp.reply@v1', 3],
  ['dsnp.reply@v2', 18],
  ['dsnp.tombstone@v1', 1],
  ['dsnp.tombstone@v2', 16],
  ['dsnp.update@v1', 5],
  ['dsnp.update@v2', 19],
  ['dsnp.user-attribute-set@v1', 11],
  ['dsnp.user-attribute-set@v2', 20],
  ['frequency.default-token-address@v1', 21],
]);

Searched for Related Issues

  • I have done a search for related issues and either found none, or noted them
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

No branches or pull requests

1 participant