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(xrpl): custom definitions support #2683

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

Conversation

elmurci
Copy link
Contributor

@elmurci elmurci commented Apr 23, 2024

High Level Overview of Change

In previous versions, custom definition support was added to the ripple-binary-codec methods but not the proxy ones in the xrpl package.

This PR adds support for Custom Definitions to the following xrpl methods:

  • utils.encode
  • utils.decode
  • utils.encodeForSigning
  • Wallet.sign

Context of Change

When using custom definitions, you had to directly use the encode, decode, and encodeForSigning methods from ripple-binary-codec. Those features can now be used via the proxy methods in the xrpl package.

Custom definition support has also been added to the Wallet.sign method which wasn't the case before.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update HISTORY.md?

  • Yes
  • No, this change does not impact library users

Test Plan

Added 2 unit tests for:

  • Wallet.sign (single signature)
  • Wallet.sign (multisignature)

@elmurci elmurci marked this pull request as ready for review April 23, 2024 12:51
@justinr1234
Copy link
Collaborator

Hey there, did you also check #2214

@mvadari
Copy link
Collaborator

mvadari commented Apr 23, 2024

Hey there, did you also check #2214

#2214 is massively outdated and it'd take a ton of effort to update.

`Invalid field TransactionType: ${tx.TransactionType}`,
)
if (!customDefinition)
throw new ValidationError(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this check the list of transactions in customDefinition instead of never erroring?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or maybe validate should be skipped entirely in the custom definition case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can this check the list of transactions in customDefinition instead of never erroring?

I like this idea. I will add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe validate should be skipped entirely in the custom definition case?

I thought about it, but then I thought there were other checks that might be useful.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or maybe validate should be skipped entirely in the custom definition case?

I thought about it, but then I thought there were other checks that might be useful.

True, but there may be new transactions that break those checks.

Just a thought - I don't have a strong preference on this.

@mvadari mvadari requested review from khancode and pdp2121 May 7, 2024 16:37
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