💱 Easy crypto swapping UI, plus theme-able templates for the Exchange extension

Latest Exchange extension: Easily swap currencies with a new interface. Theme-able templates. And more!

Version 1.2.0 of the Exchange extension to Bitcoin and Altcoin Wallets for WordPress introduces a few big and exciting changes. Read on if you are using the extension!

New easier crypto swapping UI

The Exchange extension allows you to define markets, where users can place bids and asks either as limit orders, or as instant market orders. Up to now the user had to pick the relevant market, and then choose between the buy or sell UI, and between the market or limit order UI.

I have received several requests for a UI that reminds more of platforms such as ShapeShift or Changelly. This is useful to people who wish to exchange cryptocurrencies near the current fair market value, but without any additional complexity.

Since version 1.2.0, it is now possible to use the new [wallets_exchange_market_order] shortcode:

The UI for the [wallets_exchange_market_order] shortcode.

The UI lets the user pick the source and destination currencies from a list. For this reason, the admin must create markets between all available currencies. In the example shown, the user is spending USD to buy Bitcoin. This requires an active market for either USD_BTC, or for BTC_USD. If no such market is defined, the exchange will not be possible, and the user will be shown an error message.

The UI will estimate the currency that is to be received by the user. This is done by traversing the existing limit orders in the order-book, and also takes fees into account.

Instant market orders can only be executed if enough limit orders exist on the order-book. If there is insufficient liquidity for the amount that the user wishes to exchange, then the amount to be received will be shown as n/a and the exchange will not be possible.

Theme templates

Following the recent 5.0.0 release of the parent plugin, Bitcoin and Altcoin Wallets, a similar change is performed for the Exchange extension. All UI markup is now theme-able templates. This means that:

  • The wallets_exchange_views_dir filter and views_dir attribute no longer work. Using them writes a “doing_it_wrong” warning in your debug logs, if you have them enabled. If you are using these and you update to the latest version of the plugin, the shortcode UIs will revert to the default markup.
  • The default templates now live in wp-content/plugins/wallets-exchange/templates. This is a more standard location to put templates in.
  • The file names no longer depend on sub-directories. Instead, the naming convention follows the WordPress logic of generic and specialized parts. For example: The [wallets_exchange_market template="horizontal-dropdown"] shortcode would previously load wp-content/plugins/wallets-exchange/includes/market/horizontal-dropdown.php. Now the same shortcode will load the file wp-content/plugins/wallets-exchange/templates/market-horizontal-dropdown.php.
  • It is now possible to copy template files into your theme. For example, if you were to use the [wallets_exchange_market template="horizontal-dropdown"] shortcode, and the file wp-content/themes/YOUR-THEME/templates/wallets-exchange/market-horizontal-dropdown.php exists, it will take precedence over the plugin’s template.
  • You only have to copy the files that you need to change. Any other UIs will fall back to using the templates provided in the plugin.
  • It is also possible for child themes to override templates in the same way. Just place the files under wp-content/themes/YOUR-CHILD-THEME/templates/wallets-exchange. Child themes take precedence over parent themes.
  • The documentation has been updated to reflect these changes.

Customizer settings

Many of the UIs styling effects are inherited from the Customizer settings of the parent plugin. With version 1.2.0, the Exchange extension introduces its own Customizer subsection. It is now possible to configure the exact hue of the red and green colors used to indicate bids and asks.

Picking the red and green colors in Customizer.

Changelog

The full list of changes is included with the release, in the file CHANGELOG.html.

Feedback and support

If you have any questions or comments, please post them at the support forum for the Exchange extension, or email me.

Comments:0

Leave a Reply

Your email address will not be published. Required fields are marked *