Bitcoin and Altcoin Wallets 6.2.4

Bank_Fiat_Adapter extends Fiat_Adapter
in package

The bank fiat currency adapter defines fiat currencies that are deposited/withdrawn via bank transfers.

This adapter does not communicate with any wallets. It emails the admins who then process bank transfers manually.

Tags
since
6.0.0

Introduced.

Table of Contents

$settings  : mixed
$settings_schema  : mixed
$wallet  : mixed
__construct()  : mixed
__get()  : mixed|null
Get a setting automagically
__set()  : mixed
do_cron()  : void
Do periodic tasks related to this adapter.
do_description_text()  : void
do_move()  : bool
Perform additional tasks before an internal debit transaction.
do_withdrawals()  : void
Perform a batch of withdrawals, possibly in one transaction.
get_block_height()  : int
get_extra_field_name()  : null|string
Return the extra field for addresses associated with this currency, if any.
get_hot_available_balance()  : int
Retrieve the hot wallet balance that is available for immediate use.
get_hot_balance()  : int
get_hot_locked_balance()  : int
get_new_address()  : Address
get_settings_schema()  : array<string|int, array<string|int, mixed>>
Return the settings schema for this adapter.
get_wallet_version()  : string
is_locked()  : bool
register()  : mixed
do_deposit()  : int|null
Process a potential deposit transaction.
validate_tcp_ip_address()  : bool
Validate an IP address.

Properties

Methods

__get()

Get a setting automagically

public __get(string $id) : mixed|null
Parameters
$id : string

The ID of the setting.

Return values
mixed|null

The setting's value, or the setting's default value, or NULL if the setting was not found.

__set()

public __set(mixed $id, mixed $value) : mixed
Parameters
$id : mixed
$value : mixed
Return values
mixed

do_cron()

Do periodic tasks related to this adapter.

public do_cron([callable $log = null ]) : void

The plugin will call this periodically. Adapters can optionally perform arbitrary periodic tasks, as needed. Add here any housekeeping tasks specific to the type of wallet that this adapter connects to.

Parameters
$log : callable = null
Tags
since
6.0.0

Introduced.

Return values
void

do_move()

Perform additional tasks before an internal debit transaction.

public do_move(Transaction $debit) : bool

Most adapters will NOT need to override this.

Every time an internal transfer is executed, the corresponding adapter is notified first. If the adapter returns false, then the transaction will be marked with "failed" status. The adapter can also set an error message in the transaction:

	$debit->error = 'I do not like this tranasction!';

The adapter can get the corresponding credit transaction with:

	$credit = $debit->get_other_tx();
Parameters
$debit : Transaction

The debit transaction (the one that removes balance from the sender).

Return values
bool

Whether the internal transfer should proceed.

do_withdrawals()

Perform a batch of withdrawals, possibly in one transaction.

public do_withdrawals(array<string|int, Transaction$withdrawals) : void

The method takes an array of Transactions and executes them. The method sets the following data into the transactions before returning them:

  • actual fees paid
  • TXID
  • block height

The Transactions passed must all be of the same currency. The adapter does not have to be able to cater to different currencies in one call. Subclasses can call this parent implementation to perform these checks, before proceeding to withdraw a batch of transactions.

Parameters
$withdrawals : array<string|int, Transaction>

Array of transactions to process. The transactions may be modified.

Tags
throws
InvalidArgumentException

If not all transactions are withdrawals or of the same currency.

since
6.0.0

Introduced.

Return values
void

get_extra_field_name()

Return the extra field for addresses associated with this currency, if any.

public get_extra_field_name([Currency $currency = null ]) : null|string

For example: Destination Tag, Payment ID, Memo, etc.

Parameters
$currency : Currency = null

The currency to query for. Useful only for adapters to multi-currency wallets.

Tags
since
6.0.0

Introduced.

Return values
null|string

The name of the field, or null if the field is not used.

get_hot_available_balance()

Retrieve the hot wallet balance that is available for immediate use.

public get_hot_available_balance([Currency|null $currency = null ]) : int

Available balance excludes any funds that are not mature. Immature funds are those that originate from transaction that have a low confimation count, or any funds that are mined too recently, or locked in other pending withdrawals in the wallet.

Parameters
$currency : Currency|null = null

If the wallet supports multiple currencies, pass the desired currency here.

Tags
since
6.0.0

Introduced.

Return values
int

The available balance as an integer.

get_settings_schema()

Return the settings schema for this adapter.

public final get_settings_schema() : array<string|int, array<string|int, mixed>>

This schema can be used to render input form fields in the wallets-wallet metaboxes.

Tags
since
6.0.0

Introduced.

Return values
array<string|int, array<string|int, mixed>>

The schema is an array of arrays with the following fields each: id, name, type, description.

do_deposit()

Process a potential deposit transaction.

protected final do_deposit( $potential_deposit) : int|null

This takes a Transaction object that is still in memory and looks up the deposit addresses to see if it corresponds to a user address. If the deposit concerns an existing user, the deposit is stored to the DB and the address's action slug is triggered with the transaction data as its first argument. Existing deposits are not re-created.

Concrete implementations of this abstact class must call this method to notify the plugin of any potential deposits. Since the adapter does not know which deposits correspond to users, it can notify the plugin about all potential deposits. The plugin will discard any invalid deposits.

Parameters
$potential_deposit :

A Transaction that does not yet have a user assigned to it and is not saved to the DB.

Return values
int|null

The Transaction post_id or null if the Transaction is of no interest to us/was not saved.

validate_tcp_ip_address()

Validate an IP address.

protected validate_tcp_ip_address(string $address) : bool
Parameters
$address : string
Tags
throws
InvalidArgumentException

If the IP address is not valid.

Return values
bool

Search results