feat(types): Add pseudo transactions (#2351)

Add types for `EnableAmendment`, `SetFee`, and `UNLModify` transactions.
This commit is contained in:
Caleb Kniffen
2023-06-29 14:20:36 -05:00
committed by GitHub
parent fd0b2275c1
commit 70500dcc15
6 changed files with 102 additions and 1 deletions

View File

@@ -59,6 +59,9 @@ module.exports = {
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'jsdoc/check-examples': 'off',
// We want to use certain fields like "@interface" to make join types treated as interfaces.
'jsdoc/check-tag-names': 'off',
'jsdoc/require-hyphen-before-param-description': 'off',
'tsdoc/syntax': 'off',
'jsdoc/require-description-complete-sentence': 'off',

View File

@@ -3,7 +3,7 @@
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.
## Unreleased
## Added
### Added
* Add `BurnedNFTokens`, `FirstNFTSequence`, `MintedNFTokens`,
`NFTokenMinter`, and `WalletLocator` to `AccountRoot`.
* Add `ledger_hash` and `ledger_index` to `account_nfts`,
@@ -12,6 +12,7 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
* Add types for `NFTokenPage` and `NFTokenOffer` LedgerEntries.
* Add type for NFToken object that is stored on a `NFTokenPage`.
* Add type for `account_info`'s `account_flags` property.
* Add types for `EnableAmendment`, `SetFee`, and `UNLModify` transactions.
## 2.8.0 (2023-06-13)

View File

@@ -0,0 +1,20 @@
/**
* Mark a change to the Negative UNL.
*
* @category Pseudo Transaction Models
*/
export interface UNLModify {
TransactionType: 'UNLModify'
/**
* The ledger index where this pseudo-transaction appears.
* This distinguishes the pseudo-transaction from other occurrences of the same change.
*/
LedgerSequence: number
/**
* If 0, this change represents removing a validator from the Negative UNL.
* If 1, this change represents adding a validator to the Negative UNL.
*/
UNLModifyDisabling: 0 | 1
/** The validator to add or remove, as identified by its master public key. */
UNLModifyValidator: string
}

View File

@@ -0,0 +1,26 @@
import { BaseTransaction } from './common'
/**
* Transaction Flags for an EnableAmendment Transaction.
*
* @category Transaction Flags
*/
export enum EnableAmendmentFlags {
/** Support for this amendment increased to at least 80% of trusted validators starting with this ledger version. */
tfGotMajority = 0x00010000,
/** Support for this amendment decreased to less than 80% of trusted validators starting with this ledger version. */
tfLostMajority = 0x00020000,
}
/**
* Mark a change in the status of a proposed amendment when it gains majority, looses majority, or is enabled.
*
* @category Pseudo Transaction Models
*/
export interface EnableAmendment extends BaseTransaction {
TransactionType: 'EnableAmendment'
/** A unique identifier for the amendment. */
Amendment: string
/** The ledger index where this pseudo-transaction appears. */
LedgerSequence: number
}

View File

@@ -14,6 +14,7 @@ export { DepositPreauth } from './depositPreauth'
export { EscrowCancel } from './escrowCancel'
export { EscrowCreate } from './escrowCreate'
export { EscrowFinish } from './escrowFinish'
export { EnableAmendment, EnableAmendmentFlags } from './enableAmendment'
export { NFTokenAcceptOffer } from './NFTokenAcceptOffer'
export { NFTokenBurn } from './NFTokenBurn'
export { NFTokenCancelOffer } from './NFTokenCancelOffer'
@@ -41,7 +42,9 @@ export {
} from './paymentChannelClaim'
export { PaymentChannelCreate } from './paymentChannelCreate'
export { PaymentChannelFund } from './paymentChannelFund'
export { SetFee, SetFeePreAmendment, SetFeePostAmendment } from './setFee'
export { SetRegularKey } from './setRegularKey'
export { SignerListSet } from './signerListSet'
export { TicketCreate } from './ticketCreate'
export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
export { UNLModify } from './UNLModify'

View File

@@ -0,0 +1,48 @@
import { BaseTransaction } from './common'
export interface SetFeePreAmendment extends BaseTransaction {
/**
* The charge, in drops of XRP, for the reference transaction, as hex. (This is the transaction cost before scaling for load.)
*/
BaseFee: string
/**
* The cost, in fee units, of the [reference transaction](https://xrpl.org/transaction-cost.html#reference-transaction-cost)
*/
ReferenceFeeUnits: number
/**
* The base reserve, in drops
*/
ReserveBase: number
/**
* The incremental reserve, in drops
*/
ReserveIncrement: number
}
export interface SetFeePostAmendment extends BaseTransaction {
/**
* The charge, in drops of XRP, for the reference transaction. (This is the transaction cost before scaling for load.)
*/
BaseFeeDrops: string
/**
* The base reserve, in drops
*/
ReserveBaseDrops: string
/**
* The incremental reserve, in drops
*/
ReserveIncrementDrops: string
}
/**
* Marks a change in transaction cost or reserve requirements as a result of Fee Voting.
*
* The output will be based on the status of the `XRPFees` amendment at the time of this transaction.
* - Before: {@link SetFeePostAmendment}
* - After: {@link SetFeePostAmendment}
*
* @category Pseudo Transaction Models
*/
export type SetFee = {
TransactionType: 'SetFee'
} & (SetFeePreAmendment | SetFeePostAmendment)