5 stable releases

Uses old Rust 2015

1.9.1 Nov 10, 2017
1.9.0 Oct 16, 2017
1.8.0 Sep 12, 2017
1.7.0 Mar 21, 2017
1.4.0 Oct 20, 2016

#41 in #myapp

Download history 18/week @ 2023-11-02 20/week @ 2023-11-09 17/week @ 2023-11-16 22/week @ 2023-11-23 28/week @ 2023-11-30 19/week @ 2023-12-07 22/week @ 2023-12-14 26/week @ 2023-12-21 9/week @ 2023-12-28 13/week @ 2024-01-04 17/week @ 2024-01-11 25/week @ 2024-01-18 17/week @ 2024-01-25 13/week @ 2024-02-01 19/week @ 2024-02-08 60/week @ 2024-02-15

112 downloads per month

GPL-3.0 license

17KB
297 lines

Parity Dapps (JS-glue)

Code generator to simplify creating a built-in Parity Dapp

How to create new builtin Dapp.

  1. Clone this repository.

    $ git clone https://github.com/paritytech/parity.git
    
  2. Create a new directory for your Dapp. (./myapp)

    $ mkdir -p ./parity/dapps/myapp/src/web
    
  3. Copy your frontend files to ./dapps/myapp/src/web (bundled ones)

    $ cp -r ./myapp-src/* ./parity/dapps/myapp/src/web
    
  4. Instead of creating web3 in your app. Load (as the first script tag in head):

    <script src="/parity-utils/inject.js"></script>
    

    The inject.js script will create global web3 instance with proper provider that should be used by your dapp.

  5. Create ./parity/dapps/myapp/Cargo.toml with you apps details. See example here: parity-status Cargo.toml.

    $ git clone https://github.com/paritytech/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?

  1. Edit dapps/Cargo.toml and add dependency to your application (it can be optional)

    # Use git repo and version
    parity-dapps-myapp = { path="./myapp" }
    
  2. Edit dapps/src/apps.rs and add your application to all_pages (if it's optional you need to specify two functions - see parity-dapps-wallet example)

  3. Compile parity.

    $ cargo build --release # While inside `parity`
    
  4. Commit the results.

    $ git add myapp && git commit -am "My first Parity Dapp".
    

Dependencies

~0.5–1.6MB
~44K SLoC