- Account\SimpleAccountType
- Account\Wallet\AbstractWallet
- Account\Wallet\Coinbase
- Account\Wallet\AbstractWallet
class Account\Wallet \ Coinbase
- All implemented interfaces:
- SelfUpdatingAccount, UserInteractionAccount, AccountType, AccountTypeInformation
Represents the Coinbase exchange wallet.
This is necessary for e.g. OAuth2 updating access_tokens, refresh_tokens (from SelfUpdatingAccount)
Method Summary
Name | Description |
---|---|
createProvider() | |
fetchBalances($account, CurrencyFactory $factory, Logger $logger) | Get all balances for this account. May block. |
fetchSupportedCurrencies(CurrencyFactory $factory, Logger $logger) | Get a list of all the currencies supported by this account (e.g. "btc", "ltc", ...). Uses currency codes from openclerk/currencies. May block. |
getCode() | |
getFields() | These fields can be filled in with UserInteractionAccount. |
getName() | |
getURL() | |
interaction(Logger $logger) | Prepare the user agent to redirect, etc. If user interaction is complete, instead returns an array of valid field values. |
registerAccountUpdateCallback($callback) | When we have finished with this account, register this callback that will update the account data with the given new data. |
Inherited Method Summary
Name | Description |
---|---|
checkFields($account) | Basic implementation of #checkFields() using regular expressions. (from SimpleAccountType) |
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. (from SimpleAccountType)
|
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. (from SimpleAccountType) |
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. (from SimpleAccountType)
|
fetchJSON($url, Logger $logger, $throttle = 3) | Fetch the JSON from the given GET URL, or throw a {@Link AccountFetchException} if something bad happened. (from AbstractWallet) |
jsonDecode($raw) | By default, calls Fetch#jsonDecode() (from AbstractWallet) |
public function createProvider()
public function fetchBalances($account, CurrencyFactory $factory, Logger $logger)
Get all balances for this account. May block. (from fetchBalances)
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.
Returned results may include: - confirmed: raw confirmed currency balance (e.g. 1.0 = 1 BTC) - unconfirmed: raw unconfirmed balance (e.g. 1.0 = 1 BTC) - hashrate: raw hash rate per second (e.g. 1.0 = 1 H/s) - workers: number of workers (from fetchBalances)
- Parameters:
$account
- fields that satisfy #getFields()- Returns:
all account balances- Throws:
AccountFetchException - if something bad happened
public function fetchSupportedCurrencies(CurrencyFactory $factory, Logger $logger)
Get a list of all the currencies supported by this account (e.g. "btc", "ltc", ...). Uses currency codes from openclerk/currencies. May block. (from fetchSupportedCurrencies)
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 fetchSupportedCurrencies)
public function getCode()
- Returns:
a unique string representing this account type; must be lowercase and 1-32 characters
public function getFields()
These fields can be filled in with UserInteractionAccount.
- Returns:
an array of fields that need to be provided in order to get balances, e.g. API keys
public function getName()
- Returns:
the full name of the account type
public function getURL()
- Returns:
the URL of the account type, ornull
public function interaction(Logger $logger)
Prepare the user agent to redirect, etc. If user interaction is complete, instead returns an array of valid field values. (from interaction)
- Returns:
eithernull
(interaction is not yet complete) or an array of valid field values- Throws:
AccountFetchException - if something bad happened
public function registerAccountUpdateCallback($callback)
When we have finished with this account, register this callback that will update the account data with the given new data. (from registerAccountUpdateCallback)
This is necessary for e.g. OAuth2 updating access_tokens, refresh_tokens (from registerAccountUpdateCallback)