Last active
March 14, 2018 14:54
-
-
Save benjaminshafii/248e36600ad7e8c8aeeba01a885a0c90 to your computer and use it in GitHub Desktop.
create-react-app with drizzle
This file contains hidden or 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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import "./index.css"; | |
import App from "./App"; | |
import registerServiceWorker from "./registerServiceWorker"; | |
// A json dump of our abi | |
import AssetFactory from "./AssetFactory.json" | |
// A way to provide to set the state of Drizzle to the rest of our app | |
import { DrizzleProvider } from 'drizzle-react'; | |
const options = { | |
web3: { | |
block: false, | |
fallback: { | |
type: "ws", | |
// this needs to point to ganache | |
url: "ws://127.0.0.1:8545" | |
} | |
}, | |
contracts: [AssetFactory], | |
events: { | |
AssetFactory: ["NewAsset"] | |
} | |
}; | |
ReactDOM.render( | |
<DrizzleProvider options={options}> | |
<App /> | |
</DrizzleProvider>, | |
document.getElementById("root") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment