subspace/examples/redux/README.md

48 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2019-10-21 12:56:38 +00:00
subspace - redux example
2019-09-05 01:41:07 +00:00
===
Simple application that shows how to dispatch a redux action from an observable. This app will deploy a test contract to **Ganache**.
For using Subspace with `react` and `redux`, please check `examples/react-redux` to see a practical example
2019-09-05 01:41:07 +00:00
## Requirements
- `ganache-cli`
- `yarn` or `npm` installed.
## Install
2020-03-08 13:29:41 +00:00
In the root folder, install, build and link the packages with `yarn` or `npm`
2019-09-05 01:41:07 +00:00
```
2019-10-21 12:55:20 +00:00
yarn
2020-03-08 13:29:41 +00:00
yarn bootstrap
yarn link --cwd packages/core
2019-09-05 01:41:07 +00:00
```
Then in the current folder link `@embarklabs/subspace`, and install the packages
2019-09-05 01:41:07 +00:00
```
yarn link "@embarklabs/subspace"
2019-09-05 01:41:07 +00:00
yarn
```
## Usage
In a terminal execute
```
ganache-cli
```
In a different session, execute
```
node -r esm src/index.js
```
You'll see in the console how the state changes everytime Subspace receives an event.
2019-09-05 01:41:07 +00:00
2019-10-21 12:55:20 +00:00
*Note*: this is a simple example application that does not include error handling for the web3 connection. Be sure `ganache-cli` is running in `localhost:8545` before executing the dapp.
### node-gyp problems
node-gyp can cause problems, because it requires a C++ compiler.
If you do have problems caused by it, first follow the installation steps for your OS [here](https://github.com/nodejs/node-gyp#installation).
If you still have problems and are on Windows, try the following:
- run `npm config set msvs_version 2015` before `npm install`
2019-10-21 12:56:38 +00:00
- Repair Windows Build tools that the node-gyp doc made you install. If it tells you to remove a conflicting version do it. After the repair succeeded, reboot.