Skip to content

Commit

Permalink
feat: add support for the fixPreviousTxnID amendment (#2720)
Browse files Browse the repository at this point in the history
* add support for fixPreviousTxnID

* update history
  • Loading branch information
mvadari authored Jul 8, 2024
1 parent 7e733c4 commit 1460cf5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 19 deletions.
1 change: 1 addition & 0 deletions packages/xrpl/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr

### Added
* Add `nfts_by_issuer` clio-only API definition
* Support for the `fixPreviousTxnID` amendment.

## 3.1.0 (2024-06-03)

Expand Down
4 changes: 2 additions & 2 deletions packages/xrpl/src/models/ledger/AMM.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AuthAccount, Currency, IssuedCurrencyAmount } from '../common'

import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'

export interface VoteSlot {
VoteEntry: {
Expand All @@ -15,7 +15,7 @@ export interface VoteSlot {
*
* @category Ledger Entries
*/
export default interface AMM extends BaseLedgerEntry, MissingPreviousTxnID {
export default interface AMM extends BaseLedgerEntry, HasOptionalPreviousTxnID {
LedgerEntryType: 'AMM'
/**
* The address of the special account that holds this AMM's assets.
Expand Down
4 changes: 2 additions & 2 deletions packages/xrpl/src/models/ledger/Amendments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'

/**
* The unique id for the Amendments object https://xrpl.org/amendments-object.html#amendments-id-format
Expand Down Expand Up @@ -26,7 +26,7 @@ export interface Majority {
*/
export default interface Amendments
extends BaseLedgerEntry,
MissingPreviousTxnID {
HasOptionalPreviousTxnID {
LedgerEntryType: 'Amendments'
/**
* Array of 256-bit amendment IDs for all currently-enabled amendments. If
Expand Down
14 changes: 9 additions & 5 deletions packages/xrpl/src/models/ledger/BaseLedgerEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ export interface HasPreviousTxnID {
PreviousTxnLgrSeq: number
}

export interface MissingPreviousTxnID {
export interface HasOptionalPreviousTxnID {
/**
* This field is missing on this object but is present on most other returned objects.
* The identifying hash of the transaction that most recently modified this
* object. This field was added in the `fixPreviousTxnID` amendment, so it
* may not be present in every object.
*/
PreviousTxnID: never
PreviousTxnID?: string
/**
* This field is missing on this object but is present on most other returned objects.
* The index of the ledger that contains the transaction that most recently
* modified this object. This field was added in the `fixPreviousTxnID`
* amendment, so it may not be present in every object.
*/
PreviousTxnLgrSeq: never
PreviousTxnLgrSeq?: number
}
4 changes: 2 additions & 2 deletions packages/xrpl/src/models/ledger/DirectoryNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'

/**
* The DirectoryNode object type provides a list of links to other objects in
Expand All @@ -8,7 +8,7 @@ import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
*/
export default interface DirectoryNode
extends BaseLedgerEntry,
MissingPreviousTxnID {
HasOptionalPreviousTxnID {
LedgerEntryType: 'DirectoryNode'
/**
* A bit-map of boolean flags enabled for this directory. Currently, the
Expand Down
6 changes: 4 additions & 2 deletions packages/xrpl/src/models/ledger/FeeSettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'

/**
* The unique id for the FeeSettings object https://xrpl.org/feesettings.html#feesettings-id-format
Expand Down Expand Up @@ -26,7 +26,9 @@ export interface FeeSettingsPostAmendmentFields {
ReserveIncrementDrops: string
}

export interface FeeSettingsBase extends BaseLedgerEntry, MissingPreviousTxnID {
export interface FeeSettingsBase
extends BaseLedgerEntry,
HasOptionalPreviousTxnID {
LedgerEntryType: 'FeeSettings'
/**
* A bit-map of boolean flags for this object. No flags are defined for this type.
Expand Down
6 changes: 2 additions & 4 deletions packages/xrpl/src/models/ledger/LedgerHashes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
import { BaseLedgerEntry } from './BaseLedgerEntry'

/**
* The LedgerHashes objects exist to make it possible to look up a previous
Expand All @@ -7,9 +7,7 @@ import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
*
* @category Ledger Entries
*/
export default interface LedgerHashes
extends BaseLedgerEntry,
MissingPreviousTxnID {
export default interface LedgerHashes extends BaseLedgerEntry {
LedgerEntryType: 'LedgerHashes'
/** The Ledger Index of the last entry in this object's Hashes array. */
LastLedgerSequence?: number
Expand Down
4 changes: 2 additions & 2 deletions packages/xrpl/src/models/ledger/NegativeUNL.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'

/**
* The unique id for the nUNL object https://xrpl.org/negativeunl.html#negativeunl-id-format
Expand All @@ -14,7 +14,7 @@ export const NEGATIVE_UNL_ID =
*/
export default interface NegativeUNL
extends BaseLedgerEntry,
MissingPreviousTxnID {
HasOptionalPreviousTxnID {
LedgerEntryType: 'NegativeUNL'
/**
* A list of trusted validators that are currently disabled.
Expand Down

0 comments on commit 1460cf5

Please sign in to comment.