feat: postage stamps support (#115)

* chore: release 0.3.0

* feat: added postage stamp table to list all stamps

* feat: postage stamp modal to purchase stamps

* feat: postage stamps provider

* chore: added formik

* chore: proper form state handling

* chore: revert accidental release inclusion

* chore: polishing identified when developing the upload functionality

Co-authored-by: bee-worker <70210089+bee-worker@users.noreply.github.com>
This commit is contained in:
Vojtech Simetka
2021-06-02 13:13:27 +02:00
committed by GitHub
parent 9fee1aa68a
commit 4074a9de5d
14 changed files with 22086 additions and 90 deletions
+25
View File
@@ -8,6 +8,7 @@ import {
Peer,
Topology,
LastChequesForPeerResponse,
PostageBatch,
} from '@ethersphere/bee-js'
import { beeDebugApi, beeApi } from '../services/bee'
@@ -429,3 +430,27 @@ export const useLatestBeeRelease = (): LatestBeeReleaseHook => {
return { latestBeeRelease, isLoadingLatestBeeRelease, error }
}
export interface GetPostageStampsHook {
postageStamps: PostageBatch[] | null
isLoading: boolean
error: Error | null
}
export const useGetPostageStamps = (): GetPostageStampsHook => {
const [postageStamps, setPostageStamps] = useState<PostageBatch[] | null>(null)
const [isLoading, setLoading] = useState<boolean>(false)
const [error, setError] = useState<Error | null>(null)
useEffect(() => {
beeApi.stamps
.getPostageStamps()
.then(setPostageStamps)
.catch(setError)
.finally(() => {
setLoading(false)
})
}, [])
return { postageStamps, isLoading, error }
}