A JS interface to WindingTree's Ethereum smart-contracts for Hotels.
npm install @afklblockchain/wt-js-libs # or git clone https://github.com/windingtree/wt-js-libs nvm install npm install
For more examples, see
test/usage.spec.js file. The public interface of this library
should always be the same regardless of what kind of implementation is used
under the hood.
The current documentation can be rendered by running
npm run docs
Off-chain data adapters
- In memory - Example basic implementation which is not very useful, but should be enough for quick hacking or testing
- Swarm - Uses Ethereum Swarm for off-chain storage.
- HTTPS - Retrieves data from arbitrary HTTPS locations.
Developing your own off-chain data adapter
For insipiration, you can have a look at in-memory adapter, if you'd like to create it all by yourself, here's what you need.
- Your package has to implement a simple interface that provides ways to store, update and retrieve data.
- You can also choose how your plugin is instantiated and whether you need any initialization options. These will be passed whenever an instance is created.
- Off Chain data adapters are used in two places
StoragePointer- The adapter is used to download off-chain data in there
OffChainDataClient- It is responsible for proper instantiation of all off-chain data adapters.
The interface is subject to change as we go along and find out what other types
of storages might require - be it a signature verification, data signing and other non-common
utilities. The only actual method used in the wt-js-libs internals is
download right now.
To run unit tests, run