3 - Create Coin Module
Organization
All CoinModules are located in libs/coin-modules.
A CoinModule has the following directories/modules:
api(optional): interface for exposing the CoinModule to a backend service (cf. (TODO))bridge: implementation of Bridges interface (cf. Bridge)logic: contains all core logic of the blockchain. The code here is agnostic of all external interface (i.e. Bridge or Api) and relies only on external libs andnetworkdirectorynetwork: communication logic with explorer/index/node (cf. How to wrap you api)signer: defines the interface definition to the Embedded App and the logic to retrieve derive address
Some architectural decision
For consistency among all the CoinModule, please consider the following principles:
- Always use an
index.tsfile in each directory. The goal is to “control” what is exposed from the module and allow to be used from outside. - The
index.tsin the root of the CoinModule should only expose:- Bridge interface
- Bridge type
- bot test
- …
- Inside CoinModule, the dependency between module is only one direction (avoid cyclic dependency or mutual ones). Example: From the
logicmodule, it is forbidden to use some functions declared inbridge.
…
The following steps (3-A to 3-D), your work will have some impact on the Ledger Wallet repository.
Therefore, make sure you have setup your environment to work with ledger-live.