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

feat: add support for XLS-40d + add script to auto-generate models from rippled code #2491

Merged
merged 33 commits into from Nov 15, 2023

Conversation

mvadari
Copy link
Collaborator

@mvadari mvadari commented Sep 28, 2023

High Level Overview of Change

This PR adds support for XLS-40 and adds a script to automatically generate transaction models from rippled source code.

Context of Change

XRPLF/XRPL-Standards#136
XRPLF/rippled#4636

Type of Change

  • New feature (non-breaking change which adds functionality)

Did you update CHANGELOG.md?

  • Yes

Test Plan

Added model tests (integration tests will be added later). CI passes.

@mvadari mvadari mentioned this pull request Sep 28, 2023
2 tasks
@mvadari mvadari marked this pull request as ready for review October 23, 2023 21:33
packages/xrpl/tools/generateModels.js Outdated Show resolved Hide resolved
)

newJsTxFile = newJsTxFile.replace(
`import {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels oddly specific to one type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's the last type in the list, it was easier to do it this way and have the linter fix the sorting than do some complex regex that sorts alphabetically.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a comment with that context?

@@ -140,40 +141,40 @@
[
"LedgerEntry",
{
"nth": 1,
"nth": 257,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did these fields change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixing discrepancies between the server_definitions RPC and the xrpl-codec-gen script. Tests all pass because these fields aren't used for signing, they only exist for rippled technical reasons.

| AMMVote
| AMMWithdraw
| AccountDelete
| AccountSet
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Alphabetically AccountDelete and AccountSet should be before AMM...

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Same nit applies below with the case statement if we want to maintain alphabetical order)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was sorting with capitals before lowercase, which makes more sense to me, but if you disagree I'm happy to change that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally don't consider capitalization when scanning lists, so I'd prefer to ignore it when sorting alphabetically

Flags: 2147483648,
Sequence: 4,
TransactionType: 'DIDDelete',
} as any
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is typed as any instead of DIDDelete?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So that you can remove required fields without TS complaining (see other model tests)

Copy link
Collaborator

@JST5000 JST5000 left a comment

Choose a reason for hiding this comment

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

All my changes are docs updates, logic looks good :)

@ckniffen ckniffen merged commit c8f25a6 into main Nov 15, 2023
18 checks passed
@ckniffen ckniffen deleted the did branch November 15, 2023 22:19
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