Skip to content

Commit

Permalink
feat: hostd v2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Aug 14, 2024
1 parent 54d1490 commit c0ff539
Show file tree
Hide file tree
Showing 63 changed files with 1,265 additions and 793 deletions.
6 changes: 6 additions & 0 deletions .changeset/dirty-jeans-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'hostd': minor
---

Sync status is now determined by whether the last block's timestamp is within
the last 12 hours.
7 changes: 7 additions & 0 deletions .changeset/famous-pears-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/hostd-js': minor
'@siafoundation/hostd-react': minor
'@siafoundation/hostd-types': minor
---

Updated with v2 endpoints and data types. Closes https://github.com/SiaFoundation/hostd/issues/440
9 changes: 9 additions & 0 deletions .changeset/kind-trains-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@siafoundation/hostd-js': minor
'@siafoundation/hostd-react': minor
'@siafoundation/hostd-types': minor
'@siafoundation/types': minor
'@siafoundation/walletd-types': minor
---

Core Event types have been moved to the core types library. Closes https://github.com/SiaFoundation/hostd/issues/440
5 changes: 5 additions & 0 deletions .changeset/old-hounds-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

The app has been updated to use the new v2 endpoints and data types. Closes https://github.com/SiaFoundation/hostd/issues/440
8 changes: 8 additions & 0 deletions .changeset/pretty-coins-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'hostd': minor
'walletd': minor
'@siafoundation/design-system': minor
'@siafoundation/units': minor
---

Transaction types have been refined to include new v2 derived transaction types.
5 changes: 5 additions & 0 deletions .changeset/thin-shirts-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

The wallet balance tip now includes an immature balance.
7 changes: 7 additions & 0 deletions .changeset/two-olives-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'walletd': minor
'@siafoundation/units': minor
'@siafoundation/design-system': minor
---

Event and transaction utility methods have been moved to the units library.
5 changes: 5 additions & 0 deletions .changeset/wise-dolls-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': minor
---

WalletBalance now supports an optional immature sc value.
4 changes: 2 additions & 2 deletions apps/hostd-e2e/src/specs/volumes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
} from '../fixtures/volumes'

