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

Add definitions.json changes to xrpl package #2214

Draft
wants to merge 66 commits into
base: main
Choose a base branch
from

Conversation

JST5000
Copy link
Contributor

@JST5000 JST5000 commented Feb 17, 2023

High Level Overview of Change

The user interface for defining custom definitions needs more work, so I split up #2127 to focus on the binary-codec, with this one focusing on the interface.

Context of Change

With sidechains and many amendments being worked on, we need a better way to define which types & transactions we're able to serialize/deserialize.

Type of Change

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

Before / After

  • Added an optional parameter to high level functions to manually specify the XRPL Definitions to use.
  • Added tests for modifying definitions

Test Plan

CI Passes

Future Tasks

  • Integrate with server_definitions
  • Use the Client as the "global state" so users only have to specify the definitions once per connection.
  • Automatically determine definitions when client is connected (defaulting to mainnet values)

Base automatically changed from pass-through-encode to main March 16, 2023 17:35
const tx = typeof transaction === 'string' ? decode(transaction) : transaction
function isSigned<T extends BaseTransaction = Transaction>(
transaction: T | string,
definitions?: InstanceType<typeof XrplDefinitionsBase>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should not be optional since this directly uses decode, so we should specify our default one layer above the binary codec across the board.

transaction: Transaction | string,
function getLastLedgerSequence<T extends BaseTransaction = Transaction>(
transaction: T | string,
definitions?: InstanceType<typeof XrplDefinitionsBase>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same for this one.

const tx = typeof transaction === 'string' ? decode(transaction) : transaction
function isAccountDelete<T extends BaseTransaction = Transaction>(
transaction: T | string,
definitions?: InstanceType<typeof XrplDefinitionsBase>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevermind (and for all above) - I think it makes the most sense to just have encode and decode be the only functions with default value of DEFAULT_DEFINITIONS.

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

1 participant