Package nxt.account
Class AccountLedger
java.lang.Object
nxt.account.AccountLedger
Maintain a ledger of changes to selected accounts
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAccount ledger listener eventsstatic classLedger entrystatic enumLedger events There must be a ledger event defined for each transaction (type,subtype) pair.static interfacestatic enumLedger holdings When adding a new holding, do not change the existing code assignments since they are stored in the holding_type field of the account_ledger table. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of blocks to keep when trimming -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType) Add a listenerstatic voidClear pending ledger entriesstatic voidCommit pending ledger entriesstatic List<AccountLedger.LedgerEntry>getEntries(long accountId, AccountLedger.LedgerEvent event, long eventId, AccountLedger.LedgerHolding holding, long holdingId, int firstIndex, int lastIndex) Return the ledger entries sorted in descending insert orderstatic AccountLedger.LedgerEntrygetEntry(long ledgerId) Return a single entry identified by the ledger entry identifierstatic voidinit()Initialization We don't do anything but we need to be called from Nxt.init() in order to register our tablestatic AccountLedger.LedgerEventIdnewEventId(long eventId, byte[] eventHash, Chain chain) static AccountLedger.LedgerEventIdnewEventId(Block block) static AccountLedger.LedgerEventIdnewEventId(Transaction transaction) static booleanremoveListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType) Remove a listener
-
Field Details
-
trimKeep
public static final int trimKeepNumber of blocks to keep when trimming
-
-
Constructor Details
-
AccountLedger
public AccountLedger()
-
-
Method Details
-
init
public static void init()Initialization We don't do anything but we need to be called from Nxt.init() in order to register our table -
addListener
public static boolean addListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType) Add a listener- Parameters:
listener- ListenereventType- Event to listen for- Returns:
- True if the listener was added
-
removeListener
public static boolean removeListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType) Remove a listener- Parameters:
listener- ListenereventType- Event to listen for- Returns:
- True if the listener was removed
-
commitEntries
public static void commitEntries()Commit pending ledger entries -
clearEntries
public static void clearEntries()Clear pending ledger entries -
getEntry
Return a single entry identified by the ledger entry identifier- Parameters:
ledgerId- Ledger entry identifier- Returns:
- Ledger entry or null if entry not found
-
getEntries
public static List<AccountLedger.LedgerEntry> getEntries(long accountId, AccountLedger.LedgerEvent event, long eventId, AccountLedger.LedgerHolding holding, long holdingId, int firstIndex, int lastIndex) Return the ledger entries sorted in descending insert order- Parameters:
accountId- Account identifier or zero if no account identifierevent- Ledger event or nulleventId- Ledger event identifier or zero if no event identifierholding- Ledger holding or nullholdingId- Ledger holding identifier or zero if no holding identifierfirstIndex- First matching entry index, inclusivelastIndex- Last matching entry index, inclusive- Returns:
- List of ledger entries
-
newEventId
-
newEventId
-
newEventId
-