-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename the
light-client
to web-client
Rename the `light-client` crate to `web-client` and re-write the client code to be `wasm` friendly.
- Loading branch information
Showing
9 changed files
with
161 additions
and
191 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Nimiq web client | ||
|
||
This client is a very light client that only includes the necessary dependencies and constructs | ||
to compile a client to WebAssembly and to run it in a web browser. This is a web-client intended | ||
to be used in web browsers only (no WASI support). Although it can be built for other targets, | ||
it will panic if it is executed outside a web browser. | ||
|
||
|
||
To build the client, the recommended way is to use `wasm-pack`. This tool can be obtained using: | ||
|
||
``` | ||
cargo install wasm-pack | ||
``` | ||
|
||
Once installed, the client can be built using: | ||
|
||
``` | ||
wasm-pack build --target web | ||
``` | ||
|
||
The above command will compile the Rust code to WebAssembly and generate the corresponding JS | ||
bindings required to run the client in a web browser. | ||
|
||
After the client has been built, the root directory of this crate can be served with a web server | ||
(e.g. `python3 -m http.server`) and then the `index.html` file can be loaded from the server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Nimiq Web client example</title> | ||
</head> | ||
<body> | ||
<script type="module"> | ||
import init, { nimiq_web_client } from "./pkg/nimiq_web_client.js"; | ||
init().then(() => { | ||
nimiq_web_client(); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
|
Oops, something went wrong.