diff --git a/example/.gitignore b/example/.gitignore
new file mode 100644
index 0000000..a9965a5
--- /dev/null
+++ b/example/.gitignore
@@ -0,0 +1,4 @@
+.build
+build
+web_modules
+node_modules
\ No newline at end of file
diff --git a/example/README.md b/example/README.md
new file mode 100644
index 0000000..a4fa23d
--- /dev/null
+++ b/example/README.md
@@ -0,0 +1,10 @@
+# Connect React − Intro
+
+A simple demo that displays the apps of an organization.
+
+## How to run
+
+```console
+yarn
+yarn start
+```
diff --git a/example/babel.config.json b/example/babel.config.json
new file mode 100644
index 0000000..9357351
--- /dev/null
+++ b/example/babel.config.json
@@ -0,0 +1,3 @@
+{
+ "extends": "@snowpack/app-scripts-react/babel.config.json"
+}
diff --git a/example/package.json b/example/package.json
new file mode 100644
index 0000000..55d8e7b
--- /dev/null
+++ b/example/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "example",
+ "private": true,
+ "version": "1.0.0",
+ "scripts": {
+ "start": "snowpack dev",
+ "build": "snowpack build"
+ },
+ "dependencies": {
+ "@1hive/connect-react": "^0.8.6",
+ "@commonsswarm/connect-hatch": "file:.yalc/@commonsswarm/connect-hatch",
+ "react": "^16.13.0",
+ "react-dom": "^16.13.0"
+ },
+ "devDependencies": {
+ "@snowpack/app-scripts-react": "^1.6.0-alpha.0",
+ "@types/react": "^16.9.35",
+ "@types/react-dom": "^16.9.8",
+ "snowpack": "^2.6.4",
+ "typescript": "^3.8.0"
+ }
+}
diff --git a/example/public/favicon.ico b/example/public/favicon.ico
new file mode 100644
index 0000000..bcd5dfd
Binary files /dev/null and b/example/public/favicon.ico differ
diff --git a/example/public/index.html b/example/public/index.html
new file mode 100644
index 0000000..1900432
--- /dev/null
+++ b/example/public/index.html
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ Connect React − Intro
+
+
+
+
+
+
+
+
diff --git a/example/public/robots.txt b/example/public/robots.txt
new file mode 100644
index 0000000..e9e57dc
--- /dev/null
+++ b/example/public/robots.txt
@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:
diff --git a/example/snowpack.config.json b/example/snowpack.config.json
new file mode 100644
index 0000000..ee7a488
--- /dev/null
+++ b/example/snowpack.config.json
@@ -0,0 +1,3 @@
+{
+ "extends": "@snowpack/app-scripts-react"
+}
diff --git a/example/src/App.tsx b/example/src/App.tsx
new file mode 100644
index 0000000..ce72e62
--- /dev/null
+++ b/example/src/App.tsx
@@ -0,0 +1,17 @@
+import React from 'react'
+import { Connect } from '@1hive/connect-react'
+import Info from './Info'
+
+function App() {
+ return (
+
+
+
+ )
+}
+
+export default App
diff --git a/example/src/Info.tsx b/example/src/Info.tsx
new file mode 100644
index 0000000..5184028
--- /dev/null
+++ b/example/src/Info.tsx
@@ -0,0 +1,98 @@
+import React from 'react'
+import { useOrganization, useApps, useApp } from '@1hive/connect-react'
+import connectHatch from '@commonsswarm/connect-hatch'
+import LogButton from './LogButton'
+
+export default function Info() {
+ const [org] = useOrganization()
+ const [apps] = useApps()
+ const [hatchConnector, setHatchConnector] = React.useState(null)
+ const [contributors, setContributors] = React.useState(null)
+ const [hatchApp] = useApp('marketplace-hatch')
+
+ React.useEffect(() => {
+ if (!hatchApp) {
+ return
+ }
+
+ let cancelled = false
+
+ const fetchHatchConnector = async () => {
+ try {
+ const hatchConnector = await connectHatch(hatchApp)
+
+ if (!cancelled) {
+ setHatchConnector(hatchConnector)
+ }
+ } catch (err) {
+ console.error(`Error fetching hatch connector: ${err}`)
+ }
+ }
+
+ fetchHatchConnector()
+
+ return () => {
+ cancelled = true
+ }
+ }, [hatchApp])
+
+ React.useEffect(() => {
+ let cancelled = false
+
+ const fetchContributors = async () => {
+ try {
+ const contributors = await hatchConnector.contributors({
+ first: 100,
+ skip: 50,
+ orderBy: 'totalValue',
+ orderDirection: 'asc',
+ })
+
+ if (!cancelled) {
+ setContributors(contributors)
+ }
+ } catch (err) {
+ console.error(`Error fetching hatch connector: ${err}`)
+ }
+ }
+
+ if (!hatchConnector) {
+ return
+ }
+
+ fetchContributors()
+
+ return () => {
+ cancelled = true
+ }
+ }, [hatchConnector])
+
+ if (!org) {
+ return Loading…
+ }
+
+ return (
+ <>
+ Organization
+ location: {org.location}
+ address: {org.address}
+
+ Apps
+ {apps?.map((app: any) => (
+
+
+ {app.name}
+
+ address: {app.address}
+ {app.version && version: {app.version}
}
+
+ ))}
+ Contributors
+ {contributors?.map((contributor: any) => (
+
+ address: {contributor.address}
+
+ ))}
+ >
+ )
+}
diff --git a/example/src/LogButton.tsx b/example/src/LogButton.tsx
new file mode 100644
index 0000000..ae878dc
--- /dev/null
+++ b/example/src/LogButton.tsx
@@ -0,0 +1,7 @@
+import React from 'react'
+
+function LogButton({ value }: any) {
+ return
+}
+
+export default LogButton
diff --git a/example/src/index.tsx b/example/src/index.tsx
new file mode 100644
index 0000000..13e69ea
--- /dev/null
+++ b/example/src/index.tsx
@@ -0,0 +1,16 @@
+import React from 'react'
+import ReactDOM from 'react-dom'
+import App from './App'
+
+ReactDOM.render(
+
+
+ ,
+ document.getElementById('root')
+)
+
+// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
+// Learn more: https://www.snowpack.dev/#hot-module-replacement
+if (import.meta.hot) {
+ import.meta.hot.accept()
+}
diff --git a/example/tsconfig.json b/example/tsconfig.json
new file mode 100644
index 0000000..3947680
--- /dev/null
+++ b/example/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "@snowpack/app-scripts-react/tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "./dist",
+ "rootDir": "src",
+ "jsx": "react",
+ "target": "ESNext",
+ "baseUrl": "./",
+ "paths": { "*": ["web_modules/.types/*"] }
+ },
+ "include": ["src", "types"],
+ "exclude": ["node_modules"],
+ "references": [{ "path": "../tsconfig.json" }]
+}
diff --git a/example/types/import.d.ts b/example/types/import.d.ts
new file mode 100644
index 0000000..2cca6d8
--- /dev/null
+++ b/example/types/import.d.ts
@@ -0,0 +1,8 @@
+// ESM-HMR Interface: `import.meta.hot`
+
+interface ImportMeta {
+ // TODO: Import the exact .d.ts files from "esm-hmr"
+ // https://github.com/pikapkg/esm-hmr
+ hot: any;
+ env: Record;
+}
diff --git a/example/types/static.d.ts b/example/types/static.d.ts
new file mode 100644
index 0000000..a81b1be
--- /dev/null
+++ b/example/types/static.d.ts
@@ -0,0 +1,32 @@
+/* Use this file to declare any custom file extensions for importing */
+/* Use this folder to also add/extend a package d.ts file, if needed. */
+
+declare module '*.css';
+declare module '*.svg' {
+ const ref: string;
+ export default ref;
+}
+declare module '*.bmp' {
+ const ref: string;
+ export default ref;
+}
+declare module '*.gif' {
+ const ref: string;
+ export default ref;
+}
+declare module '*.jpg' {
+ const ref: string;
+ export default ref;
+}
+declare module '*.jpeg' {
+ const ref: string;
+ export default ref;
+}
+declare module '*.png' {
+ const ref: string;
+ export default ref;
+}
+declare module '*.webp' {
+ const ref: string;
+ export default ref;
+}
diff --git a/example/yalc.lock b/example/yalc.lock
new file mode 100644
index 0000000..98dbfcc
--- /dev/null
+++ b/example/yalc.lock
@@ -0,0 +1,10 @@
+{
+ "version": "v1",
+ "packages": {
+ "@commonsswarm/connect-hatch": {
+ "signature": "55c67d2cd43470c2d3b73bd749e9b206",
+ "file": true,
+ "replaced": "^0.0.1"
+ }
+ }
+}
\ No newline at end of file