diff --git a/.changeset/famous-lemons-smile.md b/.changeset/famous-lemons-smile.md new file mode 100644 index 000000000..43792f587 --- /dev/null +++ b/.changeset/famous-lemons-smile.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/renterd-js': patch +--- + +Fixed a typo in the naming of the config method. diff --git a/.changeset/new-bananas-double.md b/.changeset/new-bananas-double.md new file mode 100644 index 000000000..0a6c679df --- /dev/null +++ b/.changeset/new-bananas-double.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/request': minor +--- + +Updated axios imports. diff --git a/.changeset/nine-crabs-try.md b/.changeset/nine-crabs-try.md new file mode 100644 index 000000000..e63f1bd33 --- /dev/null +++ b/.changeset/nine-crabs-try.md @@ -0,0 +1,7 @@ +--- +'@siafoundation/renterd-js': minor +'@siafoundation/renterd-react': minor +'@siafoundation/renterd-types': minor +--- + +Added support for autopilot config evaluation. diff --git a/apps/renterd/components/Files/checks/useDefaultContractSetNotSet.tsx b/apps/renterd/components/Files/checks/useDefaultContractSetNotSet.tsx index 628e3a860..050ec866b 100644 --- a/apps/renterd/components/Files/checks/useDefaultContractSetNotSet.tsx +++ b/apps/renterd/components/Files/checks/useDefaultContractSetNotSet.tsx @@ -1,7 +1,7 @@ -import { useContractSetSettings } from '../../../hooks/useContractSetSettings' +import { useSettingContractSet } from '@siafoundation/renterd-react' export function useDefaultContractSetNotSet() { - const css = useContractSetSettings() + const css = useSettingContractSet() return { active: css.data && !css.data?.default, diff --git a/apps/renterd/components/Files/checks/useNotEnoughContracts.tsx b/apps/renterd/components/Files/checks/useNotEnoughContracts.tsx index 8aae16913..e0b78b8ed 100644 --- a/apps/renterd/components/Files/checks/useNotEnoughContracts.tsx +++ b/apps/renterd/components/Files/checks/useNotEnoughContracts.tsx @@ -1,8 +1,8 @@ +import { useSettingRedundancy } from '@siafoundation/renterd-react' import { useContracts } from '../../../contexts/contracts' -import { useRedundancySettings } from '../../../hooks/useRedundancySettings' export function useNotEnoughContracts() { - const redundancy = useRedundancySettings() + const redundancy = useSettingRedundancy() const { datasetCount, isLoading: isContractsLoading } = useContracts() const active = diff --git a/apps/renterd/components/Keys/KeyContextMenu.tsx b/apps/renterd/components/Keys/KeyContextMenu.tsx index 913781fea..6664ea215 100644 --- a/apps/renterd/components/Keys/KeyContextMenu.tsx +++ b/apps/renterd/components/Keys/KeyContextMenu.tsx @@ -11,8 +11,10 @@ import { truncate, } from '@siafoundation/design-system' import { CaretDown16, Delete16 } from '@siafoundation/react-icons' -import { useSettingUpdate } from '@siafoundation/renterd-react' -import { useS3AuthenticationSettings } from '../../hooks/useS3AuthenticationSettings' +import { + useSettingS3Authentication, + useSettingUpdate, +} from '@siafoundation/renterd-react' import { useCallback } from 'react' import { omit } from '@technically/lodash' import { useDialog } from '../../contexts/dialog' @@ -25,7 +27,7 @@ type Props = { export function KeyContextMenu({ s3Key, contentProps, buttonProps }: Props) { const { openConfirmDialog } = useDialog() - const s3AuthenticationSettings = useS3AuthenticationSettings() + const s3AuthenticationSettings = useSettingS3Authentication() const update = useSettingUpdate() const deleteKey = useCallback(async () => { const newKeys = omit(s3AuthenticationSettings.data?.v4Keypairs, s3Key) diff --git a/apps/renterd/components/Keys/KeysCreateDialog.tsx b/apps/renterd/components/Keys/KeysCreateDialog.tsx index 036ae79ac..e79f14146 100644 --- a/apps/renterd/components/Keys/KeysCreateDialog.tsx +++ b/apps/renterd/components/Keys/KeysCreateDialog.tsx @@ -12,8 +12,10 @@ import { import { useCallback, useMemo } from 'react' import { useForm } from 'react-hook-form' import { useDialog } from '../../contexts/dialog' -import { useS3AuthenticationSettings } from '../../hooks/useS3AuthenticationSettings' -import { useSettingUpdate } from '@siafoundation/renterd-react' +import { + useSettingS3Authentication, + useSettingUpdate, +} from '@siafoundation/renterd-react' import { Reset16 } from '@carbon/icons-react' type Props = { @@ -98,7 +100,7 @@ function getFields({ export function KeysCreateDialog({ trigger, open, onOpenChange }: Props) { const { closeDialog } = useDialog() - const s3AuthenticationSettings = useS3AuthenticationSettings() + const s3AuthenticationSettings = useSettingS3Authentication() const update = useSettingUpdate() const form = useForm({ diff --git a/apps/renterd/contexts/config/useResources.tsx b/apps/renterd/contexts/config/useResources.tsx index 179057b7e..e694d6a01 100644 --- a/apps/renterd/contexts/config/useResources.tsx +++ b/apps/renterd/contexts/config/useResources.tsx @@ -1,11 +1,13 @@ import { minutesInMilliseconds } from '@siafoundation/design-system' -import { useAutopilotConfig } from '@siafoundation/renterd-react' +import { + useAutopilotConfig, + useSettingContractSet, + useSettingGouging, + useSettingRedundancy, + useSettingUploadPacking, +} from '@siafoundation/renterd-react' import { useSyncContractSet } from './useSyncContractSet' import { useAppSettings } from '@siafoundation/react-core' -import { useContractSetSettings } from '../../hooks/useContractSetSettings' -import { useGougingSettings } from '../../hooks/useGougingSettings' -import { useRedundancySettings } from '../../hooks/useRedundancySettings' -import { useUploadPackingSettings } from '../../hooks/useUploadPackingSettings' import { useSiaCentralHostsNetworkAverages } from '@siafoundation/sia-central-react' import { useApp } from '../app' @@ -21,7 +23,7 @@ export function useResources() { }, }, }) - const contractSet = useContractSetSettings({ + const contractSet = useSettingContractSet({ config: { swr: { errorRetryCount: 0, @@ -30,21 +32,21 @@ export function useResources() { }, }) // settings with initial defaults - const gouging = useGougingSettings({ + const gouging = useSettingGouging({ config: { swr: { refreshInterval: minutesInMilliseconds(1), }, }, }) - const redundancy = useRedundancySettings({ + const redundancy = useSettingRedundancy({ config: { swr: { refreshInterval: minutesInMilliseconds(1), }, }, }) - const uploadPacking = useUploadPackingSettings({ + const uploadPacking = useSettingUploadPacking({ config: { swr: { refreshInterval: minutesInMilliseconds(1), diff --git a/apps/renterd/contexts/config/useSyncContractSet.tsx b/apps/renterd/contexts/config/useSyncContractSet.tsx index 28251e865..de1d5db09 100644 --- a/apps/renterd/contexts/config/useSyncContractSet.tsx +++ b/apps/renterd/contexts/config/useSyncContractSet.tsx @@ -4,17 +4,19 @@ import { triggerSuccessToast, } from '@siafoundation/design-system' import { useCallback } from 'react' -import { useSettingUpdate } from '@siafoundation/renterd-react' +import { + useSettingContractSet, + useSettingUpdate, +} from '@siafoundation/renterd-react' import useLocalStorageState from 'use-local-storage-state' import { transformUpContractSet } from '../../contexts/config/transform' -import { useContractSetSettings } from '../../hooks/useContractSetSettings' export function useSyncContractSet() { const [shouldSyncDefaultContractSet, setShouldSyncDefaultContractSet] = useLocalStorageState('v0/autopilot/syncDefaultContractSet', { defaultValue: true, }) - const contractSet = useContractSetSettings({ + const contractSet = useSettingContractSet({ config: { swr: { errorRetryCount: 0, diff --git a/apps/renterd/contexts/contracts/index.tsx b/apps/renterd/contexts/contracts/index.tsx index 08de3f2ab..6ab52049e 100644 --- a/apps/renterd/contexts/contracts/index.tsx +++ b/apps/renterd/contexts/contracts/index.tsx @@ -10,6 +10,7 @@ import { useRouter } from 'next/router' import { useContracts as useContractsData, useContractSets, + useSettingContractSet, } from '@siafoundation/renterd-react' import { createContext, @@ -34,7 +35,6 @@ import { useSiascanUrl } from '../../hooks/useSiascanUrl' import { blockHeightToTime } from '@siafoundation/units' import { useContractMetrics } from './useContractMetrics' import { useContractSetMetrics } from './useContractSetMetrics' -import { useContractSetSettings } from '../../hooks/useContractSetSettings' import { defaultDatasetRefreshInterval } from '../../config/swr' const defaultLimit = 50 @@ -179,7 +179,7 @@ function useContractsMain() { const siascanUrl = useSiascanUrl() - const contractSetSettings = useContractSetSettings() + const contractSetSettings = useSettingContractSet() const cellContext = useMemo( () => ({ currentHeight: syncStatus.estimatedBlockHeight, diff --git a/apps/renterd/contexts/filesManager/uploads.tsx b/apps/renterd/contexts/filesManager/uploads.tsx index 65b3c87c3..bcefdf0e7 100644 --- a/apps/renterd/contexts/filesManager/uploads.tsx +++ b/apps/renterd/contexts/filesManager/uploads.tsx @@ -9,6 +9,7 @@ import { useMultipartUploadPart, useMultipartUploadComplete, useMultipartUploadCreate, + useSettingRedundancy, } from '@siafoundation/renterd-react' import { throttle } from '@technically/lodash' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' @@ -22,7 +23,6 @@ import { import { MultipartUpload } from '../../lib/multipartUpload' import { MiBToBytes } from '@siafoundation/units' import { useMutate } from '@siafoundation/react-core' -import { useRedundancySettings } from '../../hooks/useRedundancySettings' import { useWarnActiveUploadsOnClose } from './useWarnActiveUploadsOnClose' const maxConcurrentUploads = 5 @@ -42,7 +42,7 @@ export function useUploads({ activeDirectoryPath }: Props) { const busUploadCreate = useMultipartUploadCreate() const busUploadAbort = useMultipartUploadAbort() const [uploadsMap, setUploadsMap] = useState({}) - const redundancy = useRedundancySettings({ + const redundancy = useSettingRedundancy({ config: { swr: { refreshInterval: minutesInMilliseconds(1), diff --git a/apps/renterd/contexts/keys/index.tsx b/apps/renterd/contexts/keys/index.tsx index 4f06ff141..157e7f94a 100644 --- a/apps/renterd/contexts/keys/index.tsx +++ b/apps/renterd/contexts/keys/index.tsx @@ -13,8 +13,8 @@ import { sortOptions, } from './types' import { columns } from './columns' -import { useS3AuthenticationSettings } from '../../hooks/useS3AuthenticationSettings' import { defaultDatasetRefreshInterval } from '../../config/swr' +import { useSettingS3Authentication } from '@siafoundation/renterd-react' const defaultLimit = 50 @@ -22,7 +22,7 @@ function useKeysMain() { const router = useRouter() const limit = Number(router.query.limit || defaultLimit) const offset = Number(router.query.offset || 0) - const response = useS3AuthenticationSettings({ + const response = useSettingS3Authentication({ config: { swr: { refreshInterval: defaultDatasetRefreshInterval, diff --git a/apps/renterd/hooks/useContractSetSettings.tsx b/apps/renterd/hooks/useContractSetSettings.tsx deleted file mode 100644 index 751d7a468..000000000 --- a/apps/renterd/hooks/useContractSetSettings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { HookArgsSwr } from '@siafoundation/react-core' -import { ContractSetSettings } from '@siafoundation/renterd-types' -import { useSetting } from '@siafoundation/renterd-react' - -export function useContractSetSettings( - args?: HookArgsSwr -) { - return useSetting({ - ...args, - params: { key: 'contractset' }, - }) -} diff --git a/apps/renterd/hooks/useGougingSettings.tsx b/apps/renterd/hooks/useGougingSettings.tsx deleted file mode 100644 index 2caad7d5c..000000000 --- a/apps/renterd/hooks/useGougingSettings.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { HookArgsSwr } from '@siafoundation/react-core' -import { GougingSettings } from '@siafoundation/renterd-types' -import { useSetting } from '@siafoundation/renterd-react' - -export function useGougingSettings(args?: HookArgsSwr) { - return useSetting({ - ...args, - params: { key: 'gouging' }, - }) -} diff --git a/apps/renterd/hooks/useIsApcsEqDcs.tsx b/apps/renterd/hooks/useIsApcsEqDcs.tsx index 4c7166c69..6b0a06ca6 100644 --- a/apps/renterd/hooks/useIsApcsEqDcs.tsx +++ b/apps/renterd/hooks/useIsApcsEqDcs.tsx @@ -1,6 +1,8 @@ -import { useAutopilotConfig } from '@siafoundation/renterd-react' +import { + useAutopilotConfig, + useSettingContractSet, +} from '@siafoundation/renterd-react' import { useApp } from '../contexts/app' -import { useContractSetSettings } from './useContractSetSettings' // is the autopilot contract set the same as the default contract set export function useIsApcsEqDcs() { @@ -8,7 +10,7 @@ export function useIsApcsEqDcs() { const apc = useAutopilotConfig({ disabled: autopilot.status !== 'on', }) - const css = useContractSetSettings() + const css = useSettingContractSet() return { isValidating: apc.isValidating || css.isValidating, diff --git a/apps/renterd/hooks/useRedundancySettings.tsx b/apps/renterd/hooks/useRedundancySettings.tsx deleted file mode 100644 index 47c9b700e..000000000 --- a/apps/renterd/hooks/useRedundancySettings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { HookArgsSwr } from '@siafoundation/react-core' -import { RedundancySettings } from '@siafoundation/renterd-types' -import { useSetting } from '@siafoundation/renterd-react' - -export function useRedundancySettings( - args?: HookArgsSwr -) { - return useSetting({ - ...args, - params: { key: 'redundancy' }, - }) -} diff --git a/apps/renterd/hooks/useS3AuthenticationSettings.tsx b/apps/renterd/hooks/useS3AuthenticationSettings.tsx deleted file mode 100644 index 192d89672..000000000 --- a/apps/renterd/hooks/useS3AuthenticationSettings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { HookArgsSwr } from '@siafoundation/react-core' -import { S3AuthenticationSettings } from '@siafoundation/renterd-types' -import { useSetting } from '@siafoundation/renterd-react' - -export function useS3AuthenticationSettings( - args?: HookArgsSwr -) { - return useSetting({ - ...args, - params: { key: 's3authentication' }, - }) -} diff --git a/apps/renterd/hooks/useUploadPackingSettings.tsx b/apps/renterd/hooks/useUploadPackingSettings.tsx deleted file mode 100644 index c732f8822..000000000 --- a/apps/renterd/hooks/useUploadPackingSettings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { HookArgsSwr } from '@siafoundation/react-core' -import { UploadPackingSettings } from '@siafoundation/renterd-types' -import { useSetting } from '@siafoundation/renterd-react' - -export function useUploadPackingSettings( - args?: HookArgsSwr -) { - return useSetting({ - ...args, - params: { key: 'uploadpacking' }, - }) -} diff --git a/libs/renterd-js/package.json b/libs/renterd-js/package.json index 0c291d0ba..0ed789307 100644 --- a/libs/renterd-js/package.json +++ b/libs/renterd-js/package.json @@ -5,7 +5,8 @@ "license": "MIT", "dependencies": { "@siafoundation/renterd-types": "0.1.0", - "@siafoundation/request": "0.1.0" + "@siafoundation/request": "0.1.0", + "axios": "^0.27.2" }, "types": "./src/index.d.ts" } diff --git a/libs/renterd-js/src/autopilot.ts b/libs/renterd-js/src/autopilot.ts index 40e063482..bde26e561 100644 --- a/libs/renterd-js/src/autopilot.ts +++ b/libs/renterd-js/src/autopilot.ts @@ -1,4 +1,7 @@ import { + AutopilotConfigEvaluateParams, + AutopilotConfigEvaluatePayload, + AutopilotConfigEvaluateResponse, AutopilotConfigParams, AutopilotConfigPayload, AutopilotConfigResponse, @@ -36,7 +39,7 @@ export function Autopilot({ AutopilotStatePayload, AutopilotStateResponse >(axios, 'get', autopilotStateRoute), - confg: buildRequestHandler< + config: buildRequestHandler< AutopilotConfigParams, AutopilotConfigPayload, AutopilotConfigResponse @@ -46,6 +49,11 @@ export function Autopilot({ AutopilotConfigUpdatePayload, AutopilotConfigUpdateResponse >(axios, 'put', autopilotConfigRoute), + configEvaluate: buildRequestHandler< + AutopilotConfigEvaluateParams, + AutopilotConfigEvaluatePayload, + AutopilotConfigEvaluateResponse + >(axios, 'post', autopilotConfigRoute), hostsSearch: buildRequestHandler< AutopilotHostsSearchParams, AutopilotHostsSearchPayload, diff --git a/libs/renterd-js/src/bus.ts b/libs/renterd-js/src/bus.ts index 659b2088f..945e4d948 100644 --- a/libs/renterd-js/src/bus.ts +++ b/libs/renterd-js/src/bus.ts @@ -53,6 +53,7 @@ import { ContractSetMetricsParams, ContractSetMetricsPayload, ContractSetMetricsResponse, + ContractSetSettings, ContractSetUpdateParams, ContractSetUpdatePayload, ContractSetUpdateResponse, @@ -68,6 +69,7 @@ import { ContractsReleasePayload, ContractsReleaseResponse, ContractsResponse, + GougingSettings, HostInteractionParams, HostInteractionPayload, HostInteractionResponse, @@ -137,7 +139,8 @@ import { ObjectsStatsParams, ObjectsStatsPayload, ObjectsStatsResponse, - Setting, + RedundancySettings, + S3AuthenticationSettings, SettingParams, SettingPayload, SettingResponse, @@ -168,6 +171,7 @@ import { TxPoolTransactionsParams, TxPoolTransactionsPayload, TxPoolTransactionsResponse, + UploadPackingSettings, WalletAddressesParams, WalletAddressesPayload, WalletAddressesResponse, @@ -264,6 +268,7 @@ import { busWalletTransactionsRoute, } from '@siafoundation/renterd-types' import { buildRequestHandler, initAxios } from '@siafoundation/request' +import { AxiosRequestConfig } from 'axios' export function Bus({ api, password }: { api: string; password?: string }) { const axios = initAxios(api, password) @@ -534,11 +539,107 @@ export function Bus({ api, password }: { api: string; password?: string }) { SettingsPayload, SettingsResponse >(axios, 'get', busSettingsRoute), - setting: buildRequestHandler< - SettingParams, - SettingPayload, - SettingResponse - >(axios, 'get', busSettingKeyRoute), + setting: function setting>({ + params, + config, + }: { + params: SettingParams + config?: AxiosRequestConfig + }) { + return buildRequestHandler< + SettingParams, + SettingPayload, + SettingResponse + >( + axios, + 'get', + busSettingKeyRoute + )({ params, config }) + }, + settingGouging: ({ config }: { config?: AxiosRequestConfig } = {}) => { + return buildRequestHandler< + SettingParams, + SettingPayload, + SettingResponse + >( + axios, + 'get', + busSettingKeyRoute + )({ + params: { + key: 'gouging', + }, + config, + }) + }, + settingRedundancy: ({ config }: { config?: AxiosRequestConfig } = {}) => { + return buildRequestHandler< + SettingParams, + SettingPayload, + SettingResponse + >( + axios, + 'get', + busSettingKeyRoute + )({ + params: { + key: 'redundancy', + }, + config, + }) + }, + settingContractSet: ({ config }: { config?: AxiosRequestConfig } = {}) => { + return buildRequestHandler< + SettingParams, + SettingPayload, + SettingResponse + >( + axios, + 'get', + busSettingKeyRoute + )({ + params: { + key: 'contractset', + }, + config, + }) + }, + settingUploadPacking: ({ + config, + }: { config?: AxiosRequestConfig } = {}) => { + return buildRequestHandler< + SettingParams, + SettingPayload, + SettingResponse + >( + axios, + 'get', + busSettingKeyRoute + )({ + params: { + key: 'uploadpacking', + }, + config, + }) + }, + settingS3Authentication: ({ + config, + }: { config?: AxiosRequestConfig } = {}) => { + return buildRequestHandler< + SettingParams, + SettingPayload, + SettingResponse + >( + axios, + 'get', + busSettingKeyRoute + )({ + params: { + key: 's3authentication', + }, + config, + }) + }, settingUpdate: buildRequestHandler< SettingUpdateParams, SettingUpdatePayload, diff --git a/libs/renterd-react/src/autopilot.ts b/libs/renterd-react/src/autopilot.ts index 61cf62432..2759c6de4 100644 --- a/libs/renterd-react/src/autopilot.ts +++ b/libs/renterd-react/src/autopilot.ts @@ -14,6 +14,9 @@ import { AutopilotConfigUpdateParams, AutopilotConfigUpdatePayload, AutopilotConfigUpdateResponse, + AutopilotConfigEvaluateParams, + AutopilotConfigEvaluatePayload, + AutopilotConfigEvaluateResponse, AutopilotHostsSearchParams, AutopilotHostsSearchPayload, AutopilotHostsSearchResponse, @@ -68,6 +71,16 @@ export function useAutopilotConfigUpdate( ) } +export function useAutopilotConfigEvaluate( + args?: HookArgsCallback< + AutopilotConfigEvaluateParams, + AutopilotConfigEvaluatePayload, + AutopilotConfigEvaluateResponse + > +) { + return usePostFunc({ ...args, route: autopilotConfigRoute }) +} + export function useAutopilotHostsSearch( args?: HookArgsWithPayloadSwr< AutopilotHostsSearchParams, diff --git a/libs/renterd-react/src/bus.ts b/libs/renterd-react/src/bus.ts index 4e86e51ca..c41967560 100644 --- a/libs/renterd-react/src/bus.ts +++ b/libs/renterd-react/src/bus.ts @@ -248,6 +248,11 @@ import { busMultipartListpartsRoute, busMultipartListuploadsRoute, busMultipartPartRoute, + GougingSettings, + ContractSetSettings, + RedundancySettings, + S3AuthenticationSettings, + UploadPackingSettings, } from '@siafoundation/renterd-types' // state @@ -806,6 +811,49 @@ export function useSetting( return useGetSwr({ ...args, route: busSettingKeyRoute }) } +export function useSettingGouging(args?: HookArgsSwr) { + return useSetting({ + ...args, + params: { key: 'gouging' }, + }) +} + +export function useSettingContractSet( + args?: HookArgsSwr +) { + return useSetting({ + ...args, + params: { key: 'contractset' }, + }) +} + +export function useSettingRedundancy( + args?: HookArgsSwr +) { + return useSetting({ + ...args, + params: { key: 'redundancy' }, + }) +} + +export function useSettingS3Authentication( + args?: HookArgsSwr +) { + return useSetting({ + ...args, + params: { key: 's3authentication' }, + }) +} + +export function useSettingUploadPacking( + args?: HookArgsSwr +) { + return useSetting({ + ...args, + params: { key: 'uploadpacking' }, + }) +} + export function useSettingUpdate( args?: HookArgsCallback< SettingUpdateParams, diff --git a/libs/renterd-types/src/autopilot.ts b/libs/renterd-types/src/autopilot.ts index 31b674428..de2c1d5b6 100644 --- a/libs/renterd-types/src/autopilot.ts +++ b/libs/renterd-types/src/autopilot.ts @@ -1,4 +1,9 @@ -import { AutopilotConfig, Host } from './types' +import { + AutopilotConfig, + GougingSettings, + Host, + RedundancySettings, +} from './types' import { HostsSearchPayload, BusStateResponse } from './bus' export const autopilotStateRoute = '/autopilot/state' @@ -30,6 +35,34 @@ export type AutopilotConfigUpdateParams = void export type AutopilotConfigUpdatePayload = AutopilotConfig export type AutopilotConfigUpdateResponse = void +export type ConfigRecommendation = { + gougingSettings: GougingSettings +} + +export type AutopilotConfigEvaluateParams = void +export type AutopilotConfigEvaluatePayload = { + autopilotConfig: AutopilotConfig + gougingSettings: GougingSettings + redundancySettings: RedundancySettings +} +export type AutopilotConfigEvaluateResponse = { + hosts: number + usable: number + unusable: { + blocked: number + gouging: { + contract: number + download: number + gouging: number + pruning: number + upload: number + } + notAcceptingContracts: number + notScanned: number + } + recommendation?: ConfigRecommendation +} + export type AutopilotHost = { host: Host checks?: { diff --git a/libs/request/src/index.ts b/libs/request/src/index.ts index 3cea78132..5b99001b7 100644 --- a/libs/request/src/index.ts +++ b/libs/request/src/index.ts @@ -34,7 +34,7 @@ export function parameterizeRoute( return route } -type Method = 'get' | 'post' | 'patch' | 'put' | 'delete' +export type RequestMethod = 'get' | 'post' | 'patch' | 'put' | 'delete' export function buildRequestHandler< Params = void, @@ -42,7 +42,7 @@ export function buildRequestHandler< Response = void >( axios: AxiosInstance, - method: Method, + method: RequestMethod, route: string, options: { defaultParams?: Params