From b1af321eb056ba69c9d89da93025d60211efc3ee Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 15 Feb 2023 12:10:06 -0500 Subject: [PATCH] refactor: alphabetize `ledger_entry` commands and reorganize `account_objects` (#2206) * move AccountObjectType to accountObjects.ts * alphabetize ledgerEntry * remove extra account object type --- packages/xrpl/src/models/common/index.ts | 11 ---- .../xrpl/src/models/methods/accountObjects.ts | 15 ++++- .../xrpl/src/models/methods/ledgerEntry.ts | 66 +++++++++---------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/packages/xrpl/src/models/common/index.ts b/packages/xrpl/src/models/common/index.ts index 5a26a38a..2eeb7b17 100644 --- a/packages/xrpl/src/models/common/index.ts +++ b/packages/xrpl/src/models/common/index.ts @@ -1,16 +1,5 @@ export type LedgerIndex = number | ('validated' | 'closed' | 'current') -export type AccountObjectType = - | 'check' - | 'deposit_preauth' - | 'escrow' - | 'nft_offer' - | 'offer' - | 'payment_channel' - | 'signer_list' - | 'ticket' - | 'state' - interface XRP { currency: 'XRP' } diff --git a/packages/xrpl/src/models/methods/accountObjects.ts b/packages/xrpl/src/models/methods/accountObjects.ts index 45550b53..52715f6c 100644 --- a/packages/xrpl/src/models/methods/accountObjects.ts +++ b/packages/xrpl/src/models/methods/accountObjects.ts @@ -1,4 +1,4 @@ -import { AccountObjectType, LedgerIndex } from '../common' +import { LedgerIndex } from '../common' import { Check, DepositPreauth, @@ -12,6 +12,17 @@ import { import { BaseRequest, BaseResponse } from './baseMethod' +type AccountObjectType = + | 'check' + | 'deposit_preauth' + | 'escrow' + | 'nft_offer' + | 'offer' + | 'payment_channel' + | 'signer_list' + | 'state' + | 'ticket' + /** * The account_objects command returns the raw ledger format for all objects * owned by an account. For a higher-level view of an account's trust lines and @@ -65,8 +76,8 @@ type AccountObject = | Offer | PayChannel | SignerList - | Ticket | RippleState + | Ticket /** * Response expected from an {@link AccountObjectsRequest}. diff --git a/packages/xrpl/src/models/methods/ledgerEntry.ts b/packages/xrpl/src/models/methods/ledgerEntry.ts index b4203a45..f499aab8 100644 --- a/packages/xrpl/src/models/methods/ledgerEntry.ts +++ b/packages/xrpl/src/models/methods/ledgerEntry.ts @@ -46,6 +46,23 @@ export interface LedgerEntryRequest extends BaseRequest { */ account_root?: string + /** The object ID of a Check object to retrieve. */ + check?: string + + /** + * Specify a DepositPreauth object to retrieve. If a string, must be the + * object ID of the DepositPreauth object, as hexadecimal. If an object, + * requires owner and authorized sub-fields. + */ + deposit_preauth?: + | { + /** The account that provided the preauthorization. */ + owner: string + /** The account that received the preauthorization. */ + authorized: string + } + | string + /** * The DirectoryNode to retrieve. If a string, must be the object ID of the * directory, as hexadecimal. If an object, requires either `dir_root` o @@ -62,6 +79,19 @@ export interface LedgerEntryRequest extends BaseRequest { } | string + /** + * The Escrow object to retrieve. If a string, must be the object ID of the + * escrow, as hexadecimal. If an object, requires owner and seq sub-fields. + */ + escrow?: + | { + /** The owner (sender) of the Escrow object. */ + owner: string + /** Sequence Number of the transaction that created the Escrow object. */ + seq: number + } + | string + /** * The Offer object to retrieve. If a string, interpret as the unique object * ID to the Offer. If an object, requires the sub-fields `account` and `seq` @@ -76,6 +106,9 @@ export interface LedgerEntryRequest extends BaseRequest { } | string + /** The object ID of a PayChannel object to retrieve. */ + payment_channel?: string + /** * Object specifying the RippleState (trust line) object to retrieve. The * accounts and currency sub-fields are required to uniquely specify the @@ -91,39 +124,6 @@ export interface LedgerEntryRequest extends BaseRequest { currency: string } - /** The object ID of a Check object to retrieve. */ - check?: string - - /** - * The Escrow object to retrieve. If a string, must be the object ID of the - * escrow, as hexadecimal. If an object, requires owner and seq sub-fields. - */ - escrow?: - | { - /** The owner (sender) of the Escrow object. */ - owner: string - /** Sequence Number of the transaction that created the Escrow object. */ - seq: number - } - | string - - /** The object ID of a PayChannel object to retrieve. */ - payment_channel?: string - - /** - * Specify a DepositPreauth object to retrieve. If a string, must be the - * object ID of the DepositPreauth object, as hexadecimal. If an object, - * requires owner and authorized sub-fields. - */ - deposit_preauth?: - | { - /** The account that provided the preauthorization. */ - owner: string - /** The account that received the preauthorization. */ - authorized: string - } - | string - /** * The Ticket object to retrieve. If a string, must be the object ID of the * Ticket, as hexadecimal. If an object, the `owner` and `ticket_sequence`