Swig is needed to wrap the comipiled Libwally C++ code to provide an interface for Java. You can install Swig following the instructions here: http://swig.org/
git clone https://github.com/ElementsProject/libwally-core
cd libwally-core
./tools/autogen.sh
./configure --enable-elements --enable-swig-java --enable-debug
make
make check
If you need to later delete the generate files you can run:
./tools/cleanup.sh
... before then running autogen, configure, make etc.
The Java tests and examples are located in libwally-core/src/swig_java/src/com/blockstream/test
You can run each test individually by moving to the src folder:
cd libwally-core/src
And then calling the test while setting the path to the Wally jar file:
LD_LIBRARY_PATH=.libs java -Djava.library.path=.libs -classpath swig_java/src com.blockstream.test.test_tx
If you make you own test/examples within the test folder, you can compile them:
javac swig_java/src/com/blockstream/test/your_test.java
And then run them:
LD_LIBRARY_PATH=.libs java -Djava.library.path=.libs -classpath swig_java/src com.blockstream.test.your_test
The src/swig_java/src/com/blockstream/libwally/Wally.java
fle contains the Java interface definitions.
Existing examples:
- test_assets.java
- test_bip32.java
- test_mnemonic.java
- test_tx.java