test('can create and delete a volume', async ({ page }) => {
const name = 'my-new-bucket'
const path = '/tmp'
const name = 'my-new-volume'
const path = '/data'
await login({ page })
await navigateToVolumes({ page })
await deleteVolumeIfExists(page, name, path)
Expand Down
6 changes: 3 additions & 3 deletions apps/hostd/components/CmdRoot/WalletCmdGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { routes } from '../../config/routes'
import { useRouter } from 'next/router'
import { useDialog } from '../../contexts/dialog'
import { CommandGroup, CommandItemNav, CommandItemSearch } from './Item'
import { useStateHost } from '@siafoundation/hostd-react'
import { useWallet } from '@siafoundation/hostd-react'
import { Page } from './types'

const commandPage = {
Expand All @@ -20,7 +20,7 @@ type Props = {
export function WalletCmdGroup({ currentPage, parentPage, pushPage }: Props) {
const { openDialog, closeDialog } = useDialog()
const router = useRouter()
const state = useStateHost({
const wallet = useWallet({
config: {
swr: {
revalidateOnFocus: false,
Expand Down Expand Up @@ -81,7 +81,7 @@ export function WalletCmdGroup({ currentPage, parentPage, pushPage }: Props) {
currentPage={currentPage}
commandPage={commandPage}
onSelect={() => {
copyToClipboard(state.data?.walletAddress, 'wallet address')
copyToClipboard(wallet.data?.address, 'wallet address')
closeDialog()
}}
>
Expand Down
4 changes: 2 additions & 2 deletions apps/hostd/components/Config/AnnounceButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useDialog } from '../../contexts/dialog'
import {
useSettings,
useSettingsAnnounce,
useStateHost,
useHostState,
useTxPoolFee,
} from '@siafoundation/hostd-react'
import { humanSiacoin } from '@siafoundation/units'
Expand All @@ -21,7 +21,7 @@ export function AnnounceButton() {
const { openConfirmDialog } = useDialog()
const txpoolFee = useTxPoolFee()
const settingsAnnounce = useSettingsAnnounce()
const host = useStateHost()
const host = useHostState()
const settings = useSettings({
config: {
swr: {
Expand Down
219 changes: 86 additions & 133 deletions apps/hostd/components/Config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ConfigurationPanel,
PanelMenuSection,
PanelMenuSetting,
Separator,
FieldSwitch,
ConfigurationPanelSetting,
shouldShowField,
Expand Down Expand Up @@ -73,26 +72,18 @@ export function Config() {
form={form}
/>
<PanelMenuSection title="Pricing">
{shouldShowField({ form, fields, name: 'pinnedCurrency' }) && (
<>
<ConfigurationPanelSetting
name="pinnedCurrency"
form={form}
fields={fields}
/>
<Separator className="w-full my-3" />
</>
)}
{shouldShowField({ form, fields, name: 'pinnedThreshold' }) && (
<>
<ConfigurationPanelSetting
form={form}
fields={fields}
name="pinnedThreshold"
/>
<Separator className="w-full my-3" />
</>
)}
<ConfigurationPanelSetting
autoVisibility
name="pinnedCurrency"
form={form}
fields={fields}
/>
<ConfigurationPanelSetting
autoVisibility
form={form}
fields={fields}
name="pinnedThreshold"
/>
<PanelMenuSetting
id="storagePriceGroup"
title="Storage price"
Expand Down Expand Up @@ -143,7 +134,6 @@ export function Config() {
</div>
}
/>
<Separator className="w-full my-3" />
<PanelMenuSetting
id="egressPriceGroup"
title="Egress price"
Expand Down Expand Up @@ -194,7 +184,6 @@ export function Config() {
</div>
}
/>
<Separator className="w-full my-3" />
<PanelMenuSetting
id="ingressPriceGroup"
title="Ingress price"
Expand Down Expand Up @@ -245,7 +234,6 @@ export function Config() {
</div>
}
/>
<Separator className="w-full my-3" />
<ConfigurationPanelSetting
name="collateralMultiplier"
form={form}
Expand All @@ -256,116 +244,81 @@ export function Config() {
fields,
name: 'maxCollateral',
}) && (
<>
<Separator className="w-full my-3" />
<PanelMenuSetting
id="maxCollateralGroup"
title="Max collateral"
description={fields.maxCollateral.description}
control={
<div className="flex flex-col gap-1 w-[250px]">
{shouldShowField({
form,
fields,
name: 'shouldPinMaxCollateral',
}) && (
<Tooltip
align="end"
content="Pin the value to a fixed fiat amount. The daemon will automatically keep the value in sync."
>
<div className="flex w-full justify-between">
<Text weight="medium" color="verySubtle" size="14">
Pin
</Text>
<FieldSwitch
name="shouldPinMaxCollateral"
form={form}
fields={fields}
size="small"
group={false}
/>
</div>
</Tooltip>
)}
{shouldShowField({
form,
fields,
name: 'shouldPinMaxCollateral',
}) && shouldPinMaxCollateral ? (
<ConfigurationFiat
name="maxCollateralPinned"
form={form}
fields={fields}
currency={pinnedCurrency}
/>
) : (
<ConfigurationSiacoin
name="maxCollateral"
form={form}
fields={fields}
/>
)}
</div>
}
/>
</>
)}
{shouldShowField({
form,
fields,
name: 'contractPrice',
}) && (
<>
<Separator className="w-full my-3" />
<ConfigurationPanelSetting
form={form}
fields={fields}
name="contractPrice"
/>
</>
)}
{shouldShowField({
form,
fields,
name: 'baseRPCPrice',
}) && (
<>
<Separator className="w-full my-3" />
<ConfigurationPanelSetting
form={form}
fields={fields}
name="baseRPCPrice"
/>
</>
)}
{shouldShowField({
form,
fields,
name: 'sectorAccessPrice',
}) && (
<>
<Separator className="w-full my-3" />
<ConfigurationPanelSetting
form={form}
fields={fields}
name="sectorAccessPrice"
/>
</>
)}
{shouldShowField({
form,
fields,
name: 'priceTableValidity',
}) && (
<>
<Separator className="w-full my-3" />
<ConfigurationPanelSetting
form={form}
fields={fields}
name="priceTableValidity"
/>
</>
<PanelMenuSetting
id="maxCollateralGroup"
title="Max collateral"
description={fields.maxCollateral.description}
control={
<div className="flex flex-col gap-1 w-[250px]">
{shouldShowField({
form,
fields,
name: 'shouldPinMaxCollateral',
}) && (
<Tooltip
align="end"
content="Pin the value to a fixed fiat amount. The daemon will automatically keep the value in sync."
>
<div className="flex w-full justify-between">
<Text weight="medium" color="verySubtle" size="14">
Pin
</Text>
<FieldSwitch
name="shouldPinMaxCollateral"
form={form}
fields={fields}
size="small"
group={false}
/>
</div>
</Tooltip>
)}
{shouldShowField({
form,
fields,
name: 'shouldPinMaxCollateral',
}) && shouldPinMaxCollateral ? (
<ConfigurationFiat
name="maxCollateralPinned"
form={form}
fields={fields}
currency={pinnedCurrency}
/>
) : (
<ConfigurationSiacoin
name="maxCollateral"
form={form}
fields={fields}
/>
)}
</div>
}
/>
)}
<ConfigurationPanelSetting
autoVisibility
form={form}
fields={fields}
name="contractPrice"
/>
<ConfigurationPanelSetting
autoVisibility
form={form}
fields={fields}
name="baseRPCPrice"
/>
<ConfigurationPanelSetting
autoVisibility
form={form}
fields={fields}
name="sectorAccessPrice"
/>
<ConfigurationPanelSetting
autoVisibility
form={form}
fields={fields}
name="priceTableValidity"
/>
</PanelMenuSection>
<ConfigurationPanel
title="DNS"
Expand Down
Loading

0 comments on commit c0ff539

Please sign in to comment.