diff --git a/packages/xrpl/src/models/ledger/EmittedTxn.ts b/packages/xrpl/src/models/ledger/EmittedTxn.ts new file mode 100644 index 00000000..e2a690aa --- /dev/null +++ b/packages/xrpl/src/models/ledger/EmittedTxn.ts @@ -0,0 +1,20 @@ +import { Transaction } from '../transactions' + +import BaseLedgerEntry from './BaseLedgerEntry' + +/** + * The EmittedTxn object type contains the + * + * @category Ledger Entries + */ +export default interface EmittedTxn extends BaseLedgerEntry { + LedgerEntryType: 'EmittedTxn' + + EmittedTxn: Transaction + + /** + * A hint indicating which page of the sender's owner directory links to this + * object, in case the directory consists of multiple pages. + */ + OwnerNode: string +} diff --git a/packages/xrpl/src/models/ledger/Hook.ts b/packages/xrpl/src/models/ledger/Hook.ts new file mode 100644 index 00000000..aeb31ebd --- /dev/null +++ b/packages/xrpl/src/models/ledger/Hook.ts @@ -0,0 +1,27 @@ +import { Hook as WHook } from '../common' + +import BaseLedgerEntry from './BaseLedgerEntry' + +/** + * The Hook object type contains the + * + * @category Ledger Entries + */ +export default interface Hook extends BaseLedgerEntry { + LedgerEntryType: 'Hook' + + /** The identifying (classic) address of this account. */ + Account: string + + /** + * A hint indicating which page of the sender's owner directory links to this + * object, in case the directory consists of multiple pages. + */ + OwnerNode: string + + PreviousTxnID: string + + PreviousTxnLgrSeq: number + + Hooks: WHook[] +} diff --git a/packages/xrpl/src/models/ledger/HookDefinition.ts b/packages/xrpl/src/models/ledger/HookDefinition.ts new file mode 100644 index 00000000..547edbcc --- /dev/null +++ b/packages/xrpl/src/models/ledger/HookDefinition.ts @@ -0,0 +1,67 @@ +import { HookParameter } from '../common' + +import BaseLedgerEntry from './BaseLedgerEntry' + +/** + * The HookDefintion object type contains the + * + * @category Ledger Entries + */ +export default interface HookDefintion extends BaseLedgerEntry { + LedgerEntryType: 'HookDefintion' + + /** + * The flags that are set on the hook. + */ + Flags: number + + /** + * This field contains a string that is used to uniquely identify the hook. + */ + HookHash: string + + /** + * The transactions that triggers the hook. Represented as a 256Hash + */ + HookOn?: string + + /** + * The namespace of the hook. + */ + HookNamespace?: string + + /** + * The API version of the hook. + */ + HookApiVersion?: string + + /** + * The parameters of the hook. + */ + HookParameters?: HookParameter[] + + /** + * The code that is executed when the hook is triggered. + */ + CreateCode?: string + + /** + * This is an optional field that contains the transaction ID of the hook set. + */ + HookSetTxnID?: string + + /** + * This is an optional field that contains the number of references to this hook. + */ + ReferenceCount?: number + + /** + * This is an optional field that contains the fee associated with the hook. + */ + Fee?: string + + /** + * This is an optional field that contains the callback fee associated with the hook. + */ + HookCallbackFee?: number +} diff --git a/packages/xrpl/src/models/ledger/HookState.ts b/packages/xrpl/src/models/ledger/HookState.ts new file mode 100644 index 00000000..f236afec --- /dev/null +++ b/packages/xrpl/src/models/ledger/HookState.ts @@ -0,0 +1,29 @@ +import BaseLedgerEntry from './BaseLedgerEntry' + +/** + * The HookState object type contains the + * + * @category Ledger Entries + */ +export default interface HookState extends BaseLedgerEntry { + LedgerEntryType: 'HookState' + + /** + * A hint indicating which page of the sender's owner directory links to this + * object, in case the directory consists of multiple pages. + */ + OwnerNode: string + + /** + * The HookStateKey property contains the key associated with this hook state, + * and the HookStateData property contains the data associated with this hook state. + */ + HookStateKey: string + + /** + * The `HookStateData` property contains the data associated with this hook state. + * It is typically a string containing the data associated with this hook state, + * such as an identifier or other information. + */ + HookStateData: string +} diff --git a/packages/xrpl/src/models/ledger/LedgerEntry.ts b/packages/xrpl/src/models/ledger/LedgerEntry.ts index 1302c32e..33238ea8 100644 --- a/packages/xrpl/src/models/ledger/LedgerEntry.ts +++ b/packages/xrpl/src/models/ledger/LedgerEntry.ts @@ -3,8 +3,12 @@ import Amendments from './Amendments' import Check from './Check' import DepositPreauth from './DepositPreauth' import DirectoryNode from './DirectoryNode' +import EmittedTxn from './EmittedTxn' import Escrow from './Escrow' import FeeSettings from './FeeSettings' +import Hook from './Hook' +import HookDefinition from './HookDefinition' +import HookState from './HookState' import LedgerHashes from './LedgerHashes' import NegativeUNL from './NegativeUNL' import Offer from './Offer' @@ -19,8 +23,12 @@ type LedgerEntry = | Check | DepositPreauth | DirectoryNode + | EmittedTxn | Escrow | FeeSettings + | Hook + | HookDefinition + | HookState | LedgerHashes | NegativeUNL | Offer diff --git a/packages/xrpl/src/models/ledger/index.ts b/packages/xrpl/src/models/ledger/index.ts index fbb31d40..efac2c12 100644 --- a/packages/xrpl/src/models/ledger/index.ts +++ b/packages/xrpl/src/models/ledger/index.ts @@ -6,8 +6,12 @@ import Amendments from './Amendments' import Check from './Check' import DepositPreauth from './DepositPreauth' import DirectoryNode from './DirectoryNode' +import EmittedTxn from './EmittedTxn' import Escrow from './Escrow' import FeeSettings from './FeeSettings' +import Hook from './Hook' +import HookDefinition from './HookDefinition' +import HookState from './HookState' import Ledger from './Ledger' import LedgerEntry from './LedgerEntry' import LedgerHashes from './LedgerHashes' @@ -26,8 +30,12 @@ export { Check, DepositPreauth, DirectoryNode, + EmittedTxn, Escrow, FeeSettings, + Hook, + HookDefinition, + HookState, Ledger, LedgerEntry, LedgerHashes, diff --git a/packages/xrpl/src/models/methods/ledgerEntry.ts b/packages/xrpl/src/models/methods/ledgerEntry.ts index f499aab8..05e83683 100644 --- a/packages/xrpl/src/models/methods/ledgerEntry.ts +++ b/packages/xrpl/src/models/methods/ledgerEntry.ts @@ -137,6 +137,40 @@ export interface LedgerEntryRequest extends BaseRequest { ticket_sequence: number } | string + /** + * The object ID of a transaction emitted by the ledger entry. + */ + emitted_txn?: string + + /** + * The hash of the Hook object to retrieve. + */ + hook_definition?: string + + /** + * The Hook object to retrieve. If a string, must be the object ID of the Hook. + * If an object, requires `account` sub-field. + */ + hook?: + | { + /** The account of the Hook object. */ + account: string + } + | string + + /** + * Object specifying the HookState object to retrieve. Requires the sub-fields + * `account`, `key`, and `namespace_id` to uniquely specify the HookState entry + * to retrieve. + */ + hook_state?: { + /** The account of the Hook object. */ + account: string + /** The key of the state. */ + key: string + /** The namespace of the state. */ + namespace_id: string + } } /**