sudo apt-get install libboost-all-dev
sudo apt-get -y install build-essential cmake
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install doxygen python-pydot python-pydot-ng graphviz
make deps
This is work in progress, so installation is only possible from the source code. Here are instructions how to compile the library and run examples:
git clone https://github.com/usetech-llc/polkadot_api_cpp
cd polkadot_api_cpp
cmake .
make
sudo make install
make clip
Connect example will establish WebSocket connection to the polkadot node and read and output basic information.
bin/clip connect
Balance example will establish WebSocket connection and read and output address balance in DOTs.
bin/clip balance <your polkadot address>
make test
#include <polkadotcpp/polkadot.h>
/usr/lib/polkadotcpp/libpolkacpp.a
Parity node URL is the only required parameter, though URL must include port. Example:
string parity_node_url("wss://poc3-rpc.polkadot.io:443/");
CWebSocketClient ws(parity_node_url);
This call will establish connection and start message thread:
ws.connect();
The websocket subscriptions will provide data via the callback. In order to subscribe to an endpoint, call:
ws.subscribe(endpoint);
In order to stop subscription, call:
ws.unsubscribe(endpoint);
When connection is not needed anymore, call
ws.disconnect();
The data is returned as C structures. Documentation TBD.