feat: merge api (#658)
This commit is contained in:
@@ -19,8 +19,8 @@ interface Props {
|
||||
export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactElement {
|
||||
const [open, setOpen] = useState<boolean>(false)
|
||||
const [loadingCashout, setLoadingCashout] = useState<boolean>(false)
|
||||
const { beeApi } = useContext(SettingsContext)
|
||||
const { enqueueSnackbar } = useSnackbar()
|
||||
const { beeDebugApi } = useContext(SettingsContext)
|
||||
|
||||
const handleClickOpen = () => {
|
||||
setOpen(true)
|
||||
@@ -31,11 +31,9 @@ export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactE
|
||||
}
|
||||
|
||||
const handleCashout = () => {
|
||||
if (!beeDebugApi) return
|
||||
|
||||
if (peerId) {
|
||||
if (peerId && beeApi) {
|
||||
setLoadingCashout(true)
|
||||
beeDebugApi
|
||||
beeApi
|
||||
.cashoutLastCheque(peerId)
|
||||
.then(res => {
|
||||
setOpen(false)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ReactElement, CSSProperties, useContext, useState, useEffect } from 'react'
|
||||
import type { Peer } from '@ethersphere/bee-js'
|
||||
import DottedMap, { DottedMapWithoutCountriesLib } from 'dotted-map/without-countries'
|
||||
import { CSSProperties, ReactElement, useContext, useEffect, useState } from 'react'
|
||||
import mapData from '../assets/data/map-data.json'
|
||||
import nodesDb from '../assets/data/nodes-db.json'
|
||||
import { Context } from '../providers/Bee'
|
||||
import mapData from '../assets/data/map-data.json'
|
||||
|
||||
interface Props {
|
||||
style?: CSSProperties
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
import { Divider, Drawer, Grid, Link as MUILink, List } from '@material-ui/core'
|
||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
||||
import { BeeModes } from '@ethersphere/bee-js'
|
||||
import { Divider, Drawer, Grid, List, Link as MUILink } from '@material-ui/core'
|
||||
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles'
|
||||
import { ReactElement, useContext } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import FilesIcon from 'remixicon-react/ArrowUpDownLineIcon'
|
||||
import DocsIcon from 'remixicon-react/BookOpenLineIcon'
|
||||
import GithubIcon from 'remixicon-react/GithubFillIcon'
|
||||
import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon'
|
||||
import GithubIcon from 'remixicon-react/GithubFillIcon'
|
||||
import HomeIcon from 'remixicon-react/Home3LineIcon'
|
||||
import SettingsIcon from 'remixicon-react/Settings2LineIcon'
|
||||
import AccountIcon from 'remixicon-react/Wallet3LineIcon'
|
||||
import { Context as BeeContext } from '../providers/Bee'
|
||||
import { Context as SettingsContext } from '../providers/Settings'
|
||||
import DashboardLogo from '../assets/dashboard-logo.svg'
|
||||
import DesktopLogo from '../assets/desktop-logo.svg'
|
||||
import { BEE_DOCS_HOST, GITHUB_BEE_DASHBOARD_URL } from '../constants'
|
||||
import { Context as BeeContext } from '../providers/Bee'
|
||||
import { Context as SettingsContext } from '../providers/Settings'
|
||||
import { ROUTES } from '../routes'
|
||||
import SideBarItem from './SideBarItem'
|
||||
import SideBarStatus from './SideBarStatus'
|
||||
import { BeeModes } from '@ethersphere/bee-js'
|
||||
import { BEE_DOCS_HOST } from '../constants'
|
||||
import { GITHUB_BEE_DASHBOARD_URL } from '../constants'
|
||||
|
||||
const drawerWidth = 300
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BeeDebug } from '@ethersphere/bee-js'
|
||||
import { Bee } from '@ethersphere/bee-js'
|
||||
import { Box } from '@material-ui/core'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import Dialog from '@material-ui/core/Dialog'
|
||||
@@ -12,11 +12,11 @@ import { ReactElement, ReactNode, useState } from 'react'
|
||||
interface Props {
|
||||
type: 'Topup' | 'Dilute'
|
||||
icon: ReactNode
|
||||
beeDebug: BeeDebug
|
||||
bee: Bee
|
||||
stamp: string
|
||||
}
|
||||
|
||||
export default function StampExtensionModal({ type, icon, beeDebug, stamp }: Props): ReactElement {
|
||||
export default function StampExtensionModal({ type, icon, bee, stamp }: Props): ReactElement {
|
||||
const [open, setOpen] = useState(false)
|
||||
const [amount, setAmount] = useState('')
|
||||
const { enqueueSnackbar } = useSnackbar()
|
||||
@@ -34,7 +34,7 @@ export default function StampExtensionModal({ type, icon, beeDebug, stamp }: Pro
|
||||
const handleAction = async () => {
|
||||
if (type === 'Topup') {
|
||||
try {
|
||||
await beeDebug.topUpBatch(stamp, amount)
|
||||
await bee.topUpBatch(stamp, amount)
|
||||
enqueueSnackbar(`Successfully topped up stamp, your changes will appear soon`, { variant: 'success' })
|
||||
} catch (error) {
|
||||
enqueueSnackbar(`Failed to topup stamp: ${error || 'Unknown reason'}`, { variant: 'error' })
|
||||
@@ -43,7 +43,7 @@ export default function StampExtensionModal({ type, icon, beeDebug, stamp }: Pro
|
||||
|
||||
if (type === 'Dilute') {
|
||||
try {
|
||||
await beeDebug.diluteBatch(stamp, parseInt(amount, 10))
|
||||
await bee.diluteBatch(stamp, parseInt(amount, 10))
|
||||
enqueueSnackbar(`Successfully diluted stamp, your changes will appear soon`, { variant: 'success' })
|
||||
} catch (error) {
|
||||
enqueueSnackbar(`Failed to dilute stamp: ${error || 'Unknown reason'}`, { variant: 'error' })
|
||||
|
||||
Reference in New Issue
Block a user