Please be aware and take note that my primary focus is on expanding the core functionality of this wallet and not on adding altcoins. However, for those wishing to add a specific altcoin for personal use, this guide was created so that you may fork off in a proper fashion. If you have any questions I'm always happy to help so don't hesitate to reach out.
Feel free to use the following commit as a reference to what changes need to be made: https://github.com/coreyphillips/moonshine/commit/0eeecdeea7a9004bacf6db369cec61bc2c930962
- peers.json
- /src/utils/networks.js
- src/utils/walletApi.js
- nodejs-assets/nodejs-project/api.js
- /src/assets
- TransactionDetail.js
Step 1: Modify peers.json in electrum-host-parse
- Add the necessary servers to the /fixture/peers.json file. This server list is used to kickstart the peerlist for the wallet.
Step 2: Modify networks.js & Add New Coin Image To /src/assets
- Add the necessary network params to the
networks
object in /src/utils/networks.js. - Using the same key that you used in the
networks
object, add the coin to the zeroValueItems & arrayTypeItems objects. - Using the same key, add the coin to
defaultWalletShape.keyDerivationPath
with a default value of "84". - Using the same key, add the coin to
defaultWalletShape.addressType
with a default value of "bech32". - Using the same key, add the coin to
defaultWalletShape.addressType
with a default value of "bech32". - Add the coin's image to /src/assets
- Add the coin to the switch statement in
getCoinImage
and ensure it matches up with and requires the new image that was just added. - Add the coin to the switch statement in
getCoinData
. This will ensure the app displays the correct cryptoUnit label for the selected coin.
Step 3 (Optional): Modify walletApi.js
- Add the necessary api to push a rawTx for the new coin to the
fallbackBroadcastTransaction
method. In the event that a transaction fails to send via Electrum, this api will be used to push the rawTx instead.
Step 4: Modify nodejs-assets/nodejs-project/api.js
- All you'll need to do here is add the new coin to the
this.mainClient
,this.peer
&this.peers
objects.
Step 5: Modify TransactionDetail.js
- Locate the
openAddress
method and add the proper url of a block explorer to view the details of an address for the new coin. - Locate the
openMessage
method and add the proper url of a block explorer for the new coin to view any OP_RETURN message in a transaction. - Locate the
openBlock
method and add the proper url of a block explorer to view a block for the new coin.
Step 6: Modify helpers.js
- Locate the
openTxId
method and add the proper url of a block explorer to view a transaction for the new coin.
Note: An easy way to ensure you've made all of the appropriate modifications is to search for "litecoinTestnet". If the new coin is not listed or detailed next to one of the "litecoinTestnet" matches you most likely need to add the new coin there as well.