Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDP committed Apr 24, 2018
1 parent bf573ff commit c7376aa
Show file tree
Hide file tree
Showing 51 changed files with 165 additions and 14,898 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "rust"]
path = rust
url = https://github.com/input-output-hk/rust-cardano-crypto
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ script:
- cargo test --verbose --all
matrix:
include:
- rust: stable
- rust: beta
- rust: nightly
- rust: nightly
env: NODE_JS_GLUE
before_script:
- rustup target add wasm32-unknown-unknown --toolchain nightly
- nvm install 8.2.1
Expand Down
8 changes: 0 additions & 8 deletions Cargo.toml

This file was deleted.

25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
cardano rust / wasm experiments
===============================
# cardano wasm binding for JavaScript

## Installation

Installation
------------
```
# install rustup
curl https://sh.rustup.rs -sSf | sh
# use nightly version
rustup install nightly
rustup default nightly
# with wasm32 target
rustup target add wasm32-unknown-unknown --toolchain nightly
```

Build the Library
-----------------
## Build the Library

To Compile the rust crypto to a Web Assembly (WASM) module and build JS library run the `./build` script.
(only necessary if you want to build locally)

Run the Example
-------------------
## Run the Example

There is a simple example application in `js-example` that can be run to test some of the features.

### installation
Expand All @@ -31,26 +27,31 @@ within `js-example/` folder
3. `npm run install`

### Building

within `js-example/` run `npm run build`

### Running

open `js-example/index.html` in any browser

Use the Crypto Library
----------------------
## Use the Crypto Library

### Install

You can either build the library locally on your machine
to test the latest version with your project or install via NPM.

#### Install locally:

in the root of this repo: `npm link`
in the root of your project: `npm link rust-cardano-crypto`

#### Install via NPM:

in the root of your project: `npm install rust-cardano-crypto`

### Import the API in Your Code

```js
// Import like this:
import CardanoCrypto from 'rust-cardano-crypto'
Expand Down
3 changes: 3 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/sh
set +e
git submodule update --init --recursive
pushd wallet-wasm
cargo +nightly build --target wasm32-unknown-unknown --release --verbose
popd
npm run build
2 changes: 1 addition & 1 deletion js/RustModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import loadModule from '../target/wasm32-unknown-unknown/release/wallet_wasm.wasm';
import loadModule from '../wallet-wasm/target/wasm32-unknown-unknown/release/wallet_wasm.wasm';

let Module = null;

Expand Down
Loading

0 comments on commit c7376aa

Please sign in to comment.