Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 650d100dd2 | |||
| 960ffb8fdd | |||
| be8b88516b | |||
| 43b3a45d90 | |||
| 20ed3cb387 | |||
| b190cac706 | |||
| 6f645dc6c3 | |||
| af88027ba9 | |||
| 5748c9b609 | |||
| 5ace7629f2 | |||
| 465df17741 |
+2
-2
@@ -3,5 +3,5 @@ REACT_APP_BEE_HOST=http://localhost:1633
|
|||||||
REACT_APP_BEE_DEBUG_HOST=http://localhost:1635
|
REACT_APP_BEE_DEBUG_HOST=http://localhost:1635
|
||||||
REACT_APP_BEE_DOCS_HOST=https://docs.ethswarm.org/docs/
|
REACT_APP_BEE_DOCS_HOST=https://docs.ethswarm.org/docs/
|
||||||
REACT_APP_BEE_DISCORD_HOST=https://discord.gg/eKr9XPv7
|
REACT_APP_BEE_DISCORD_HOST=https://discord.gg/eKr9XPv7
|
||||||
REACT_APP_ETHERSCAN_HOST=etherscan.io
|
REACT_APP_BLOCKCHAIN_EXPLORER_URL=https://blockscout.com/xdai/mainnet
|
||||||
REACT_APP_BEE_GITHUB_REPO_URL=https://api.github.com/repos/ethersphere/bee
|
REACT_APP_BEE_GITHUB_REPO_URL=https://api.github.com/repos/ethersphere/bee
|
||||||
|
|||||||
+1
-1
@@ -2,5 +2,5 @@ REACT_APP_BEE_HOST=http://localhost:1633
|
|||||||
REACT_APP_BEE_DEBUG_HOST=http://localhost:1635
|
REACT_APP_BEE_DEBUG_HOST=http://localhost:1635
|
||||||
REACT_APP_BEE_DOCS_HOST=https://docs.ethswarm.org/docs/
|
REACT_APP_BEE_DOCS_HOST=https://docs.ethswarm.org/docs/
|
||||||
REACT_APP_BEE_DISCORD_HOST=https://discord.gg/eKr9XPv7
|
REACT_APP_BEE_DISCORD_HOST=https://discord.gg/eKr9XPv7
|
||||||
REACT_APP_ETHERSCAN_HOST=etherscan.io
|
REACT_APP_BLOCKCHAIN_EXPLORER_URL=https://blockscout.com/xdai/mainnet
|
||||||
REACT_APP_BEE_GITHUB_REPO_URL=https://api.github.com/repos/ethersphere/bee
|
REACT_APP_BEE_GITHUB_REPO_URL=https://api.github.com/repos/ethersphere/bee
|
||||||
|
|||||||
@@ -1,5 +1,37 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.5.0](https://www.github.com/ethersphere/bee-dashboard/compare/v0.4.0...v0.5.0) (2021-08-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated troubleshooting instructions and links for mainnet ([#161](https://www.github.com/ethersphere/bee-dashboard/issues/161)) ([960ffb8](https://www.github.com/ethersphere/bee-dashboard/commit/960ffb8fdd6cbfe4928b758da6cac9ba94050c00))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* amend readme ([#155](https://www.github.com/ethersphere/bee-dashboard/issues/155)) ([be8b885](https://www.github.com/ethersphere/bee-dashboard/commit/be8b88516b00d79a623798588d3d4dac3340e8b2))
|
||||||
|
|
||||||
|
## [0.4.0](https://www.github.com/ethersphere/bee-dashboard/compare/v0.3.1...v0.4.0) (2021-06-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* display postage batch usage percentage ([#149](https://www.github.com/ethersphere/bee-dashboard/issues/149)) ([6f645dc](https://www.github.com/ethersphere/bee-dashboard/commit/6f645dc6c357cb9d86cec15e454b361bc871bec6))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* clear dropzone state after upload ([#150](https://www.github.com/ethersphere/bee-dashboard/issues/150)) ([b190cac](https://www.github.com/ethersphere/bee-dashboard/commit/b190cac7064ad3dffb770c5a83d3db4a14d39607))
|
||||||
|
|
||||||
|
### [0.3.1](https://www.github.com/ethersphere/bee-dashboard/compare/v0.3.0...v0.3.1) (2021-06-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't display version alert when unable to retrieve version from bee node ([#138](https://www.github.com/ethersphere/bee-dashboard/issues/138)) ([5ace762](https://www.github.com/ethersphere/bee-dashboard/commit/5ace7629f2479499fe975dec8be4187ece6221ed))
|
||||||
|
* typeerror in the postage stamps form ([#137](https://www.github.com/ethersphere/bee-dashboard/issues/137)) ([465df17](https://www.github.com/ethersphere/bee-dashboard/commit/465df177413afba5376682bd23a712066bd0385c))
|
||||||
|
|
||||||
## [0.3.0](https://www.github.com/ethersphere/bee-dashboard/compare/v0.2.0...v0.3.0) (2021-06-02)
|
## [0.3.0](https://www.github.com/ethersphere/bee-dashboard/compare/v0.2.0...v0.3.0) (2021-06-02)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ git clone git@github.com:ethersphere/bee-dashboard.git
|
|||||||
|
|
||||||
cd bee-dashboard
|
cd bee-dashboard
|
||||||
|
|
||||||
|
npm i
|
||||||
|
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Generated
+10
-28
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "@ethersphere/bee-dashboard",
|
"name": "@ethersphere/bee-dashboard",
|
||||||
"version": "0.3.0",
|
"version": "0.5.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@ethersphere/bee-dashboard",
|
"name": "@ethersphere/bee-dashboard",
|
||||||
"version": "0.3.0",
|
"version": "0.5.0",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ethersphere/bee-js": "^0.10.0",
|
"@ethersphere/bee-js": "^1.0.0",
|
||||||
"@material-ui/core": "^4.11.4",
|
"@material-ui/core": "^4.11.4",
|
||||||
"@material-ui/icons": "^4.11.2",
|
"@material-ui/icons": "^4.11.2",
|
||||||
"@material-ui/lab": "^4.0.0-alpha.57",
|
"@material-ui/lab": "^4.0.0-alpha.57",
|
||||||
@@ -1460,20 +1460,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ethersphere/bee-js": {
|
"node_modules/@ethersphere/bee-js": {
|
||||||
"version": "0.10.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-0.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-1.0.0.tgz",
|
||||||
"integrity": "sha512-j5HcrtN+LMmaqDNqdI5jUmU4YM039rV/vvOM2xsUX3+sFZBP00KVrpUsEMBzqQspU6U7//0y3BKx634V1hvpCA==",
|
"integrity": "sha512-u+TnKf0loAQba7AfZ54kXIEWjNdqVMUR6NXwINhHa2IdoD2b52rcuP96eMImlUm4tEJkxi2yAS+lcIZ2U9/1Vw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"elliptic": "^6.5.4",
|
"elliptic": "^6.5.4",
|
||||||
"isomorphic-ws": "^4.0.1",
|
"isomorphic-ws": "^4.0.1",
|
||||||
"js-sha3": "^0.8.0",
|
"js-sha3": "^0.8.0",
|
||||||
"json-bigint": "^1.0.0",
|
|
||||||
"tar-js": "^0.3.0",
|
"tar-js": "^0.3.0",
|
||||||
"ws": "^7.4.4"
|
"ws": "^7.4.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"bee": "0.6.2-984dca0a",
|
"bee": "1.0.0-2572fa48",
|
||||||
"node": ">=12.0.0",
|
"node": ">=12.0.0",
|
||||||
"npm": ">=6.0.0"
|
"npm": ">=6.0.0"
|
||||||
}
|
}
|
||||||
@@ -11760,14 +11759,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/json-bigint": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"bignumber.js": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/json-parse-better-errors": {
|
"node_modules/json-parse-better-errors": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
||||||
@@ -22904,15 +22895,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@ethersphere/bee-js": {
|
"@ethersphere/bee-js": {
|
||||||
"version": "0.10.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-0.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ethersphere/bee-js/-/bee-js-1.0.0.tgz",
|
||||||
"integrity": "sha512-j5HcrtN+LMmaqDNqdI5jUmU4YM039rV/vvOM2xsUX3+sFZBP00KVrpUsEMBzqQspU6U7//0y3BKx634V1hvpCA==",
|
"integrity": "sha512-u+TnKf0loAQba7AfZ54kXIEWjNdqVMUR6NXwINhHa2IdoD2b52rcuP96eMImlUm4tEJkxi2yAS+lcIZ2U9/1Vw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"elliptic": "^6.5.4",
|
"elliptic": "^6.5.4",
|
||||||
"isomorphic-ws": "^4.0.1",
|
"isomorphic-ws": "^4.0.1",
|
||||||
"js-sha3": "^0.8.0",
|
"js-sha3": "^0.8.0",
|
||||||
"json-bigint": "^1.0.0",
|
|
||||||
"tar-js": "^0.3.0",
|
"tar-js": "^0.3.0",
|
||||||
"ws": "^7.4.4"
|
"ws": "^7.4.4"
|
||||||
}
|
}
|
||||||
@@ -31634,14 +31624,6 @@
|
|||||||
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
|
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"json-bigint": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
|
|
||||||
"requires": {
|
|
||||||
"bignumber.js": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"json-parse-better-errors": {
|
"json-parse-better-errors": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ethersphere/bee-dashboard",
|
"name": "@ethersphere/bee-dashboard",
|
||||||
"version": "0.3.0",
|
"version": "0.5.0",
|
||||||
"description": "An app which helps users to setup their Bee node and do actions like cash out cheques",
|
"description": "An app which helps users to setup their Bee node and do actions like cash out cheques",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bee",
|
"bee",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"url": "https://github.com/ethersphere/bee-dashboard.git"
|
"url": "https://github.com/ethersphere/bee-dashboard.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ethersphere/bee-js": "^0.10.0",
|
"@ethersphere/bee-js": "^1.0.0",
|
||||||
"@material-ui/core": "^4.11.4",
|
"@material-ui/core": "^4.11.4",
|
||||||
"@material-ui/icons": "^4.11.2",
|
"@material-ui/icons": "^4.11.2",
|
||||||
"@material-ui/lab": "^4.0.0-alpha.57",
|
"@material-ui/lab": "^4.0.0-alpha.57",
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import Collapse from '@material-ui/core/Collapse'
|
||||||
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
||||||
|
import { Alert, AlertTitle } from '@material-ui/lab'
|
||||||
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
|
const LIMIT = 100_000_000 // 100 megabytes
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
file: File
|
||||||
|
}
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
|
createStyles({
|
||||||
|
root: {
|
||||||
|
width: '100%',
|
||||||
|
marginTop: theme.spacing(2),
|
||||||
|
marginBottom: theme.spacing(2),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
export default function UploadSizeAlert(props: Props): ReactElement | null {
|
||||||
|
const classes = useStyles()
|
||||||
|
|
||||||
|
const aboveLimit = props.file.size >= LIMIT
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Collapse in={aboveLimit}>
|
||||||
|
<div className={classes.root}>
|
||||||
|
<Alert severity="warning">
|
||||||
|
<AlertTitle>Warning</AlertTitle>
|
||||||
|
The file you are trying to upload is above the recommended size. The chunks may not be synchronised properly
|
||||||
|
over the network.
|
||||||
|
</Alert>
|
||||||
|
</div>
|
||||||
|
</Collapse>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ export default function VersionAlert(): ReactElement | null {
|
|||||||
|
|
||||||
const isExactlySupportedBeeVersion = SUPPORTED_BEE_VERSION_EXACT === userVersion
|
const isExactlySupportedBeeVersion = SUPPORTED_BEE_VERSION_EXACT === userVersion
|
||||||
|
|
||||||
if (isLoading) return null
|
if (isLoading || !userVersion) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Collapse in={!isExactlySupportedBeeVersion && open}>
|
<Collapse in={!isExactlySupportedBeeVersion && open}>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default function DepositModal({ peerId, uncashedAmount }: Props): ReactEl
|
|||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
<span>
|
<span>
|
||||||
Successfully cashed out cheque. Transaction
|
Successfully cashed out cheque. Transaction
|
||||||
<EthereumAddress hideBlockie transaction address={res} network={'goerli'} />
|
<EthereumAddress hideBlockie transaction address={res} />
|
||||||
</span>,
|
</span>,
|
||||||
{ variant: 'success' },
|
{ variant: 'success' },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { ReactElement } from 'react'
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
address: string | undefined
|
address: string | undefined
|
||||||
network?: string
|
|
||||||
hideBlockie?: boolean
|
hideBlockie?: boolean
|
||||||
transaction?: boolean
|
transaction?: boolean
|
||||||
truncate?: boolean
|
truncate?: boolean
|
||||||
@@ -37,9 +36,9 @@ export default function EthereumAddress(props: Props): ReactElement {
|
|||||||
}
|
}
|
||||||
: { marginRight: '7px' }
|
: { marginRight: '7px' }
|
||||||
}
|
}
|
||||||
href={`https://${props.network}.${process.env.REACT_APP_ETHERSCAN_HOST}/${
|
href={`${process.env.REACT_APP_BLOCKCHAIN_EXPLORER_URL}/${props.transaction ? 'tx' : 'address'}/${
|
||||||
props.transaction ? 'tx' : 'address'
|
props.address
|
||||||
}/${props.address}`}
|
}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { ReactElement } from 'react'
|
import { ReactElement } from 'react'
|
||||||
|
|
||||||
import { createStyles, makeStyles } from '@material-ui/core/styles'
|
import { createStyles, makeStyles } from '@material-ui/core/styles'
|
||||||
import { Card, CardContent, Typography } from '@material-ui/core/'
|
import { Card, CardContent, Typography } from '@material-ui/core/'
|
||||||
@@ -49,7 +49,7 @@ function EthereumAddressCard(props: Props): ReactElement {
|
|||||||
<Typography variant="subtitle1" gutterBottom>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
Ethereum Address
|
Ethereum Address
|
||||||
</Typography>
|
</Typography>
|
||||||
<EthereumAddress address={props.nodeAddresses?.ethereum} network={'goerli'} />
|
<EthereumAddress address={props.nodeAddresses?.ethereum} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -64,7 +64,7 @@ function EthereumAddressCard(props: Props): ReactElement {
|
|||||||
<Typography variant="subtitle1" gutterBottom>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
Chequebook Contract Address
|
Chequebook Contract Address
|
||||||
</Typography>
|
</Typography>
|
||||||
<EthereumAddress address={props.chequebookAddress?.chequebookAddress} network={'goerli'} />
|
<EthereumAddress address={props.chequebookAddress?.chequebookAddress} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, ReactElement } from 'react'
|
import { useState, ReactElement } from 'react'
|
||||||
|
|
||||||
import { createStyles, makeStyles } from '@material-ui/core/styles'
|
import { createStyles, makeStyles } from '@material-ui/core/styles'
|
||||||
import { Toolbar, Chip, IconButton } from '@material-ui/core/'
|
import { Toolbar, IconButton } from '@material-ui/core/'
|
||||||
|
|
||||||
import { Sun, Moon } from 'react-feather'
|
import { Sun, Moon } from 'react-feather'
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ const useStyles = makeStyles(() =>
|
|||||||
width: `calc(100% - ${drawerWidth}px)`,
|
width: `calc(100% - ${drawerWidth}px)`,
|
||||||
marginLeft: drawerWidth,
|
marginLeft: drawerWidth,
|
||||||
},
|
},
|
||||||
network: {},
|
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -42,16 +41,11 @@ export default function SideBar(props: Props): ReactElement {
|
|||||||
<div>
|
<div>
|
||||||
<div style={{ display: 'fixed' }} className={classes.appBar}>
|
<div style={{ display: 'fixed' }} className={classes.appBar}>
|
||||||
<Toolbar style={{ display: 'flex' }}>
|
<Toolbar style={{ display: 'flex' }}>
|
||||||
<Chip style={{ marginLeft: '7px' }} size="small" label="Goerli" className={classes.network} />
|
|
||||||
<div style={{ width: '100%' }}>
|
<div style={{ width: '100%' }}>
|
||||||
<div style={{ float: 'right' }}>
|
<div style={{ float: 'right' }}>
|
||||||
<IconButton style={{ marginRight: '10px' }} aria-label="dark-mode" onClick={() => switchTheme()}>
|
<IconButton style={{ marginRight: '10px' }} aria-label="dark-mode" onClick={() => switchTheme()}>
|
||||||
{props.themeMode === 'dark' ? <Moon /> : <Sun />}
|
{props.themeMode === 'dark' ? <Moon /> : <Sun />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{/* <Chip
|
|
||||||
label="Connect Wallet"
|
|
||||||
color="primary"
|
|
||||||
/> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import React, { ReactElement } from 'react'
|
|
||||||
import Button from '@material-ui/core/Button'
|
import Button from '@material-ui/core/Button'
|
||||||
|
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||||
import Menu from '@material-ui/core/Menu'
|
import Menu from '@material-ui/core/Menu'
|
||||||
import MenuItem from '@material-ui/core/MenuItem'
|
import MenuItem from '@material-ui/core/MenuItem'
|
||||||
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
import React, { ReactElement } from 'react'
|
||||||
import { PostageBatch } from '@ethersphere/bee-js'
|
|
||||||
import PeerDetailDrawer from '../../components/PeerDetail'
|
import PeerDetailDrawer from '../../components/PeerDetail'
|
||||||
|
import { EnrichedPostageBatch } from '../../providers/Stamps'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
stamps: PostageBatch[] | null
|
stamps: EnrichedPostageBatch[] | null
|
||||||
selectedStamp: PostageBatch | null
|
selectedStamp: EnrichedPostageBatch | null
|
||||||
setSelected: (stamp: PostageBatch) => void
|
setSelected: (stamp: EnrichedPostageBatch) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SimpleMenu({ stamps, selectedStamp, setSelected }: Props): ReactElement | null {
|
export default function SimpleMenu({ stamps, selectedStamp, setSelected }: Props): ReactElement | null {
|
||||||
@@ -38,7 +38,7 @@ export default function SimpleMenu({ stamps, selectedStamp, setSelected }: Props
|
|||||||
}}
|
}}
|
||||||
selected={stamp.batchID === selectedStamp?.batchID}
|
selected={stamp.batchID === selectedStamp?.batchID}
|
||||||
>
|
>
|
||||||
<ListItemIcon>{stamp.utilization}</ListItemIcon>
|
<ListItemIcon>{stamp.usageText}</ListItemIcon>
|
||||||
<PeerDetailDrawer peerId={stamp.batchID} />
|
<PeerDetailDrawer peerId={stamp.batchID} />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
|
|||||||
+30
-20
@@ -1,33 +1,35 @@
|
|||||||
import { ReactElement, useContext, useEffect, useState } from 'react'
|
import { Button, CircularProgress, Container } from '@material-ui/core'
|
||||||
import { beeApi } from '../../services/bee'
|
|
||||||
|
|
||||||
import { Button, Container, CircularProgress } from '@material-ui/core'
|
|
||||||
import { DropzoneArea } from 'material-ui-dropzone'
|
|
||||||
import ClipboardCopy from '../../components/ClipboardCopy'
|
|
||||||
import { PostageBatch } from '@ethersphere/bee-js'
|
|
||||||
import { Context } from '../../providers/Stamps'
|
|
||||||
import PeerDetailDrawer from '../../components/PeerDetail'
|
|
||||||
import Chip from '@material-ui/core/Chip'
|
|
||||||
import Avatar from '@material-ui/core/Avatar'
|
import Avatar from '@material-ui/core/Avatar'
|
||||||
import SelectStamp from './SelectStamp'
|
import Chip from '@material-ui/core/Chip'
|
||||||
import CreatePostageStamp from '../stamps/CreatePostageStampModal'
|
import { DropzoneArea } from 'material-ui-dropzone'
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
|
import { ReactElement, useContext, useEffect, useState } from 'react'
|
||||||
|
import UploadSizeAlert from '../../components/AlertUploadSize'
|
||||||
|
import ClipboardCopy from '../../components/ClipboardCopy'
|
||||||
|
import PeerDetailDrawer from '../../components/PeerDetail'
|
||||||
|
import { Context, EnrichedPostageBatch } from '../../providers/Stamps'
|
||||||
|
import { beeApi } from '../../services/bee'
|
||||||
|
import CreatePostageStamp from '../stamps/CreatePostageStampModal'
|
||||||
|
import SelectStamp from './SelectStamp'
|
||||||
|
|
||||||
|
const MAX_FILE_SIZE = 1_000_000_000 // 1 gigabyte
|
||||||
|
|
||||||
export default function Files(): ReactElement {
|
export default function Files(): ReactElement {
|
||||||
|
const [dropzoneKey, setDropzoneKey] = useState(0)
|
||||||
const [file, setFile] = useState<File | null>(null)
|
const [file, setFile] = useState<File | null>(null)
|
||||||
const [uploadReference, setUploadReference] = useState('')
|
const [uploadReference, setUploadReference] = useState('')
|
||||||
const [isUploadingFile, setIsUploadingFile] = useState(false)
|
const [isUploadingFile, setIsUploadingFile] = useState(false)
|
||||||
|
|
||||||
const [selectedStamp, setSelectedStamp] = useState<PostageBatch | null>(null)
|
const [selectedStamp, setSelectedStamp] = useState<EnrichedPostageBatch | null>(null)
|
||||||
|
|
||||||
const { isLoading, error, stamps } = useContext(Context)
|
const { isLoading, error, stamps } = useContext(Context)
|
||||||
const { enqueueSnackbar } = useSnackbar()
|
const { enqueueSnackbar } = useSnackbar()
|
||||||
|
|
||||||
// Choose a postage stamp that has the lowest utilization
|
// Choose a postage stamp that has the lowest usage
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!selectedStamp && stamps && stamps.length > 0) {
|
if (!selectedStamp && stamps && stamps.length > 0) {
|
||||||
const stamp = stamps.reduce((prev, curr) => {
|
const stamp = stamps.reduce((prev, curr) => {
|
||||||
if (curr.utilization < prev.utilization) return curr
|
if (curr.usage < prev.usage) return curr
|
||||||
|
|
||||||
return prev
|
return prev
|
||||||
}, stamps[0])
|
}, stamps[0])
|
||||||
@@ -42,8 +44,11 @@ export default function Files(): ReactElement {
|
|||||||
beeApi.files
|
beeApi.files
|
||||||
.uploadFile(selectedStamp.batchID, file)
|
.uploadFile(selectedStamp.batchID, file)
|
||||||
.then(hash => {
|
.then(hash => {
|
||||||
setUploadReference(hash)
|
window.setTimeout(() => {
|
||||||
setFile(null)
|
setFile(null)
|
||||||
|
setUploadReference(hash)
|
||||||
|
setDropzoneKey(dropzoneKey + 1)
|
||||||
|
}, 0)
|
||||||
})
|
})
|
||||||
.catch(e => enqueueSnackbar(`Error uploading: ${e.message}`, { variant: 'error' }))
|
.catch(e => enqueueSnackbar(`Error uploading: ${e.message}`, { variant: 'error' }))
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@@ -54,21 +59,25 @@ export default function Files(): ReactElement {
|
|||||||
const handleChange = (files?: File[]) => {
|
const handleChange = (files?: File[]) => {
|
||||||
if (files) {
|
if (files) {
|
||||||
setFile(files[0])
|
setFile(files[0])
|
||||||
setUploadReference('')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<DropzoneArea onChange={handleChange} filesLimit={1} />
|
<DropzoneArea
|
||||||
|
key={'dropzone-' + dropzoneKey}
|
||||||
|
onChange={handleChange}
|
||||||
|
filesLimit={1}
|
||||||
|
maxFileSize={MAX_FILE_SIZE}
|
||||||
|
/>
|
||||||
<div style={{ marginTop: '15px' }}>
|
<div style={{ marginTop: '15px' }}>
|
||||||
{selectedStamp && (
|
{selectedStamp && (
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex' }}>
|
||||||
<small>
|
<small>
|
||||||
with Postage Stamp{' '}
|
with Postage Stamp{' '}
|
||||||
<Chip
|
<Chip
|
||||||
avatar={<Avatar>{selectedStamp.utilization}</Avatar>}
|
avatar={<Avatar>{selectedStamp.usageText}</Avatar>}
|
||||||
label={<PeerDetailDrawer peerId={selectedStamp.batchID} characterLength={6} />}
|
label={<PeerDetailDrawer peerId={selectedStamp.batchID} characterLength={6} />}
|
||||||
deleteIcon={<ClipboardCopy value={selectedStamp.batchID} />}
|
deleteIcon={<ClipboardCopy value={selectedStamp.batchID} />}
|
||||||
onDelete={() => {} /* eslint-disable-line*/}
|
onDelete={() => {} /* eslint-disable-line*/}
|
||||||
@@ -82,6 +91,7 @@ export default function Files(): ReactElement {
|
|||||||
<Button disabled={!file && isUploadingFile && !selectedStamp} onClick={() => uploadFile()}>
|
<Button disabled={!file && isUploadingFile && !selectedStamp} onClick={() => uploadFile()}>
|
||||||
Upload
|
Upload
|
||||||
</Button>
|
</Button>
|
||||||
|
{file && <UploadSizeAlert file={file} />}
|
||||||
{isUploadingFile && (
|
{isUploadingFile && (
|
||||||
<Container style={{ textAlign: 'center', padding: '50px' }}>
|
<Container style={{ textAlign: 'center', padding: '50px' }}>
|
||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ export default function FormDialog({ label }: Props): ReactElement {
|
|||||||
initialValues={initialFormValues}
|
initialValues={initialFormValues}
|
||||||
onSubmit={async (values: FormValues, actions: FormikHelpers<FormValues>) => {
|
onSubmit={async (values: FormValues, actions: FormikHelpers<FormValues>) => {
|
||||||
try {
|
try {
|
||||||
if (!values.depth) return
|
// This is really just a typeguard, the validation pretty much guarantees these will have the right values
|
||||||
|
if (!values.depth || !values.amount) return
|
||||||
|
|
||||||
const amount = BigInt(values.amount)
|
const amount = BigInt(values.amount)
|
||||||
const depth = Number.parseInt(values.depth)
|
const depth = Number.parseInt(values.depth)
|
||||||
@@ -105,7 +106,7 @@ export default function FormDialog({ label }: Props): ReactElement {
|
|||||||
return errors
|
return errors
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ submitForm, isValid, isSubmitting }) => (
|
{({ submitForm, isValid, isSubmitting, values }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<Button variant="outlined" color="primary" onClick={handleClickOpen}>
|
<Button variant="outlined" color="primary" onClick={handleClickOpen}>
|
||||||
{label || 'Buy Postage Stamp'}
|
{label || 'Buy Postage Stamp'}
|
||||||
@@ -140,7 +141,7 @@ export default function FormDialog({ label }: Props): ReactElement {
|
|||||||
<div className={classes.wrapper}>
|
<div className={classes.wrapper}>
|
||||||
<Button
|
<Button
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={isSubmitting || !isValid}
|
disabled={isSubmitting || !isValid || !values.amount || !values.depth}
|
||||||
type="submit"
|
type="submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={submitForm}
|
onClick={submitForm}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import type { ReactElement } from 'react'
|
import { Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@material-ui/core'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import { Table, TableBody, TableCell, TableContainer, TableRow, TableHead, Paper } from '@material-ui/core'
|
import type { ReactElement } from 'react'
|
||||||
|
|
||||||
import ClipboardCopy from '../../components/ClipboardCopy'
|
import ClipboardCopy from '../../components/ClipboardCopy'
|
||||||
import PeerDetailDrawer from '../../components/PeerDetail'
|
import PeerDetailDrawer from '../../components/PeerDetail'
|
||||||
import { PostageBatch } from '@ethersphere/bee-js'
|
import { EnrichedPostageBatch } from '../../providers/Stamps'
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles({
|
||||||
table: {
|
table: {
|
||||||
@@ -16,7 +15,7 @@ const useStyles = makeStyles({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
interface Props {
|
interface Props {
|
||||||
postageStamps: PostageBatch[] | null
|
postageStamps: EnrichedPostageBatch[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
function StampsTable({ postageStamps }: Props): ReactElement | null {
|
function StampsTable({ postageStamps }: Props): ReactElement | null {
|
||||||
@@ -29,11 +28,11 @@ function StampsTable({ postageStamps }: Props): ReactElement | null {
|
|||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell>Batch ID</TableCell>
|
<TableCell>Batch ID</TableCell>
|
||||||
<TableCell align="right">Utilization</TableCell>
|
<TableCell align="right">Usage</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{postageStamps.map(({ batchID, utilization }) => (
|
{postageStamps.map(({ batchID, usageText }) => (
|
||||||
<TableRow key={batchID}>
|
<TableRow key={batchID}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex' }}>
|
||||||
@@ -43,7 +42,7 @@ function StampsTable({ postageStamps }: Props): ReactElement | null {
|
|||||||
<ClipboardCopy value={batchID} />
|
<ClipboardCopy value={batchID} />
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.values}>{utilization}</TableCell>
|
<TableCell className={classes.values}>{usageText}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
|
|||||||
@@ -8,12 +8,7 @@ interface Props extends StatusChequebookHook {
|
|||||||
ethereumAddress?: string
|
ethereumAddress?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChequebookDeployFund = ({
|
const ChequebookDeployFund = ({ isLoading, chequebookAddress, chequebookBalance }: Props): ReactElement | null => {
|
||||||
isLoading,
|
|
||||||
chequebookAddress,
|
|
||||||
chequebookBalance,
|
|
||||||
ethereumAddress,
|
|
||||||
}: Props): ReactElement | null => {
|
|
||||||
if (isLoading) return null
|
if (isLoading) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -25,10 +20,12 @@ const ChequebookDeployFund = ({
|
|||||||
{!(chequebookAddress?.chequebookAddress && chequebookBalance?.totalBalance.toBigNumber.isGreaterThan(0)) && (
|
{!(chequebookAddress?.chequebookAddress && chequebookBalance?.totalBalance.toBigNumber.isGreaterThan(0)) && (
|
||||||
<div>
|
<div>
|
||||||
<span>
|
<span>
|
||||||
Your chequebook is either not deployed or funded. Join{' '}
|
Your chequebook is either not deployed or funded. To run the node you will need xDAI and xBZZ on the xDai
|
||||||
<a href="https://discord.gg/ykCupZMuww">our discord channel</a>, get verified and send a message{' '}
|
network. You may need to aquire BZZ through (e.g. <a href="https://bzz.exchange/">bzz.exchange</a>) and
|
||||||
<pre>sprinkle {ethereumAddress || '<YOUR BEE NODE ETH ADDRESS>'}</pre> in the <pre>#faucet-request</pre>{' '}
|
bridge it to the xDai network through the <a href="https://omni.xdaichain.com/bridge">omni bridge</a>. To
|
||||||
channel to get Goerli ETH and Goerli BZZ token.
|
pay the transaction fees, you will also need xDAI token. You can purchase DAI on the network and bridge it
|
||||||
|
to xDai network through the <a href="https://bridge.xdaichain.com/">xDai Bridge</a>. See the{' '}
|
||||||
|
<a href="https://www.xdaichain.com/#xdai-stable-chain">official xDai website</a> for more information.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -36,7 +33,7 @@ const ChequebookDeployFund = ({
|
|||||||
<Typography variant="subtitle1" gutterBottom>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
Chequebook Address
|
Chequebook Address
|
||||||
</Typography>
|
</Typography>
|
||||||
<EthereumAddress address={chequebookAddress?.chequebookAddress} network={'goerli'} />
|
<EthereumAddress address={chequebookAddress?.chequebookAddress} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,28 +13,24 @@ export default function EthereumConnectionCheck({ isLoading, isOk, nodeAddresses
|
|||||||
<Typography variant="subtitle1" gutterBottom>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
Node Address
|
Node Address
|
||||||
</Typography>
|
</Typography>
|
||||||
<EthereumAddress address={nodeAddresses?.ethereum} network={'goerli'} />
|
<EthereumAddress address={nodeAddresses?.ethereum} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
Your Bee node must have access to the Ethereum blockchain, so that it can interact and deploy your chequebook
|
Your Bee node must have access to the xDai blockchain, so that it can interact and deploy your chequebook
|
||||||
contract. You can run{' '}
|
contract. You can run{' '}
|
||||||
<a href="https://github.com/goerli/testnet" rel="noreferrer" target="_blank">
|
<a href="https://www.xdaichain.com/" rel="noreferrer" target="_blank">
|
||||||
your own Goerli node
|
your own xDai node
|
||||||
</a>
|
</a>
|
||||||
, or use a provider such as{' '}
|
, or use a provider instead - we recommend{' '}
|
||||||
<a href="https://rpc.slock.it/goerli" rel="noreferrer" target="_blank">
|
<a href="https://getblock.io/" rel="noreferrer" target="_blank">
|
||||||
rpc.slock.it/goerli
|
Getblock
|
||||||
</a>{' '}
|
|
||||||
or{' '}
|
|
||||||
<a href="https://infura.io/" rel="noreferrer" target="_blank">
|
|
||||||
Infura
|
|
||||||
</a>
|
</a>
|
||||||
. By default, Bee expects a local Goerli node at http://localhost:8545. To use a provider instead, simply change
|
. By default, Bee expects a local node at http://localhost:8545. To use a provider instead, simply change the{' '}
|
||||||
your <strong>--swap-endpoint</strong> in your configuration file.
|
<strong>swap-endpoint</strong> in your configuration file.
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,13 @@ import { PostageBatch } from '@ethersphere/bee-js'
|
|||||||
import { createContext, ReactChild, ReactElement, useEffect, useState } from 'react'
|
import { createContext, ReactChild, ReactElement, useEffect, useState } from 'react'
|
||||||
import { beeApi } from '../services/bee'
|
import { beeApi } from '../services/bee'
|
||||||
|
|
||||||
|
export interface EnrichedPostageBatch extends PostageBatch {
|
||||||
|
usage: number
|
||||||
|
usageText: string
|
||||||
|
}
|
||||||
|
|
||||||
interface ContextInterface {
|
interface ContextInterface {
|
||||||
stamps: PostageBatch[] | null
|
stamps: EnrichedPostageBatch[] | null
|
||||||
error: Error | null
|
error: Error | null
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
lastUpdate: number | null
|
lastUpdate: number | null
|
||||||
@@ -29,8 +34,21 @@ interface Props {
|
|||||||
children: ReactChild
|
children: ReactChild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enrichStamp(postageBatch: PostageBatch): EnrichedPostageBatch {
|
||||||
|
const { depth, bucketDepth, utilization } = postageBatch
|
||||||
|
|
||||||
|
const usage = utilization / Math.pow(2, depth - bucketDepth)
|
||||||
|
const usageText = `${Math.ceil(usage * 100)}%`
|
||||||
|
|
||||||
|
return {
|
||||||
|
...postageBatch,
|
||||||
|
usage,
|
||||||
|
usageText,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function Provider({ children }: Props): ReactElement {
|
export function Provider({ children }: Props): ReactElement {
|
||||||
const [stamps, setStamps] = useState<PostageBatch[] | null>(initialValues.stamps)
|
const [stamps, setStamps] = useState<EnrichedPostageBatch[] | null>(initialValues.stamps)
|
||||||
const [error, setError] = useState<Error | null>(initialValues.error)
|
const [error, setError] = useState<Error | null>(initialValues.error)
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(initialValues.isLoading)
|
const [isLoading, setIsLoading] = useState<boolean>(initialValues.isLoading)
|
||||||
const [lastUpdate, setLastUpdate] = useState<number | null>(initialValues.lastUpdate)
|
const [lastUpdate, setLastUpdate] = useState<number | null>(initialValues.lastUpdate)
|
||||||
@@ -44,7 +62,7 @@ export function Provider({ children }: Props): ReactElement {
|
|||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const stamps = await beeApi.stamps.getPostageStamps()
|
const stamps = await beeApi.stamps.getPostageStamps()
|
||||||
|
|
||||||
setStamps(stamps)
|
setStamps(stamps.map(enrichStamp))
|
||||||
setLastUpdate(Date.now())
|
setLastUpdate(Date.now())
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(e)
|
setError(e)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export const beeApi = {
|
|||||||
return beeJSClient().getAllPostageBatch()
|
return beeJSClient().getAllPostageBatch()
|
||||||
},
|
},
|
||||||
buyPostageStamp(amount: bigint, depth: number, options: PostageBatchOptions = {}): Promise<Address> {
|
buyPostageStamp(amount: bigint, depth: number, options: PostageBatchOptions = {}): Promise<Address> {
|
||||||
return beeJSClient().createPostageBatch(amount, depth, options)
|
return beeJSClient().createPostageBatch(amount.toString(), depth, options)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -95,10 +95,10 @@ export const beeDebugApi = {
|
|||||||
return beeJSDebugClient().getLastChequesForPeer(peerId)
|
return beeJSDebugClient().getLastChequesForPeer(peerId)
|
||||||
},
|
},
|
||||||
withdraw(amount: bigint): Promise<string> {
|
withdraw(amount: bigint): Promise<string> {
|
||||||
return beeJSDebugClient().withdrawTokens(amount)
|
return beeJSDebugClient().withdrawTokens(amount.toString())
|
||||||
},
|
},
|
||||||
deposit(amount: bigint): Promise<string> {
|
deposit(amount: bigint): Promise<string> {
|
||||||
return beeJSDebugClient().depositTokens(amount)
|
return beeJSDebugClient().depositTokens(amount.toString())
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
settlements: {
|
settlements: {
|
||||||
|
|||||||
Reference in New Issue
Block a user