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:
$ltc_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_available_balance_filter(float $balance, array $args = array()) : float
Accesses the available balance of a user. This is the balance that can be used right now.
Excludes amounts locked in pending withdrawals, pending internal transfers, trades etc.
Example: Available Bitcoin balance of current user:
$btc_balance = apply_filters( 'wallets_api_available_balance', 0, array( 'symbol' => 'BTC' ) );
Example: Available Litecoin balance of user 2:
$btc_balance = apply_filters( 'wallets_api_available_balance', 0, array(
'symbol' => 'LTC',
'user_id' => 2,
) );
float | $balance | The available balance. Initialize to zero before the filter call. |
array | $args | Array of arguments to this filter:
|
If capability checking fails.
The available 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 user 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' );
}
Example: Get all the online coin adapters. Do not use a cached state of the adapters; instead, make sure that the adapters are each queried one by one to determine if they are online.
$adapters = apply_filters( 'wallets_api_adapters', array(), array(
'online_only' => true,
'force_online_check' => true,
) );
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_transactions', array(), array( 'symbol' => 'BTC' ) );
Example: Litecoin transactions #10 to #14 of of user #2 with more than 3 confirmations:
$ltc_txs = apply_filters( 'wallets_api_transactions', array(), array(
'symbol' => 'LTC',
'user_id' => 2,
'from' => 10,
'count' => 5,
) );
Example: Ten most recent Dogecoin faucet payouts for the current user:
$doge_payouts = apply_filters( 'wallets_api_transactions', array(), array(
'symbol' => 'DOGE',
'categories' => 'move',
'tags' => 'wallets-faucet payout',
) );
Example: 100 most recent Litecoin deposits and withdrawals of user #3.
$ltc_wds = apply_filters( 'wallets_api_transactions', array(), array(
'symbol' => 'LTC',
'user_id' => 3,
'count' => 100,
'categories' => array( 'deposit', 'withdraw' ),
) );
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, or if the adapter does not respond with a string.
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.
api_cancel_transaction_action(array $args = array())
Allows a transaction to be cancelled. Requires `manage_wallets` capability.
Example: Cancel an internal move transaction with TXID move-5beb31b1c658e1.51082864-send
. This will also cancel move-5beb31b1c658e1.51082864-receive
(total of 2 transactions).
do_action( 'wallets_api_cancel_transaction', array( 'txid' => 'move-5beb31b1c658e1.51082864-send' ) );`
Example: Cancel a trade transaction with TXID T-BTC-DOGE-O5be995f006796-O5be99619d1f2d-2
. This will also cancel transactions ending with -1
, -3
and -4
(total of 4 transactions).
array | $args | Array of arguments to this filter:
|
If capability checking fails or if the transaction is not found.
api_retry_transaction_action(array $args = array())
Allows a transaction to be retried. Requires `manage_wallets` capability.
Example: Retry an internal move transaction with TXID move-5beb31b1c658e1.51082864-send
. This will also retry move-5beb31b1c658e1.51082864-receive
(total of 2 transactions).
do_action( 'wallets_api_retry_transaction', array( 'txid' => 'move-5beb31b1c658e1.51082864-send' ) );`
Example: Retry a trade transaction with TXID T-BTC-DOGE-O5be995f006796-O5be99619d1f2d-2
. This will also retry transactions ending with -1
, -3
and -4
(total of 4 transactions).
array | $args | Array of arguments to this filter:
|
If capability checking fails or if the transaction is not found.