Skip to content

Commit 47d500b

Browse files
authored
feat: feeProxy + enable xdai + disable mainnet (#15)
& remove tsdx, upgrades, refactorings
1 parent f8bf0c4 commit 47d500b

96 files changed

Lines changed: 8625 additions & 7921 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/create-deploy-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@master
13-
- name: Use Node.js 10.x
13+
- name: Use Node.js 14.x
1414
uses: actions/setup-node@v1
1515
with:
16-
node-version: 10.x
16+
node-version: 14.x
1717
- name: yarn install & build
1818
run: |
1919
# https://github.com/yarnpkg/yarn/issues/2629

.github/workflows/create-deploy-staging.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@master
10-
- name: Use Node.js 10.x
10+
- name: Use Node.js 14.x
1111
uses: actions/setup-node@v1
1212
with:
13-
node-version: 10.x
13+
node-version: 14.x
1414
- name: yarn install & build
1515
run: |
1616
# https://github.com/yarnpkg/yarn/issues/2629

.github/workflows/pay-deploy-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@master
13-
- name: Use Node.js 10.x
13+
- name: Use Node.js 14.x
1414
uses: actions/setup-node@v1
1515
with:
16-
node-version: 10.x
16+
node-version: 14.x
1717
- name: yarn install & build
1818
run: |
1919
# https://github.com/yarnpkg/yarn/issues/2629

.github/workflows/pay-deploy-staging.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@master
10-
- name: Use Node.js 10.x
10+
- name: Use Node.js 14.x
1111
uses: actions/setup-node@v1
1212
with:
13-
node-version: 10.x
13+
node-version: 14.x
1414
- name: yarn install & build
1515
run: |
1616
# https://github.com/yarnpkg/yarn/issues/2629

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
node_modules
44
.cache
55
dist
6+
build
67
e2e
78
tsconfig.tsbuildinfo

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"packages/*"
77
]
88
}
9-
}
9+
}

packages/create/package.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,19 @@
66
"@material-ui/core": "^4.9.7",
77
"@material-ui/icons": "^4.9.1",
88
"@material-ui/lab": "^4.0.0-alpha.46",
9-
"@requestnetwork/types": "0.20.0",
10-
"@testing-library/jest-dom": "^4.2.4",
11-
"@testing-library/react": "^9.3.2",
12-
"@testing-library/user-event": "^7.1.2",
13-
"@types/jest": "^24.0.0",
14-
"@types/node": "^12.0.0",
15-
"@types/react": "^16.9.0",
16-
"@types/react-dom": "^16.9.0",
17-
"@types/yup": "^0.26.3",
189
"@web3-react/core": "^6.0.7",
1910
"@web3-react/injected-connector": "^6.0.7",
20-
"ethers": "^4.0.46",
11+
"@requestnetwork/currency": "^0.8.1-next.1581",
12+
"ethers": "5.5.1",
2113
"export-to-csv": "^0.2.1",
2214
"formik": "^2.1.4",
2315
"react": "^16.13.0",
2416
"react-dom": "^16.13.0",
2517
"react-infinite-scroller": "^1.2.4",
2618
"react-intercom": "^1.0.15",
27-
"react-scripts": "3.4.0",
19+
"react-scripts": "4.0.3",
2820
"request-ui": "0.1.0",
29-
"typescript": "~3.7.2",
21+
"typescript": "^4.1.2",
3022
"use-clipboard-copy": "^0.1.2",
3123
"wallet-address-validator": "^0.2.4",
3224
"yup": "^0.28.3"
@@ -38,7 +30,10 @@
3830
"eject": "react-scripts eject"
3931
},
4032
"eslintConfig": {
41-
"extends": "react-app"
33+
"root": true,
34+
"extends": [
35+
"react-app"
36+
]
4237
},
4338
"browserslist": {
4439
"production": [
@@ -53,8 +48,17 @@
5348
]
5449
},
5550
"devDependencies": {
51+
"@requestnetwork/types": "^0.35.1-next.1581",
52+
"@testing-library/jest-dom": "^5.15.1",
53+
"@testing-library/react": "^12.1.2",
54+
"@testing-library/user-event": "^13.5.0",
55+
"@types/jest": "^27.0.3",
56+
"@types/node": "^12.0.0",
57+
"@types/react": "^16.9.0",
5658
"@types/react-csv": "^1.1.1",
59+
"@types/react-dom": "^16.9.0",
5760
"@types/react-infinite-scroller": "^1.2.1",
58-
"@types/testing-library__react": "^10.2.0"
61+
"@types/testing-library__react": "^10.2.0",
62+
"@types/yup": "^0.26.3"
5963
}
6064
}

packages/create/src/App.tsx

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { Web3Provider } from "ethers/providers";
1+
import { providers } from "ethers";
22
import React from "react";
33
import { BrowserRouter, Route, Switch } from "react-router-dom";
4-
import { ErrorBoundary, theme, RAlert, useMobile, Analytics } from "request-ui";
54
import Intercom from "react-intercom";
5+
import { ErrorBoundary, theme, RAlert, useMobile, Analytics } from "request-ui";
66

