diff --git a/apps/hostd-e2e/project.json b/apps/hostd-e2e/project.json
index 02c094dd2..b21b1430a 100644
--- a/apps/hostd-e2e/project.json
+++ b/apps/hostd-e2e/project.json
@@ -9,9 +9,9 @@
"executor": "nx:run-commands",
"options": {
"commands": [
- "cd internal/cluster && go get -u go.sia.tech/hostd@master",
- "cd internal/cluster && go get -u go.sia.tech/renterd@dev",
- "cd internal/cluster && go get -u go.sia.tech/walletd@master",
+ // "cd internal/cluster && go get -u go.sia.tech/hostd@master",
+ // "cd internal/cluster && go get -u go.sia.tech/renterd@dev",
+ // "cd internal/cluster && go get -u go.sia.tech/walletd@master",
"cd internal/cluster && go mod tidy",
"cd internal/cluster && go build -o bin/clusterd ./cmd/clusterd || echo 'BUILD FAILED'",
"git checkout internal/cluster/go.mod internal/cluster/go.sum",
diff --git a/apps/hostd/contexts/contracts/dataset.ts b/apps/hostd/contexts/contracts/dataset.ts
index 2f259dc82..0125b023f 100644
--- a/apps/hostd/contexts/contracts/dataset.ts
+++ b/apps/hostd/contexts/contracts/dataset.ts
@@ -3,7 +3,7 @@ import { Contract } from '@siafoundation/hostd-types'
import { useContracts } from '@siafoundation/hostd-react'
import { ContractData } from './types'
import BigNumber from 'bignumber.js'
-import { Maybe } from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
export function useDataset({
response,
diff --git a/apps/hostd/contexts/contracts/index.tsx b/apps/hostd/contexts/contracts/index.tsx
index aee79989a..26c8ea334 100644
--- a/apps/hostd/contexts/contracts/index.tsx
+++ b/apps/hostd/contexts/contracts/index.tsx
@@ -3,9 +3,9 @@ import {
useDatasetEmptyState,
useServerFilters,
getContractsTimeRangeBlockHeight,
- Maybe,
useMultiSelect,
} from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
import { useRouter } from 'next/router'
import { ContractStatus } from '@siafoundation/hostd-types'
import { useContracts as useContractsData } from '@siafoundation/hostd-react'
diff --git a/apps/renterd-e2e/project.json b/apps/renterd-e2e/project.json
index 84ec6abd9..ad09bcb3c 100644
--- a/apps/renterd-e2e/project.json
+++ b/apps/renterd-e2e/project.json
@@ -9,9 +9,9 @@
"executor": "nx:run-commands",
"options": {
"commands": [
- "cd internal/cluster && go get -u go.sia.tech/hostd@master",
- "cd internal/cluster && go get -u go.sia.tech/renterd@dev",
- "cd internal/cluster && go get -u go.sia.tech/walletd@master",
+ // "cd internal/cluster && go get -u go.sia.tech/hostd@master",
+ // "cd internal/cluster && go get -u go.sia.tech/renterd@dev",
+ // "cd internal/cluster && go get -u go.sia.tech/walletd@master",
"cd internal/cluster && go mod tidy",
"cd internal/cluster && go build -o bin/clusterd ./cmd/clusterd || echo 'BUILD FAILED'",
"git checkout internal/cluster/go.mod internal/cluster/go.sum",
diff --git a/apps/renterd-e2e/src/specs/contracts.spec.ts b/apps/renterd-e2e/src/specs/contracts.spec.ts
index 061b7b1ea..2c3ae4ffe 100644
--- a/apps/renterd-e2e/src/specs/contracts.spec.ts
+++ b/apps/renterd-e2e/src/specs/contracts.spec.ts
@@ -76,9 +76,7 @@ test('contracts bulk delete', async ({ page }) => {
const dialog = page.getByRole('dialog')
await dialog.getByRole('button', { name: 'Delete' }).click()
- await expect(
- page.getByText('There are currently no active contracts')
- ).toBeVisible()
+ await expect(page.getByText('3 contracts deleted')).toBeVisible()
})
test('contracts bulk allowlist', async ({ page }) => {
diff --git a/apps/renterd/components/Config/RebalancePrices.tsx b/apps/renterd/components/Config/RebalancePrices.tsx
index ef9b44538..cfa97d042 100644
--- a/apps/renterd/components/Config/RebalancePrices.tsx
+++ b/apps/renterd/components/Config/RebalancePrices.tsx
@@ -4,10 +4,10 @@ import { useConfig } from '../../contexts/config'
import {
Button,
formSetFields,
- Maybe,
Text,
Tooltip,
} from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
import { InputValues } from '../../contexts/config/types'
import BigNumber from 'bignumber.js'
import { derivePricingFromSpendingEstimate } from '../../contexts/config/spending'
diff --git a/apps/renterd/contexts/alerts/columns.tsx b/apps/renterd/contexts/alerts/columns.tsx
index c4db94f8a..e61991542 100644
--- a/apps/renterd/contexts/alerts/columns.tsx
+++ b/apps/renterd/contexts/alerts/columns.tsx
@@ -2,6 +2,7 @@ import {
Badge,
Button,
ControlGroup,
+ objectEntries,
Panel,
Separator,
TableColumn,
@@ -86,8 +87,8 @@ export const columns: AlertsTableColumn[] = [
// Collect data for data fields
const datums = useMemo(
() =>
- Object.keys(dataFields)
- .map((key) => {
+ objectEntries(dataFields)
+ .map(([key]) => {
const value = data[key]
if (
value === undefined ||
@@ -98,14 +99,17 @@ export const columns: AlertsTableColumn[] = [
}
return { key, value }
})
- .filter(Boolean) as { key: string; value: unknown }[],
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ .filter((data) => data) as { key: string; value: any }[],
[data]
)
return (
{datums.map(({ key, value }, i) => {
- const Component = dataFields?.[key]?.render
+ const Component: // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ((props: { value: any }) => React.ReactNode) | undefined =
+ dataFields?.[key as keyof AlertData['data']]?.render
if (!Component) {
return null
}
diff --git a/apps/renterd/contexts/alerts/types.ts b/apps/renterd/contexts/alerts/types.ts
index e3ee3c8d2..aba865826 100644
--- a/apps/renterd/contexts/alerts/types.ts
+++ b/apps/renterd/contexts/alerts/types.ts
@@ -1,11 +1,14 @@
-export type AlertSeverity = 'info' | 'warning' | 'error' | 'critical'
+import {
+ AlertSeverity,
+ AlertData as AlertDataField,
+} from '@siafoundation/renterd-types'
export type AlertData = {
id: string
severity: AlertSeverity
message: string
timestamp: string
- data: Record
+ data: AlertDataField
dismiss: () => void
}
diff --git a/apps/renterd/contexts/config/fields.tsx b/apps/renterd/contexts/config/fields.tsx
index d66568eef..a4faa973b 100644
--- a/apps/renterd/contexts/config/fields.tsx
+++ b/apps/renterd/contexts/config/fields.tsx
@@ -2,9 +2,9 @@
import {
Code,
ConfigFields,
- Maybe,
toFixedMaxString,
} from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
import { hoursInDays, secondsInMinutes } from '@siafoundation/units'
import BigNumber from 'bignumber.js'
import React from 'react'
diff --git a/apps/renterd/contexts/config/types.ts b/apps/renterd/contexts/config/types.ts
index 2baa52b60..b30698f20 100644
--- a/apps/renterd/contexts/config/types.ts
+++ b/apps/renterd/contexts/config/types.ts
@@ -1,4 +1,4 @@
-import { NoUndefined } from '@siafoundation/design-system'
+import { NoUndefined } from '@siafoundation/types'
import { CurrencyId } from '@siafoundation/react-core'
import BigNumber from 'bignumber.js'
diff --git a/apps/renterd/contexts/config/useSpendingEstimate.tsx b/apps/renterd/contexts/config/useSpendingEstimate.tsx
index 0dfa780d2..3fa3edea4 100644
--- a/apps/renterd/contexts/config/useSpendingEstimate.tsx
+++ b/apps/renterd/contexts/config/useSpendingEstimate.tsx
@@ -1,6 +1,6 @@
import { useConfig } from '.'
import { useMemo } from 'react'
-import { Maybe } from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
import BigNumber from 'bignumber.js'
import { useRedundancyMultiplier } from './useRedundancyMultiplier'
import { calculateSpendingEstimate } from './spending'
diff --git a/apps/renterd/contexts/contracts/dataset.tsx b/apps/renterd/contexts/contracts/dataset.tsx
index f50339d98..60d6bf4d4 100644
--- a/apps/renterd/contexts/contracts/dataset.tsx
+++ b/apps/renterd/contexts/contracts/dataset.tsx
@@ -7,7 +7,7 @@ import { useSyncStatus } from '../../hooks/useSyncStatus'
import { blockHeightToTime } from '@siafoundation/units'
import { defaultDatasetRefreshInterval } from '../../config/swr'
import { usePrunableContractSizes } from './usePrunableContractSizes'
-import { Maybe } from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
export function useDataset() {
const response = useContractsData({
diff --git a/apps/renterd/contexts/contracts/index.tsx b/apps/renterd/contexts/contracts/index.tsx
index 41efbd1ff..c1d640d4e 100644
--- a/apps/renterd/contexts/contracts/index.tsx
+++ b/apps/renterd/contexts/contracts/index.tsx
@@ -5,8 +5,8 @@ import {
useClientFilters,
useClientFilteredDataset,
useMultiSelect,
- Maybe,
} from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
import { useRouter } from 'next/router'
import { useContracts as useContractsData } from '@siafoundation/renterd-react'
import { createContext, useContext, useMemo, useState } from 'react'
diff --git a/apps/renterd/contexts/hosts/dataset.ts b/apps/renterd/contexts/hosts/dataset.ts
index 26ca7c430..efad1db4b 100644
--- a/apps/renterd/contexts/hosts/dataset.ts
+++ b/apps/renterd/contexts/hosts/dataset.ts
@@ -9,7 +9,8 @@ import {
} from '@siafoundation/renterd-react'
import { ContractData } from '../contracts/types'
import { SiaCentralHost } from '@siafoundation/sia-central-types'
-import { Maybe, objectEntries } from '@siafoundation/design-system'
+import { Maybe } from '@siafoundation/types'
+import { objectEntries } from '@siafoundation/design-system'
export function useDataset({
response,
diff --git a/apps/walletd-e2e/project.json b/apps/walletd-e2e/project.json
index 4d751725f..1c3088392 100644
--- a/apps/walletd-e2e/project.json
+++ b/apps/walletd-e2e/project.json
@@ -9,9 +9,9 @@
"executor": "nx:run-commands",
"options": {
"commands": [
- "cd internal/cluster && go get -u go.sia.tech/hostd@master",
- "cd internal/cluster && go get -u go.sia.tech/renterd@dev",
- "cd internal/cluster && go get -u go.sia.tech/walletd@master",
+ // "cd internal/cluster && go get -u go.sia.tech/hostd@master",
+ // "cd internal/cluster && go get -u go.sia.tech/renterd@dev",
+ // "cd internal/cluster && go get -u go.sia.tech/walletd@master",
"cd internal/cluster && go mod tidy",
"cd internal/cluster && go build -o bin/clusterd ./cmd/clusterd || echo 'BUILD FAILED'",
"git checkout internal/cluster/go.mod internal/cluster/go.sum",
diff --git a/libs/clusterd/package.json b/libs/clusterd/package.json
index b51ba1b77..ff5adfede 100644
--- a/libs/clusterd/package.json
+++ b/libs/clusterd/package.json
@@ -9,7 +9,8 @@
"axios": "^0.27.2",
"@siafoundation/renterd-js": "0.11.0",
"@siafoundation/units": "3.2.0",
- "@siafoundation/hostd-js": "0.3.1"
+ "@siafoundation/hostd-js": "0.3.1",
+ "@siafoundation/types": "0.6.0"
},
"types": "./src/index.d.ts"
}
diff --git a/libs/clusterd/src/index.ts b/libs/clusterd/src/index.ts
index 92ed215da..cf7764247 100644
--- a/libs/clusterd/src/index.ts
+++ b/libs/clusterd/src/index.ts
@@ -4,6 +4,7 @@ import Axios from 'axios'
import { Bus } from '@siafoundation/renterd-js'
import { pluralize } from '@siafoundation/units'
import { Hostd } from '@siafoundation/hostd-js'
+import { Maybe } from '@siafoundation/types'
type Node = {
type: string
@@ -52,12 +53,12 @@ export async function setupCluster({
const addr = `http://localhost:${clusterd.managementPort}/nodes`
try {
const nodes = await Axios.get<
- { type: string; apiAddress: string; password: string }[]
+ Maybe<{ type: string; apiAddress: string; password: string }[]>
>(`http://localhost:${clusterd.managementPort}/nodes`)
- const runningCount = nodes.data.length
+ const runningCount = nodes.data?.length
const totalCount = renterdCount + hostdCount + walletdCount
- if (nodes.data.length === renterdCount + hostdCount + walletdCount) {
- clusterd.nodes = nodes.data.map((n) => ({
+ if (nodes.data?.length === renterdCount + hostdCount + walletdCount) {
+ clusterd.nodes = nodes.data?.map((n) => ({
...n,
apiAddress: n.apiAddress.replace('[::]', '127.0.0.1'),
}))
@@ -112,12 +113,14 @@ export async function renterdWaitForContracts({
},
})
const contracts = await bus.contracts()
+
+ const hostCount = hosts.data?.length || 0
+ const contractCount = contracts.data?.length || 0
+
console.log(
- `usable hosts: ${hosts.data.length}/${hostdCount} - active contracts: ${contracts.data.length}/${hostdCount}`
- )
- return (
- hosts.data.length >= hostdCount && contracts.data.length >= hostdCount
+ `usable hosts: ${hostCount}/${hostdCount} - active contracts: ${contractCount}/${hostdCount}`
)
+ return hostCount >= hostdCount && contractCount >= hostdCount
},
{
timeout: maxTimeWaitingForContractsToForm,
diff --git a/libs/design-system/src/index.ts b/libs/design-system/src/index.ts
index 57b2fe863..7e7926b99 100644
--- a/libs/design-system/src/index.ts
+++ b/libs/design-system/src/index.ts
@@ -192,4 +192,3 @@ export * from './lib/nodeToImage'
export * from './lib/colors'
export * from './lib/object'
export * from './lib/handleBatchOperation'
-export type * from './lib/types'
diff --git a/libs/renterd-js/README.md b/libs/renterd-js/README.md
index 13feb95e7..65728a18c 100644
--- a/libs/renterd-js/README.md
+++ b/libs/renterd-js/README.md
@@ -62,7 +62,7 @@ export async function example() {
},
})
- hosts.data.forEach((host) => {
+ hosts.data?.forEach((host) => {
console.log(host.publicKey, host.priceTable)
})
diff --git a/libs/renterd-js/src/example.ts b/libs/renterd-js/src/example.ts
index 9b3339138..98a2064a5 100644
--- a/libs/renterd-js/src/example.ts
+++ b/libs/renterd-js/src/example.ts
@@ -51,7 +51,7 @@ export async function example() {
},
})
- hosts.data.forEach((host) => {
+ hosts.data?.forEach((host) => {
console.log(host.publicKey, host.priceTable)
})
diff --git a/libs/renterd-types/src/bus.ts b/libs/renterd-types/src/bus.ts
index 8a2f397fe..9614b7578 100644
--- a/libs/renterd-types/src/bus.ts
+++ b/libs/renterd-types/src/bus.ts
@@ -9,6 +9,7 @@ import {
Transaction,
TransactionID,
WalletEvent,
+ Maybe,
} from '@siafoundation/types'
import {
ConsensusState,
@@ -231,7 +232,7 @@ export type HostsPayload = {
limit?: number
maxLastScan?: string
}
-export type HostsResponse = Host[]
+export type HostsResponse = Maybe
export type HostParams = { hostkey: string }
export type HostPayload = Host
@@ -290,7 +291,7 @@ export type HostScanResponse = {
export type ContractsParams = void
export type ContractsPayload = void
-export type ContractsResponse = Contract[]
+export type ContractsResponse = Maybe
export type ContractAcquireParams = {
id: string
diff --git a/libs/types/src/index.ts b/libs/types/src/index.ts
index 0957f1243..94bbe7acb 100644
--- a/libs/types/src/index.ts
+++ b/libs/types/src/index.ts
@@ -1,3 +1,4 @@
-export * from './core'
-export * from './events'
-export * from './v2'
+export type * from './core'
+export type * from './events'
+export type * from './utils'
+export type * from './v2'
diff --git a/libs/design-system/src/lib/types.ts b/libs/types/src/utils.ts
similarity index 100%
rename from libs/design-system/src/lib/types.ts
rename to libs/types/src/utils.ts