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
@@ -49,7 +49,7 @@ export function PostageStampAdvancedCreation({ onFinished }: Props): ReactElemen
const classes = useStyles()
const { chainState } = useContext(BeeContext)
const { refresh } = useContext(StampsContext)
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const [depthInput, setDepthInput] = useState<string>('')
const [amountInput, setAmountInput] = useState<string>('')
@@ -94,7 +94,7 @@ export function PostageStampAdvancedCreation({ onFinished }: Props): ReactElemen
return
}
if (!beeDebugApi) {
if (!beeApi) {
return
}
@@ -107,8 +107,8 @@ export function PostageStampAdvancedCreation({ onFinished }: Props): ReactElemen
immutableFlag: immutable,
}
const batchId = await beeDebugApi.createPostageBatch(amount.toString(), depth, options)
await waitUntilStampExists(batchId, beeDebugApi)
const batchId = await beeApi.createPostageBatch(amount.toString(), depth, options)
await waitUntilStampExists(batchId, beeApi)
await refresh()
onFinished()
} catch (e) {
@@ -44,7 +44,7 @@ const marks = [
export function PostageStampStandardCreation({ onFinished }: Props): ReactElement {
const classes = useStyles()
const { refresh } = useContext(StampsContext)
const { beeDebugApi } = useContext(SettingsContext)
const { beeApi } = useContext(SettingsContext)
const [depthInput, setDepthInput] = useState<number>(Utils.getDepthForCapacity(4))
const [amountInput, setAmountInput] = useState<string>(Utils.getAmountForTtl(30))
@@ -83,7 +83,7 @@ export function PostageStampStandardCreation({ onFinished }: Props): ReactElemen
return
}
if (!beeDebugApi) {
if (!beeApi) {
return
}
@@ -96,8 +96,8 @@ export function PostageStampStandardCreation({ onFinished }: Props): ReactElemen
immutableFlag: true,
}
const batchId = await beeDebugApi.createPostageBatch(amount.toString(), depth, options)
await waitUntilStampExists(batchId, beeDebugApi)
const batchId = await beeApi.createPostageBatch(amount.toString(), depth, options)
await waitUntilStampExists(batchId, beeApi)
await refresh()
onFinished()
} catch (e) {
+4 -4
View File
@@ -18,9 +18,9 @@ interface Props {
}
function StampsTable({ postageStamps }: Props): ReactElement | null {
const { beeDebugApi } = useContext(Context)
const { beeApi } = useContext(Context)
if (!postageStamps || !beeDebugApi) {
if (!postageStamps || !beeApi) {
return null
}
@@ -53,13 +53,13 @@ function StampsTable({ postageStamps }: Props): ReactElement | null {
<StampExtensionModal
type="Topup"
icon={<TimerFlashFill size="1rem" />}
beeDebug={beeDebugApi}
bee={beeApi}
stamp={stamp.batchID}
/>
<StampExtensionModal
type="Dilute"
icon={<TimerFlashLine size="1rem" />}
beeDebug={beeDebugApi}
bee={beeApi}
stamp={stamp.batchID}
/>
</ExpandableListItemActions>