Skip to content

Implementation registry demo #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions implementation-registry/dapp/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_POLYWRAP_VERSION_REGISTRY_ADDRESS_RINKEBY=0xf414335011C0Ec6048FCE591D5C58DFF52CC70fa
REACT_APP_POLYWRAP_IMPLEMENTATION_REGISTRY_ADDRESS_RINKEBY=0xE60B2Ef1b6dFA6e143fFF3b89666d935d8F7B876
23 changes: 23 additions & 0 deletions implementation-registry/dapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
46 changes: 46 additions & 0 deletions implementation-registry/dapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
53 changes: 53 additions & 0 deletions implementation-registry/dapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "dapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@web3api/ethereum-plugin-js": "^0.0.1-prealpha.30",
"@web3api/react": "^0.0.1-prealpha.30",
"awesome-debounce-promise": "^2.1.0",
"ethers": "^5.4.1",
"node-sass": "4.14.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-loader-spinner": "^4.0.0",
"react-scripts": "4.0.3",
"react-toast-notifications": "^2.5.1",
"typescript": "^4.1.2",
"use-constant": "^1.1.0",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"prebuild": "yarn install:web3api",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"install:web3api": "npx web3api-worker-install ./public"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added implementation-registry/dapp/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions implementation-registry/dapp/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap');
</style>
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Polywrap ImplementatioRegistry Demo"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
Binary file added implementation-registry/dapp/public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added implementation-registry/dapp/public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions implementation-registry/dapp/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions implementation-registry/dapp/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
316 changes: 316 additions & 0 deletions implementation-registry/dapp/public/thread.js

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions implementation-registry/dapp/src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.App {
text-align: center;

background-color: #111620;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
font-size: 18px;
color: white;

.widget-container {
width: 100%;

.registry-container {
display: flex;
justify-content: space-evenly;
}

.implementations-container {
display: flex;
justify-content: center;
}
}

h3 {
font-size: 35px;
margin-top: 10px;
margin-bottom: 30px;
}

h4 {
font-size: 25px;
}

.main__logo {
width: 150px;
margin-top: 20px;
}
}
9 changes: 9 additions & 0 deletions implementation-registry/dapp/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
66 changes: 66 additions & 0 deletions implementation-registry/dapp/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import './App.scss';
import { Web3ApiProvider } from "@web3api/react";
import { useEffect } from 'react';
import { ethereumPlugin } from "@web3api/ethereum-plugin-js";
import React from 'react';
import { ToastProvider } from 'react-toast-notifications';
import VersionRegistryComponent from './components/version-registry-component/VersionRegistryComponent';
import ImplementationsComponent from './components/implementations-component/ImplementationsComponent';
import ImplementationRegistryComponent from './components/implementations-registry-component/ImplementationRegistryComponent';
import Logo from './logo.png';

function App() {
const ethereum = (window as any).ethereum;

useEffect(() => {
(async () => {
if (ethereum) {
await ethereum.request({ method: "eth_requestAccounts" });
} else {
throw Error("Please install Metamask.");
}
})();
}, []);

const redirects: any[] = [
{
uri: "w3://ens/ethereum.web3api.eth",
plugin: ethereumPlugin({
networks: {
rinkeby: {
provider: ethereum
}
}
}),
}
];

return (

<div className="App">

<ToastProvider>
<Web3ApiProvider plugins={redirects}>
<div>
<img src={Logo} className='main__logo' />
<h3 className="title">Interface Implementations</h3>
</div>

<div className="widget-container">
<div className="registry-container">
<VersionRegistryComponent />
<ImplementationRegistryComponent />
</div>

<div className="implementations-container">
<ImplementationsComponent />
</div>
</div>
</Web3ApiProvider>
</ToastProvider>

</div>
);
}

export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.ImplementationsComponent {
margin: 30px;
width: 90%;

h4 {
margin-top: 5px;
}

.implementations-loading {
margin: 30px;
display: flex;
justify-content: center;
align-items: center;
}

.implementations {
margin: 10px;
display: flex;
flex-flow: row wrap;

.implementation {
width: 200px;
margin: 1rem;
border-radius: 2px;
border: 1px solid #babcbf;
background: #1c5043;
box-shadow: #d2d2f9 2px 2px 0px 0px;
padding: 15px;
font-size: 20px;

.implementation-title {
margin-bottom: 10px;
}
}
}

.find-implementations {
margin-left: 10px;
}

.all-speak-btn {
margin-left: 10px;
}
}
Loading