Package nxt.account

Class FundingMonitor

java.lang.Object
nxt.account.FundingMonitor

public final class FundingMonitor extends Object
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.

  • Field Details

    • MIN_FUND_AMOUNT

      public static final long MIN_FUND_AMOUNT
      Minimum monitor amount
      See Also:
    • MIN_FUND_THRESHOLD

      public static final long MIN_FUND_THRESHOLD
      Minimum monitor threshold
      See Also:
    • MIN_FUND_INTERVAL

      public static final int MIN_FUND_INTERVAL
      Minimum funding interval
      See Also:
  • Method Details

    • 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, currency, or coin
    • getChain

      public Chain getChain()
      Return the transaction chain
      Returns:
      Chain
    • getProperty

      public 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 String 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 monitor

      One or more funding parameters can be overridden in the account property value string: {"amount":"long","threshold":"long","interval":integer}

      Parameters:
      chain - Chain for transactions
      holdingType - Holding type
      holdingId - Asset, currency, or coin identifier
      property - Account property name
      amount - Fund amount
      threshold - Fund threshold
      interval - Fund interval
      privateKey - Fund private key
      feeRateNQTPerFXT - 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 chain
      holdingType - Monitor holding type
      holdingId - Asset, currency, or coin identifier
      property - Account property
      accountId - Fund account identifier
      Returns:
      TRUE if the monitor was stopped
    • getMonitors

      public static List<FundingMonitor> getMonitors(Filter<FundingMonitor> filter)
      Get monitors satisfying the supplied filter
      Parameters:
      filter - Monitor filter
      Returns:
      Monitor list
    • getAllMonitors

      public static List<FundingMonitor> getAllMonitors()
      Get all monitors
      Returns:
      Account monitor list
    • getMonitoredAccounts

      public static 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 class Object
      Returns:
      Hash code
    • equals

      public boolean equals(Object obj)
      Check if two monitors are equal
      Overrides:
      equals in class Object
      Parameters:
      obj - Comparison object
      Returns:
      TRUE if the objects are equal