Skip to content

Commit

Permalink
Merge the develop branch to the master branch, preparation to v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
akolotov committed May 7, 2020
2 parents 5b4b01a + 1921087 commit 4117f29
Show file tree
Hide file tree
Showing 74 changed files with 25,370 additions and 614 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
submodules
coverage
lib
dist
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage

# production
build
dist

# misc
.DS_Store
Expand Down Expand Up @@ -48,4 +49,4 @@ __pycache__

#monitor
monitor/responses/*
!monitor/.gitkeep
!monitor/.gitkeep
1 change: 1 addition & 0 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ MONITOR_VALIDATOR_FOREIGN_TX_LIMIT | Average gas usage of a transaction sent by
MONITOR_TX_NUMBER_THRESHOLD | If estimated number of transaction is equal to or below this value, the monitor will report that the validator has less funds than it is required. | integer
MONITOR_PORT | The port for the Monitor. | integer
MONITOR_BRIDGE_NAME | The name to be used in the url path for the bridge | string
MONITOR_CACHE_EVENTS | If set to true, monitor will cache obtained events for other workers runs
31 changes: 31 additions & 0 deletions burner-wallet-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
extends: [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from @typescript-eslint/eslint-plugin
"../.eslintrc"
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
ecmaFeatures: {
jsx: true // Allows for the parsing of JSX
}
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off", // Reduce the use of 'any'
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
"react/prop-types": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/explicit-member-accessibility": "off"
},
settings: {
react: {
version: "detect",
}
}
};
30 changes: 30 additions & 0 deletions burner-wallet-plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:12 as plugin-base

WORKDIR /mono
COPY package.json .
RUN mkdir -p contracts/node_modules

COPY burner-wallet-plugin/package.json ./burner-wallet-plugin/
COPY burner-wallet-plugin/lerna.json ./burner-wallet-plugin/
COPY burner-wallet-plugin/yarn.lock ./burner-wallet-plugin/
COPY burner-wallet-plugin/tsconfig.json ./burner-wallet-plugin/
COPY burner-wallet-plugin/tokenbridge-bw-exchange/package.json ./burner-wallet-plugin/tokenbridge-bw-exchange/
COPY burner-wallet-plugin/staging/package.json ./burner-wallet-plugin/staging/
COPY burner-wallet-plugin/testing/package.json ./burner-wallet-plugin/testing/
COPY yarn.lock .
RUN yarn install --production --frozen-lockfile

COPY ./burner-wallet-plugin/tokenbridge-bw-exchange ./burner-wallet-plugin/tokenbridge-bw-exchange
RUN yarn build:plugin


FROM plugin-base as testing
COPY ./burner-wallet-plugin/testing ./burner-wallet-plugin/testing
WORKDIR /mono/burner-wallet-plugin
CMD ["yarn", "start-testing"]


FROM plugin-base as staging
COPY ./burner-wallet-plugin/staging ./burner-wallet-plugin/staging
WORKDIR /mono/burner-wallet-plugin
CMD ["yarn", "start-staging"]
41 changes: 41 additions & 0 deletions burner-wallet-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# TokenBridge Burner Wallet 2 Plugin

Please refer to the [Plugin README](./tokenrbdige-bw-exchange/README.md) for resources provided, instructions to install and use the plugin.

### Setup
1. [Initialize](../README.md#initializing-the-monorepository) the monorepository.
2. Run `yarn build` or from the monorepository root `yarn build:plugin`

### Run Burner Wallet with the plugin in Mainnet & Classic
1. Create `.env` file in `staging` folder and set `REACT_APP_INFURA_KEY=<your key from infura.com>`
2. Run `yarn start-staging` to start the wallet connected to Mainnet & Classic and interact with the ETH - WETC Bridge.

### Run Burner Wallet with the plugin in Sokol & Kovan
1. Create `.env` file in `testing` folder and set `REACT_APP_INFURA_KEY=<your key from infura.com>`.
Also, a private key can be set to start the wallet with the specified account `REACT_APP_PK=0x...`
2. Run `yarn start-testing` to start the wallet connected to Sokol & Kovan and interact with a test bridge
that works on top of the AMB bridge.

### Docker Setup
Docker can be used to build the services and run the testing and staging wallets.

First you may want to create the `.env` files for testing and staging as mentioned before. This is optional before building the containers, variables can be passes later using `--env-file` or `--env` parameters in `docker run`.

Build the services with docker-compose:
```bash
docker-compose build
```

### Run Burner Wallet with the plugin in Mainnet & Classic using Docker
```bash
docker run -ti -p 8080:8080 -e PORT=8080 --rm burner-wallet-plugin_staging
```

### Run Burner Wallet with the plugin in Sokol & Kovan using Docker
```bash
docker run -ti -p 8080:8080 -e PORT=8080 --rm burner-wallet-plugin_testing
```
### Publish to npm
In order to make this plugin accessible, it should be available as a npm package. Follow the [instructions](publish.md) to publish
the package to npm registry.

17 changes: 17 additions & 0 deletions burner-wallet-plugin/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
version: '2.4'
services:
staging:
build:
context: ..
dockerfile: burner-wallet-plugin/Dockerfile
target: staging
environment:
- NODE_ENV=production
testing:
build:
context: ..
dockerfile: burner-wallet-plugin/Dockerfile
target: testing
environment:
- NODE_ENV=production
10 changes: 10 additions & 0 deletions burner-wallet-plugin/lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"packages": [
"basic-wallet",
"local-wallet",
"tokenbridge-bw-exchange"
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "independent"
}
28 changes: 28 additions & 0 deletions burner-wallet-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "burner-wallet-plugin",
"description": "Burner Wallet 2 plugin",
"version": "1.0.0",
"license": "GPL-3.0-only",
"private": true,
"scripts": {
"install": "lerna bootstrap",
"build": "lerna run --ignore testing --ignore staging build --stream",
"lint": "eslint '*/**/*.{js,ts,tsx}' --ignore-path ../.eslintignore",
"start-staging": "lerna run --scope staging start --stream",
"start-testing": "lerna run --scope testing start --stream",
"test": "lerna run --ignore testing --ignore staging test --stream"
},
"workspaces": [
"staging",
"testing",
"tokenbridge-bw-exchange"
],
"dependencies": {
"@types/color": "3.0.0",
"@typescript-eslint/eslint-plugin": "1.13.0",
"@typescript-eslint/parser": "1.13.0",
"eslint-plugin-react": "7.19.0",
"lerna": "3.16.4",
"typescript": "3.5.3"
}
}
36 changes: 36 additions & 0 deletions burner-wallet-plugin/publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## Plugin Package Information

The package to be published gets its configuration from `tokenbridge/burner-wallet-plugin/tokenbridge-bw-exchange/package.json`

```json
{
"name": "tokenbridge-bw-exchange",
"version": "1.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"/dist"
]
}
```

- `name` is the name of how package will be available in npm.
- `main` is entry point for the package
- `types` is the entry point for typescript types
- `files` is the list of files included when publishing the package. So we have to run `yarn build` first to
generate the `dist` folder.

## Steps to publish to npm

1. Create account in https://www.npmjs.com/

2. Go to `tokenbridge/burner-wallet-plugin/tokenbridge-bw-exchange/`

3. Run `yarn build`. Make sure it generates the `dist` folder

4. Update `version` in `tokenbridge/burner-wallet-plugin/tokenbridge-bw-exchange/package.json`
5. Run `yarn login` and fill login information if required.
6. Run `yarn publish --access public`.
The prompt will ask for the new version, complete it with the version from `package.json`

More information in https://classic.yarnpkg.com/en/docs/publishing-a-package/
1 change: 1 addition & 0 deletions burner-wallet-plugin/staging/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_INFURA_KEY=
40 changes: 40 additions & 0 deletions burner-wallet-plugin/staging/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "staging",
"version": "0.1.0",
"private": true,
"dependencies": {
"@burner-wallet/assets": "^1.1.10",
"@burner-wallet/core": "^1.1.0",
"@burner-wallet/exchange": "^1.1.4",
"@burner-wallet/metamask-plugin": "^1.0.0",
"@burner-wallet/modern-ui": "^1.0.7",
"@poanet/tokenbridge-bw-exchange": "^1.0.0",
"@types/node": "12.0.4",
"@types/react": "*",
"@types/react-dom": "16.8.4",
"@types/react-router-dom": "^4.3.3",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"typescript": "3.5.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {}
}
Binary file added burner-wallet-plugin/staging/public/favicon.ico
Binary file not shown.
38 changes: 38 additions & 0 deletions burner-wallet-plugin/staging/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions burner-wallet-plugin/staging/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
21 changes: 21 additions & 0 deletions burner-wallet-plugin/staging/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import ReactDOM from 'react-dom'
import BurnerCore from '@burner-wallet/core'
import { InjectedSigner, LocalSigner } from '@burner-wallet/core/signers'
import { InfuraGateway, InjectedGateway } from '@burner-wallet/core/gateways'
import Exchange from '@burner-wallet/exchange'
import ModernUI from '@burner-wallet/modern-ui'
import { Etc, Wetc, TokenBridgeGateway, WETCBridge } from '@poanet/tokenbridge-bw-exchange'
import MetamaskPlugin from '@burner-wallet/metamask-plugin'

const core = new BurnerCore({
signers: [new InjectedSigner(), new LocalSigner()],
gateways: [new InjectedGateway(), new InfuraGateway(process.env.REACT_APP_INFURA_KEY), new TokenBridgeGateway()],
assets: [Wetc, Etc]
})

const exchange = new Exchange([new WETCBridge()])

const BurnerWallet = () => <ModernUI title="Staging Wallet" core={core} plugins={[exchange, new MetamaskPlugin()]} />

ReactDOM.render(<BurnerWallet />, document.getElementById('root'))
1 change: 1 addition & 0 deletions burner-wallet-plugin/staging/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
25 changes: 25 additions & 0 deletions burner-wallet-plugin/staging/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
},
"include": [
"src"
]
}
14 changes: 14 additions & 0 deletions burner-wallet-plugin/testing/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
REACT_APP_INFURA_KEY=
#REACT_APP_PK=0x

REACT_APP_MODE=AMB_NATIVE_TO_ERC677

REACT_APP_HOME_TOKEN_NAME=sPOA
REACT_APP_HOME_NETWORK=77
REACT_APP_HOME_MEDIATOR_ADDRESS=0x867949C3F2f66D827Ed40847FaA7B3a369370e13
REACT_APP_HOME_TOKEN_ADDRESS=

REACT_APP_FOREIGN_TOKEN_NAME=ksPOA
REACT_APP_FOREIGN_NETWORK=42
REACT_APP_FOREIGN_MEDIATOR_ADDRESS=0x99FB1a25caeB9c3a5Bf132686E2fe5e27BC0e2dd
REACT_APP_FOREIGN_TOKEN_ADDRESS=0xff94183659f549D6273349696d73686Ee1d2AC83

0 comments on commit 4117f29

Please sign in to comment.