bin | ||
configs | ||
dist | ||
docs | ||
external | ||
src | ||
.gitignore | ||
.gitmodules | ||
.project | ||
CMakeLists.txt | ||
donate.png | ||
index.js | ||
LICENSE.txt | ||
package-lock.json | ||
package.json | ||
README.md | ||
todo.txt | ||
wasm_exception_whitelist.txt | ||
webpack.base.js | ||
webpack.tests.js | ||
webpack.worker.js |
townforge-wasm
Builds townforge as a wasm for the browser.
Building WebAssembly binaries from source
This project uses WebAssembly to package and execute Townforge's source code for use in a browser.
Compiled WebAssembly binaries are committed to ./dist for convenience, but these files can be built independently from source code:
- Install and activate emscripten.
- Clone emscripten repository:
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull && ./emsdk install latest-upstream && ./emsdk activate latest-upstream && source ./emsdk_env.sh
export EMSCRIPTEN=path/to/emsdk/upstream/emscripten
(change for your system)
- Clone emscripten repository:
- Clone townforge-wasm's repository:
git clone https://github.com/woodser/townforge-wasm.git
cd townforge-wasm
./bin/update_submodules.sh
- Modify ./external/monero-cpp/external/townforge/src/crypto/wallet/CMakeLists.txt from
set(MONERO_WALLET_CRYPTO_LIBRARY "auto" ...
toset(MONERO_WALLET_CRYPTO_LIBRARY "cn" ...
. ./bin/build_all.sh
(install townforge dependencies as needed for your system)
Running tests
- Clone the project repository:
git clone https://github.com/woodser/townforge-wasm.git
cd townforge-wasm
- Start RPC servers:
- Download and install Monero CLI.
- Start monero-daemon-rpc, e.g.:
./monerod --stagenet
(or use a remote daemon). - Start monero-wallet-rpc, e.g.:
./monero-wallet-rpc --daemon-address http://localhost:38081 --stagenet --rpc-bind-port 38084 --rpc-login rpc_user:abc123 --wallet-dir ./
- Configure the appropriate RPC endpoints, authentication, and other settings in TestUtils.js (e.g.
WALLET_RPC_CONFIG
andDAEMON_RPC_CONFIG
).
Running tests in Node.js
- Run all tests:
npm test
- Run tests by their description, e.g.:
npm run test -- --grep "Can get transactions"
Running tests in a browser
- Start monero-wallet-rpc servers used by tests:
./bin/start_wallet_rpc_test_servers.sh
- In another terminal, build browser tests:
./bin/build_browser_tests.sh
- Access http://localhost:8080/tests.html in a browser to run all tests
License
This project is licensed under MIT.