Skip to content

Commit

Permalink
feat(types): Update FeeSettings and add id
Browse files Browse the repository at this point in the history
Adds the new fields for `XRPFees` amendment and id for the `FeeSettings`
singleton ledger entry.

Closes #2219
  • Loading branch information
ckniffen committed Jun 29, 2023
1 parent 70500dc commit 0ef72f6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
52 changes: 37 additions & 15 deletions packages/xrpl/src/models/ledger/FeeSettings.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,49 @@
import BaseLedgerEntry from './BaseLedgerEntry'

/**
* The FeeSettings object type contains the current base transaction cost and
* reserve amounts as determined by fee voting.
*
* @category Ledger Entries
*/
export default interface FeeSettings extends BaseLedgerEntry {
LedgerEntryType: 'FeeSettings'
/**
* The transaction cost of the "reference transaction" in drops of XRP as
* hexadecimal.
*/
export const FEE_SETTINGS_ID =
'4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A651'

export interface FeeSettingsPreAmendmentFields {
/** The transaction cost of the "reference transaction" in drops of XRP as hexadecimal. */
BaseFee: string
/** The BaseFee translated into "fee units". */
ReferenceFeeUnits: number
/** The base reserve for an account in the XRP Ledger, as drops of XRP. */
ReserveBase: number
/** The incremental owner reserve for owning objects, as drops of XRP. */
ReserveIncrement: number
}

export interface FeeSettingsPostAmendmentFields {
/** The transaction cost of the "reference transaction" in drops of XRP as hexadecimal. */
BaseFeeDrops: string
/** The base reserve for an account in the XRP Ledger, as drops of XRP. */
ReserveBaseDrops: string
/** The incremental owner reserve for owning objects, as drops of XRP. */
ReserveIncrementDrops: string
}

export interface FeeSettingsBase extends BaseLedgerEntry {
LedgerEntryType: 'FeeSettings'
/**
* A bit-map of boolean flags for this object. No flags are defined for this
* type.
* A bit-map of boolean flags for this object. No flags are defined for this type.
*/
Flags: number
Flags: 0
}

/**
* The FeeSettings object type contains the current base transaction cost and
* reserve amounts as determined by fee voting.
*
* The fields will be based on the status of the `XRPFees` amendment.
* - Before: {@link FeeSettingsPreAmendmentFields}
* - After: {@link FeeSettingsPostAmendmentFields}
*
* @interface
*
* @category Ledger Entries
*/
type FeeSettings = FeeSettingsBase &
(FeeSettingsPreAmendmentFields | FeeSettingsPostAmendmentFields)

export default FeeSettings
9 changes: 8 additions & 1 deletion packages/xrpl/src/models/ledger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import Check from './Check'
import DepositPreauth from './DepositPreauth'
import DirectoryNode from './DirectoryNode'
import Escrow from './Escrow'
import FeeSettings from './FeeSettings'
import FeeSettings, {
FeeSettingsPreAmendmentFields,
FeeSettingsPostAmendmentFields,
FEE_SETTINGS_ID,
} from './FeeSettings'
import Ledger from './Ledger'
import LedgerEntry from './LedgerEntry'
import LedgerHashes from './LedgerHashes'
Expand All @@ -29,7 +33,10 @@ export {
DepositPreauth,
DirectoryNode,
Escrow,
FEE_SETTINGS_ID,
FeeSettings,
FeeSettingsPreAmendmentFields,
FeeSettingsPostAmendmentFields,
Ledger,
LedgerEntry,
LedgerHashes,
Expand Down

0 comments on commit 0ef72f6

Please sign in to comment.