Package nxt
Class FundingMonitor
- java.lang.Object
-
- nxt.FundingMonitor
-
public final class FundingMonitor extends java.lang.Object
Monitor account balances based on account propertiesNXT, ASSET and CURRENCY balances can be monitored. If a balance falls below the threshold, a transaction will be submitted to transfer units from the funding account to the monitored account. A transfer will remain pending if the number of blocks since the previous transfer transaction is less than the monitor interval.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FundingMonitor.MonitoredAccount
Monitored account
-
Field Summary
Fields Modifier and Type Field Description static long
MIN_FUND_AMOUNT
Minimum monitor amountstatic int
MIN_FUND_INTERVAL
Minimum funding intervalstatic long
MIN_FUND_THRESHOLD
Minimum monitor threshold
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Check if two monitors are equallong
getAccountId()
Return the fund account identifierjava.lang.String
getAccountName()
Return the fund account namestatic java.util.List<FundingMonitor>
getAllMonitors()
Get all monitorslong
getAmount()
Return the fund amountlong
getHoldingId()
Return the holding identifierHoldingType
getHoldingType()
Return the monitor holding typeint
getInterval()
Return the fund intervalstatic java.util.List<FundingMonitor.MonitoredAccount>
getMonitoredAccounts(FundingMonitor monitor)
Get all monitored accounts for a single monitorstatic java.util.List<FundingMonitor>
getMonitors(Filter<FundingMonitor> filter)
Get monitors satisfying the supplied filterjava.lang.String
getProperty()
Return the account property namelong
getThreshold()
Return the fund thresholdint
hashCode()
Return the hash codestatic void
shutdown()
Stop monitor processingstatic boolean
startMonitor(HoldingType holdingType, long holdingId, java.lang.String property, long amount, long threshold, int interval, java.lang.String secretPhrase)
Start the monitorstatic int
stopAllMonitors()
Stop all monitors Pending fund transactions will still be processedstatic boolean
stopMonitor(HoldingType holdingType, long holdingId, java.lang.String property, long accountId)
Stop monitor Pending fund transactions will still be processed
-
-
-
Field Detail
-
MIN_FUND_AMOUNT
public static final long MIN_FUND_AMOUNT
Minimum monitor amount- See Also:
- Constant Field Values
-
MIN_FUND_THRESHOLD
public static final long MIN_FUND_THRESHOLD
Minimum monitor threshold- See Also:
- Constant Field Values
-
MIN_FUND_INTERVAL
public static final int MIN_FUND_INTERVAL
Minimum funding interval- See Also:
- Constant Field Values
-
-
Method Detail
-
getHoldingType
public HoldingType getHoldingType()
Return the monitor holding type- Returns:
- Holding type
-
getHoldingId
public long getHoldingId()
Return the holding identifier- Returns:
- Holding identifier for asset or currency
-
getProperty
public java.lang.String getProperty()
Return the account property name- Returns:
- Account property
-
getAmount
public long getAmount()
Return the fund amount- Returns:
- Fund amount
-
getThreshold
public long getThreshold()
Return the fund threshold- Returns:
- Fund threshold
-
getInterval
public int getInterval()
Return the fund interval- Returns:
- Fund interval
-
getAccountId
public long getAccountId()
Return the fund account identifier- Returns:
- Account identifier
-
getAccountName
public java.lang.String getAccountName()
Return the fund account name- Returns:
- Account name
-
startMonitor
public static boolean startMonitor(HoldingType holdingType, long holdingId, java.lang.String property, long amount, long threshold, int interval, java.lang.String secretPhrase)
Start the monitorOne or more funding parameters can be overridden in the account property value string: {"amount":"long","threshold":"long","interval":integer}
- Parameters:
holdingType
- Holding typeholdingId
- Asset or currency identifier, ignored for NXT monitorproperty
- Account property nameamount
- Fund amountthreshold
- Fund thresholdinterval
- Fund intervalsecretPhrase
- Fund account secret phrase- Returns:
- TRUE if the monitor was started
-
stopAllMonitors
public static int stopAllMonitors()
Stop all monitors Pending fund transactions will still be processed- Returns:
- Number of monitors stopped
-
stopMonitor
public static boolean stopMonitor(HoldingType holdingType, long holdingId, java.lang.String property, long accountId)
Stop monitor Pending fund transactions will still be processed- Parameters:
holdingType
- Monitor holding typeholdingId
- Asset or currency identifier, ignored for NXT monitorproperty
- Account propertyaccountId
- Fund account identifier- Returns:
- TRUE if the monitor was stopped
-
getMonitors
public static java.util.List<FundingMonitor> getMonitors(Filter<FundingMonitor> filter)
Get monitors satisfying the supplied filter- Parameters:
filter
- Monitor filter- Returns:
- Monitor list
-
getAllMonitors
public static java.util.List<FundingMonitor> getAllMonitors()
Get all monitors- Returns:
- Account monitor list
-
getMonitoredAccounts
public static java.util.List<FundingMonitor.MonitoredAccount> getMonitoredAccounts(FundingMonitor monitor)
Get all monitored accounts for a single monitor- Parameters:
monitor
- Monitor- Returns:
- List of monitored accounts
-
shutdown
public static void shutdown()
Stop monitor processing
-
hashCode
public int hashCode()
Return the hash code- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- Hash code
-
equals
public boolean equals(java.lang.Object obj)
Check if two monitors are equal- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- Comparison object- Returns:
- TRUE if the objects are equal
-
-