abstract class Account \ SimpleAccountType

All implemented interfaces:
AccountType, AccountTypeInformation
All known direct subclasses:
AbstractMiner,AbstractWallet

Implements some basic helper methods for an account type.

Instances of this account may be represented as an Account, and can be used to obtain current balances for this account. For example, get the current wallet balances for a mining pool or exchange wallet.

In theory this could also be extended to cryptocurrency addresses? (from AccountType)


Method Summary

Name Description
checkFields($account) Basic implementation of #checkFields() using regular expressions.
fetchBalance($currency, $account, CurrencyFactory $factory, Logger $logger) Helper function to get all balances for the given currency for this account, or null if there is no balance for this currency. May block.
fetchConfirmedBalance($currency, $account, CurrencyFactory $factory, Logger $logger) Helper function to get the current, confirmed, available balance of the given currency for this account. May block.
throttle(Logger $logger, $default = 3) This allows all exchanges to optionally throttle multiple repeated requests based on a runtime configuration value. The throttle time is selected from either the accounts_NAME_throttle or accounts_throttle config values, or $default seconds; which is the time in seconds to wait between repeated requests.

public function checkFields($account)

Basic implementation of #checkFields() using regular expressions.

Returns:
array of (error string, array(args)) errors or false if there are no errors

public function fetchBalance($currency, $account, CurrencyFactory $factory, Logger $logger)

Helper function to get all balances for the given currency for this account, or null if there is no balance for this currency. May block.

We need to have a reference to a CurrencyFactory because we might need to find out runtime properties of a currency in order to correctly distinguish hash rates, currency codes etc. (from fetchBalance)

Parameters:
$account - fields that satisfy #getFields
Returns:
array('confirmed', 'unconfirmed', 'hashrate', ...) or null

public function fetchConfirmedBalance($currency, $account, CurrencyFactory $factory, Logger $logger)

Helper function to get the current, confirmed, available balance of the given currency for this account. May block.

We need to have a reference to a CurrencyFactory because we might need to find out runtime properties of a currency in order to correctly distinguish hash rates, currency codes etc. (from fetchConfirmedBalance)

Parameters:
$account - fields that satisfy #getFields
Returns:
confirmed balance or null

public function throttle(Logger $logger, $default = 3)

This allows all exchanges to optionally throttle multiple repeated requests based on a runtime configuration value. The throttle time is selected from either the accounts_NAME_throttle or accounts_throttle config values, or $default seconds; which is the time in seconds to wait between repeated requests.

Parameters:
$default - the default delay, or 3 seconds if not specified
Defaults:
default = 3