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

Defines TypeScript types for rippled account method requests & responses #1498

Merged
merged 32 commits into from
Aug 9, 2021

Conversation

mvadari
Copy link
Collaborator

@mvadari mvadari commented Aug 2, 2021

High Level Overview of Change

This PR creates new TypeScript types for all rippled account methods (https://xrpl.org/account-methods.html), both the request shapes and response shapes.

Context of Change

xrpl.js v2.0 models

Type of Change

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

Before / After

Test Plan

This PR doesn't change any existing code, so tests are fine.

@mvadari mvadari force-pushed the mv/account-methods branch from 7c16a47 to 7e6b1c1 Compare August 2, 2021 21:26
@mvadari mvadari changed the base branch from develop to mv/ledger-objects August 2, 2021 21:26
@mvadari mvadari marked this pull request as ready for review August 2, 2021 21:56
@mvadari mvadari requested a review from ledhed2222 August 3, 2021 14:01
@mvadari mvadari force-pushed the mv/account-methods branch from 0dd7c8c to 8549ae0 Compare August 4, 2021 14:57
@mvadari mvadari requested a review from ledhed2222 August 4, 2021 14:57
ModifiedNode: {
LedgerEntryType: string
LedgerIndex: string
FinalFields: {[field: string]: any}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way we can narrow this from {[field: string]: any? Does this come in the form of a LedgerEntry that we can use to replace any here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You could in theory narrow it, but as far as I understand, it's a subset of LedgerEntry fields, and isn't necessarily a full LedgerEntry object. I suppose this is another question for @intelliot

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably any (modifiable) fields in any ledger object, so I believe there are a lot of possibilities, and it'll expand in the future as more kinds of ledger objects are added in the future. I would fine with leaving this as-is, but of course, if we want to make this more specific in the future, that would be fine as well.


export interface BaseResponse {
id: number | string
status: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Can status be anything other than success or error?

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'm not entirely sure, which is why I left it as string - maybe @intelliot knows

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know. I think this is fine as-is, or "success" | string if you want to document the fact that 'success' is the happy path value

Base automatically changed from mv/ledger-objects to 2.0 August 9, 2021 16:54
Copy link
Contributor

@natenichols natenichols left a comment

Choose a reason for hiding this comment

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

LGTM 👍 , given the two open questions for @intelliot are answered before merging.

@mvadari mvadari merged commit dba5e63 into 2.0 Aug 9, 2021
@mvadari mvadari deleted the mv/account-methods branch August 9, 2021 21:36
mvadari added a commit that referenced this pull request Aug 19, 2021
…ses (#1498)

* account_channels

* account_currencies

* account_info

* account_lines

* account_objects

* account_offers

* account_tx

* gateway_balances

* no ripple check

* respond to comments

* export methods

* fix typos

* respond to comments

* edit BaseResponse to be more specific
mvadari added a commit that referenced this pull request Sep 14, 2021
…ses (#1498)

* account_channels

* account_currencies

* account_info

* account_lines

* account_objects

* account_offers

* account_tx

* gateway_balances

* no ripple check

* respond to comments

* export methods

* fix typos

* respond to comments

* edit BaseResponse to be more specific
mvadari added a commit that referenced this pull request Oct 4, 2021
…ses (#1498)

* account_channels

* account_currencies

* account_info

* account_lines

* account_objects

* account_offers

* account_tx

* gateway_balances

* no ripple check

* respond to comments

* export methods

* fix typos

* respond to comments

* edit BaseResponse to be more specific
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