ERR_GET_USERS_INFO
ERR_GET_USERS_INFO
Error code for exception thrown while getting user info.
PHP API to the plugin. Allows programmatic access using WordPress actions and filters.
api_balance_filter(float $balance, array $args = array()) : float
Accesses the balance of a user.
Example: Bitcoin balance of current user:
$btc_balance = apply_filters( 'wallets_api_balance', 0, array( 'symbol' => 'BTC' ) );
Example: Litecoin balance of user 2:
$btc_balance = apply_filters( 'wallets_api_balance', 0, array(
'symbol' => 'LTC',
'user_id' => 2,
) );
float | $balance | The balance. Initialize to zero before the filter call. |
array | $args | Array of arguments to this filter:
|
If capability checking fails.
The balance for the specified coin and user.
api_adapters_filter(array $adapters = array(), array $args = array()) : array
Accesses the available coin adapters.
Example: Get all the coin adapters
$adapters = apply_filters( 'wallets_api_adapters', array() ) );
Example: Get all the online coin adapters, but only if the current use has the has_wallets
capability.
try {
$adapters = apply_filters( 'wallets_api_adapters', array(), array(
'check_capabilities' => true,
'online_only' => true,
) );
} catch ( Exception $e ) {
error_log( 'you do not have access to wallets' );
}
array | $adapters | The adapters. Initialize to empty array before the filter call. |
array | $args | Array of arguments to this filter:
|
If capability checking fails.
Associative array of coin symbols to coin adapter objects.
api_transactions_filter(array $txs = array(), array $args = array()) : float
Accesses user transactions.
Example: Ten most recent Bitcoin transactions of current user:
$btc_txs = apply_filters( 'wallets_api_balance', array(), array( 'symbol' => 'BTC' ) );
Example: Litecoin transactions #10 to #14 of of user 2 with more than 3 confirmations:
$btc_txs = apply_filters( 'wallets_api_transactions', array(), array(
'symbol' => 'LTC',
'user_id' => 2,
'from' => 10,
'count' => 5,
'minconf' => 3,
) );
array | $txs | The transactions. Initialize to empty array before the filter call. |
array | $args | Array of arguments to this filter:
|
If capability checking fails.
The transactions for the specified coin, user and range.
api_withdraw_action(array $args = array())
Request to perform a withdrawal transaction.
Example: Request to withdraw 0.1 LTC from user 2
do_action( 'wallets_api_withdraw', array(
'symbol' => 'LTC',
'amount => 0.1,
'from_user_id' => 2,
'address' => 'LdaShEdER2UuhMPvv33ttDPu89mVgu4Arf',
'comment' => 'Withdrawing some Litecoin',
'skip_confirm' => true,
) );
array | $args | Array of arguments to this action:
|
If capability checking fails or if insufficient balance, amount is less than fees, etc.
api_move_action(array $args = array())
Request to perform an internal transfer transaction (aka "move") between two users.
Example: Request to move 10 DOGE from user 2 to user 3. User 2 is to pay 1 DOGE as fee and user 3 is to receive 9 DOGE.
do_action( 'wallets_api_move', array(
'symbol' => 'DOGE',
'amount' => 10,
'from_user_id' => 2,
'to_user_id' => 3,
'fee' => 1,
'comment' => 'WOW such off-chain transaction, much internal transfer !!!1',
'skip_confirm' => true,
) );
array | $args | Array of arguments to this action:
|
If capability checking fails or if insufficient balance, amount is less than fees, etc.
api_deposit_address_filter(string $address = '', array $args = array()) : string|array
Accesses a deposit address of a user.
Example: Bitcoin deposit address of the current user:
$deposit_address = apply_filters( 'wallets_api_deposit_address', '', array( 'symbol' => 'BTC' ) );`
Example: A newly generated Litecoin deposit address of user 2, making sure that the user has the has_wallets
capability:
$deposit_address = apply_filters( 'wallets_api_deposit_address', '', array(
'symbol' => 'LTC',
'user_id' => 2,
'check_capabilities' => true,
'force_new' => true,
) );
string | $address | The address. Initialize to an empty string before the filter call. |
array | $args | Array of arguments to this filter:
|
If capability checking fails.
Usually the address is a string. In special cases like Monero or Ripple where an extra argument may be needed,
(e.g. Payment ID, Destination Tag, etc.) the filter returns an stdClass
, with two fields:
An 'address' field pointing to the address string and an 'extra' field pointing to the extra argument.
Consumers of the result of this API endpoint must use the PHP is_string()
or is_object()
functions.