feat: bee-js revamp (#690)

* chore: initial commit

* refactor: remove unnecessary wrappers

* style: add missing newline

* chore: bump bee-js

* chore: ignore any cast in fdp

* fix: remove cid import

* fix: make TextEncoder and TextDecoder available in jest

* refactor: dedupe stamp ttl second conversion

* refactor: use convenience methods from bee-js

* feat: update to bee-js for restored ens support

* fix: bump bee-js to get download fix

* fix: resolve feed before downloading reference

* fix: fix token displays

* fix: fix token input modal error message

* refactor: remove wallet balance provider

* chore: remove dead code

* refactor: upcoming bee js 0.15.0 (#692)

* chore: initial commit

* fix: do not break page when duration seconds is 0

* ci: remove cache

* chore: upgrade bee-js

* feat: bee-js and bee v2.6 compatibility

* chore: switch upcoming/bee-js to ethersphere/bee-js
This commit is contained in:
Cafe137
2025-07-16 17:10:14 +02:00
committed by GitHub
parent 082a8f52ef
commit 1249c0df71
62 changed files with 675 additions and 16303 deletions
+13 -7
View File
@@ -1,14 +1,13 @@
import { Bee } from '@ethersphere/bee-js'
import { FdpStorage } from '@fairdatasociety/fdp-storage'
import { Pod } from '@fairdatasociety/fdp-storage/dist/pod/types'
import { CircularProgress, Typography } from '@material-ui/core'
import { Bee, MantarayNode } from '@ethersphere/bee-js'
import { useSnackbar } from 'notistack'
import { ReactElement, useEffect, useState } from 'react'
import ImportIcon from 'remixicon-react/AddBoxLineIcon'
import PlusCircle from 'remixicon-react/AddCircleLineIcon'
import { SwarmButton } from '../../components/SwarmButton'
import { joinUrl } from '../../react-fs/Utility'
import { ManifestJs } from '../../utils/manifest'
import { FdpLogin } from './FdpLogin'
import { FdpPods } from './FdpPods'
import { Horizontal } from './Horizontal'
@@ -25,7 +24,9 @@ async function makeFdp(): Promise<FdpStorage | null> {
return null
}
return new FdpStorage('http://localhost:1633', highestCapacityBatch.batchID, {
// TODO: FDS has bad types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new FdpStorage('http://localhost:1633', highestCapacityBatch.batchID.toHex() as any, {
ensOptions: {
rpcUrl: sepolia,
contractAddresses: {
@@ -120,11 +121,16 @@ export default function FDP(): ReactElement {
}
setCreatingPod(true)
const bee = new Bee('http://localhost:1633')
const manifestJs = new ManifestJs(bee)
const entries = await manifestJs.getHashes(importHash)
const manifest = await MantarayNode.unmarshal(bee, importHash)
await manifest.loadRecursively(bee)
const nodes = manifest.collect()
await fdp.personalStorage.create(name)
for (const [path, hash] of Object.entries(entries)) {
await fdp.file.uploadData(name, joinUrl('/', path), await bee.downloadData(hash))
for (const node of nodes) {
await fdp.file.uploadData(
name,
joinUrl('/', node.fullPathString),
(await bee.downloadData(node.targetAddress)).toUint8Array(),
)
}
const pods = await fdp.personalStorage.list()
setPods(pods.pods)