feat: merge api (#658)

This commit is contained in:
Cafe137
2024-06-03 15:07:01 -07:00
committed by GitHub
parent b3f521ca20
commit 8cbd812a2c
43 changed files with 218 additions and 717 deletions
+5 -3
View File
@@ -6,7 +6,7 @@ import { Context as BeeContext } from '../providers/Bee'
import { Context as SettingsContext } from '../providers/Settings'
export default function DepositModal(): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const { refresh } = useContext(BeeContext)
return (
@@ -18,9 +18,11 @@ export default function DepositModal(): ReactElement {
icon={<Download size="1rem" />}
min={new BigNumber(0)}
action={async (amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
if (!beeApi) {
throw new Error('Bee URL is not valid')
}
const transactionHash = await beeDebugApi.depositTokens(amount.toString())
const transactionHash = await beeApi.depositTokens(amount.toString())
refresh()
return transactionHash
+5 -3
View File
@@ -11,7 +11,7 @@ interface Props {
}
export default function StakeModal({ onStarted, onFinished }: Props): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const { refresh } = useContext(BeeContext)
return (
@@ -23,12 +23,14 @@ export default function StakeModal({ onStarted, onFinished }: Props): ReactEleme
icon={<Download size="1rem" />}
min={new BigNumber(0)}
action={async (amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
if (!beeApi) {
throw new Error('Bee URL is not valid')
}
onStarted()
try {
await beeDebugApi.depositStake(amount.toString())
await beeApi.depositStake(amount.toString())
} finally {
refresh()
onFinished()
+5 -3
View File
@@ -6,7 +6,7 @@ import { Context as BeeContext } from '../providers/Bee'
import { Context as SettingsContext } from '../providers/Settings'
export default function WithdrawModal(): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const { refresh } = useContext(BeeContext)
return (
@@ -18,9 +18,11 @@ export default function WithdrawModal(): ReactElement {
icon={<Upload size="1rem" />}
min={new BigNumber(0)}
action={async (amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
if (!beeApi) {
throw new Error('Bee URL is not valid')
}
const transactionHash = await beeDebugApi.withdrawTokens(amount.toString())
const transactionHash = await beeApi.withdrawTokens(amount.toString())
refresh()
return transactionHash