cypherpoker.js icon indicating copy to clipboard operation
cypherpoker.js copied to clipboard

Update web client to support Monero / multiple cryptocurrencies

Open monicanagent opened this issue 6 years ago • 0 comments

This task is preceded by issue #53

Overview

Adding support for a new cryptocurrency such as Monero in the CypherPoker.JS web client is less complicated than adding support to the Services API. Most of the functionality supporting the cryptocurrency is encapsulated by the Services API; the client typically just needs to send cryptocurrency-specific information for processing by the API.

Update Templates

Before updating the templates you may want to read a little more about them and the metatag system that they user: https://github.com/monicanagent/cypherpoker.js/wiki/Customizing-the-CypherPoker.JS-User-Interface

Once you feel comfortable, update the accountCreate.html template to include the new cryptocurrency and sub-types: https://github.com/monicanagent/cypherpoker.js/blob/1a4e605e2dbbcf394e2adaf3a2d428a67ae125e8/src/web/templates/accountCreate.html#L4-L7

The value attributes will be subsequently carried through in all transactions so be careful with spelling. The format for each <option value is "cryptocurrency/network". For example, "bitcoin/test3" is the Bitcoin cryptocurrency using Testnet3 (the current Bitcoin testnet).

Next, update the help.html template to include information in the various help sections about the new cryptocurrency. While formatting, keep in mind that most of this content is displayed within the dialog container of the main index.html file:

https://github.com/monicanagent/cypherpoker.js/blob/1a4e605e2dbbcf394e2adaf3a2d428a67ae125e8/src/web/index.html#L37-L40

Finally, update the postCashout.html template to include information for players on the new cryptocurrency after they cash out:

https://github.com/monicanagent/cypherpoker.js/blob/1a4e605e2dbbcf394e2adaf3a2d428a67ae125e8/src/web/templates/postCashout.html#L1-L26

The above template list is not exhaustive. There may be other templates that may mention "satoshis" or "Bitcoin" which may need to be updated. If this is the case, the best approach to use would be to replace any such hard-coded text with metatags and to dynamically replace them when displaying the content.

Functional Updates

The majority of functional updates have to do with cryptocurrency formatting. For example, there are a number of places in the CypherPokerUI class that use hard-coded unit conversions such as:

https://github.com/monicanagent/cypherpoker.js/blob/1a4e605e2dbbcf394e2adaf3a2d428a67ae125e8/src/web/scripts/CypherPokerUI.js#L689-L691

A search for "bitcoin" and "satoshi" should reveal most of these.

Code comments for CypherPokerAccount should be updated to reflect any new changes. For example:

https://github.com/monicanagent/cypherpoker.js/blob/1a4e605e2dbbcf394e2adaf3a2d428a67ae125e8/src/web/scripts/CypherPokerAccount.js#L284-L297

Additional information, including code documentation and formatting, can be found here: #48

monicanagent avatar Mar 21 '19 21:03 monicanagent