From 912bb97e4c543e6ffd7be27d12820a061b68b12d Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:52:45 -0400 Subject: [PATCH 01/31] offer --- src/models/common/index.ts | 20 ++++++++++++++++++++ src/models/ledger/offer.ts | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/models/common/index.ts create mode 100644 src/models/ledger/offer.ts diff --git a/src/models/common/index.ts b/src/models/common/index.ts new file mode 100644 index 0000000000..66ad1f335b --- /dev/null +++ b/src/models/common/index.ts @@ -0,0 +1,20 @@ +export type LedgerIndex = number | ('validated' | 'closed' | 'current') + +export type AccountObjectType = 'check' | 'escrow' | 'offer' | 'payment_channel' | 'signer_list' | 'state' + +export interface XRP { + currency: "XRP" +} + +export interface IssuedCurrency { + currency: string + issuer: string +} + +export type Currency = IssuedCurrency | XRP + +export interface IssuedCurrencyAmount extends IssuedCurrency { + value: string +} + +export type Amount = IssuedCurrencyAmount | string \ No newline at end of file diff --git a/src/models/ledger/offer.ts b/src/models/ledger/offer.ts new file mode 100644 index 0000000000..77d060c74a --- /dev/null +++ b/src/models/ledger/offer.ts @@ -0,0 +1,16 @@ +import { Amount } from "../common"; + +export interface Offer { + LedgerEntryType: 'Offer' + Flags: number + Account: string + Sequence: number + TakerPays: Amount + TakerGets: Amount + BookDirectory: string + BookNode: string + OwnerNode: string + PreviousTxnID: string + PreviousTxnLgrSeq: number + Expiration?: number + } \ No newline at end of file From da51f264c7709fd505e20da78b3a6bb600a9fbea Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:53:15 -0400 Subject: [PATCH 02/31] accountroot --- src/models/ledger/account_root.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/models/ledger/account_root.ts diff --git a/src/models/ledger/account_root.ts b/src/models/ledger/account_root.ts new file mode 100644 index 0000000000..1d39f9696b --- /dev/null +++ b/src/models/ledger/account_root.ts @@ -0,0 +1,18 @@ +export interface AccountRoot { + LedgerEntryType: 'AccountRoot' + Account: string + Balance: string + Flags: number + OwnerCount: number + PreviousTxnID: string + PreviousTxnLgrSeq: number + Sequence: number + AccountTxnID?: string + Domain?: string + EmailHash?: string + MessageKey?: string + RegularKey?: string + TicketCount?: number + TickSize?: number + TransferRate?: number + } \ No newline at end of file From 2c2339d087e6933314b6175007faacad7d2468f9 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:56:34 -0400 Subject: [PATCH 03/31] amendments --- src/models/ledger/amendments.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/models/ledger/amendments.ts diff --git a/src/models/ledger/amendments.ts b/src/models/ledger/amendments.ts new file mode 100644 index 0000000000..e2d4843365 --- /dev/null +++ b/src/models/ledger/amendments.ts @@ -0,0 +1,13 @@ +interface Majority { + Majority: { + Amendment: string + CloseTime: number + } +} + +export interface AmendmentsLedgerEntry { + LedgerEntryType: 'Amendments' + Amendments?: string[] + Majorities?: Majority[] + Flags: 0 +} \ No newline at end of file From df0bc936c6ec221551623c4d5f2e71807035754d Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:58:25 -0400 Subject: [PATCH 04/31] check --- src/models/ledger/check.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/models/ledger/check.ts diff --git a/src/models/ledger/check.ts b/src/models/ledger/check.ts new file mode 100644 index 0000000000..b6a7051afa --- /dev/null +++ b/src/models/ledger/check.ts @@ -0,0 +1,18 @@ +import { Amount } from "../common"; + +export interface CheckLedgerEntry { + LedgerEntryType: 'Check' + Account: string + Destination: string + Flags: 0 + OwnerNode: string + PreviousTxnID: string + PreviousTxnLgrSeq: number + SendMax: Amount + Sequence: number + DestinationNode?: string + DestinationTag?: number + Expiration?: number + InvoiceID?: string + SourceTag?: number + } \ No newline at end of file From f18038f3065706237b0f81d29eabe4d79f030b9f Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:59:57 -0400 Subject: [PATCH 05/31] deposit preauth --- src/models/ledger/amendments.ts | 2 +- src/models/ledger/check.ts | 2 +- src/models/ledger/deposit_preauth.ts | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/models/ledger/deposit_preauth.ts diff --git a/src/models/ledger/amendments.ts b/src/models/ledger/amendments.ts index e2d4843365..bd0c641d01 100644 --- a/src/models/ledger/amendments.ts +++ b/src/models/ledger/amendments.ts @@ -5,7 +5,7 @@ interface Majority { } } -export interface AmendmentsLedgerEntry { +export interface Amendments { LedgerEntryType: 'Amendments' Amendments?: string[] Majorities?: Majority[] diff --git a/src/models/ledger/check.ts b/src/models/ledger/check.ts index b6a7051afa..08965f3b9f 100644 --- a/src/models/ledger/check.ts +++ b/src/models/ledger/check.ts @@ -1,6 +1,6 @@ import { Amount } from "../common"; -export interface CheckLedgerEntry { +export interface Check { LedgerEntryType: 'Check' Account: string Destination: string diff --git a/src/models/ledger/deposit_preauth.ts b/src/models/ledger/deposit_preauth.ts new file mode 100644 index 0000000000..18da53ccdd --- /dev/null +++ b/src/models/ledger/deposit_preauth.ts @@ -0,0 +1,9 @@ +export interface DepositPreauth { + LedgerEntryType: 'DepositPreauth' + Account: string + Authorize: string + Flags: 0 + OwnerNode: string + PreviousTxnID: string + PreviousTxnLgrSeq: number + } \ No newline at end of file From b1b9851dbcadb6065bea34d7e6bbebcd41b78059 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:01:31 -0400 Subject: [PATCH 06/31] directory node --- src/models/ledger/directory_node.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/models/ledger/directory_node.ts diff --git a/src/models/ledger/directory_node.ts b/src/models/ledger/directory_node.ts new file mode 100644 index 0000000000..aa7860265c --- /dev/null +++ b/src/models/ledger/directory_node.ts @@ -0,0 +1,13 @@ +export interface DirectoryNode { + LedgerEntryType: 'DirectoryNode' + Flags: number + RootIndex: string + Indexes: string[] + IndexNext?: number + IndexPrevious?: number + Owner?: string + TakerPaysCurrency?: string + TakerPaysIssuer?: string + TakerGetsCurrency?: string + TakerGetsIssuer?: string +} \ No newline at end of file From 5071cbe665991bb707c9df70386077eb76f98528 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:05:04 -0400 Subject: [PATCH 07/31] escrow --- src/models/ledger/escrow.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/models/ledger/escrow.ts diff --git a/src/models/ledger/escrow.ts b/src/models/ledger/escrow.ts new file mode 100644 index 0000000000..eb12efa772 --- /dev/null +++ b/src/models/ledger/escrow.ts @@ -0,0 +1,16 @@ +export interface Escrow { + LedgerEntryType: 'Escrow' + Account: string + Destination: string + Amount: string + Condition?: string + CancelAfter?: number + FinishAfter?: number + Flags: number + SourceTag?: number + DestinationTag?: number + OwnerNode: string + DestinationNode?: string + PreviousTxnID: string + PreviousTxnLgrSeq: number + } \ No newline at end of file From 0af06f48c51a62724e3dee839343f4634e28f276 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:05:47 -0400 Subject: [PATCH 08/31] fee settings --- src/models/ledger/fee_settings.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/models/ledger/fee_settings.ts diff --git a/src/models/ledger/fee_settings.ts b/src/models/ledger/fee_settings.ts new file mode 100644 index 0000000000..22e79daacf --- /dev/null +++ b/src/models/ledger/fee_settings.ts @@ -0,0 +1,8 @@ +export interface FeeSettings { + LedgerEntryType: 'FeeSettings' + BaseFee: string + ReferenceFeeUnits: number + ReserveBase: number + ReserveIncrement: number + Flags: number + } \ No newline at end of file From 06aecbf13a07b2297a0a9e658a790869b760c343 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:06:46 -0400 Subject: [PATCH 09/31] ledger hashes --- src/models/ledger/ledger_hashes.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/models/ledger/ledger_hashes.ts diff --git a/src/models/ledger/ledger_hashes.ts b/src/models/ledger/ledger_hashes.ts new file mode 100644 index 0000000000..b547d05093 --- /dev/null +++ b/src/models/ledger/ledger_hashes.ts @@ -0,0 +1,6 @@ +export interface LedgerHashes { + LedgerEntryType: 'LedgerHashes' + LastLedgerSequence?: number + Hashes: string[] + Flags: number + } \ No newline at end of file From 3bf2bec530a6df57a775f77c0b7de3f2bad4af75 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:08:18 -0400 Subject: [PATCH 10/31] negative unl --- src/models/ledger/negative_unl.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/models/ledger/negative_unl.ts diff --git a/src/models/ledger/negative_unl.ts b/src/models/ledger/negative_unl.ts new file mode 100644 index 0000000000..d133cf552a --- /dev/null +++ b/src/models/ledger/negative_unl.ts @@ -0,0 +1,11 @@ +interface DisabledValidator { + FirstLedgerSequence: number + PublicKey: string +} + +export interface NegativeUNL { + LedgerEntryType: "NegativeUNL" + DisabledValidators?: DisabledValidator[] + ValidatorToDisable?: string + ValidatorToReEnable?: string +} \ No newline at end of file From bfa9fe2f5a9a553d269746703b4e31bb0e28303e Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:10:41 -0400 Subject: [PATCH 11/31] pay channel --- src/models/ledger/pay_channel.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/models/ledger/pay_channel.ts diff --git a/src/models/ledger/pay_channel.ts b/src/models/ledger/pay_channel.ts new file mode 100644 index 0000000000..493f3f9542 --- /dev/null +++ b/src/models/ledger/pay_channel.ts @@ -0,0 +1,18 @@ +export interface PayChannelLedgerEntry { + LedgerEntryType: 'PayChannel' + Account: string + Destination: string + Amount: string + Balance: string + PublicKey: string + SettleDelay: number + OwnerNode: string + PreviousTxnID: string + PreviousTxnLgrSeq: number + Flags: number + Expiration?: number + CancelAfter?: number + SourceTag?: number + DestinationTag?: number + index: string +} \ No newline at end of file From c25bbf92cc52251fdd6a1e86ff68e9a18e689491 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:12:18 -0400 Subject: [PATCH 12/31] ripple state --- src/models/ledger/ripple_state.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/models/ledger/ripple_state.ts diff --git a/src/models/ledger/ripple_state.ts b/src/models/ledger/ripple_state.ts new file mode 100644 index 0000000000..0e33129b05 --- /dev/null +++ b/src/models/ledger/ripple_state.ts @@ -0,0 +1,17 @@ +import { Amount } from "../common"; + +export interface RippleStateLedgerEntry { + LedgerEntryType: 'RippleState' + Flags: number + Balance: Amount + LowLimit: Amount + HighLimit: Amount + PreviousTxnID: string + PreviousTxnLgrSeq: number + LowNode?: string + HighNode?: string + LowQualityIn?: number + LowQualityOut?: number + HighQualityIn?: number + HighQualityOut?: number +} \ No newline at end of file From bb8b283565a0218635f5926edb63557acd626cdb Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:12:50 -0400 Subject: [PATCH 13/31] signer list --- src/models/ledger/signer_list.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/models/ledger/signer_list.ts diff --git a/src/models/ledger/signer_list.ts b/src/models/ledger/signer_list.ts new file mode 100644 index 0000000000..1b53f416bc --- /dev/null +++ b/src/models/ledger/signer_list.ts @@ -0,0 +1,17 @@ +interface SignerEntry { + SignerEntry: { + Account: string + SignerWeight: number + } +} + +export interface SignerList { + LedgerEntryType: 'SignerList' + Flags: number + PreviousTxnID: string + PreviousTxnLgrSeq: number + OwnerNode: string + SignerEntries: SignerEntry[] + SignerListID: number + SignerQuorum: number +} \ No newline at end of file From 0389ff647c406e3085e5a1a2c8250d0e010bc200 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:14:23 -0400 Subject: [PATCH 14/31] ticket --- src/models/ledger/ticket.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/models/ledger/ticket.ts diff --git a/src/models/ledger/ticket.ts b/src/models/ledger/ticket.ts new file mode 100644 index 0000000000..f648fd4e72 --- /dev/null +++ b/src/models/ledger/ticket.ts @@ -0,0 +1,9 @@ +export interface Ticket { + LedgerEntryType: "Ticket" + Account: string + Flags: number + OwnerNode: string + PreviousTxnID: string + PreviousTxnLgrSeq: number + TicketSequence: number +} \ No newline at end of file From 72c13a23cb9c04aeff5772ec305c656011711250 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:19:01 -0400 Subject: [PATCH 15/31] export --- src/models/ledger/index.ts | 46 +++++++++++++++++++++++++++++++ src/models/ledger/pay_channel.ts | 2 +- src/models/ledger/ripple_state.ts | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 src/models/ledger/index.ts diff --git a/src/models/ledger/index.ts b/src/models/ledger/index.ts new file mode 100644 index 0000000000..a806d77a9e --- /dev/null +++ b/src/models/ledger/index.ts @@ -0,0 +1,46 @@ +import { Ticket } from "../../transaction/ticket"; +import { AccountRoot } from "./account_root"; +import { Amendments } from "./amendments"; +import { Check } from "./check"; +import { DepositPreauth } from "./deposit_preauth"; +import { DirectoryNode } from "./directory_node"; +import { Escrow } from "./escrow"; +import { FeeSettings } from "./fee_settings"; +import { LedgerHashes } from "./ledger_hashes"; +import { NegativeUNL } from "./negative_unl"; +import { Offer } from "./offer"; +import { PayChannel } from "./pay_channel"; +import { RippleState } from "./ripple_state"; +import { SignerList } from "./signer_list"; + +export type LedgerEntry = AccountRoot + | Amendments + | Check + | DepositPreauth + | DirectoryNode + | Escrow + | FeeSettings + | LedgerHashes + | NegativeUNL + | Offer + | PayChannel + | RippleState + | SignerList + | Ticket + +export { + AccountRoot, + Amendments, + Check, + DepositPreauth, + DirectoryNode, + Escrow, + FeeSettings, + LedgerHashes, + NegativeUNL, + Offer, + PayChannel, + RippleState, + SignerList, + Ticket +} \ No newline at end of file diff --git a/src/models/ledger/pay_channel.ts b/src/models/ledger/pay_channel.ts index 493f3f9542..f7af9c15fa 100644 --- a/src/models/ledger/pay_channel.ts +++ b/src/models/ledger/pay_channel.ts @@ -1,4 +1,4 @@ -export interface PayChannelLedgerEntry { +export interface PayChannel { LedgerEntryType: 'PayChannel' Account: string Destination: string diff --git a/src/models/ledger/ripple_state.ts b/src/models/ledger/ripple_state.ts index 0e33129b05..77a87aca24 100644 --- a/src/models/ledger/ripple_state.ts +++ b/src/models/ledger/ripple_state.ts @@ -1,6 +1,6 @@ import { Amount } from "../common"; -export interface RippleStateLedgerEntry { +export interface RippleState { LedgerEntryType: 'RippleState' Flags: number Balance: Amount From 837343039fd289fe3c8ca51a040f07126a61095d Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 4 Aug 2021 07:45:31 -0700 Subject: [PATCH 16/31] respond to comments --- src/models/ledger/account_root.ts | 4 +++- src/models/ledger/amendments.ts | 4 +++- src/models/ledger/base_ledger_entry.ts | 3 +++ src/models/ledger/check.ts | 3 ++- src/models/ledger/deposit_preauth.ts | 4 +++- src/models/ledger/directory_node.ts | 4 +++- src/models/ledger/escrow.ts | 4 +++- src/models/ledger/fee_settings.ts | 4 +++- src/models/ledger/ledger_hashes.ts | 4 +++- src/models/ledger/negative_unl.ts | 4 +++- src/models/ledger/offer.ts | 3 ++- src/models/ledger/pay_channel.ts | 6 ++++-- src/models/ledger/ripple_state.ts | 11 ++++++----- src/models/ledger/signer_list.ts | 4 +++- src/models/ledger/ticket.ts | 4 +++- 15 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 src/models/ledger/base_ledger_entry.ts diff --git a/src/models/ledger/account_root.ts b/src/models/ledger/account_root.ts index 1d39f9696b..d207462b9e 100644 --- a/src/models/ledger/account_root.ts +++ b/src/models/ledger/account_root.ts @@ -1,4 +1,6 @@ -export interface AccountRoot { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface AccountRoot extends BaseLedgerEntry{ LedgerEntryType: 'AccountRoot' Account: string Balance: string diff --git a/src/models/ledger/amendments.ts b/src/models/ledger/amendments.ts index bd0c641d01..fe40d5ec92 100644 --- a/src/models/ledger/amendments.ts +++ b/src/models/ledger/amendments.ts @@ -1,3 +1,5 @@ +import { BaseLedgerEntry } from "./base_ledger_entry"; + interface Majority { Majority: { Amendment: string @@ -5,7 +7,7 @@ interface Majority { } } -export interface Amendments { +export interface Amendments extends BaseLedgerEntry { LedgerEntryType: 'Amendments' Amendments?: string[] Majorities?: Majority[] diff --git a/src/models/ledger/base_ledger_entry.ts b/src/models/ledger/base_ledger_entry.ts new file mode 100644 index 0000000000..d322ccac60 --- /dev/null +++ b/src/models/ledger/base_ledger_entry.ts @@ -0,0 +1,3 @@ +export interface BaseLedgerEntry { + index: string +} \ No newline at end of file diff --git a/src/models/ledger/check.ts b/src/models/ledger/check.ts index 08965f3b9f..b39b06fbfe 100644 --- a/src/models/ledger/check.ts +++ b/src/models/ledger/check.ts @@ -1,6 +1,7 @@ import { Amount } from "../common"; +import { BaseLedgerEntry } from "./base_ledger_entry"; -export interface Check { +export interface Check extends BaseLedgerEntry { LedgerEntryType: 'Check' Account: string Destination: string diff --git a/src/models/ledger/deposit_preauth.ts b/src/models/ledger/deposit_preauth.ts index 18da53ccdd..7f9c399318 100644 --- a/src/models/ledger/deposit_preauth.ts +++ b/src/models/ledger/deposit_preauth.ts @@ -1,4 +1,6 @@ -export interface DepositPreauth { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface DepositPreauth extends BaseLedgerEntry { LedgerEntryType: 'DepositPreauth' Account: string Authorize: string diff --git a/src/models/ledger/directory_node.ts b/src/models/ledger/directory_node.ts index aa7860265c..bed02606da 100644 --- a/src/models/ledger/directory_node.ts +++ b/src/models/ledger/directory_node.ts @@ -1,4 +1,6 @@ -export interface DirectoryNode { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface DirectoryNode extends BaseLedgerEntry { LedgerEntryType: 'DirectoryNode' Flags: number RootIndex: string diff --git a/src/models/ledger/escrow.ts b/src/models/ledger/escrow.ts index eb12efa772..6e60dbceef 100644 --- a/src/models/ledger/escrow.ts +++ b/src/models/ledger/escrow.ts @@ -1,4 +1,6 @@ -export interface Escrow { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface Escrow extends BaseLedgerEntry { LedgerEntryType: 'Escrow' Account: string Destination: string diff --git a/src/models/ledger/fee_settings.ts b/src/models/ledger/fee_settings.ts index 22e79daacf..32c56ccc1a 100644 --- a/src/models/ledger/fee_settings.ts +++ b/src/models/ledger/fee_settings.ts @@ -1,4 +1,6 @@ -export interface FeeSettings { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface FeeSettings extends BaseLedgerEntry { LedgerEntryType: 'FeeSettings' BaseFee: string ReferenceFeeUnits: number diff --git a/src/models/ledger/ledger_hashes.ts b/src/models/ledger/ledger_hashes.ts index b547d05093..de031f24e7 100644 --- a/src/models/ledger/ledger_hashes.ts +++ b/src/models/ledger/ledger_hashes.ts @@ -1,4 +1,6 @@ -export interface LedgerHashes { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface LedgerHashes extends BaseLedgerEntry { LedgerEntryType: 'LedgerHashes' LastLedgerSequence?: number Hashes: string[] diff --git a/src/models/ledger/negative_unl.ts b/src/models/ledger/negative_unl.ts index d133cf552a..aecdb9d8b4 100644 --- a/src/models/ledger/negative_unl.ts +++ b/src/models/ledger/negative_unl.ts @@ -1,9 +1,11 @@ +import { BaseLedgerEntry } from "./base_ledger_entry"; + interface DisabledValidator { FirstLedgerSequence: number PublicKey: string } -export interface NegativeUNL { +export interface NegativeUNL extends BaseLedgerEntry { LedgerEntryType: "NegativeUNL" DisabledValidators?: DisabledValidator[] ValidatorToDisable?: string diff --git a/src/models/ledger/offer.ts b/src/models/ledger/offer.ts index 77d060c74a..99e35cdf32 100644 --- a/src/models/ledger/offer.ts +++ b/src/models/ledger/offer.ts @@ -1,6 +1,7 @@ import { Amount } from "../common"; +import { BaseLedgerEntry } from "./base_ledger_entry"; -export interface Offer { +export interface Offer extends BaseLedgerEntry { LedgerEntryType: 'Offer' Flags: number Account: string diff --git a/src/models/ledger/pay_channel.ts b/src/models/ledger/pay_channel.ts index f7af9c15fa..7287d2e6c9 100644 --- a/src/models/ledger/pay_channel.ts +++ b/src/models/ledger/pay_channel.ts @@ -1,4 +1,6 @@ -export interface PayChannel { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface PayChannel extends BaseLedgerEntry { LedgerEntryType: 'PayChannel' Account: string Destination: string @@ -14,5 +16,5 @@ export interface PayChannel { CancelAfter?: number SourceTag?: number DestinationTag?: number - index: string + DestinationNode?: string } \ No newline at end of file diff --git a/src/models/ledger/ripple_state.ts b/src/models/ledger/ripple_state.ts index 77a87aca24..af0331607d 100644 --- a/src/models/ledger/ripple_state.ts +++ b/src/models/ledger/ripple_state.ts @@ -1,11 +1,12 @@ -import { Amount } from "../common"; +import { BaseLedgerEntry } from "./base_ledger_entry"; +import { IssuedCurrencyAmount } from "../common"; -export interface RippleState { +export interface RippleState extends BaseLedgerEntry { LedgerEntryType: 'RippleState' Flags: number - Balance: Amount - LowLimit: Amount - HighLimit: Amount + Balance: IssuedCurrencyAmount + LowLimit: IssuedCurrencyAmount + HighLimit: IssuedCurrencyAmount PreviousTxnID: string PreviousTxnLgrSeq: number LowNode?: string diff --git a/src/models/ledger/signer_list.ts b/src/models/ledger/signer_list.ts index 1b53f416bc..222978d40b 100644 --- a/src/models/ledger/signer_list.ts +++ b/src/models/ledger/signer_list.ts @@ -1,3 +1,5 @@ +import { BaseLedgerEntry } from "./base_ledger_entry"; + interface SignerEntry { SignerEntry: { Account: string @@ -5,7 +7,7 @@ interface SignerEntry { } } -export interface SignerList { +export interface SignerList extends BaseLedgerEntry { LedgerEntryType: 'SignerList' Flags: number PreviousTxnID: string diff --git a/src/models/ledger/ticket.ts b/src/models/ledger/ticket.ts index f648fd4e72..457aec67b5 100644 --- a/src/models/ledger/ticket.ts +++ b/src/models/ledger/ticket.ts @@ -1,4 +1,6 @@ -export interface Ticket { +import { BaseLedgerEntry } from "./base_ledger_entry"; + +export interface Ticket extends BaseLedgerEntry { LedgerEntryType: "Ticket" Account: string Flags: number From 4e2ff678cec12a8ecb9763b0d24129f944ecc0e1 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 4 Aug 2021 07:51:03 -0700 Subject: [PATCH 17/31] rename files to camelCase --- .../{account_root.ts => accountRoot.ts} | 2 +- src/models/ledger/amendments.ts | 2 +- ...ase_ledger_entry.ts => baseLedgerEntry.ts} | 0 src/models/ledger/check.ts | 2 +- .../{deposit_preauth.ts => depositPreauth.ts} | 2 +- .../{directory_node.ts => directoryNode.ts} | 2 +- src/models/ledger/escrow.ts | 2 +- .../{fee_settings.ts => feeSettings.ts} | 2 +- src/models/ledger/index.ts | 20 +++++++++---------- .../{ledger_hashes.ts => ledgerHashes.ts} | 2 +- .../{negative_unl.ts => negativeUNL.ts} | 2 +- src/models/ledger/offer.ts | 2 +- .../ledger/{pay_channel.ts => payChannel.ts} | 2 +- .../{ripple_state.ts => rippleState.ts} | 2 +- .../ledger/{signer_list.ts => signerList.ts} | 2 +- src/models/ledger/ticket.ts | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) rename src/models/ledger/{account_root.ts => accountRoot.ts} (88%) rename src/models/ledger/{base_ledger_entry.ts => baseLedgerEntry.ts} (100%) rename src/models/ledger/{deposit_preauth.ts => depositPreauth.ts} (80%) rename src/models/ledger/{directory_node.ts => directoryNode.ts} (85%) rename src/models/ledger/{fee_settings.ts => feeSettings.ts} (79%) rename src/models/ledger/{ledger_hashes.ts => ledgerHashes.ts} (75%) rename src/models/ledger/{negative_unl.ts => negativeUNL.ts} (84%) rename src/models/ledger/{pay_channel.ts => payChannel.ts} (88%) rename src/models/ledger/{ripple_state.ts => rippleState.ts} (89%) rename src/models/ledger/{signer_list.ts => signerList.ts} (86%) diff --git a/src/models/ledger/account_root.ts b/src/models/ledger/accountRoot.ts similarity index 88% rename from src/models/ledger/account_root.ts rename to src/models/ledger/accountRoot.ts index d207462b9e..8d12e3882a 100644 --- a/src/models/ledger/account_root.ts +++ b/src/models/ledger/accountRoot.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface AccountRoot extends BaseLedgerEntry{ LedgerEntryType: 'AccountRoot' diff --git a/src/models/ledger/amendments.ts b/src/models/ledger/amendments.ts index fe40d5ec92..79bd3f04d9 100644 --- a/src/models/ledger/amendments.ts +++ b/src/models/ledger/amendments.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; interface Majority { Majority: { diff --git a/src/models/ledger/base_ledger_entry.ts b/src/models/ledger/baseLedgerEntry.ts similarity index 100% rename from src/models/ledger/base_ledger_entry.ts rename to src/models/ledger/baseLedgerEntry.ts diff --git a/src/models/ledger/check.ts b/src/models/ledger/check.ts index b39b06fbfe..6c6d620915 100644 --- a/src/models/ledger/check.ts +++ b/src/models/ledger/check.ts @@ -1,5 +1,5 @@ import { Amount } from "../common"; -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface Check extends BaseLedgerEntry { LedgerEntryType: 'Check' diff --git a/src/models/ledger/deposit_preauth.ts b/src/models/ledger/depositPreauth.ts similarity index 80% rename from src/models/ledger/deposit_preauth.ts rename to src/models/ledger/depositPreauth.ts index 7f9c399318..d10ab67112 100644 --- a/src/models/ledger/deposit_preauth.ts +++ b/src/models/ledger/depositPreauth.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface DepositPreauth extends BaseLedgerEntry { LedgerEntryType: 'DepositPreauth' diff --git a/src/models/ledger/directory_node.ts b/src/models/ledger/directoryNode.ts similarity index 85% rename from src/models/ledger/directory_node.ts rename to src/models/ledger/directoryNode.ts index bed02606da..295c46e126 100644 --- a/src/models/ledger/directory_node.ts +++ b/src/models/ledger/directoryNode.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface DirectoryNode extends BaseLedgerEntry { LedgerEntryType: 'DirectoryNode' diff --git a/src/models/ledger/escrow.ts b/src/models/ledger/escrow.ts index 6e60dbceef..264da1bad5 100644 --- a/src/models/ledger/escrow.ts +++ b/src/models/ledger/escrow.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface Escrow extends BaseLedgerEntry { LedgerEntryType: 'Escrow' diff --git a/src/models/ledger/fee_settings.ts b/src/models/ledger/feeSettings.ts similarity index 79% rename from src/models/ledger/fee_settings.ts rename to src/models/ledger/feeSettings.ts index 32c56ccc1a..c00b69c465 100644 --- a/src/models/ledger/fee_settings.ts +++ b/src/models/ledger/feeSettings.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface FeeSettings extends BaseLedgerEntry { LedgerEntryType: 'FeeSettings' diff --git a/src/models/ledger/index.ts b/src/models/ledger/index.ts index a806d77a9e..4301f42bb3 100644 --- a/src/models/ledger/index.ts +++ b/src/models/ledger/index.ts @@ -1,17 +1,17 @@ -import { Ticket } from "../../transaction/ticket"; -import { AccountRoot } from "./account_root"; +import { AccountRoot } from "./accountRoot"; import { Amendments } from "./amendments"; import { Check } from "./check"; -import { DepositPreauth } from "./deposit_preauth"; -import { DirectoryNode } from "./directory_node"; +import { DepositPreauth } from "./depositPreauth"; +import { DirectoryNode } from "./directoryNode"; import { Escrow } from "./escrow"; -import { FeeSettings } from "./fee_settings"; -import { LedgerHashes } from "./ledger_hashes"; -import { NegativeUNL } from "./negative_unl"; +import { FeeSettings } from "./feeSettings"; +import { LedgerHashes } from "./ledgerHashes"; +import { NegativeUNL } from "./negativeUNL"; import { Offer } from "./offer"; -import { PayChannel } from "./pay_channel"; -import { RippleState } from "./ripple_state"; -import { SignerList } from "./signer_list"; +import { PayChannel } from "./payChannel"; +import { RippleState } from "./rippleState"; +import { SignerList } from "./signerList"; +import { Ticket } from "./ticket"; export type LedgerEntry = AccountRoot | Amendments diff --git a/src/models/ledger/ledger_hashes.ts b/src/models/ledger/ledgerHashes.ts similarity index 75% rename from src/models/ledger/ledger_hashes.ts rename to src/models/ledger/ledgerHashes.ts index de031f24e7..51292a90df 100644 --- a/src/models/ledger/ledger_hashes.ts +++ b/src/models/ledger/ledgerHashes.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface LedgerHashes extends BaseLedgerEntry { LedgerEntryType: 'LedgerHashes' diff --git a/src/models/ledger/negative_unl.ts b/src/models/ledger/negativeUNL.ts similarity index 84% rename from src/models/ledger/negative_unl.ts rename to src/models/ledger/negativeUNL.ts index aecdb9d8b4..eff7106d75 100644 --- a/src/models/ledger/negative_unl.ts +++ b/src/models/ledger/negativeUNL.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; interface DisabledValidator { FirstLedgerSequence: number diff --git a/src/models/ledger/offer.ts b/src/models/ledger/offer.ts index 99e35cdf32..138af70fd7 100644 --- a/src/models/ledger/offer.ts +++ b/src/models/ledger/offer.ts @@ -1,5 +1,5 @@ import { Amount } from "../common"; -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface Offer extends BaseLedgerEntry { LedgerEntryType: 'Offer' diff --git a/src/models/ledger/pay_channel.ts b/src/models/ledger/payChannel.ts similarity index 88% rename from src/models/ledger/pay_channel.ts rename to src/models/ledger/payChannel.ts index 7287d2e6c9..3ab97a8361 100644 --- a/src/models/ledger/pay_channel.ts +++ b/src/models/ledger/payChannel.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface PayChannel extends BaseLedgerEntry { LedgerEntryType: 'PayChannel' diff --git a/src/models/ledger/ripple_state.ts b/src/models/ledger/rippleState.ts similarity index 89% rename from src/models/ledger/ripple_state.ts rename to src/models/ledger/rippleState.ts index af0331607d..7648b3eb6e 100644 --- a/src/models/ledger/ripple_state.ts +++ b/src/models/ledger/rippleState.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; import { IssuedCurrencyAmount } from "../common"; export interface RippleState extends BaseLedgerEntry { diff --git a/src/models/ledger/signer_list.ts b/src/models/ledger/signerList.ts similarity index 86% rename from src/models/ledger/signer_list.ts rename to src/models/ledger/signerList.ts index 222978d40b..6ba41cf3a9 100644 --- a/src/models/ledger/signer_list.ts +++ b/src/models/ledger/signerList.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; interface SignerEntry { SignerEntry: { diff --git a/src/models/ledger/ticket.ts b/src/models/ledger/ticket.ts index 457aec67b5..0ae5c7549d 100644 --- a/src/models/ledger/ticket.ts +++ b/src/models/ledger/ticket.ts @@ -1,4 +1,4 @@ -import { BaseLedgerEntry } from "./base_ledger_entry"; +import { BaseLedgerEntry } from "./baseLedgerEntry"; export interface Ticket extends BaseLedgerEntry { LedgerEntryType: "Ticket" From 0e7e2677eedb7dacd37fadcf6d59f6adf597f7ab Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 15:58:45 -0400 Subject: [PATCH 18/31] account_channels --- src/models/methods/account_channels.ts | 38 ++++++++++++++++++++++++++ src/models/methods/base_method.ts | 21 ++++++++++++++ src/models/methods/index.ts | 0 3 files changed, 59 insertions(+) create mode 100644 src/models/methods/account_channels.ts create mode 100644 src/models/methods/base_method.ts create mode 100644 src/models/methods/index.ts diff --git a/src/models/methods/account_channels.ts b/src/models/methods/account_channels.ts new file mode 100644 index 0000000000..6045eace9f --- /dev/null +++ b/src/models/methods/account_channels.ts @@ -0,0 +1,38 @@ +import { BaseRequest, BaseResponse } from './base_method' + +interface Channel { + account: string + amount: string + balance: string + channel_id: string + destination_account: string + settle_delay: number + public_key?: string + public_key_hex?: string + expiration?: number + cancel_after?: number + source_tab?: number + destination_tag?: number +} + +export interface AccountChannelsRequest extends BaseRequest { + command: "account_channels" + account: string + destination_account?: string + ledger_hash?: string + ledger_index?: string | number + limit: number + marker: any +} + +export interface AccountChannelsResponse extends BaseResponse { + result: { + account: string + channels: Channel[] + ledger_hash: string + ledger_index: number + validated?: boolean + limit?: number + marker?: any + } +} diff --git a/src/models/methods/base_method.ts b/src/models/methods/base_method.ts new file mode 100644 index 0000000000..8c20e368dd --- /dev/null +++ b/src/models/methods/base_method.ts @@ -0,0 +1,21 @@ +export interface BaseRequest { + id: number | string + command: string + api_version?: number +} + +interface Warning { + id: number + message: string + details?: {[key: string]: string} +} + +export interface BaseResponse { + id: number | string + status: string + type: string + result: any + warning?: "load" + warnings?: Warning[] + forwarded?: boolean +} \ No newline at end of file diff --git a/src/models/methods/index.ts b/src/models/methods/index.ts new file mode 100644 index 0000000000..e69de29bb2 From 804898f26d2d9d4e88a73a68305d179de6c209cb Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:10:17 -0400 Subject: [PATCH 19/31] account_currencies --- src/models/methods/account_currencies.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/models/methods/account_currencies.ts diff --git a/src/models/methods/account_currencies.ts b/src/models/methods/account_currencies.ts new file mode 100644 index 0000000000..1adf8a1bb6 --- /dev/null +++ b/src/models/methods/account_currencies.ts @@ -0,0 +1,20 @@ +import { BaseRequest, BaseResponse } from './base_method' + +export interface AccountCurrenciesRequest extends BaseRequest { + command: "account_currencies" + account: string + destination_account?: string + ledger_hash?: string + ledger_index?: string | number + strict?: boolean +} + +export interface AccountCurrenciesResponse extends BaseResponse { + result: { + ledger_hash?: string + ledger_index: number + receive_currencies: string[] + send_currencies: string[] + validated: boolean + } +} From 9ba5ea182f4801ffbe832812fc166ece62814011 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:24:36 -0400 Subject: [PATCH 20/31] account_info --- src/models/common/index.ts | 2 +- src/models/methods/account_info.ts | 41 ++++++++++++++++++++++++++++++ src/models/methods/base_method.ts | 3 +++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/models/methods/account_info.ts diff --git a/src/models/common/index.ts b/src/models/common/index.ts index 66ad1f335b..27fef92e94 100644 --- a/src/models/common/index.ts +++ b/src/models/common/index.ts @@ -17,4 +17,4 @@ export interface IssuedCurrencyAmount extends IssuedCurrency { value: string } -export type Amount = IssuedCurrencyAmount | string \ No newline at end of file +export type Amount = IssuedCurrencyAmount | string diff --git a/src/models/methods/account_info.ts b/src/models/methods/account_info.ts new file mode 100644 index 0000000000..d577285264 --- /dev/null +++ b/src/models/methods/account_info.ts @@ -0,0 +1,41 @@ +import { BaseRequest, BaseResponse } from './base_method' +import { LedgerIndex } from "../common" +import { AccountRoot, SignerList } from "../ledger" + +export interface AccountCurrenciesRequest extends BaseRequest { + command: "account_info" + account: string + ledger_hash?: string + ledger_index?: LedgerIndex + queue?: boolean + signer_lists?: boolean + strict?: boolean +} + +export interface QueueTransaction { + auth_change: boolean + fee: string + fee_level: string + max_spend_drops: string + seq: number +} + +export interface QueueData { + txn_count: number + auth_change_queued?: boolean + lowest_sequence?: number + highest_sequence?: number + max_spend_drops_total?: string + transactions?: QueueTransaction[] +} + +export interface AccountCurrenciesResponse extends BaseResponse { + result: { + account_data: AccountRoot + signer_lists?: SignerList[] + ledger_current_index?: number + ledger_index?: number + queue_data?: QueueData + validated?: boolean + } +} \ No newline at end of file diff --git a/src/models/methods/base_method.ts b/src/models/methods/base_method.ts index 8c20e368dd..43ccf9398f 100644 --- a/src/models/methods/base_method.ts +++ b/src/models/methods/base_method.ts @@ -18,4 +18,7 @@ export interface BaseResponse { warning?: "load" warnings?: Warning[] forwarded?: boolean + error?: string + request?: any + api_version?: number } \ No newline at end of file From d1e29a8a0ef7fad43ea879ded9edc549a0d816c2 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 16:30:44 -0400 Subject: [PATCH 21/31] account_lines --- src/models/methods/account_channels.ts | 3 +- src/models/methods/account_currencies.ts | 3 +- src/models/methods/account_lines.ts | 39 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/models/methods/account_lines.ts diff --git a/src/models/methods/account_channels.ts b/src/models/methods/account_channels.ts index 6045eace9f..4226c2debf 100644 --- a/src/models/methods/account_channels.ts +++ b/src/models/methods/account_channels.ts @@ -1,4 +1,5 @@ import { BaseRequest, BaseResponse } from './base_method' +import { LedgerIndex } from "../common" interface Channel { account: string @@ -20,7 +21,7 @@ export interface AccountChannelsRequest extends BaseRequest { account: string destination_account?: string ledger_hash?: string - ledger_index?: string | number + ledger_index?: LedgerIndex limit: number marker: any } diff --git a/src/models/methods/account_currencies.ts b/src/models/methods/account_currencies.ts index 1adf8a1bb6..e0d51b44e4 100644 --- a/src/models/methods/account_currencies.ts +++ b/src/models/methods/account_currencies.ts @@ -1,11 +1,12 @@ import { BaseRequest, BaseResponse } from './base_method' +import { LedgerIndex } from "../common" export interface AccountCurrenciesRequest extends BaseRequest { command: "account_currencies" account: string destination_account?: string ledger_hash?: string - ledger_index?: string | number + ledger_index?: LedgerIndex strict?: boolean } diff --git a/src/models/methods/account_lines.ts b/src/models/methods/account_lines.ts new file mode 100644 index 0000000000..5a4c26b9f7 --- /dev/null +++ b/src/models/methods/account_lines.ts @@ -0,0 +1,39 @@ +import { BaseRequest, BaseResponse } from './base_method' +import { LedgerIndex } from "../common" + +interface Trustline { + account: string + balance: string + currency: string + limit: string + limit_peer: string + quality_in: number + quality_out: number + no_ripple?: boolean + no_ripple_peer?: boolean + authorized?: boolean + peer_authorized?: boolean + freeze?: boolean + freeze_peer?: boolean +} + +export interface AccountLinesRequest extends BaseRequest { + command: "account_lines" + account: string + ledger_hash?: string + ledger_index?: LedgerIndex + peer?: string + limit?: number + marker?: any +} + +export interface AccountLinesResponse extends BaseResponse { + result: { + account: string + lines: Trustline[] + ledger_current_index?: number + ledger_index?: number + ledger_hash?: string + marker?: any + } +} From 66b72f700ed48bc5bec2f4354db92cec4a3f604c Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:30:58 -0400 Subject: [PATCH 22/31] account_objects --- src/models/ledger/index.ts | 2 +- src/models/methods/account_objects.ts | 29 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/models/methods/account_objects.ts diff --git a/src/models/ledger/index.ts b/src/models/ledger/index.ts index 4301f42bb3..4be46fa27a 100644 --- a/src/models/ledger/index.ts +++ b/src/models/ledger/index.ts @@ -43,4 +43,4 @@ export { RippleState, SignerList, Ticket -} \ No newline at end of file +} diff --git a/src/models/methods/account_objects.ts b/src/models/methods/account_objects.ts new file mode 100644 index 0000000000..2a055b419c --- /dev/null +++ b/src/models/methods/account_objects.ts @@ -0,0 +1,29 @@ +import { BaseRequest, BaseResponse } from './base_method' +import { AccountObjectType, LedgerIndex } from "../common" +import { Check, DepositPreauth, Escrow, Offer, PayChannel, RippleState, SignerList, Ticket } from "../ledger" + +export interface AccountObjectsRequest extends BaseRequest { + command: "account_objects" + account: string + type?: AccountObjectType + deletion_blockers_only?: boolean + ledger_hash?: string + ledger_index?: LedgerIndex + limit?: number + marker?: any +} + +type AccountObject = Check | DepositPreauth | Escrow | Offer | PayChannel | SignerList | Ticket | RippleState + +export interface AccountObjectsResponse extends BaseResponse { + result: { + account: string + account_objects: AccountObject[] + ledger_hash?: string + ledger_index?: number + ledger_current_index?: number + limit?: number + marker?: string + validated?: boolean + } +} \ No newline at end of file From 636ec0d28257b2e4cb3feb8ceb39bb924a7b3dbb Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:33:57 -0400 Subject: [PATCH 23/31] account_offers --- src/models/methods/account_offers.ts | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/models/methods/account_offers.ts diff --git a/src/models/methods/account_offers.ts b/src/models/methods/account_offers.ts new file mode 100644 index 0000000000..a938f138b1 --- /dev/null +++ b/src/models/methods/account_offers.ts @@ -0,0 +1,32 @@ +import { Amount, LedgerIndex } from "../common"; +import { BaseRequest, BaseResponse } from "./base_method"; + +export interface AccountOffersRequest extends BaseRequest { + command: "account_offers" + account: string + ledger_hash?: string + ledger_index?: LedgerIndex + limit?: number + marker?: any + strict?: boolean +} + +export interface AccountOffer { + flags: number + seq: number + taker_gets: Amount + taker_pays: Amount + quality: string + expiration?: number +} + +export interface AccountOffersResponse extends BaseResponse { + result: { + account: string + offers?: AccountOffer[] + ledger_current_index?: number + ledger_index?: number + ledger_hash?: string + marker?: any + } +} From 945bfe4ed6209756620aecb6f64975269757ae51 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:48:51 -0400 Subject: [PATCH 24/31] account_tx --- src/models/common/transaction.ts | 38 ++++++++++++++++++++++++++++++++ src/models/methods/account_tx.ts | 36 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/models/common/transaction.ts create mode 100644 src/models/methods/account_tx.ts diff --git a/src/models/common/transaction.ts b/src/models/common/transaction.ts new file mode 100644 index 0000000000..69e2550d97 --- /dev/null +++ b/src/models/common/transaction.ts @@ -0,0 +1,38 @@ +import { Amount } from "."; + +interface CreatedNode { + CreatedNode: { + LedgerEntryType: string + LedgerIndex: string + NewFields: {[field: string]: any} + } +} + +interface ModifiedNode { + ModifiedNode: { + LedgerEntryType: string + LedgerIndex: string + FinalFields: {[field: string]: any} + PreviousFields: {[field: string]: any} + PreviousTxnID?: string + PreviouTxnLgrSeq?: number + } +} + +interface DeletedNode { + DeletedNode: { + LedgerEntryType: string + LedgerIndex: string + FinalFields: {[field: string]: any} + } +} + +type Node = CreatedNode | ModifiedNode | DeletedNode + +export interface TransactionMetadata { + AffectedNodes: Node[] + DeliveredAmount?: Amount + delivered_amount?: Amount + TransactionIndex: number + TransactionResult: string +} \ No newline at end of file diff --git a/src/models/methods/account_tx.ts b/src/models/methods/account_tx.ts new file mode 100644 index 0000000000..b7cefea905 --- /dev/null +++ b/src/models/methods/account_tx.ts @@ -0,0 +1,36 @@ +import { LedgerIndex } from "../common"; +import { TransactionMetadata } from "../common/transaction"; +import { BaseRequest, BaseResponse } from "./base_method"; + +export interface AccountTxRequest extends BaseRequest { + command: "account_tx" + account: string + ledger_index_min?: number + ledger_index_max?: number + ledger_hash?: string + ledger_index?: LedgerIndex + binary?: boolean + forward?: boolean + limit?: number + marker?: any +} + +interface AccountTransaction { + ledger_index: number + meta: string | TransactionMetadata + tx?: any // TODO: replace when transaction objects are done + tx_blob?: string + validated: boolean +} + +export interface AccountTxResponse extends BaseResponse { + result: { + account: string + ledger_index_min: number + ledger_index_max: number + limit: number + marker?: any + transactions: AccountTransaction[] + validated?: boolean + } +} From ab0643fe575ac1a94a1be1218c64bdcfb6306585 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:51:19 -0400 Subject: [PATCH 25/31] gateway_balances --- src/models/common/index.ts | 5 +++++ src/models/methods/gateway_balances.ts | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/models/methods/gateway_balances.ts diff --git a/src/models/common/index.ts b/src/models/common/index.ts index 27fef92e94..51b2827298 100644 --- a/src/models/common/index.ts +++ b/src/models/common/index.ts @@ -11,6 +11,11 @@ export interface IssuedCurrency { issuer: string } +export interface Balance { + currency: string + value: string +} + export type Currency = IssuedCurrency | XRP export interface IssuedCurrencyAmount extends IssuedCurrency { diff --git a/src/models/methods/gateway_balances.ts b/src/models/methods/gateway_balances.ts new file mode 100644 index 0000000000..15c50c2cd9 --- /dev/null +++ b/src/models/methods/gateway_balances.ts @@ -0,0 +1,21 @@ +import { Balance, LedgerIndex } from '../common' +import { BaseRequest, BaseResponse } from './base_method'; + +export interface GatewayBalancesRequest extends BaseRequest { + command: "gateway_balances" + account: string + strict?: boolean + hotwallet: string | string[] + ledger_hash?: string + ledger_index?: LedgerIndex +} + +export interface GatewayBalancesResponse extends BaseResponse { + account: string + obligations?: {[currency: string]: string} + balances?: {[address: string]: Balance[]} + assets?: {[address: string]: Balance[]} + ledger_hash?: string + ledger_current_index?: number + ledger_index?: number +} From 0100700f59fb877140dab3c375e8dd3cdedb483a Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 2 Aug 2021 17:54:28 -0400 Subject: [PATCH 26/31] no ripple check --- src/models/methods/noripple_check.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/models/methods/noripple_check.ts diff --git a/src/models/methods/noripple_check.ts b/src/models/methods/noripple_check.ts new file mode 100644 index 0000000000..0263b9f31d --- /dev/null +++ b/src/models/methods/noripple_check.ts @@ -0,0 +1,17 @@ +import { LedgerIndex } from '../common' +import { BaseRequest, BaseResponse } from './base_method'; + +export interface NoRippleCheckRequest extends BaseRequest { + command: "noripple_check" + account: string + role: "gateway" | "user" + transactions?: boolean + ledger_hash?: string + ledger_index?: LedgerIndex +} + +export interface NoRippleCheckResponse extends BaseResponse { + ledger_current_index: number + problems: string[] + transactions: any[] // TODO: fix once transaction objects are implemented +} From 8549ae0c3ea550df4d142148abe5e27701f47748 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 4 Aug 2021 07:56:59 -0700 Subject: [PATCH 27/31] respond to comments --- src/models/common/index.ts | 5 ----- .../methods/{account_channels.ts => accountChannels.ts} | 2 +- .../{account_currencies.ts => accountCurrencies.ts} | 2 +- src/models/methods/{account_info.ts => accountInfo.ts} | 2 +- src/models/methods/{account_lines.ts => accountLines.ts} | 2 +- .../methods/{account_objects.ts => accountObjects.ts} | 2 +- .../methods/{account_offers.ts => accountOffers.ts} | 4 ++-- src/models/methods/{account_tx.ts => accountTx.ts} | 2 +- src/models/methods/{base_method.ts => baseMethod.ts} | 0 .../methods/{gateway_balances.ts => gatewayBalances.ts} | 9 +++++++-- .../methods/{noripple_check.ts => norippleCheck.ts} | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) rename src/models/methods/{account_channels.ts => accountChannels.ts} (93%) rename src/models/methods/{account_currencies.ts => accountCurrencies.ts} (89%) rename src/models/methods/{account_info.ts => accountInfo.ts} (94%) rename src/models/methods/{account_lines.ts => accountLines.ts} (93%) rename src/models/methods/{account_objects.ts => accountObjects.ts} (93%) rename src/models/methods/{account_offers.ts => accountOffers.ts} (86%) rename src/models/methods/{account_tx.ts => accountTx.ts} (93%) rename src/models/methods/{base_method.ts => baseMethod.ts} (100%) rename src/models/methods/{gateway_balances.ts => gatewayBalances.ts} (76%) rename src/models/methods/{noripple_check.ts => norippleCheck.ts} (88%) diff --git a/src/models/common/index.ts b/src/models/common/index.ts index 51b2827298..27fef92e94 100644 --- a/src/models/common/index.ts +++ b/src/models/common/index.ts @@ -11,11 +11,6 @@ export interface IssuedCurrency { issuer: string } -export interface Balance { - currency: string - value: string -} - export type Currency = IssuedCurrency | XRP export interface IssuedCurrencyAmount extends IssuedCurrency { diff --git a/src/models/methods/account_channels.ts b/src/models/methods/accountChannels.ts similarity index 93% rename from src/models/methods/account_channels.ts rename to src/models/methods/accountChannels.ts index 4226c2debf..2a96589eb2 100644 --- a/src/models/methods/account_channels.ts +++ b/src/models/methods/accountChannels.ts @@ -1,4 +1,4 @@ -import { BaseRequest, BaseResponse } from './base_method' +import { BaseRequest, BaseResponse } from './baseMethod' import { LedgerIndex } from "../common" interface Channel { diff --git a/src/models/methods/account_currencies.ts b/src/models/methods/accountCurrencies.ts similarity index 89% rename from src/models/methods/account_currencies.ts rename to src/models/methods/accountCurrencies.ts index e0d51b44e4..1151cad4e0 100644 --- a/src/models/methods/account_currencies.ts +++ b/src/models/methods/accountCurrencies.ts @@ -1,4 +1,4 @@ -import { BaseRequest, BaseResponse } from './base_method' +import { BaseRequest, BaseResponse } from './baseMethod' import { LedgerIndex } from "../common" export interface AccountCurrenciesRequest extends BaseRequest { diff --git a/src/models/methods/account_info.ts b/src/models/methods/accountInfo.ts similarity index 94% rename from src/models/methods/account_info.ts rename to src/models/methods/accountInfo.ts index d577285264..0a5e2d4135 100644 --- a/src/models/methods/account_info.ts +++ b/src/models/methods/accountInfo.ts @@ -1,4 +1,4 @@ -import { BaseRequest, BaseResponse } from './base_method' +import { BaseRequest, BaseResponse } from './baseMethod' import { LedgerIndex } from "../common" import { AccountRoot, SignerList } from "../ledger" diff --git a/src/models/methods/account_lines.ts b/src/models/methods/accountLines.ts similarity index 93% rename from src/models/methods/account_lines.ts rename to src/models/methods/accountLines.ts index 5a4c26b9f7..2b15614f0c 100644 --- a/src/models/methods/account_lines.ts +++ b/src/models/methods/accountLines.ts @@ -1,4 +1,4 @@ -import { BaseRequest, BaseResponse } from './base_method' +import { BaseRequest, BaseResponse } from './baseMethod' import { LedgerIndex } from "../common" interface Trustline { diff --git a/src/models/methods/account_objects.ts b/src/models/methods/accountObjects.ts similarity index 93% rename from src/models/methods/account_objects.ts rename to src/models/methods/accountObjects.ts index 2a055b419c..80eb546bc0 100644 --- a/src/models/methods/account_objects.ts +++ b/src/models/methods/accountObjects.ts @@ -1,4 +1,4 @@ -import { BaseRequest, BaseResponse } from './base_method' +import { BaseRequest, BaseResponse } from './baseMethod' import { AccountObjectType, LedgerIndex } from "../common" import { Check, DepositPreauth, Escrow, Offer, PayChannel, RippleState, SignerList, Ticket } from "../ledger" diff --git a/src/models/methods/account_offers.ts b/src/models/methods/accountOffers.ts similarity index 86% rename from src/models/methods/account_offers.ts rename to src/models/methods/accountOffers.ts index a938f138b1..2e89be3740 100644 --- a/src/models/methods/account_offers.ts +++ b/src/models/methods/accountOffers.ts @@ -1,5 +1,5 @@ import { Amount, LedgerIndex } from "../common"; -import { BaseRequest, BaseResponse } from "./base_method"; +import { BaseRequest, BaseResponse } from "./baseMethod"; export interface AccountOffersRequest extends BaseRequest { command: "account_offers" @@ -11,7 +11,7 @@ export interface AccountOffersRequest extends BaseRequest { strict?: boolean } -export interface AccountOffer { +interface AccountOffer { flags: number seq: number taker_gets: Amount diff --git a/src/models/methods/account_tx.ts b/src/models/methods/accountTx.ts similarity index 93% rename from src/models/methods/account_tx.ts rename to src/models/methods/accountTx.ts index b7cefea905..c05798fb93 100644 --- a/src/models/methods/account_tx.ts +++ b/src/models/methods/accountTx.ts @@ -1,6 +1,6 @@ import { LedgerIndex } from "../common"; import { TransactionMetadata } from "../common/transaction"; -import { BaseRequest, BaseResponse } from "./base_method"; +import { BaseRequest, BaseResponse } from "./baseMethod"; export interface AccountTxRequest extends BaseRequest { command: "account_tx" diff --git a/src/models/methods/base_method.ts b/src/models/methods/baseMethod.ts similarity index 100% rename from src/models/methods/base_method.ts rename to src/models/methods/baseMethod.ts diff --git a/src/models/methods/gateway_balances.ts b/src/models/methods/gatewayBalances.ts similarity index 76% rename from src/models/methods/gateway_balances.ts rename to src/models/methods/gatewayBalances.ts index 15c50c2cd9..8f8a185079 100644 --- a/src/models/methods/gateway_balances.ts +++ b/src/models/methods/gatewayBalances.ts @@ -1,5 +1,5 @@ -import { Balance, LedgerIndex } from '../common' -import { BaseRequest, BaseResponse } from './base_method'; +import { LedgerIndex } from '../common' +import { BaseRequest, BaseResponse } from './baseMethod'; export interface GatewayBalancesRequest extends BaseRequest { command: "gateway_balances" @@ -10,6 +10,11 @@ export interface GatewayBalancesRequest extends BaseRequest { ledger_index?: LedgerIndex } +interface Balance { + currency: string + value: string +} + export interface GatewayBalancesResponse extends BaseResponse { account: string obligations?: {[currency: string]: string} diff --git a/src/models/methods/noripple_check.ts b/src/models/methods/norippleCheck.ts similarity index 88% rename from src/models/methods/noripple_check.ts rename to src/models/methods/norippleCheck.ts index 0263b9f31d..63ef9f0f6b 100644 --- a/src/models/methods/noripple_check.ts +++ b/src/models/methods/norippleCheck.ts @@ -1,5 +1,5 @@ import { LedgerIndex } from '../common' -import { BaseRequest, BaseResponse } from './base_method'; +import { BaseRequest, BaseResponse } from './baseMethod'; export interface NoRippleCheckRequest extends BaseRequest { command: "noripple_check" From 31c306687ba8b58892f285eb2193766052fb5f71 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 4 Aug 2021 08:30:56 -0700 Subject: [PATCH 28/31] export methods --- src/models/methods/accountInfo.ts | 4 +-- src/models/methods/index.ts | 52 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/models/methods/accountInfo.ts b/src/models/methods/accountInfo.ts index 0a5e2d4135..188bb2c0cc 100644 --- a/src/models/methods/accountInfo.ts +++ b/src/models/methods/accountInfo.ts @@ -2,7 +2,7 @@ import { BaseRequest, BaseResponse } from './baseMethod' import { LedgerIndex } from "../common" import { AccountRoot, SignerList } from "../ledger" -export interface AccountCurrenciesRequest extends BaseRequest { +export interface AccountInfoRequest extends BaseRequest { command: "account_info" account: string ledger_hash?: string @@ -29,7 +29,7 @@ export interface QueueData { transactions?: QueueTransaction[] } -export interface AccountCurrenciesResponse extends BaseResponse { +export interface AccountInfoResponse extends BaseResponse { result: { account_data: AccountRoot signer_lists?: SignerList[] diff --git a/src/models/methods/index.ts b/src/models/methods/index.ts index e69de29bb2..4914713dff 100644 --- a/src/models/methods/index.ts +++ b/src/models/methods/index.ts @@ -0,0 +1,52 @@ +import { AccountChannelsRequest, AccountChannelsResponse } from "./accountChannels"; +import { AccountCurrenciesRequest, AccountCurrenciesResponse } from "./accountCurrencies"; +import { AccountInfoRequest, AccountInfoResponse } from "./accountInfo"; +import { AccountLinesRequest, AccountLinesResponse } from "./accountLines"; +import { AccountObjectsRequest, AccountObjectsResponse } from "./accountObjects"; +import { AccountOffersRequest, AccountOffersResponse } from "./accountOffers"; +import { AccountTxRequest, AccountTxResponse } from "./accountTx"; +import { GatewayBalancesRequest, GatewayBalancesResponse } from "./gatewayBalances"; +import { NoRippleCheckRequest, NoRippleCheckResponse } from "./norippleCheck"; + +type Request = AccountChannelsRequest + | AccountCurrenciesRequest + | AccountInfoRequest + | AccountLinesRequest + | AccountObjectsRequest + | AccountOffersRequest + | AccountTxRequest + | GatewayBalancesRequest + | NoRippleCheckRequest + +type Response = AccountChannelsResponse + | AccountCurrenciesResponse + | AccountInfoResponse + | AccountLinesResponse + | AccountObjectsResponse + | AccountOffersResponse + | AccountTxResponse + | GatewayBalancesResponse + | NoRippleCheckResponse + +export { + Request, + Response, + AccountChannelsRequest, + AccountChannelsResponse, + AccountCurrenciesRequest, + AccountCurrenciesResponse, + AccountInfoRequest, + AccountInfoResponse, + AccountLinesRequest, + AccountLinesResponse, + AccountObjectsRequest, + AccountObjectsResponse, + AccountOffersRequest, + AccountOffersResponse, + AccountTxRequest, + AccountTxResponse, + GatewayBalancesRequest, + GatewayBalancesResponse, + NoRippleCheckRequest, + NoRippleCheckResponse +} \ No newline at end of file From 540068f5c4db73e45662723215dbdafb5d8896fe Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 4 Aug 2021 12:24:39 -0700 Subject: [PATCH 29/31] fix typos --- src/models/methods/gatewayBalances.ts | 16 +++++++++------- src/models/methods/norippleCheck.ts | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/models/methods/gatewayBalances.ts b/src/models/methods/gatewayBalances.ts index 8f8a185079..b9da2d2dd3 100644 --- a/src/models/methods/gatewayBalances.ts +++ b/src/models/methods/gatewayBalances.ts @@ -16,11 +16,13 @@ interface Balance { } export interface GatewayBalancesResponse extends BaseResponse { - account: string - obligations?: {[currency: string]: string} - balances?: {[address: string]: Balance[]} - assets?: {[address: string]: Balance[]} - ledger_hash?: string - ledger_current_index?: number - ledger_index?: number + result: { + account: string + obligations?: {[currency: string]: string} + balances?: {[address: string]: Balance[]} + assets?: {[address: string]: Balance[]} + ledger_hash?: string + ledger_current_index?: number + ledger_index?: number + } } diff --git a/src/models/methods/norippleCheck.ts b/src/models/methods/norippleCheck.ts index 63ef9f0f6b..75d28ceed5 100644 --- a/src/models/methods/norippleCheck.ts +++ b/src/models/methods/norippleCheck.ts @@ -11,7 +11,9 @@ export interface NoRippleCheckRequest extends BaseRequest { } export interface NoRippleCheckResponse extends BaseResponse { - ledger_current_index: number - problems: string[] - transactions: any[] // TODO: fix once transaction objects are implemented + result: { + ledger_current_index: number + problems: string[] + transactions: any[] // TODO: fix once transaction objects are implemented + } } From c7261dc2d2f1d85815e9ae41cc9b217a3285dc20 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 9 Aug 2021 09:35:46 -0700 Subject: [PATCH 30/31] respond to comments --- src/models/methods/baseMethod.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/methods/baseMethod.ts b/src/models/methods/baseMethod.ts index 43ccf9398f..29becbe341 100644 --- a/src/models/methods/baseMethod.ts +++ b/src/models/methods/baseMethod.ts @@ -1,3 +1,5 @@ +import { Response } from "."; + export interface BaseRequest { id: number | string command: string @@ -19,6 +21,6 @@ export interface BaseResponse { warnings?: Warning[] forwarded?: boolean error?: string - request?: any + request?: Response api_version?: number } \ No newline at end of file From 053339f9b4ec4b3295dc42d0c6cd7641b162080d Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 9 Aug 2021 14:36:13 -0700 Subject: [PATCH 31/31] edit BaseResponse to be more specific --- src/models/methods/baseMethod.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/methods/baseMethod.ts b/src/models/methods/baseMethod.ts index 29becbe341..917625dcf2 100644 --- a/src/models/methods/baseMethod.ts +++ b/src/models/methods/baseMethod.ts @@ -14,8 +14,8 @@ interface Warning { export interface BaseResponse { id: number | string - status: string - type: string + status: "success" | "error" | string + type: "response" | string result: any warning?: "load" warnings?: Warning[]