77
import {
88
CssBaseline,
99
makeStyles,
1010
ThemeProvider,
1111
Link,
12+
Box,
1213
} from "@material-ui/core";
1314
import { useWeb3React, Web3ReactProvider } from "@web3-react/core";
1415

@@ -22,6 +23,8 @@ import { useEagerConnect } from "./hooks/useEagerConnect";
2223
import { useInactiveListener } from "./hooks/useInactiveListnerer";
2324
import { useConnectedUser, UserProvider } from "./contexts/UserContext";
2425
import { injected } from "./connectors";
26+
import { CurrencyProvider, getCurrencies } from "request-shared";
27+
import { ChangeChainLink } from "./components/ChangeChainLink";
2528

2629
const useStyles = makeStyles(() => ({
2730
paper: {
@@ -33,7 +36,7 @@ const useStyles = makeStyles(() => ({
3336
},
3437
}));
3538

36-
const App: React.FC = () => {
39+
const AppInner: React.FC = () => {
3740
const classes = useStyles();
3841
const tried = useEagerConnect();
3942
useInactiveListener(!tried);
@@ -110,37 +113,51 @@ const App: React.FC = () => {
110113
}
111114
/>
112115
)}
113-
{web3detected && error && error.name === "UnsupportedChainIdError" && (
114-
<RAlert severity="error" message="Network not supported" />
116+
{web3detected && error && error.name === "UnsupportedChainIdError" ? (
117+
<ErrorPage
118+
topText="Network not supported."
119+
bottomText={
120+
<Box mt={4}>
121+
<ChangeChainLink variant="button" chain="xdai" />
122+
</Box>
123+
}
124+
/>
125+
) : (
126+
<div className={classes.paper}>
127+
<Analytics trackingId="UA-105153327-15">
128+
<Switch>
129+
<Route path="/" exact component={CreatePage} />
130+
<Route path="/dashboard" component={DashboardPage} />
131+
<Route path="/:id([0-9a-fA-F]+)" component={RequestPage} />
132+
<Route path="*" component={NotFoundPage} />
133+
</Switch>
134+
</Analytics>
135+
</div>
115136
)}
116-
<div className={classes.paper}>
117-
<Analytics trackingId="UA-105153327-15">
118-
<Switch>
119-
<Route path="/" exact component={CreatePage} />
120-
<Route path="/dashboard" component={DashboardPage} />
121-
<Route path="/:id([0-9a-fA-F]+)" component={RequestPage} />
122-
<Route path="*" component={NotFoundPage} />
123-
</Switch>
124-
</Analytics>
125-
</div>
126137
</ThemeProvider>
127138
</BrowserRouter>
128139
);
129140
};
130141

131-
export default () => {
142+
const App = () => {
132143
return (
133144
<ErrorBoundary
134145
stackdriverErrorReporterApiKey="AIzaSyBr5Ix9knr8FPzOmkB6QmcEs-E9fjReZj8"
135146
projectId="request-240714"
136147
service="RequestApp"
137148
component={ErrorPage}
138149
>
139-
<Web3ReactProvider getLibrary={(provider) => new Web3Provider(provider)}>
140-
<UserProvider>
141-
<App />
142-
</UserProvider>
150+
<Web3ReactProvider
151+
getLibrary={provider => new providers.Web3Provider(provider)}
152+
>
153+
<CurrencyProvider currencies={getCurrencies()}>
154+
<UserProvider>
155+
<AppInner />
156+
</UserProvider>
157+
</CurrencyProvider>
143158
</Web3ReactProvider>
144159
</ErrorBoundary>
145160
);
146161
};
162+
163+
export default App;

packages/create/src/components/AppBar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Skeleton } from "@material-ui/lab";
2121
import ConnectButton from "./ConnectButton";
2222
import UserInfo from "./UserInfo";
2323
import { ConnectModal } from "./ConnectModal";
24+
import { ChangeChainLink } from "./ChangeChainLink";
2425

2526
const useStyles = makeStyles((theme: Theme) => ({
2627
root: {
@@ -221,6 +222,8 @@ export const RequestAppBar = ({
221222
network={network}
222223
onClick={() => setConnectModalOpen(true)}
223224
/>
225+
) : hasError ? (
226+
<ChangeChainLink chain="xdai" variant="button" />
224227
) : (
225228
<ConnectButton
226229
connecting={connecting}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from "react";
2+
import { Button, Link } from "@material-ui/core";
3+
import { addEthereumChain, chainInfos } from "request-shared";
4+
import { useWeb3React } from "@web3-react/core";
5+
6+
export const ChangeChainLink = ({
7+
chain,
8+
variant = "link",
9+
}: {
10+
chain: string;
11+
variant?: "link" | "button";
12+
}) => {
13+
const { library } = useWeb3React();
14+
15+
const onClick = () => addEthereumChain(chain, library);
16+
const text = <>Change to {chainInfos[chain]?.name}</>;
17+
if (variant === "link")
18+
return (
19+
<Link style={{ cursor: "pointer" }} onClick={onClick}>
20+
{text}
21+
</Link>
22+
);
23+
return (
24+
<Button variant="contained" color="secondary" onClick={onClick}>
25+
{text}
26+
</Button>
27+
);
28+
};

0 commit comments

Comments
 (0)