Skip to content

Commit

Permalink
ledger entry objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dangell7 committed Mar 26, 2023
1 parent ad6ca1b commit 49bc75b
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/xrpl/src/models/ledger/EmittedTxn.ts
Original file line number Diff line number Diff line change
@@ -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
}
27 changes: 27 additions & 0 deletions packages/xrpl/src/models/ledger/Hook.ts
Original file line number Diff line number Diff line change
@@ -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[]
}
67 changes: 67 additions & 0 deletions packages/xrpl/src/models/ledger/HookDefinition.ts
Original file line number Diff line number Diff line change
@@ -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
}
29 changes: 29 additions & 0 deletions packages/xrpl/src/models/ledger/HookState.ts
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 8 additions & 0 deletions packages/xrpl/src/models/ledger/LedgerEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -19,8 +23,12 @@ type LedgerEntry =
| Check
| DepositPreauth
| DirectoryNode
| EmittedTxn
| Escrow
| FeeSettings
| Hook
| HookDefinition
| HookState
| LedgerHashes
| NegativeUNL
| Offer
Expand Down
8 changes: 8 additions & 0 deletions packages/xrpl/src/models/ledger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -26,8 +30,12 @@ export {
Check,
DepositPreauth,
DirectoryNode,
EmittedTxn,
Escrow,
FeeSettings,
Hook,
HookDefinition,
HookState,
Ledger,
LedgerEntry,
LedgerHashes,
Expand Down
34 changes: 34 additions & 0 deletions packages/xrpl/src/models/methods/ledgerEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

/**
Expand Down

0 comments on commit 49bc75b

Please sign in to comment.