Developer’s guidelines
This document provides guidelines for developers who want to contribute to the XChainPy2 library.
Adding a new chain client
If you want to add a new chain to the XChainPy2 library, follow the steps below:
Create a new folder in the
packages/xchainpy_CHAINdirectory with the name of the chain you want to add.Add LICENSE, README.md. A good point to start is to copy the files from any other client folder.
Copy and edit
pyproject.tomlChange the
namefield toxchainpy_CHAINChange the
descriptionfield to something likeXChainPy2 client for the CHAIN chainFill
keywordsFill
dependencieswith the required dependencies for the chain client
Create a new folder
packages/xchainpy_CHAIN/xchainpy2_CHAINWrite the chain client code in the new folder (yeah, that’s the hard part)
Add
__init__.pyfile that imports all the necessary classes and functionsWrite some tests in the
testsfolderGo to
docs/index.mdand add mention of the new chain client (you will easily find where to add it)Go to
docs/conf.pyand add the newly added package to the list ofpackagesGo to
docs/requirements.txtand add the package to the list ofpackages/xchainpy_CHAINAt the end, run
make publishto publish the package.Go to
packages/xchainpy_wallet/xchainpy2_wallet/detect_clients.pyand add a piece of code like this
try:
from xchainpy2_Chain import YourChainClient
except ImportError:
YourChainClient = NoClient
Also, there you a reference to the client class to
CLIENT_CLASSESdict.