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

Aliter: Implement DeliverMax alias in Payment transactions, through autofill method #2689

Merged
merged 28 commits into from
Jun 27, 2024

Conversation

ckeshava
Copy link
Collaborator

@ckeshava ckeshava commented May 3, 2024

High Level Overview of Change

This is an alternative solution for the DeliverMax alias, inspired from this discussion: #2684 (comment)

Note: Only one of these two PRs must be merged.

Both the PRs seek to achieve the same objectives, albeit through different means.

Context of Change

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 unit tests

@ckeshava
Copy link
Collaborator Author

ckeshava commented May 3, 2024

Do you guys have any ideas for complying with lint errors? For instance:

error    Unsafe member access .DeliverMax on an `any` value                                @typescript-eslint/no-unsafe-member-access

error    Unsafe return of type `Promise<any>` from function with return type `Promise<T>`  @typescript-eslint/no-unsafe-return

@ckeshava
Copy link
Collaborator Author

ckeshava commented May 8, 2024

@mvadari Do you have any workarounds for the lint errors? type-erasure does not seem to sit well with the linter.

@mvadari
Copy link
Collaborator

mvadari commented May 8, 2024

@mvadari Do you have any workarounds for the lint errors? type-erasure does not seem to sit well with the linter.

Feel free to disable the linter error for that line.

@ckeshava
Copy link
Collaborator Author

ckeshava commented May 9, 2024

thanks, I've fixed the linter errors and warnings. I didn't realize that I could ignore the errors and get away with it haha

I think it's safe to ignore the linter errors because, a malformed input is sure to through an error in signing or serialization steps.

@ckeshava ckeshava requested a review from justinr1234 June 4, 2024 22:06
packages/xrpl/src/client/index.ts Outdated Show resolved Hide resolved
packages/xrpl/src/client/index.ts Outdated Show resolved Hide resolved
packages/xrpl/src/client/index.ts Outdated Show resolved Hide resolved
@ckeshava
Copy link
Collaborator Author

ckeshava commented Jun 6, 2024

sorry about the forced updates, I had messed up the git history

packages/xrpl/src/client/index.ts Outdated Show resolved Hide resolved
packages/xrpl/src/client/index.ts Outdated Show resolved Hide resolved
packages/xrpl/src/client/index.ts Outdated Show resolved Hide resolved
packages/xrpl/test/client/autofill.test.ts Outdated Show resolved Hide resolved
@khancode
Copy link
Collaborator

We should also add integ tests to verify it works for both API versions under packages/xrpl/test/integration/transactions/payment.test.ts

@ckeshava ckeshava requested a review from khancode June 10, 2024 22:19
@ckeshava
Copy link
Collaborator Author

Integration tests are set up against rippledv2.2.0-b3 in the current codebase. I tried to execute the integration tests against v1.12.0 (this rippled version contains API v1), but I'm running into some config errors

@ckeshava ckeshava requested a review from khancode June 14, 2024 17:32
@ckeshava ckeshava requested a review from khancode June 14, 2024 22:51
ckeshava and others added 5 commits June 14, 2024 16:21
paymentTx.DeliverMax = '6789'
paymentTx.Amount = '1234'

await assertRejects(testContext.client.autofill(paymentTx), ValidationError)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@justinr1234 here is the test case where the ValidationError is caught as expected -- there is not websocket connection to a rippled instance, but it traverses the new code path.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is not an integration test, hence it does not involve any codepaths through connection.ts or other websocket related functions

@ckeshava ckeshava requested a review from pdp2121 June 17, 2024 18:29
Copy link
Collaborator

@pdp2121 pdp2121 left a comment

Choose a reason for hiding this comment

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

LGTM

@ckeshava ckeshava merged commit 39fed49 into XRPLF:main Jun 27, 2024
15 checks passed
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.

4 participants