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

Support for native asset & hash in custom Definitions #2597

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WietseWind
Copy link
Member

High Level Overview of Change

Add native asset & hash as returned by the server_definitions method to XrplDefinitions objects, and allow getting them through:

  • getNativeAsset()
  • getHash()

This allows to use these params as present in constructed XrplDefinitions by other libs building on top, potentially wanting to pass getNativeAsset to #2596 and using getHash to save bandwidth when checking if new definitions are to be loaded.

@@ -0,0 +1,2740 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should go in the test folder, not the src folder. And perhaps should be renamed to something like definitions-sample.json so that people don't think it's the current production file.

This is because this file would increase the size of the package by about 6%, and it's therefore not sustainable to do for every XRPL-based chain. I'd recommend maintaining this file in a separate repo and pointing people towards that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do in separate repo 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

The rest of the PR was fine, just this one file was what I suggested you move to a new repo 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

@mvadari Done, loading JSON from external dev-dependency.

@WietseWind WietseWind closed this Feb 14, 2024
@WietseWind WietseWind reopened this Feb 16, 2024
@@ -44,5 +44,8 @@
"prettier": "@xrplf/prettier-config",
"engines": {
"node": ">= 10"
},
"devDependencies": {
"xrpl-binary-codec-prerelease": "^7.0.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer this be a package with just the definitions. The name of it seems like a circular dep. That the stable release would require a pre release to release.

@@ -1,5 +1,6 @@
const { encode, decode, XrplDefinitions } = require('../src')
const normalDefinitionsJson = require('../src/enums/definitions.json')
const altDefinitions = require('xrpl-binary-codec-prerelease/dist/enums/definitions-xahau.json')
Copy link
Collaborator

@mvadari mvadari Feb 16, 2024

Choose a reason for hiding this comment

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

I'd recommend having the definitions file be just a copy-pasted test file in the fixtures folder instead of importing a new package, since it doesn't need to be kept up-to-date for the tests to still work.

Copy link
Member Author

Choose a reason for hiding this comment

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

You know what: I propose that you decide internally how you want to resolve this :) Lmk if there's anything I can do at this point.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @mvadari approach.

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.

None yet

3 participants