* Removing submodule * Fixing UI dependency structure. * Merging RS and JS package * Updating release script to push also rs files * fix merge gone wrong * Fixing compilation |
||
|---|---|---|
| .. | ||
| src | ||
| build.rs | ||
| Cargo.toml | ||
| README.md | ||
Parity Dapps (JS-glue)
Code generator to simplify creating a built-in Parity Dapp
How to create new builtin Dapp.
-
Clone this repository.
$ git clone https://github.com/ethcore/parity.git -
Create a new directory for your Dapp. (
./myapp)$ mkdir -p ./parity/dapps/myapp/src/web -
Copy your frontend files to
./dapps/myapp/src/web(bundled ones)$ cp -r ./myapp-src/* ./parity/dapps/myapp/src/web -
Instead of creating
web3in your app. Load (as the first script tag inhead):<script src="/parity-utils/inject.js"></script>The
inject.jsscript will create globalweb3instance with proper provider that should be used by your dapp. -
Create
./parity/dapps/myapp/Cargo.tomlwith you apps details. See example here: parity-status Cargo.toml.$ git clone https://github.com/ethcore/parity-ui.git $ cd ./parity-ui/ $ cp ./home/Cargo.toml ../parity/dapps/myapp/Cargo.toml $ cp ./home/build.rs ../parity/dapps/myapp/build.rs $ cp ./home/src/lib.rs ../parity/dapps/myapp/src/lib.rs $ cp ./home/src/lib.rs.in ../parity/dapps/myapp/src/lib.rs.in # And edit the details of your app $ vim ../parity/dapps/myapp/Cargo.toml # Edit the details $ vim ./parity/dapps/myapp/src/lib.rs.in # Edit the details
How to include your Dapp into Parity?
-
Edit
dapps/Cargo.tomland add dependency to your application (it can be optional)# Use git repo and version parity-dapps-myapp = { path="./myapp" } -
Edit
dapps/src/apps.rsand add your application toall_pages(if it's optional you need to specify two functions - seeparity-dapps-walletexample) -
Compile parity.
$ cargo build --release # While inside `parity` -
Commit the results.
$ git add myapp && git commit -am "My first Parity Dapp".