Compare commits

..

8 Commits

Author SHA1 Message Date
bee-worker 43b3a45d90 chore: release 0.4.0 (#151) 2021-06-29 11:46:19 +02:00
Cafe137 20ed3cb387 build: update bee-js to 1.0.0 (#153) 2021-06-29 11:41:30 +02:00
Cafe137 b190cac706 fix: clear dropzone state after upload (#150)
* fix: clear dropzone state after upload

* fix: avoid state update on unmounted component
2021-06-20 11:39:34 +02:00
Cafe137 6f645dc6c3 feat: display postage batch usage percentage (#149)
* feat: display postage batch usage percentage

* refactor: use string template instead of concat
2021-06-19 19:04:11 +02:00
Cafe137 af88027ba9 refactor: call toString on numerical values to be bee-js compatible (#148)
* refactor: call toString on numerical values to be bee-js compatible

* feat: add upload size check
2021-06-18 12:37:09 +02:00
bee-worker 5748c9b609 chore: release 0.3.1 (#141) 2021-06-03 13:22:57 +02:00
Vojtech Simetka 5ace7629f2 fix: don't display version alert when unable to retrieve version from bee node (#138) 2021-06-03 13:19:16 +02:00
Vojtech Simetka 465df17741 fix: typeerror in the postage stamps form (#137) 2021-06-03 13:18:58 +02:00
11 changed files with 143 additions and 75 deletions
+20
View File
@@ -1,5 +1,25 @@
# Changelog # Changelog
## [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)
+10 -28
View File
@@ -1,15 +1,15 @@
{ {
"name": "@ethersphere/bee-dashboard", "name": "@ethersphere/bee-dashboard",
"version": "0.3.0", "version": "0.4.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.4.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
View File
@@ -1,6 +1,6 @@
{ {
"name": "@ethersphere/bee-dashboard", "name": "@ethersphere/bee-dashboard",
"version": "0.3.0", "version": "0.4.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",
+38
View File
@@ -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>
)
}
+1 -1
View File
@@ -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}>
+7 -7
View File
@@ -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
View File
@@ -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 />
+4 -3
View File
@@ -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}
+7 -8
View File
@@ -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>
+21 -3
View File
@@ -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)
+3 -3
View File
@@ -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: {