DSWallets
Interfaces, Classes, Traits and Enums
- Fiat_Adapter
- The fiat currency adapter is a wallet adapter for defining fiat currencies.
- Wallet_Adapter
- The wallet adapter is an object that abstracts communication with a wallet backend.
- Bank_Fiat_Adapter
- The bank fiat currency adapter defines fiat currencies that are deposited/withdrawn via bank transfers.
- Bitcoin_Core_Like_Wallet_Adapter
- The Bitcoin core-like adapter is for communicating with Bitcoin core and with similar wallets.
- Task
- Cron task abstract class.
- Adapters_Task
- Cron task abstract class.
- Auto_Cancel_Task
- Cron task abstract class.
- Bitcoin_Creator_Task
- Cron task abstract class.
- CoinGecko_Task
- Iterate over all currencies with a CoinGecko ID assigned to them and retrieve exchange rates.
- Currency_Icons_Task
- Cron task abstract class.
- Email_Queue_Task
- Cron task abstract class.
- FixerIO_Task
- Cron task abstract class.
- Migration_Task
- Migrates transactions and addresses from the old MySQL tables to custom posts.
- Moves_Task
- Cron task abstract class.
- Withdrawals_Task
- Cron task abstract class.
- Post_Type
- Post type base class
- Address
- Address class
- Currency
- Currency class.
- Transaction
- Transaction class
- Wallet
- Wallet class
- Aggregation_Task
- Cron task abstract class.
Table of Contents
- DEFAULT_ADDRESS_MAX_COUNT = 10
- DEFAULT_CRON_AGGREGATE_INTERVAL = 0
- DEFAULT_CRON_APPROVE_WITHDRAWALS = ''
- DEFAULT_CRON_AUTOCANCEL_INTERVAL = 0
- DEFAULT_CRON_EMAILS_MAX_BATCH_SIZE = 8
- DEFAULT_CRON_INTERVAL = 'wallets_one_minute'
- DEFAULT_CRON_MOVES_MAX_BATCH_SIZE = 8
- DEFAULT_CRON_TASK_TIMEOUT = 5
- DEFAULT_CRON_VERBOSE = ''
- DEFAULT_CRON_WITHDRAWALS_MAX_BATCH_SIZE = 4
- DEFAULT_DISABLE_CACHE = false
- DEFAULT_FIAT_FIXERIO_CURRENCIES = ['USD']
- DEFAULT_FRONTEND_LEGACY_JSON_API = ''
- DEFAULT_FRONTEND_MOVE_SPILLS_USERS = 'on'
- DEFAULT_FRONTEND_POLLING_INTERVAL = 30
- DEFAULT_FRONTEND_VS_AMOUNT_DECIMALS = 4
- DEFAULT_HTTP_REDIRECTS = 2
- DEFAULT_HTTP_TIMEOUT = 10
- DEFAULT_HTTP_TOR_ENABLED = false
- DEFAULT_HTTP_TOR_IP = '127.0.0.1'
- DEFAULT_HTTP_TOR_PORT = 9050
- DEFAULT_RATES_VS = ['btc', 'usd']
- DEFAULT_TRANSIENTS_BROKEN = false
- DEFAULT_WALLETS_CONFIRM_MOVE_USER_ENABLED = ''
- DEFAULT_WALLETS_CONFIRM_WITHDRAW_USER_ENABLED = 'on'
- ERR_DO_CANCEL = -108
- Error code for exception thrown while cancelling a transaction.
- ERR_DO_MOVE = -105
- Error code for exception thrown while transferring funds between users.
- ERR_DO_RETRY = -109
- Error code for exception thrown while retrying a transaction.
- ERR_DO_WITHDRAW = -104
- Error code for exception thrown while performing withdrawals.
- ERR_GET_COINS_INFO = -102
- Error code for exception thrown while getting coins info.
- ERR_GET_TRANSACTIONS = -103
- Error code for exception thrown while getting transactions.
- ERR_GET_USERS_INFO = -101
- Error code for exception thrown while getting user info.
- ERR_NOT_ALLOWED = -107
- Error code for exception thrown due to insufficient capabilities.
- ERR_NOT_LOGGED_IN = -106
- Error code for exception thrown due to user not being logged in.
- GDPR_ITEMS_PER_PAGE = 100
- LATEST_API_VERSION = 3
- MAX_DROPDOWN_LIMIT = 1000
- NONCE_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- NONCE_LENGTH = 16
- TABS = ['general' => '🔧 General settings', 'rates' => '💱 Exchange rates', 'fiat' => '💵 Fiat currencies', 'frontend' => '🗔 Frontend UI settings', 'notify' => '📧 Notifications', 'cron' => '⌛ Cron tasks', 'http' => '🌐 HTTP settings']
- TRANSACTIONS_COLS = ['type', 'tags', 'time', 'currency', 'amount', 'fee', 'address', 'txid', 'comment', 'status', 'user_confirm']
- The possible values for the `columns` attribute for the `wallets_transactions` shortcode.
- WALLETS_BORDER_COLOR = '#000000'
- Color for the border of the UIs.
- WALLETS_BORDER_PADDING_PX = '20'
- Padding in pixels around the border of the UIs.
- WALLETS_BORDER_RADIUS_PX = '0'
- Corner radius in pixels for the border of the UIs. Allows for rounded corners.
- WALLETS_BORDER_SHADOW_BLUR_RADIUS_PX = '0'
- Shadow radius in pixels.
- WALLETS_BORDER_SHADOW_COLOR = '#000000'
- Shadow color in hex.
- WALLETS_BORDER_SHADOW_OFFSET_X_PX = '0'
- Horizontal offset of shadow in pixels.
- WALLETS_BORDER_SHADOW_OFFSET_Y_PX = '0'
- Vertical offset of shadow in pixels.
- WALLETS_BORDER_STYLE = 'solid'
- Style for the border of the UIs.
- WALLETS_BORDER_WIDTH_PX = '1'
- Width in pixels for the border of the UIs.
- WALLETS_FONT_COLOR = '#202020'
- Font color in hex.
- WALLETS_FONT_LABEL_COLOR = '#000000'
- Font color for field labels, in hex.
- WALLETS_FONT_LABEL_SIZE_PT = '14'
- Font size for field labels, in points.
- WALLETS_FONT_SIZE_PT = '12'
- Font size in points.
- WALLETS_GENERAL_OPACITY_LOADING = '0.5'
- Opacity of a UI while it is loading data, from 0 to 1.
- WALLETS_ICON_SHADOW_BLUR_RADIUS_PX = '0'
- Radius for shadow behind currency logos/icons, in pixels. For no shadow, leave at 0.
- WALLETS_ICON_SHADOW_COLOR = '#000000'
- Color for shadow behind currency logos/icons, in hex.
- WALLETS_ICON_SHADOW_OFFSET_X_PX = '0'
- Horizontal offset for shadow behind currency logos/icons, in pixels.
- WALLETS_ICON_SHADOW_OFFSET_Y_PX = '0'
- Vertical offset for shadow behind currency logos/icons, in pixels.
- WALLETS_ICON_WIDTH_PX = '64'
- Width for currency logos/icons, in pixels. Since logos are usually square, this is also the height.
- WALLETS_TXCOLORS_CANCELLED = '#f8f828'
- Background color, in hex, for rows showing transactions with CANCELLE status.
- WALLETS_TXCOLORS_DONE = '#58b858'
- Background color, in hex, for rows showing transactions with DONE status.
- WALLETS_TXCOLORS_FAILED = '#d85848'
- Background color, in hex, for rows showing transactions with FAILED status.
- WALLETS_TXCOLORS_PENDING = '#808080'
- Background color, in hex, for rows showing transactions with PENDING status.
- tab_caps_cb() : mixed
- db_wallets_cb() : mixed
- db_currencies_cb() : mixed
- db_txs_cb() : mixed
- db_migration_cb() : mixed
- db_debug_cb() : mixed
- wp_get_cache_type() : string
- Attempts to determine which object cache is being used.
- migration_type_descriptions() : string
- wallets_user_profile() : mixed
- numeric_cb() : mixed
- string_cb() : mixed
- select_cb() : mixed
- checkbox_cb() : mixed
- multicheckbox_cb() : mixed
- page_cb() : mixed
- settings_page_cb() : mixed
- tab_cron_cb() : mixed
- tab_general_cb() : mixed
- tab_frontend_cb() : mixed
- tab_http_cb() : mixed
- tab_rates_cb() : mixed
- tab_notify_cb() : mixed
- tab_fiat_cb() : mixed
- tab_updates_cb() : mixed
- get_update_info_for_dashed_slug_extension() : object|null
- Get update info for dashed-slug extension.
- user_profile_legacy_api_key() : mixed
- json_api_init() : mixed
- This hook provides friendly URI mappings for the JSON API.
- json_api_query_vars() : mixed
- json_api_parse_request() : mixed
- coin_comparator() : mixed
- get_effective_user_id() : mixed
- In case of programmatic access, checks that the specified user_id matches with the API key passed.
- json_api_3_handle() : mixed
- api_balance_filter() : float|string
- Accesses the balance of a user.
- api_available_balance_filter() : float|string
- Accesses the available balance of a user. This is the balance that can be used right now.
- api_adapters_filter() : array<string|int, mixed>
- Accesses the available coin adapters.
- api_transactions_filter() : array<string|int, mixed>
- Accesses user transactions.
- api_withdraw_action() : mixed
- Request to perform a withdrawal transaction.
- api_move_action() : mixed
- Request to perform an internal transfer transaction (aka "move") between two users.
- api_deposit_address_filter() : string|array<string|int, mixed>
- Accesses a deposit address of a user.
- api_cancel_transaction_action() : mixed
- Allows a transaction to be cancelled. Requires `manage_wallets` capability.
- api_retry_transaction_action() : mixed
- Allows a transaction to be retried. Requires `manage_wallets` capability.
- do_not_cache_page() : mixed
- Force caching plugins to not cache the current page.
- get_deposit_address_by_strings() : Address|null
- Retrieves a depost address by its address string.
- get_withdrawal_address_by_strings() : Address|null
- Retrieves a withdrawal address by its address string.
- get_address_by_strings() : Address|null
- Retrieves a depost address by its address string. This can be a deposit or withdrawal address.
- get_all_addresses_for_user_id() : array<string|int, mixed>
- Get all the addresses for a user specified by numeric ID.
- count_all_addresses_for_user_id() : int
- user_and_currency_have_label() : bool
- get_or_make_address() : Address
- Check an address object to see if it already exists on the db as a post and if not, create it.
- get_latest_address_for_user_id_and_currency() : Address|null
- Retrieves the latest saved address for the specified currency and user, if any.
- get_latest_address_per_currency_for_user_id() : array<string|int, mixed>
- Get latest address per currency for user specified by numeric ID.
- get_all_addresses_for_user_id_and_currency_id() : array<string|int, Address>
- Retrieves all the addresses for the specified currency and user, and possibly type.
- count_all_addresses_for_user_id_and_currency_id() : int
- get_address_ids_for_currency_id() : array<string|int, int>
- Get all address IDs for a currency ID.
- get_address_ids_by_currency_id_and_type_and_tags() : array<string|int, int>
- Get all the IDs for addresses of a specified wallet and having the specified tags.
- get_deposit_address_ids_by_tags() : array<string|int, mixed>
- Get IDs of deposit addresses by tags.
- get_asset_path() : string
- Determine the actual location of an asset.
- get_script_path() : string|null
- get_balance_for_user_and_currency_id() : int
- get_all_balances_assoc_for_user() : array<string|int, mixed>
- Get all balances for a user or for all users.
- get_available_balance_for_user_and_currency_id() : int
- get_all_available_balances_assoc_for_user() : array<string|int, mixed>
- Get all available balances for a user or for all users.
- sum_transactions() : array<string|int, number>
- Sums transactions into balances.
- load_currencies() : array<string|int, mixed>
- Takes an array of currency post_ids and instantiates them into an array of Currency objects.
- get_coingecko_currencies() : array<string|int, mixed>
- get_coingecko_platforms() : array<string|int, mixed>
- get_currency_ids_for_wallet() : array<string|int, mixed>
- Retrieve the currency IDs associated with the specified wallet.
- get_currencies_for_wallet() : array<string|int, mixed>
- Retrieve the currency or currencies associated with the specified wallet.
- get_currency_symbols_names_for_wallet() : array<string|int, mixed>
- Retrieves the sumbols and names for the currencies associated with the specified wallet.
- get_all_currencies() : array<string|int, Currency>
- Retrieve all published currencies.
- get_all_enabled_currencies() : array<string|int, Currency>
- Retrieve all enabled currencies.
- get_currencies_with_wallets_with_unlocked_adapters() : array<string|int, Currency>
- Gets all currencies backed by wallets with unlocked adapters. Useful for executing transactions on cron.
- get_first_currency_by_symbol() : Currency|null
- Retrieves the first currencies that has the specified ticker symbol.
- get_all_currencies_by_symbol() : array<string|int, mixed>
- Retrieves all currencies that match the specified ticker symbol.
- get_first_currency_by_coingecko_id() : Currency|null
- Retrieves a currency by its unique CoinGecko id.
- get_currency_ids() : array<string|int, mixed>
- Gets currency IDs by tag and status.
- get_all_fiat_currencies() : array<string|int, Currency>
- Retrieves all fiat currencies.
- get_all_cryptocurrencies() : array<string|int, Currency>
- Retrieves all cryptocurrencies.
- has_transactions() : bool
- Determines whether there are transactions for the specified currency.
- get_ids_for_coingecko_currencies_without_icon() : array<string|int, int>
- Retrieve all currencies with a CoinGecko ID, but without an icon assigned.
- get_currency_by_wallet_id_and_ticker_symbol() : Currency|null
- get_paged_currencies_with_coingecko_id() : array<string|int, Currency>
- Retrieve currencies having a CoinGecko ID, with pagination.
- get_vs_decimals() : int
- wp_mail_enqueue() : void
- Enqueue an email for later sending via wp_mail() by the email cron task.
- wp_mail_enqueue_to_admins() : void
- Enqueue an email for later sending via wp_mail() by the email cron task.
- get_admin_emails() : array<string|int, mixed>
- ds_http_get() : string|null
- Retrieves the response of the specified URL via HTTP GET.
- is_net_active() : bool
- Whether the wallets plugin is network-active on a multisite installation.
- maybe_switch_blog() : bool
- Switch to main site/blog to do DB stuff.
- maybe_restore_blog() : bool
- Switch back from blog 1 to the current blog after doing DB stuff.
- add_ds_option() : bool
- Creates a new option/value pair related to the plugin.
- update_ds_option() : bool
- Updates an existing option/value pair related to the plugin, or creates the option.
- get_ds_option() : mixed
- Retrieves an option's value.
- delete_ds_option() : bool
- Deletes an option's value.
- set_ds_transient() : bool
- Sets a transient value to be used as cached data.
- delete_ds_transient() : bool
- Deletes a transient value.
- get_ds_transient() : mixed
- Retrieves cached data that was previously stored in a transient.
- ds_user_can() : mixed
- ds_current_user_can() : mixed
- parse_categories() : array<string|int, mixed>
- Parses a string of transaction category/type slugs.
- parse_tags() : array<string|int, mixed>
- parse_atts_for_currency() : void
- Parses shortcode attributes to determine the currency specified, if any.
- parse_atts_for_user() : void
- Parses shortcode attributes to determine the user specified, if any.
- get_template_part() : string
- Retrieves a template part for this plugin or its extensions.
- locate_template() : string|null
- load_transactions() : array<string|int, mixed>
- Takes an array of transaction post_ids and instantiates them into an array of Transaction objects.
- get_transaction_by_txid() : Transaction|null
- Retrieves a transaction by its blockchain TXID.
- get_deposit_transaction_by_txid_and_address() : Transaction|null
- Retrieves a deposit transaction by its TXID and address string.
- get_pending_transactions_by_currency_and_category() : array<string|int, mixed>|null
- get_transactions() : array<string|int, mixed>|null
- Get transactions.
- get_transactions_for_address() : array<string|int, mixed>|null
- get_executable_withdrawals() : array<string|int, mixed>
- get_executable_moves() : mixed
- get_transactions_older_than() : array<string|int, mixed>
- Gets transactions from the before times.
- get_transactions_newer_than() : array<string|int, mixed>
- Gets latest transactions.
- get_transactions_by_time() : array<string|int, mixed>
- Gets transactions from the before times.
- do_validate_pending_transactions() : void
- get_tx_with_parent() : Transaction|null
- get_latest_fiat_withdrawal_by_user() : Transaction|null
- fiat_deposit_exists_by_txid_currency() : bool
- get_or_make_transaction() : Transaction
- Check a transaction object to see if it already exists on the db as a post and if not, create it.
- get_todays_withdrawal_counters() : array<string|int, mixed>
- increment_todays_withdrawal_counters() : void
- get_next_currency_with_pending_withdrawals() : Currency|null
- Get next currency with pending withdrawals
- get_possible_transaction_counterparts() : array<string|int, mixed>
- Get possible counterpart transactions to specified transaction.
- resolve_recipient() : WP_User|null
- Resolves a user from a string that may denote a username, login name, or email.
- get_move_recipient_suggestions() : array<string|int, mixed>
- Gets a list of user names that the specified user has previously sent internal transfers (moves) to.
- create_random_nonce() : string
- Generate a random string.
- get_legacy_api_key() : string
- Get a user's API key for the legacy JSON-API v3 (deprecated!).
- generate_random_bytes() : string
- Returns a hex-encoded string of API_KEY_BYTES random bytes.
- get_ids_for_users_with_cap() : array<string|int, int>
- Returns array of all users WITH the specified capability.
- get_ids_for_users_without_cap() : array<string|int, int>
- Returns array of all users WITHOUT the specified capability.
- load_wallets() : array<string|int, mixed>
- Takes an array of wallet post_ids and instantiates them into an array of Wallet objects.
- get_wallets() : array<string|int, Wallet>
- Retrieves all wallet posts that can be instantiated.
- get_ids_of_enabled_wallets() : array<string|int, mixed>
- Get the IDs of all enabled wallets.
- get_wallet_adapter_class_names() : array<string|int, mixed>
- Get the class names of all available declared adapters.
Constants
DEFAULT_ADDRESS_MAX_COUNT
public
mixed
DEFAULT_ADDRESS_MAX_COUNT
= 10
DEFAULT_CRON_AGGREGATE_INTERVAL
public
mixed
DEFAULT_CRON_AGGREGATE_INTERVAL
= 0
DEFAULT_CRON_APPROVE_WITHDRAWALS
public
mixed
DEFAULT_CRON_APPROVE_WITHDRAWALS
= ''
DEFAULT_CRON_AUTOCANCEL_INTERVAL
public
mixed
DEFAULT_CRON_AUTOCANCEL_INTERVAL
= 0
DEFAULT_CRON_EMAILS_MAX_BATCH_SIZE
public
mixed
DEFAULT_CRON_EMAILS_MAX_BATCH_SIZE
= 8
DEFAULT_CRON_INTERVAL
public
mixed
DEFAULT_CRON_INTERVAL
= 'wallets_one_minute'
DEFAULT_CRON_MOVES_MAX_BATCH_SIZE
public
mixed
DEFAULT_CRON_MOVES_MAX_BATCH_SIZE
= 8
DEFAULT_CRON_TASK_TIMEOUT
public
mixed
DEFAULT_CRON_TASK_TIMEOUT
= 5
DEFAULT_CRON_VERBOSE
public
mixed
DEFAULT_CRON_VERBOSE
= ''
DEFAULT_CRON_WITHDRAWALS_MAX_BATCH_SIZE
public
mixed
DEFAULT_CRON_WITHDRAWALS_MAX_BATCH_SIZE
= 4
DEFAULT_DISABLE_CACHE
public
mixed
DEFAULT_DISABLE_CACHE
= false
DEFAULT_FIAT_FIXERIO_CURRENCIES
public
mixed
DEFAULT_FIAT_FIXERIO_CURRENCIES
= ['USD']
DEFAULT_FRONTEND_LEGACY_JSON_API
public
mixed
DEFAULT_FRONTEND_LEGACY_JSON_API
= ''
DEFAULT_FRONTEND_MOVE_SPILLS_USERS
public
mixed
DEFAULT_FRONTEND_MOVE_SPILLS_USERS
= 'on'
DEFAULT_FRONTEND_POLLING_INTERVAL
public
mixed
DEFAULT_FRONTEND_POLLING_INTERVAL
= 30
DEFAULT_FRONTEND_VS_AMOUNT_DECIMALS
public
mixed
DEFAULT_FRONTEND_VS_AMOUNT_DECIMALS
= 4
DEFAULT_HTTP_REDIRECTS
public
mixed
DEFAULT_HTTP_REDIRECTS
= 2
DEFAULT_HTTP_TIMEOUT
public
mixed
DEFAULT_HTTP_TIMEOUT
= 10
DEFAULT_HTTP_TOR_ENABLED
public
mixed
DEFAULT_HTTP_TOR_ENABLED
= false
DEFAULT_HTTP_TOR_IP
public
mixed
DEFAULT_HTTP_TOR_IP
= '127.0.0.1'
DEFAULT_HTTP_TOR_PORT
public
mixed
DEFAULT_HTTP_TOR_PORT
= 9050
DEFAULT_RATES_VS
public
mixed
DEFAULT_RATES_VS
= ['btc', 'usd']
DEFAULT_TRANSIENTS_BROKEN
public
mixed
DEFAULT_TRANSIENTS_BROKEN
= false
DEFAULT_WALLETS_CONFIRM_MOVE_USER_ENABLED
public
mixed
DEFAULT_WALLETS_CONFIRM_MOVE_USER_ENABLED
= ''
DEFAULT_WALLETS_CONFIRM_WITHDRAW_USER_ENABLED
public
mixed
DEFAULT_WALLETS_CONFIRM_WITHDRAW_USER_ENABLED
= 'on'
ERR_DO_CANCEL
Error code for exception thrown while cancelling a transaction.
public
mixed
ERR_DO_CANCEL
= -108
ERR_DO_MOVE
Error code for exception thrown while transferring funds between users.
public
mixed
ERR_DO_MOVE
= -105
ERR_DO_RETRY
Error code for exception thrown while retrying a transaction.
public
mixed
ERR_DO_RETRY
= -109
ERR_DO_WITHDRAW
Error code for exception thrown while performing withdrawals.
public
mixed
ERR_DO_WITHDRAW
= -104
ERR_GET_COINS_INFO
Error code for exception thrown while getting coins info.
public
mixed
ERR_GET_COINS_INFO
= -102
ERR_GET_TRANSACTIONS
Error code for exception thrown while getting transactions.
public
mixed
ERR_GET_TRANSACTIONS
= -103
ERR_GET_USERS_INFO
Error code for exception thrown while getting user info.
public
mixed
ERR_GET_USERS_INFO
= -101
ERR_NOT_ALLOWED
Error code for exception thrown due to insufficient capabilities.
public
mixed
ERR_NOT_ALLOWED
= -107
ERR_NOT_LOGGED_IN
Error code for exception thrown due to user not being logged in.
public
mixed
ERR_NOT_LOGGED_IN
= -106
GDPR_ITEMS_PER_PAGE
public
mixed
GDPR_ITEMS_PER_PAGE
= 100
LATEST_API_VERSION
public
mixed
LATEST_API_VERSION
= 3
MAX_DROPDOWN_LIMIT
public
mixed
MAX_DROPDOWN_LIMIT
= 1000
NONCE_CHARS
public
mixed
NONCE_CHARS
= '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
NONCE_LENGTH
public
mixed
NONCE_LENGTH
= 16
TABS
public
mixed
TABS
= ['general' => '🔧 General settings', 'rates' => '💱 Exchange rates', 'fiat' => '💵 Fiat currencies', 'frontend' => '🗔 Frontend UI settings', 'notify' => '📧 Notifications', 'cron' => '⌛ Cron tasks', 'http' => '🌐 HTTP settings']
TRANSACTIONS_COLS
The possible values for the `columns` attribute for the `wallets_transactions` shortcode.
public
mixed
TRANSACTIONS_COLS
= ['type', 'tags', 'time', 'currency', 'amount', 'fee', 'address', 'txid', 'comment', 'status', 'user_confirm']
Tags
WALLETS_BORDER_COLOR
Color for the border of the UIs.
public
string
WALLETS_BORDER_COLOR
= '#000000'
Color value in hex, must start with #.
WALLETS_BORDER_PADDING_PX
Padding in pixels around the border of the UIs.
public
string|number
WALLETS_BORDER_PADDING_PX
= '20'
WALLETS_BORDER_RADIUS_PX
Corner radius in pixels for the border of the UIs. Allows for rounded corners.
public
string|number
WALLETS_BORDER_RADIUS_PX
= '0'
WALLETS_BORDER_SHADOW_BLUR_RADIUS_PX
Shadow radius in pixels.
public
string|number
WALLETS_BORDER_SHADOW_BLUR_RADIUS_PX
= '0'
WALLETS_BORDER_SHADOW_COLOR
Shadow color in hex.
public
string
WALLETS_BORDER_SHADOW_COLOR
= '#000000'
WALLETS_BORDER_SHADOW_OFFSET_X_PX
Horizontal offset of shadow in pixels.
public
string|number
WALLETS_BORDER_SHADOW_OFFSET_X_PX
= '0'
WALLETS_BORDER_SHADOW_OFFSET_Y_PX
Vertical offset of shadow in pixels.
public
string|number
WALLETS_BORDER_SHADOW_OFFSET_Y_PX
= '0'
WALLETS_BORDER_STYLE
Style for the border of the UIs.
public
string
WALLETS_BORDER_STYLE
= 'solid'
Can be a valid CSS value, such as solid, dashed, etc.
WALLETS_BORDER_WIDTH_PX
Width in pixels for the border of the UIs.
public
string|number
WALLETS_BORDER_WIDTH_PX
= '1'
WALLETS_FONT_COLOR
Font color in hex.
public
string
WALLETS_FONT_COLOR
= '#202020'
WALLETS_FONT_LABEL_COLOR
Font color for field labels, in hex.
public
string
WALLETS_FONT_LABEL_COLOR
= '#000000'
WALLETS_FONT_LABEL_SIZE_PT
Font size for field labels, in points.
public
string|number
WALLETS_FONT_LABEL_SIZE_PT
= '14'
WALLETS_FONT_SIZE_PT
Font size in points.
public
string|number
WALLETS_FONT_SIZE_PT
= '12'
WALLETS_GENERAL_OPACITY_LOADING
Opacity of a UI while it is loading data, from 0 to 1.
public
string|number
WALLETS_GENERAL_OPACITY_LOADING
= '0.5'
WALLETS_ICON_SHADOW_BLUR_RADIUS_PX
Radius for shadow behind currency logos/icons, in pixels. For no shadow, leave at 0.
public
string|number
WALLETS_ICON_SHADOW_BLUR_RADIUS_PX
= '0'
WALLETS_ICON_SHADOW_COLOR
Color for shadow behind currency logos/icons, in hex.
public
string
WALLETS_ICON_SHADOW_COLOR
= '#000000'
WALLETS_ICON_SHADOW_OFFSET_X_PX
Horizontal offset for shadow behind currency logos/icons, in pixels.
public
string|number
WALLETS_ICON_SHADOW_OFFSET_X_PX
= '0'
WALLETS_ICON_SHADOW_OFFSET_Y_PX
Vertical offset for shadow behind currency logos/icons, in pixels.
public
string|number
WALLETS_ICON_SHADOW_OFFSET_Y_PX
= '0'
WALLETS_ICON_WIDTH_PX
Width for currency logos/icons, in pixels. Since logos are usually square, this is also the height.
public
string|number
WALLETS_ICON_WIDTH_PX
= '64'
WALLETS_TXCOLORS_CANCELLED
Background color, in hex, for rows showing transactions with CANCELLE status.
public
string
WALLETS_TXCOLORS_CANCELLED
= '#f8f828'
WALLETS_TXCOLORS_DONE
Background color, in hex, for rows showing transactions with DONE status.
public
string
WALLETS_TXCOLORS_DONE
= '#58b858'
WALLETS_TXCOLORS_FAILED
Background color, in hex, for rows showing transactions with FAILED status.
public
string
WALLETS_TXCOLORS_FAILED
= '#d85848'
WALLETS_TXCOLORS_PENDING
Background color, in hex, for rows showing transactions with PENDING status.
public
string
WALLETS_TXCOLORS_PENDING
= '#808080'
Functions
tab_caps_cb()
tab_caps_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —db_wallets_cb()
db_wallets_cb() : mixed
Return values
mixed —db_currencies_cb()
db_currencies_cb() : mixed
Return values
mixed —db_txs_cb()
db_txs_cb() : mixed
Return values
mixed —db_migration_cb()
db_migration_cb() : mixed
Return values
mixed —db_debug_cb()
db_debug_cb() : mixed
Return values
mixed —wp_get_cache_type()
Attempts to determine which object cache is being used.
wp_get_cache_type() : string
Note that the guesses made by this function are based on the WP_Object_Cache classes that define the 3rd party object cache extension. Changes to those classes could render problems with this function's ability to determine which object cache is being used.
This function is shamelessly stolen from wp-cli.
Tags
Return values
string —migration_type_descriptions()
migration_type_descriptions(mixed $type) : string
Parameters
- $type : mixed
Return values
string —wallets_user_profile()
wallets_user_profile(mixed $profileuser) : mixed
Parameters
- $profileuser : mixed
Return values
mixed —numeric_cb()
numeric_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —string_cb()
string_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —select_cb()
select_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —checkbox_cb()
checkbox_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —multicheckbox_cb()
multicheckbox_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —page_cb()
page_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —settings_page_cb()
settings_page_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_cron_cb()
tab_cron_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_general_cb()
tab_general_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_frontend_cb()
tab_frontend_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_http_cb()
tab_http_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_rates_cb()
tab_rates_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_notify_cb()
tab_notify_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_fiat_cb()
tab_fiat_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —tab_updates_cb()
tab_updates_cb(mixed $arg) : mixed
Parameters
- $arg : mixed
Return values
mixed —get_update_info_for_dashed_slug_extension()
Get update info for dashed-slug extension.
get_update_info_for_dashed_slug_extension(string $plugin_slug) : object|null
Retrieves update information for an extension specified by slug. Extensions to this plugin will use this function to check for available updates to these extensions.
The update information is cached on the object cache for 30 minutes to reduce load on the updates server. This means that you will see updates to the extensions after a maximum delay of 30 minutes.
Parameters
- $plugin_slug : string
-
The extension slug, suchs as "wallets-faucet", "wallets-exchange", etc.
Return values
object|null —The update information or null if not retrieved.
user_profile_legacy_api_key()
user_profile_legacy_api_key(int $user_id) : mixed
Parameters
- $user_id : int
Return values
mixed —json_api_init()
This hook provides friendly URI mappings for the JSON API.
json_api_init() : mixed
Return values
mixed —json_api_query_vars()
json_api_query_vars(mixed $vars) : mixed
Parameters
- $vars : mixed
Return values
mixed —json_api_parse_request()
json_api_parse_request(mixed $query) : mixed
Parameters
- $query : mixed
Return values
mixed —coin_comparator()
coin_comparator(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed
Return values
mixed —get_effective_user_id()
In case of programmatic access, checks that the specified user_id matches with the API key passed.
get_effective_user_id() : mixed
Checks the the wallets_api_key GET parameter, the Bearer HTTP_AUTHORIZATION header, and the Authorization header.
Tags
Return values
mixed —json_api_3_handle()
json_api_3_handle(mixed $query, mixed $action) : mixed
Parameters
- $query : mixed
- $action : mixed
Return values
mixed —api_balance_filter()
Accesses the balance of a user.
api_balance_filter(float $balance[, array<string|int, mixed> $args = [] ]) : float|string
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,
) );
Parameters
- $balance : float
-
The balance. Initialize to zero before the filter call.
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter:
- string 'symbol' → The coin to get the balance of, by ticker symbol.
- integer 'currency_id' → More precise way to define the coin to get the balance of.
- integer 'user_id' → (Optional) WordPress ID of the user to get the balance of. Default is the current user.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
. - bool 'formatted' → (Default: false) Whether to display the value using the currency's pattern.
Tags
Return values
float|string —The balance for the specified coin and user, as a float. If formatted = true then the result is a string, rendered using the currency's sprintf() pattern.
api_available_balance_filter()
Accesses the available balance of a user. This is the balance that can be used right now.
api_available_balance_filter(float $available_balance[, array<string|int, mixed> $args = [] ]) : float|string
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,
) );
Parameters
- $available_balance : float
-
The available balance. Initialize to zero before the filter call.
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter:
- string 'symbol' → The coin to get the balance of, by ticker symbol.
- integer 'currency_id' → More precise way to define the coin to get the balance of.
- integer 'user_id' → (Optional) WordPress ID of the user to get the balance of. Default is the current user.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
. - bool 'formatted' → (Default: false) Whether to display the value using the currency's pattern.
Tags
Return values
float|string —The available balance for the specified coin and user, as a float. If formatted = true then the result is a string, rendered using the currency's sprintf() pattern.
api_adapters_filter()
Accesses the available coin adapters.
api_adapters_filter([array<string|int, mixed> $adapters = [] ][, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
This is now disabled and produces a warning. There are no more coin adapters since version 6.0.0. To get a list of wallets use DSWallets\get_wallets(). Wallets cointain wallet adapters.
Parameters
- $adapters : array<string|int, mixed> = []
-
The adapters array.
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter. Deprecated.
Tags
Return values
array<string|int, mixed> —Associative array of coin symbols to coin adapter objects.
api_transactions_filter()
Accesses user transactions.
api_transactions_filter([array<string|int, mixed> $txs = [] ][, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Example: Ten most recent Bitcoin transactions of current user:
$btc_txs = apply_filters( 'wallets_api_transactions', [], 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(
'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(
'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(
'symbol' => 'LTC',
'user_id' => 3,
'count' => 100,
'categories' => array( 'deposit', 'withdraw' ),
) );
Parameters
- $txs : array<string|int, mixed> = []
-
The transactions. Initialize to empty array before the filter call.
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter:
- string 'symbol' → The ticker symbol of the coin to get transactions of.
- integer 'currency_id' → More precise way to define the currency to get transactions of.
- integer 'user_id' → (Optional) WordPress ID of the user whose transactions to get. Default is the current user.
- integer 'from' → (Optional) Return range of transactions starting from this count. Default is
0
. - integer 'count' → (Optional) Number of transactions starting from this count. Default is
10
. - string|array 'categories' → (Optional) Filter by categories, can be any of: deposit, withdraw, move, trade. Default is empty array, which means do not filter by categories.
- string|array 'tags' → (Optional) Filter by tags. Returns transactions having ALL of the specified tags. Default is empty array, which means do not filter by tags.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
.
Tags
Return values
array<string|int, mixed> —The transactions for the specified coin, user and range.
api_withdraw_action()
Request to perform a withdrawal transaction.
api_withdraw_action([array<string|int, mixed> $args = [] ]) : mixed
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, ) );
Parameters
- $args : array<string|int, mixed> = []
-
Array of arguments to this action:
- integer 'from_user_id' → (Optional) WordPress ID of the user whose account will perform a withdrawal. Default is the current user.
- string 'symbol' → The coin to withdraw.
- integer 'currency_id' → More precise way to define the currency to withdraw.
- string 'address' → The blockchain destination address to send the funds to.
- string 'extra' → (Optional) Any additional information needed by some coins to specify the destination, e.g. Monero (XMR) "Payment ID" or Ripple (XRP) "Destination Tag".
- float 'amount' → The amount to withdraw, including any applicable fee.
- float 'fee' → (Optional) The amount to charge as withdrawal fee, which will cover the network transaction fee. Subtracted from amount. Default: as specified in the coin adapter settings.
- string 'comment' → (Optional) A textual description that will be attached to the transaction.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
. - boolean 'skip_confirm' → (Optional) If
true
, withdrawal will be entered in pending state. Otherwise the withdrawal may require confirmation by the user and/or an admin depending on plugin settings. Default isfalse
.
Tags
Return values
mixed —api_move_action()
Request to perform an internal transfer transaction (aka "move") between two users.
api_move_action([array<string|int, mixed> $args = [] ]) : mixed
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, ) );
Parameters
- $args : array<string|int, mixed> = []
-
Array of arguments to this action:
- string 'symbol' → The coin to get transactions of.
- integer 'currency_id' → More precise way to define the currency to get transactions of.
- float 'amount' → The amount to transfer, including any applicable fee.
- float 'fee' → (Optional) The amount to charge as an internal transaction fee. Subtracted from amount. Default: Fees specified by the coin adapter settings.
- integer 'from_user_id' → (Optional) WordPress ID of the user who will send the coins. Default is the current user.
- integer 'to_user_id' → WordPress ID of the user who will receive the coins.
- string 'comment' → (Optional) A textual description that will be attached to the transaction.
- string 'tags' → (Optional) A list of space-separated tags that will be attached to the transaction, in addition to some default ones. Used to group together transfers of the same kind.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
. - boolean 'skip_confirm' → (Optional) If
true
, the tranfer will be entered in pending state. Otherwise the transfer may require confirmation by the user and/or an admin depending on plugin settings. Default isfalse
.
Tags
Return values
mixed —api_deposit_address_filter()
Accesses a deposit address of a user.
api_deposit_address_filter([string $address = '' ][, array<string|int, mixed> $args = [] ]) : string|array<string|int, mixed>
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,
) );
Parameters
- $address : string = ''
-
The address. Initialize to an empty string before the filter call.
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter:
- string 'symbol' → The coin to get the deposit address of.
- integer 'currency_id' → More precise way to define the currency to get transactions of.
- integer 'user_id' → (Optional) WordPress ID of the user whose deposit address to get. Default is the current user.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
. - boolean 'force_new' → (Optional) If
true
, generate a new address. A new address will also be generated if there is no already existing address in the database, the first time a user logs in or uses this wallet. Default isfalse
.
Tags
Return values
string|array<string|int, mixed> —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()
Allows a transaction to be cancelled. Requires `manage_wallets` capability.
api_cancel_transaction_action([array<string|int, mixed> $args = [] ]) : mixed
Example: Cancel an internal move transaction with TXID move-5beb31b1c658e1.51082864-send
. This will also cancel move-5beb31b1c658e1.51082865-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).
do_action( 'wallets_api_cancel_transaction', array( 'txid' => 'T-BTC-DOGE-O5be995f006796-O5be99619d1f2d-2' ) );`
Parameters
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter:
- string 'txid' → The unique transaction ID string. If this corresponds to a move-XXX-send or move-XXX-receive transaction, its counterpart is also affected.
- integer 'user_id' → (Optional) WordPress ID of the user who is performing the action. Default is the current user.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
.
Tags
Return values
mixed —api_retry_transaction_action()
Allows a transaction to be retried. Requires `manage_wallets` capability.
api_retry_transaction_action([array<string|int, mixed> $args = [] ]) : mixed
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).
Parameters
- $args : array<string|int, mixed> = []
-
Array of arguments to this filter:
- string 'txid' → The unique transaction ID string. If this corresponds to a move-XXX-send or move-XXX-receive transaction, its counterpart is also affected.
- integer 'user_id' → (Optional) WordPress ID of the user who is performing the action. Default is the current user.
- boolean 'check_capabilities' → (Optional) Whether to check for the appropriate user capabilities. Default is
false
.
Tags
Return values
mixed —do_not_cache_page()
Force caching plugins to not cache the current page.
do_not_cache_page() : mixed
This works by setting the DONOTCACHEPAGE constant. The constant is respected by W3 Total Cache, WP Super Cache, and possibly other plugins.
Tags
Return values
mixed —get_deposit_address_by_strings()
Retrieves a depost address by its address string.
get_deposit_address_by_strings(string $address[, string|null $extra = null ]) : Address|null
Useful for performing deposits. If the extra field is specified, it must also match.
Parameters
- $address : string
-
The address string.
- $extra : string|null = null
-
Optionally a Payment ID, Memo, Destination tag, etc.
return Address|null The address found, or null if no address was found.
Return values
Address|null —get_withdrawal_address_by_strings()
Retrieves a withdrawal address by its address string.
get_withdrawal_address_by_strings(string $address[, string|null $extra = null ]) : Address|null
Useful for editing withdrawals. If the extra field is specified, it must also match.
Parameters
- $address : string
-
The address string.
- $extra : string|null = null
-
Optionally a Payment ID, Memo, Destination tag, etc.
return Address|null The address found, or null if no address was found.
Return values
Address|null —get_address_by_strings()
Retrieves a depost address by its address string. This can be a deposit or withdrawal address.
get_address_by_strings(string $address[, string|null $extra = null ][, string $type = '' ]) : Address|null
Useful for performing deposits. If the extra field is specified, it must also match.
Parameters
- $address : string
-
The address string.
- $extra : string|null = null
-
Optionally a Payment ID, Memo, Destination tag, etc. If not applicable, should be falsy.
- $type : string = ''
-
One of deposit, withdrawal.
return Address|null The address found, or null if no address was found.
Return values
Address|null —get_all_addresses_for_user_id()
Get all the addresses for a user specified by numeric ID.
get_all_addresses_for_user_id(int $user_id[, int|null $page = null ][, int|null $rows = null ][, bool $include_archived = false ]) : array<string|int, mixed>
This function features pagination.
Parameters
- $user_id : int
-
The ID of the user to query.
- $page : int|null = null
-
The page to request.
- $rows : int|null = null
-
The amount of rows per page.
- $include_archived : bool = false
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
array<string|int, mixed> —count_all_addresses_for_user_id()
count_all_addresses_for_user_id(int $user_id) : int
Parameters
- $user_id : int
Return values
int —user_and_currency_have_label()
user_and_currency_have_label(int $user_id, int $currency_id, string $label) : bool
Parameters
- $user_id : int
- $currency_id : int
- $label : string
Return values
bool —get_or_make_address()
Check an address object to see if it already exists on the db as a post and if not, create it.
get_or_make_address(Address $address) : Address
The post_id and label are not compared. Everything else is. Trashed addresses are not counted.
Parameters
- $address : Address
-
An address to look for.
Tags
Return values
Address —The existing address or newly created address.
get_latest_address_for_user_id_and_currency()
Retrieves the latest saved address for the specified currency and user, if any.
get_latest_address_for_user_id_and_currency(int $user_id, Currency $currency[, string $type = 'deposit' ][, bool $include_archived = true ]) : Address|null
Parameters
- $user_id : int
-
The user id.
- $currency : Currency
-
The currency.
- $type : string = 'deposit'
-
One of 'deposit', 'withdrawal'.
- $include_archived : bool = true
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
Address|null —The address found, or null.
get_latest_address_per_currency_for_user_id()
Get latest address per currency for user specified by numeric ID.
get_latest_address_per_currency_for_user_id(int $user_id[, string $type = 'deposit' ][, bool $include_archived = false ]) : array<string|int, mixed>
Parameters
- $user_id : int
-
The ID of the user to query.
- $type : string = 'deposit'
-
One of
deposit
orwithdrawal
. - $include_archived : bool = false
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
array<string|int, mixed> —The Addresses found, one per currency maximum.
get_all_addresses_for_user_id_and_currency_id()
Retrieves all the addresses for the specified currency and user, and possibly type.
get_all_addresses_for_user_id_and_currency_id(int $user_id, int $currency_id[, string $type = 'deposit' ][, bool $include_archived = false ]) : array<string|int, Address>
Parameters
- $user_id : int
-
The user id.
- $currency_id : int
-
The currency_id.
- $type : string = 'deposit'
-
One of 'deposit', 'withdrawal'.
- $include_archived : bool = false
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
array<string|int, Address> —The addresses found.
count_all_addresses_for_user_id_and_currency_id()
count_all_addresses_for_user_id_and_currency_id(int $user_id, int $currency_id) : int
Parameters
- $user_id : int
- $currency_id : int
Return values
int —get_address_ids_for_currency_id()
Get all address IDs for a currency ID.
get_address_ids_for_currency_id(int $currency_id[, string $type = 'deposit' ][, bool $include_archived = false ]) : array<string|int, int>
Retrieves all the ids of the deposit (or withdrawal) addresses for the specified currency and type.
Parameters
- $currency_id : int
-
The ID of the currency whose addresses to retrieve..
- $type : string = 'deposit'
-
Type of addresses to retrieve. One of 'deposit', 'withdrawal'. Default is deposit addresses.
- $include_archived : bool = false
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
array<string|int, int> —The IDs of the addresses found.
get_address_ids_by_currency_id_and_type_and_tags()
Get all the IDs for addresses of a specified wallet and having the specified tags.
get_address_ids_by_currency_id_and_type_and_tags(int $currency_id[, string $type = 'deposit' ][, array<string|int, string> $tags = [] ][, bool $include_archived = false ]) : array<string|int, int>
Retrieves all the ids of the deposit (or withdrawal) addresses for the specified wallet and tags.
Parameters
- $currency_id : int
-
The ID of the currency whose addresses to retrieve.
- $type : string = 'deposit'
-
Type of addresses to retrieve. One of 'deposit', 'withdrawal'. Default is deposit addresses.
- $tags : array<string|int, string> = []
-
The addresses found must have all the specified tags.
- $include_archived : bool = false
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
array<string|int, int> —The IDs of the addresses found.
get_deposit_address_ids_by_tags()
Get IDs of deposit addresses by tags.
get_deposit_address_ids_by_tags([array<string|int, mixed> $tags = [] ][, bool $include_archived = false ]) : array<string|int, mixed>
Get the IDs of deposit addresses with the specified tags.
Parameters
- $tags : array<string|int, mixed> = []
-
The addresses found must have all these tags.
- $include_archived : bool = false
-
Whether to include addresses that have the
archived
tag in thewallets_address_tags
taxonomy.
Tags
Return values
array<string|int, mixed> —The IDs of the matching addresses.
get_asset_path()
Determine the actual location of an asset.
get_asset_path(string $name[, string $type = 'script' ][, string $plugin_slug = 'wallets' ]) : string
Autodetects which plugin it was called from. Gives priority to minified, versioned files. This way, if you delete the minified file, the plugin falls back to the unminified asset.
Parameters
- $name : string
-
Base name of asset.
- $type : string = 'script'
-
One of script, style, sprite.
- $plugin_slug : string = 'wallets'
-
The plugin's slug. For this plugin, this is "wallets".
Tags
Return values
string —The path to the asset, relative to wordpress base dir.
get_script_path()
get_script_path(string $name) : string|null
Parameters
- $name : string
Return values
string|null —get_balance_for_user_and_currency_id()
get_balance_for_user_and_currency_id(int $user_id, int $currency_id) : int
Parameters
- $user_id : int
- $currency_id : int
Return values
int —get_all_balances_assoc_for_user()
Get all balances for a user or for all users.
get_all_balances_assoc_for_user(int $user_id) : array<string|int, mixed>
Balances are the sum of all transactions with "done" state. Balances for all enabled currencies are returned.
Parameters
- $user_id : int
-
The ID for the user, or 0 to retrieve balance sums over all users.
Return values
array<string|int, mixed> —Assoc array of currency_ids to balance amounts, in decimal form (float).
get_available_balance_for_user_and_currency_id()
get_available_balance_for_user_and_currency_id(int $user_id, int $currency_id) : int
Parameters
- $user_id : int
- $currency_id : int
Return values
int —get_all_available_balances_assoc_for_user()
Get all available balances for a user or for all users.
get_all_available_balances_assoc_for_user(int $user_id) : array<string|int, mixed>
Available balances are the sum of all transactions in "done" state and any debiting balances (withdrawals, negative moves) that are in a "pending" state. Balances for all enabled currencies are returned.
Parameters
- $user_id : int
-
The ID for the user. If zero, then return total balances for all users.
Return values
array<string|int, mixed> —Assoc array of currency_ids to balance amounts, in integer form.
sum_transactions()
Sums transactions into balances.
sum_transactions(array<string|int, mixed> $txs) : array<string|int, number>
Gets the transaction objects from the passed array and sums them into an assoc array of currency_id to balance sum. Applies fees to debiting transactions (withdrawals, negative moves).
Parameters
- $txs : array<string|int, mixed>
-
The array of Transaction objects.
Return values
array<string|int, number> —The assoc array of currency_ids to balances.
load_currencies()
Takes an array of currency post_ids and instantiates them into an array of Currency objects.
load_currencies(array<string|int, mixed> $post_ids) : array<string|int, mixed>
If a currency cannot be loaded due to Currency::load() throwing (i.e. bad DB data), then it is skipped and the rest of the currencies will be loaded.
Parameters
- $post_ids : array<string|int, mixed>
-
The array of integer post_ids
Tags
Return values
array<string|int, mixed> —The array of Currency objects.
get_coingecko_currencies()
get_coingecko_currencies() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_coingecko_platforms()
get_coingecko_platforms() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_currency_ids_for_wallet()
Retrieve the currency IDs associated with the specified wallet.
get_currency_ids_for_wallet( $wallet) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —get_currencies_for_wallet()
Retrieve the currency or currencies associated with the specified wallet.
get_currencies_for_wallet( $wallet) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —get_currency_symbols_names_for_wallet()
Retrieves the sumbols and names for the currencies associated with the specified wallet.
get_currency_symbols_names_for_wallet(Wallet $wallet) : array<string|int, mixed>
Does not instantiate the currencies.
Parameters
- $wallet : Wallet
-
The wallet to lookup.
Return values
array<string|int, mixed> —An associative array of smybols to names.
get_all_currencies()
Retrieve all published currencies.
get_all_currencies() : array<string|int, Currency>
Returns all currencies that are not drafts, pending review, trashed, etc. Some of these currencies may not be currently attached to wallets.
Return values
array<string|int, Currency> —The currencies found on the system.
get_all_enabled_currencies()
Retrieve all enabled currencies.
get_all_enabled_currencies([bool $with_wallet = true ]) : array<string|int, Currency>
Useful for the WP REST API. Only returns currencies that are enabled (meta wallets_wallet_id exists and is a positive integer)
Parameters
- $with_wallet : bool = true
-
If true, only returns currencies that have a valid, enabled adapter.
Return values
array<string|int, Currency> —The enabled currencies found on the system.
get_currencies_with_wallets_with_unlocked_adapters()
Gets all currencies backed by wallets with unlocked adapters. Useful for executing transactions on cron.
get_currencies_with_wallets_with_unlocked_adapters([bool $include_fiat = true ]) : array<string|int, Currency>
Parameters
- $include_fiat : bool = true
-
Whether to include fiat currencies.
Tags
Return values
array<string|int, Currency> —The found currencies.
get_first_currency_by_symbol()
Retrieves the first currencies that has the specified ticker symbol.
get_first_currency_by_symbol(string $symbol) : Currency|null
This will only return the first currency that matches. There may be others, since ticker symbols are NOT unique.
Parameters
- $symbol : string
-
The ticker symbol. Case sensitive.
Tags
Return values
Currency|null —The currency found, or NULL if no currency matches.
get_all_currencies_by_symbol()
Retrieves all currencies that match the specified ticker symbol.
get_all_currencies_by_symbol(string $symbol) : array<string|int, mixed>
There may be many currencies for one symbol, since ticker symbols are NOT unique.
Parameters
- $symbol : string
-
The ticker symbol. Case sensitive.
Tags
Return values
array<string|int, mixed> —The currencies found.
get_first_currency_by_coingecko_id()
Retrieves a currency by its unique CoinGecko id.
get_first_currency_by_coingecko_id(string $coingecko_id) : Currency|null
This is the most reliable way to get a coin, if it's in the list of known CoinGecko coins. When creating/editing a coin, you should set the coingecko_id correctly for this to work.
Parameters
- $coingecko_id : string
-
A unique id such as "bitcoin", "ethereum", etc. Case sensitive.
Tags
Return values
Currency|null —The currency object from the DB, or null if not found.
get_currency_ids()
Gets currency IDs by tag and status.
get_currency_ids([string|array<string|int, mixed>|null $having_tag = null ][, string|array<string|int, mixed> $having_status = 'publish' ]) : array<string|int, mixed>
This is useful for quickly getting the post_ids of currencies belonging to a specific group. e.g. Fixer currencies, fiat currencies, CP currencies, etc.
Parameters
- $having_tag : string|array<string|int, mixed>|null = null
-
A term slug or array of term slugs.
- $having_status : string|array<string|int, mixed> = 'publish'
-
A post status (publish,draft,pending,trash) or array of post statuses.
Return values
array<string|int, mixed> —Integer post ids for currencies found matching the query.
get_all_fiat_currencies()
Retrieves all fiat currencies.
get_all_fiat_currencies() : array<string|int, Currency>
Fiat currencies are those that are assigned the fiat adapter. These are usually created via fixer.io, but can also be assigned manually.
Tags
Return values
array<string|int, Currency> —The found currencies.
get_all_cryptocurrencies()
Retrieves all cryptocurrencies.
get_all_cryptocurrencies() : array<string|int, Currency>
Cryptocurrencies are the currencies that are not fiat currencies.
Tags
Return values
array<string|int, Currency> —The found currencies.
has_transactions()
Determines whether there are transactions for the specified currency.
has_transactions(Currency $currency) : bool
Any trashed transactions are excluded, as well as cancelled/failed transactions. Only pending and done transactions count. This helper lets us know when it's safe to modify the number of decimals in a currency.
Parameters
- $currency : Currency
Tags
Return values
bool —get_ids_for_coingecko_currencies_without_icon()
Retrieve all currencies with a CoinGecko ID, but without an icon assigned.
get_ids_for_coingecko_currencies_without_icon() : array<string|int, int>
Icons are assigned to currencies as featured images.
Return values
array<string|int, int> —The currency ids found.
get_currency_by_wallet_id_and_ticker_symbol()
get_currency_by_wallet_id_and_ticker_symbol(int $wallet_id, string $symbol) : Currency|null
Parameters
- $wallet_id : int
- $symbol : string
-
The ticker symbol. Case sensitive.
Return values
Currency|null —The currency found, or NULL if no currency matches.
get_paged_currencies_with_coingecko_id()
Retrieve currencies having a CoinGecko ID, with pagination.
get_paged_currencies_with_coingecko_id([int $limit = 10 ], int $page) : array<string|int, Currency>
Parameters
- $limit : int = 10
- $page : int
Return values
array<string|int, Currency> —The currencies found.
get_vs_decimals()
get_vs_decimals() : int
Return values
int —wp_mail_enqueue()
Enqueue an email for later sending via wp_mail() by the email cron task.
wp_mail_enqueue(string|array<string|int, mixed> $to, string $subject, string $message[, string|array<string|int, mixed> $headers = '' ][, string|array<string|int, mixed> $attachments = [] ]) : void
Parameters
- $to : string|array<string|int, mixed>
-
Array or comma-separated list of email addresses to send message.
- $subject : string
-
Email subject.
- $message : string
-
Message contents.
- $headers : string|array<string|int, mixed> = ''
-
(Optional) Additional headers.
- $attachments : string|array<string|int, mixed> = []
-
(Optional) Files to attach.
Return values
void —wp_mail_enqueue_to_admins()
Enqueue an email for later sending via wp_mail() by the email cron task.
wp_mail_enqueue_to_admins(string $subject, string $message[, string|array<string|int, mixed> $headers = '' ][, string|array<string|int, mixed> $attachments = [] ]) : void
Parameters
- $subject : string
-
Email subject
- $message : string
-
Message contents
- $headers : string|array<string|int, mixed> = ''
-
(Optional) Additional headers.
- $attachments : string|array<string|int, mixed> = []
-
(Optional) Files to attach.
Tags
Return values
void —get_admin_emails()
get_admin_emails() : array<string|int, mixed>
Return values
array<string|int, mixed> —ds_http_get()
Retrieves the response of the specified URL via HTTP GET.
ds_http_get(string $url[, array<string|int, mixed> $headers = [] ]) : string|null
If the php_curl extension is installed and Tor is enabled, the request is routed through Tor.
Parameters
- $url : string
-
The URL to retrieve.
- $headers : array<string|int, mixed> = []
-
Array of extra HTTP request headers to pass.
Return values
string|null —The response body (payload) or null on error.
is_net_active()
Whether the wallets plugin is network-active on a multisite installation.
is_net_active() : bool
Return values
bool —True iff net active on MS.
maybe_switch_blog()
Switch to main site/blog to do DB stuff.
maybe_switch_blog() : bool
This is useful for any function that does DB stuff, and ensures that data is synced between blogs.
Return values
bool —Whether the blog was switched.
maybe_restore_blog()
Switch back from blog 1 to the current blog after doing DB stuff.
maybe_restore_blog() : bool
This is useful for any function that does DB stuff, and ensures that data is synced between blogs.
Return values
bool —Whether the blog was switched back.
add_ds_option()
Creates a new option/value pair related to the plugin.
add_ds_option(string $option, mixed $value) : bool
This delegates to the WordPress function add_option. But if the plugin is network-active on a multisite installation, the option is created on the network's main blog. This ensures that settings are global over all blogs.
Parameters
- $option : string
-
The option name.
- $value : mixed
-
The option value.
Tags
Return values
bool —The result of the wrapped function.
update_ds_option()
Updates an existing option/value pair related to the plugin, or creates the option.
update_ds_option(string $option, mixed $value) : bool
This delegates to the WordPress function update_option. But if the plugin is network-active on a multisite installation, the option is updated on the network's main blog. This ensures that settings are global over all blogs.
Parameters
- $option : string
-
The option name.
- $value : mixed
-
The option value.
Tags
Return values
bool —The result of the wrapped function.
get_ds_option()
Retrieves an option's value.
get_ds_option(string $option[, mixed $default = false ]) : mixed
This delegates to the WordPress function get_option. But if the plugin is network-active on a multisite installation, the option is retrieved from the network's main blog. This ensures that settings are global over all blogs.
Parameters
- $option : string
-
The option name.
- $default : mixed = false
Tags
Return values
mixed —The result of the wrapped function.
delete_ds_option()
Deletes an option's value.
delete_ds_option(string $option) : bool
This delegates to the WordPress function delete_option. But if the plugin is network-active on a multisite installation, the option is deleted from the network's main blog. This ensures that settings are global over all blogs.
Parameters
- $option : string
-
The option name.
Tags
Return values
bool —The result of the wrapped function.
set_ds_transient()
Sets a transient value to be used as cached data.
set_ds_transient(string $transient, mixed $value, int $expiration) : bool
This delegates to the WordPress function set_transient. But if the plugin is network-active on a multisite installation, the transient is saved on the network's main blog. This ensures that cached data are global over all blogs.
Parameters
- $transient : string
-
The transient name.
- $value : mixed
-
The transient value.
- $expiration : int
-
Time until expiration in seconds from now, or 0 for never expires.
Tags
Return values
bool —The result of the wrapped function.
delete_ds_transient()
Deletes a transient value.
delete_ds_transient(string $transient) : bool
This delegates to the WordPress function delete_transient. But if the plugin is network-active on a multisite installation, the transient is deleted from the network's main blog. This ensures that cached data are global over all blogs.
Parameters
- $transient : string
-
The transient name.
Tags
Return values
bool —True if successful, false otherwise.
get_ds_transient()
Retrieves cached data that was previously stored in a transient.
get_ds_transient(string $transient[, mixed $default = false ]) : mixed
This delegates to the WordPress function get_transient. But if the plugin is network-active on a multisite installation, the transient is retrieved from the network's main blog. This ensures that cached data are global over all blogs.
Parameters
- $transient : string
-
The transient name.
- $default : mixed = false
-
The default value to return if transient was not found.
Tags
Return values
mixed —The result of the wrapped function.
ds_user_can()
ds_user_can(mixed $user, string $capability, mixed ...$args) : mixed
Parameters
- $user : mixed
- $capability : string
- $args : mixed
Return values
mixed —ds_current_user_can()
ds_current_user_can(string $capability, mixed ...$args) : mixed
Parameters
- $capability : string
- $args : mixed
Return values
mixed —parse_categories()
Parses a string of transaction category/type slugs.
parse_categories(string $category_slugs) : array<string|int, mixed>
Transactions can have any one of the category/type slugs:
-
deposit
-
withdrawal
-
move
Additionally, all
is used to refer to all three categories/types.
Note that these are not real taxonomies, just a post_meta on the posts of wallets_tx
type.
Parameters
- $category_slugs : string
-
Comma-separated list of category/type slugs.
Return values
array<string|int, mixed> —Parsed list of category/type slugs.
parse_tags()
parse_tags([string $tags = '' ]) : array<string|int, mixed>
Parameters
- $tags : string = ''
Return values
array<string|int, mixed> —parse_atts_for_currency()
Parses shortcode attributes to determine the currency specified, if any.
parse_atts_for_currency(array<string|int, mixed> &$atts) : void
Looks for these attributes in sequence: currency_id
, coingecko_id
, symbol
.
Parameters
- $atts : array<string|int, mixed>
-
The shortcode attruibutes.
Return values
void —parse_atts_for_user()
Parses shortcode attributes to determine the user specified, if any.
parse_atts_for_user(array<string|int, mixed> &$atts) : void
First checks for the user attribute. If it matches a login, email, or slug for a user,
it sets the \WP_User
object in $atts['user_data']
Alternatively, if the user_id is specified, then the user with that ID is loaded into user_data
.
Parameters
- $atts : array<string|int, mixed>
-
The shortcode attributes.
Tags
Return values
void —get_template_part()
Retrieves a template part for this plugin or its extensions.
get_template_part(string $slug[, string|null $name = null ][, bool $load = false ][, string $plugin_slug = 'wallets' ]) : string
Adapted from bbPress
Parameters
- $slug : string
-
The generic template part.
- $name : string|null = null
-
The specialized template part.
- $load : bool = false
-
Whether to include the template.
- $plugin_slug : string = 'wallets'
Tags
Return values
string —Full path to the template file.
locate_template()
locate_template(array<string|int, mixed> $template_names[, bool $load = false ][, string $plugin_slug = 'wallets' ]) : string|null
Parameters
- $template_names : array<string|int, mixed>
- $load : bool = false
- $plugin_slug : string = 'wallets'
Return values
string|null —load_transactions()
Takes an array of transaction post_ids and instantiates them into an array of Transaction objects.
load_transactions(array<string|int, mixed> $post_ids) : array<string|int, mixed>
If a transaction cannot be loaded due to Transaction::load() throwing (i.e. bad DB data), then it is skipped and the rest of the transactions will be loaded.
Parameters
- $post_ids : array<string|int, mixed>
-
The array of integer post_ids
Tags
Return values
array<string|int, mixed> —The array of Transaction objects.
get_transaction_by_txid()
Retrieves a transaction by its blockchain TXID.
get_transaction_by_txid(string $txid) : Transaction|null
Useful for checking for existing transactions on the plugin's ledger.
Parameters
- $txid : string
-
The blockchain TXID for the transaction we're looking for.
return Transaction|null The transaction found, or null if no transaction was found.
Return values
Transaction|null —get_deposit_transaction_by_txid_and_address()
Retrieves a deposit transaction by its TXID and address string.
get_deposit_transaction_by_txid_and_address(string $txid, string $address[, string|null $extra = null ]) : Transaction|null
Useful for checking for existing transactions on the plugin's ledger. Deposit transactions should be unique by TXID and address.
If the extra field is specified, it must also match.
Parameters
- $txid : string
-
The blockchain TXID for the transaction we're looking for.
- $address : string
-
The address string for the transaction we're looking for.
- $extra : string|null = null
-
Optionally a Payment ID, Memo, Destination tag, etc.
return Transaction|null The transaction found, or null if no transaction was found.
Return values
Transaction|null —get_pending_transactions_by_currency_and_category()
get_pending_transactions_by_currency_and_category(Currency $currency, string $category[, int $limit = -1 ]) : array<string|int, mixed>|null
Parameters
- $currency : Currency
- $category : string
- $limit : int = -1
Return values
array<string|int, mixed>|null —get_transactions()
Get transactions.
get_transactions([int|null $user_id = null ][, Currency|null $currency = null ][, array<string|int, mixed> $categories = ['all'] ][, array<string|int, mixed> $tags = [] ][, int|null $page = null ][, int|null $rows = null ][, int|null $offset = null ]) : array<string|int, mixed>|null
Parameters
- $user_id : int|null = null
-
Get txs of this user only.
- $currency : Currency|null = null
-
Look for transactions of this currency. If null, txs of all currencies are returned.
- $categories : array<string|int, mixed> = ['all']
-
Array can contain: 'deposit', 'withdrawal', 'move', 'all'.
- $tags : array<string|int, mixed> = []
-
Transactions found must have all these tags (this is an array of taxonomy slugs)
- $page : int|null = null
-
Used in conjunction with $rows for pagination.
- $rows : int|null = null
-
Number of txs to return. Can be used with $page, but if $offset is set it overrides $page.
- $offset : int|null = null
-
How many txs to skip for pagination. If set, $page is ignored.
Return values
array<string|int, mixed>|null —get_transactions_for_address()
get_transactions_for_address(Address $address) : array<string|int, mixed>|null
Parameters
- $address : Address
Return values
array<string|int, mixed>|null —get_executable_withdrawals()
get_executable_withdrawals(Currency $currency[, int $limit = -1 ]) : array<string|int, mixed>
Parameters
- $currency : Currency
- $limit : int = -1
Return values
array<string|int, mixed> —get_executable_moves()
get_executable_moves(mixed $currency[, mixed $limit = -1 ]) : mixed
Parameters
- $currency : mixed
- $limit : mixed = -1
Return values
mixed —get_transactions_older_than()
Gets transactions from the before times.
get_transactions_older_than(int $interval_days[, mixed $post_status = ['pending'] ]) : array<string|int, mixed>
Useful for the autocancel cron task. For time intervals over a month, it rounds to nearest month. Same for years.
Parameters
- $interval_days : int
-
How many days old the transaction should be at least.
- $post_status : mixed = ['pending']
Tags
Return values
array<string|int, mixed> —An array of Transaction objects.
get_transactions_newer_than()
Gets latest transactions.
get_transactions_newer_than(int $interval_days[, mixed $post_status = ['draft', 'pending', 'publish'] ]) : array<string|int, mixed>
Useful for the admin dashboard summaries For time intervals over a month, it rounds to nearest month. Same for years.
Parameters
- $interval_days : int
-
Up to how many days old the transaction should be.
- $post_status : mixed = ['draft', 'pending', 'publish']
Tags
Return values
array<string|int, mixed> —An array of Transaction objects.
get_transactions_by_time()
Gets transactions from the before times.
get_transactions_by_time(int $interval_days[, bool $before = true ][, array<string|int, mixed>|string $post_status = ['draft', 'pending', 'publish'] ]) : array<string|int, mixed>
Useful for the autocancel cron task. For time intervals over a month, it rounds to nearest month. Same for years.
Parameters
- $interval_days : int
-
How many days before now to set the pivot for comparing dates.
- $before : bool = true
-
True retrieves txs before the $interval_days, false retrieves txs after it.
- $post_status : array<string|int, mixed>|string = ['draft', 'pending', 'publish']
-
The post status or statuses to allow in query.
Tags
Return values
array<string|int, mixed> —An array of Transaction objects.
do_validate_pending_transactions()
do_validate_pending_transactions(string $nonce) : void
Parameters
- $nonce : string
Return values
void —get_tx_with_parent()
get_tx_with_parent(int $post_id) : Transaction|null
Parameters
- $post_id : int
Return values
Transaction|null —get_latest_fiat_withdrawal_by_user()
get_latest_fiat_withdrawal_by_user([int|null $user_id = null ]) : Transaction|null
Parameters
- $user_id : int|null = null
Return values
Transaction|null —fiat_deposit_exists_by_txid_currency()
fiat_deposit_exists_by_txid_currency(string $txid, Currency $currency) : bool
Parameters
- $txid : string
- $currency : Currency
Return values
bool —get_or_make_transaction()
Check a transaction object to see if it already exists on the db as a post and if not, create it.
get_or_make_transaction(Transaction $tx[, bool $notify = true ]) : Transaction
The post_id and status are not compared. Everything else is. Trashed transactions are not counted.
Parameters
- $tx : Transaction
-
An address to look for.
- $notify : bool = true
-
Whether to notify the user by email. Default true.
Tags
Return values
Transaction —The existing transaction or newly created transaction.
get_todays_withdrawal_counters()
get_todays_withdrawal_counters(int $user_id[, mixed $current_day = '' ]) : array<string|int, mixed>
Parameters
- $user_id : int
- $current_day : mixed = ''
Return values
array<string|int, mixed> —increment_todays_withdrawal_counters()
increment_todays_withdrawal_counters(Transaction $wd[, string|null $current_day = null ]) : void
Parameters
- $wd : Transaction
- $current_day : string|null = null
Return values
void —get_next_currency_with_pending_withdrawals()
Get next currency with pending withdrawals
get_next_currency_with_pending_withdrawals() : Currency|null
All currencies with enabled unlocked wallets are processed, one currency per cron run, with no starvation. Currencies with no pending withdrawals are skipped. If no eligible currencies have pending withdrawals, the loop ends.
Return values
Currency|null —get_possible_transaction_counterparts()
Get possible counterpart transactions to specified transaction.
get_possible_transaction_counterparts(Transaction $tx) : array<string|int, mixed>
Retrieve all transactions that can possibly be set to be the counterpart to the sepcified transaction. These must be move transactions. The amounts between counterpart transactions must have opposing signs (+/-) and they must be of the same currency.
Will not retrieve more than 1000 transactions since it doesn't make sense to display this many transactions as a dropdown.
Parameters
- $tx : Transaction
Return values
array<string|int, mixed> —(id,Title) touples
resolve_recipient()
Resolves a user from a string that may denote a username, login name, or email.
resolve_recipient(string $recipient) : WP_User|null
Useful for sending internal transactions.
Parameters
- $recipient : string
-
A string that may denote a user by their username, login name, or email.
Return values
WP_User|null —The user found, or null if not found.
get_move_recipient_suggestions()
Gets a list of user names that the specified user has previously sent internal transfers (moves) to.
get_move_recipient_suggestions([int|null $user_id = null ]) : array<string|int, mixed>
Parameters
- $user_id : int|null = null
-
The sender's user id or null for current user.
Return values
array<string|int, mixed> —A list of user names.
create_random_nonce()
Generate a random string.
create_random_nonce(int $length) : string
Uses the cryptographically secure function random_int.
Parameters
- $length : int
-
The desired length of the string.
Tags
Return values
string —The generated string.
get_legacy_api_key()
Get a user's API key for the legacy JSON-API v3 (deprecated!).
get_legacy_api_key([int|null $user_id = null ]) : string
Parameters
- $user_id : int|null = null
-
The user whose API key to generate or retrieve.
Tags
Return values
string —The user's API key, which is a HEX string of 32 bytes.
generate_random_bytes()
Returns a hex-encoded string of API_KEY_BYTES random bytes.
generate_random_bytes([int $bytes_count = 32 ]) : string
Useful for generating API keys for the legacy JSON-API v3. The bytes are generated as securely as possible on the platform.
Parameters
- $bytes_count : int = 32
-
How many random bytes to generate.
Return values
string —Hex-encoded string of the generated random bytes.
get_ids_for_users_with_cap()
Returns array of all users WITH the specified capability.
get_ids_for_users_with_cap(string $capability) : array<string|int, int>
Useful for retrieving users with has_wallets, etc.
Parameters
- $capability : string
-
The capability to check for.
Return values
array<string|int, int> —Array of user_ids.
get_ids_for_users_without_cap()
Returns array of all users WITHOUT the specified capability.
get_ids_for_users_without_cap(string $capability) : array<string|int, int>
Useful for retrieving users with has_wallets, etc.
Parameters
- $capability : string
-
The capability to check for.
Return values
array<string|int, int> —Array of user_ids.
load_wallets()
Takes an array of wallet post_ids and instantiates them into an array of Wallet objects.
load_wallets(array<string|int, mixed> $post_ids) : array<string|int, mixed>
If a wallet cannot be loaded due to Wallet::load() throwing, then it is skipped and the rest of the wallets will be loaded.
Parameters
- $post_ids : array<string|int, mixed>
-
The array of integer post_ids
Tags
Return values
array<string|int, mixed> —The array of Wallet objects.
get_wallets()
Retrieves all wallet posts that can be instantiated.
get_wallets() : array<string|int, Wallet>
Return values
array<string|int, Wallet> —The Wallet objects representing posts of the custom post type wallets_wallet
.
get_ids_of_enabled_wallets()
Get the IDs of all enabled wallets.
get_ids_of_enabled_wallets() : array<string|int, mixed>
Wallets are enabled if:
- the admin has ticked the "enabled" box
- the admin has assigned a wallet adapter to the wallet
Return values
array<string|int, mixed> —get_wallet_adapter_class_names()
Get the class names of all available declared adapters.
get_wallet_adapter_class_names() : array<string|int, mixed>
The class names of any concrete subclasses of Wallet_Adapter are returned.
Tags
Return values
array<string|int, mixed> —The names of the adapter classes.