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:
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user