Package nxt.account
Class FundingMonitor
java.lang.Object
nxt.account.FundingMonitor
Monitor account balances based on account properties
COIN, 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 ClassesModifier and TypeClassDescriptionstatic final classMonitored account -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longMinimum monitor amountstatic final intMinimum funding intervalstatic final longMinimum monitor threshold -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if two monitors are equallongReturn the fund account identifierReturn the fund account namestatic List<FundingMonitor>Get all monitorslongReturn the fund amountgetChain()Return the transaction chainlongReturn the feeRateNQTPerFXTlongReturn the holding identifierReturn the monitor holding typeintReturn the fund intervalstatic List<FundingMonitor.MonitoredAccount>getMonitoredAccounts(FundingMonitor monitor) Get all monitored accounts for a single monitorstatic List<FundingMonitor>getMonitors(Filter<FundingMonitor> filter) Get monitors satisfying the supplied filterReturn the account property namelongReturn the fund thresholdinthashCode()Return the hash codestatic voidshutdown()Stop monitor processingstatic FundingMonitorstartMonitor(Chain chain, HoldingType holdingType, long holdingId, String property, long amount, long threshold, int interval, byte[] privateKey, long feeRateNQTPerFXT) Start the monitorstatic intStop all monitors Pending fund transactions will still be processedstatic booleanstopMonitor(Chain chain, HoldingType holdingType, long holdingId, String property, long accountId) Stop monitor Pending fund transactions will still be processed
-
Field Details
-
MIN_FUND_AMOUNT
public static final long MIN_FUND_AMOUNTMinimum monitor amount- See Also:
-
MIN_FUND_THRESHOLD
public static final long MIN_FUND_THRESHOLDMinimum monitor threshold- See Also:
-
MIN_FUND_INTERVAL
public static final int MIN_FUND_INTERVALMinimum funding interval- See Also:
-
-
Method Details
-
getHoldingType
Return the monitor holding type- Returns:
- Holding type
-
getHoldingId
public long getHoldingId()Return the holding identifier- Returns:
- Holding identifier for asset, currency, or coin
-
getChain
Return the transaction chain- Returns:
- Chain
-
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
Return the fund account name- Returns:
- Account name
-
getFeeRateNQTPerFXT
public long getFeeRateNQTPerFXT()Return the feeRateNQTPerFXT- Returns:
- Fee rate NQT per FXT
-
startMonitor
public static FundingMonitor startMonitor(Chain chain, HoldingType holdingType, long holdingId, String property, long amount, long threshold, int interval, byte[] privateKey, long feeRateNQTPerFXT) Start the monitorOne or more funding parameters can be overridden in the account property value string: {"amount":"long","threshold":"long","interval":integer}
- Parameters:
chain- Chain for transactionsholdingType- Holding typeholdingId- Asset, currency, or coin identifierproperty- Account property nameamount- Fund amountthreshold- Fund thresholdinterval- Fund intervalprivateKey- Fund private keyfeeRateNQTPerFXT- Fee rate to use for the child chain transactions created- Returns:
- The monitor, null if unable to start
-
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(Chain chain, HoldingType holdingType, long holdingId, String property, long accountId) Stop monitor Pending fund transactions will still be processed- Parameters:
chain- Monitor chainholdingType- Monitor holding typeholdingId- Asset, currency, or coin identifierproperty- Account propertyaccountId- Fund account identifier- Returns:
- TRUE if the monitor was stopped
-
getMonitors
Get monitors satisfying the supplied filter- Parameters:
filter- Monitor filter- Returns:
- Monitor list
-
getAllMonitors
Get all monitors- Returns:
- Account monitor list
-
getMonitoredAccounts
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 -
equals
Check if two monitors are equal
-