From f1d067206af5ec605f3ef7dfff8151a792825652 Mon Sep 17 00:00:00 2001 From: april Date: Thu, 10 Oct 2024 22:55:02 +0100 Subject: [PATCH] docs: fix tsdoc annotations --- packages/client-react-hooks/src/logging.ts | 2 +- .../client-react-hooks/src/nil-hook-base.ts | 60 +++++++++---------- .../src/nillion-provider.tsx | 49 ++++++++------- .../src/use-nil-compute-output.ts | 10 ++-- .../client-react-hooks/src/use-nil-compute.ts | 16 +++-- .../src/use-nil-delete-value.ts | 12 ++-- .../src/use-nil-fetch-store-acl.ts | 12 ++-- .../src/use-nil-fetch-value.ts | 19 +++--- .../src/use-nil-set-store-acl.ts | 12 ++-- .../src/use-nil-store-program.ts | 7 +-- .../src/use-nil-store-value.ts | 11 ++-- .../src/use-nil-update-value.ts | 11 ++-- .../src/use-nillion-auth.ts | 7 +-- packages/client-vms/src/nada.ts | 2 +- packages/client-vms/src/nilvm/client.ts | 43 +++++++------ packages/client-vms/src/types.ts | 20 +++---- 16 files changed, 136 insertions(+), 157 deletions(-) diff --git a/packages/client-react-hooks/src/logging.ts b/packages/client-react-hooks/src/logging.ts index 9f214a0..70ace69 100644 --- a/packages/client-react-hooks/src/logging.ts +++ b/packages/client-react-hooks/src/logging.ts @@ -2,6 +2,6 @@ import debug from "debug"; /** * `Log` is a debug logger that can be used to log messages to the console. - * @param message: string + * @param message - string */ export const Log = debug("nillion:react-hooks"); diff --git a/packages/client-react-hooks/src/nil-hook-base.ts b/packages/client-react-hooks/src/nil-hook-base.ts index 81b237f..c6a3d88 100644 --- a/packages/client-react-hooks/src/nil-hook-base.ts +++ b/packages/client-react-hooks/src/nil-hook-base.ts @@ -1,12 +1,11 @@ import { UseMutationResult } from "@tanstack/react-query"; /** - * NilHookState is a set of states that a NilHook can be in: - * - Idle: waiting to receive a request - * - Loading: waiting for the request to complete - * - Success: the request was successful - * - Error: the request had an error - @enum + * `NilHookState` is a set of states that a NilHook can be in: + * - Idle: Waiting to receive a request + * - Loading: Waiting for the request to complete + * - Success: The request was successful + * - Error: The request had an error */ export const NilHookState = { Idle: { @@ -41,7 +40,6 @@ export const NilHookState = { /** * `UseNilHook` is a hook that allows you to execute a NilHook operation, and check its status. - * @type */ export type UseNilHook = NilHookBaseResult< ExecuteArgs, @@ -56,8 +54,8 @@ export type UseNilHook = NilHookBaseResult< /** * NilHookBaseResult is a set of functions that a NilHook can use. - * @property execute - A function that executes the NilHook. - * @property executeAsync - A function that executes the NilHook asynchronously. + * execute - A function that executes the NilHook. + * executeAsync - A function that executes the NilHook asynchronously. */ export interface NilHookBaseResult { execute: (args: ExecuteArgs) => void; @@ -66,11 +64,11 @@ export interface NilHookBaseResult { /** * NilHookIdleResult is a set of states that a NilHook can be in when it is idle. - * @property status - The status of the NilHook. - * @property isLoading - Whether the NilHook is loading. - * @property isSuccess - Whether the NilHook is successful. - * @property isError - Whether the NilHook has an error. - * @property isIdle - Whether the NilHook is idle. + * status - The status of the NilHook. + * isLoading - Whether the NilHook is loading. + * isSuccess - Whether the NilHook is successful. + * isError - Whether the NilHook has an error. + * isIdle - Whether the NilHook is idle. */ export interface NilHookIdleResult { status: "idle"; @@ -82,11 +80,11 @@ export interface NilHookIdleResult { /** * NilHookLoadingResult is a set of states that a NilHook can be in when it is loading. - * @property status - The status of the NilHook. - * @property isLoading - Whether the NilHook is loading. - * @property isSuccess - Whether the NilHook is successful. - * @property isError - Whether the NilHook has an error. - * @property isIdle - Whether the NilHook is idle. + * status - The status of the NilHook, namely "loading". + * isLoading - Whether the NilHook is loading. + * isSuccess - Whether the NilHook is successful. + * isError - Whether the NilHook has an error. + * isIdle - Whether the NilHook is idle. */ export interface NilHookLoadingResult { status: "loading"; @@ -98,12 +96,12 @@ export interface NilHookLoadingResult { /** * NilHookSuccessResult is a set of states that a NilHook can be in when it is successful. - * @property status - The status of the NilHook. - * @property data - The data of the NilHook. - * @property isLoading - Whether the NilHook is loading. - * @property isSuccess - Whether the NilHook is successful. - * @property isError - Whether the NilHook has an error. - * @property isIdle - Whether the NilHook is idle. + * status - The status of the NilHook namely "success". + * data - The data of the NilHook. + * isLoading - Whether the NilHook is loading. + * isSuccess - Whether the NilHook is successful. + * isError - Whether the NilHook has an error. + * isIdle - Whether the NilHook is idle. */ export interface NilHookSuccessResult { status: "success"; @@ -116,12 +114,12 @@ export interface NilHookSuccessResult { /** * NilHookErrorResult is a set of states that a NilHook can be in when it has an error. - * @property status - The status of the NilHook. - * @property error - The error of the NilHook. - * @property isLoading - Whether the NilHook is loading. - * @property isSuccess - Whether the NilHook is successful. - * @property isError - Whether the NilHook has an error. - * @property isIdle - Whether the NilHook is idle. + * status - The status of the NilHook namely "error". + * error - The error of the NilHook. + * isLoading - Whether the NilHook is loading. + * isSuccess - Whether the NilHook is successful. + * isError - Whether the NilHook has an error. + * isIdle - Whether the NilHook is idle. */ export interface NilHookErrorResult { status: "error"; diff --git a/packages/client-react-hooks/src/nillion-provider.tsx b/packages/client-react-hooks/src/nillion-provider.tsx index dece4be..db2ff97 100644 --- a/packages/client-react-hooks/src/nillion-provider.tsx +++ b/packages/client-react-hooks/src/nillion-provider.tsx @@ -25,25 +25,25 @@ import { NetworkConfig, NillionClient } from "@nillion/client-vms"; import { Log } from "./logging"; /** - * WithConfigProps - * @property config is a ProviderNetworkConfig - * @property network is a NamedNetwork - * @property client is not allowed + * `WithConfigProps` + * `config` is a ProviderNetworkConfig + * `network` is a NamedNetwork + * `client` is not allowed **/ -export interface WithConfigProps { +interface WithConfigProps { config?: ProviderNetworkConfig; network?: NamedNetwork; client?: never; } /** - * ProviderNetworkConfig - * @property bootnodes is an array of Multiaddr or string - * @property clusterId is a ClusterId or string - * @property nilChainId is a ChainId or string - * @property nilChainEndpoint is a Url or string + * `ProviderNetworkConfig` + * `bootnodes` is an array of Multiaddr or string + * `clusterId` is a ClusterId or string + * `nilChainId` is a ChainId or string + * `nilChainEndpoint` is a Url or string */ -export interface ProviderNetworkConfig { +interface ProviderNetworkConfig { bootnodes?: (Multiaddr | string)[]; clusterId?: ClusterId | string; nilChainId?: ChainId | string; @@ -51,28 +51,27 @@ export interface ProviderNetworkConfig { } /** - * WithClientProps - * @property client is a NillionClient - * @property config is not allowed - * @property network is not allowed + * `WithClientProps` + * `client` is a `NillionClient` + * `config` is not allowed + * `network` is not allowed */ -export interface WithClientProps { +interface WithClientProps { client: NillionClient; config?: never; network?: never; } /** - * NillionProviderProps - * @type Alias for either WithConfigProps or WithClientProps + * `NillionProviderProps` + * Alias for either WithConfigProps or WithClientProps */ export type NillionProviderProps = WithConfigProps | WithClientProps; /** - * NillionContext - * @property client is a NillionClient - * @property logout is a function that returns a Promise - * @interface + * `NillionContext` + * `client` is a NillionClient + * `logout` is a function that returns a Promise */ export interface NillionContext { client: NillionClient; @@ -80,8 +79,8 @@ export interface NillionContext { } /** - * NillionContext - * @type React.Context + * `NillionContext` + * It provides a `NillionClient` context */ export const NillionContext = createContext( undefined, @@ -92,7 +91,7 @@ const client = NillionClient.create(); /** * NillionProvider - * @param NillionProviderProps & { children: ReactNode } + * @param NillionProviderProps - expects provider props or a `ReactNode` * @returns ReactNode */ export const NillionProvider: React.FC< diff --git a/packages/client-react-hooks/src/use-nil-compute-output.ts b/packages/client-react-hooks/src/use-nil-compute-output.ts index 21c8e0f..3bba2aa 100644 --- a/packages/client-react-hooks/src/use-nil-compute-output.ts +++ b/packages/client-react-hooks/src/use-nil-compute-output.ts @@ -7,7 +7,7 @@ import { useNillion } from "./use-nillion"; /** * `ExecuteArgs` is an interface that can be passed to the `execute` function. - * @param id: `ComputeOutputId` or `string` + * @param id - `ComputeOutputId` or `string` */ interface ExecuteArgs { id: ComputeOutputId | string; @@ -17,16 +17,14 @@ type ExecuteResult = Record; /** * `UseNilComputeOutput` is a hook that allows you to execute a compute output. - * @property execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. - * @property executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. - * @type + * execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. + * executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. */ -export type UseNilComputeOutput = UseNilHook; +type UseNilComputeOutput = UseNilHook; /** * `useNilComputeOutput` is a hook that allows you to execute a compute output. * @returns {@link UseNilComputeOutput} - * @interface */ export const useNilComputeOutput = (): UseNilComputeOutput => { const { client: nilClient } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nil-compute.ts b/packages/client-react-hooks/src/use-nil-compute.ts index 4dba462..1978be6 100644 --- a/packages/client-react-hooks/src/use-nil-compute.ts +++ b/packages/client-react-hooks/src/use-nil-compute.ts @@ -11,11 +11,11 @@ import { nilHookBaseResult, UseNilHook } from "./nil-hook-base"; import { useNillion } from "./use-nillion"; /** ExecuteArgs is an interface that can be passed to the `execute` function. - * @param bindings: `ProgramBindings` - * @param values?: `NadaValues` - * @param storeIds?: array of `StoreId`s or strings + * @param bindings - `ProgramBindings` + * @param values - `NadaValues` + * @param storeIds - array of `StoreId`s or strings */ -export interface ExecuteArgs { +interface ExecuteArgs { bindings: ProgramBindings; values?: NadaValues; storeIds?: (StoreId | string)[]; @@ -24,16 +24,14 @@ type ExecuteResult = ComputeOutputId; /** * `UseNilCompute` is a hook that allows you to execute a compute operation on Nillion. - * @property execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. - * @property executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. - * @type + * execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. + * executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. */ -export type UseNilCompute = UseNilHook; +type UseNilCompute = UseNilHook; /** * `useNilCompute` is a hook that allows you to execute a compute. * @returns {@link UseNilCompute} - * @interface */ export const useNilCompute = (): UseNilCompute => { const { client: nilClient } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nil-delete-value.ts b/packages/client-react-hooks/src/use-nil-delete-value.ts index c1449b6..3170d7a 100644 --- a/packages/client-react-hooks/src/use-nil-delete-value.ts +++ b/packages/client-react-hooks/src/use-nil-delete-value.ts @@ -9,9 +9,9 @@ import { useNillion } from "./use-nillion"; /** * `ExecuteArgs` is an interface that can be passed to the `execute` function - * @param id: `StoreId` or `string` + * @param id - `StoreId` or `string` */ -export interface ExecuteArgs { +interface ExecuteArgs { id: StoreId | string; } @@ -19,16 +19,14 @@ type ExecuteResult = StoreId; /** * `UseNilDeleteValue` is a hook that allows you to delete a value from a store. - * @property execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. - * @property executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. - * @interface + * execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. + * executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. */ -export type UseNilDeleteValue = UseNilHook; +type UseNilDeleteValue = UseNilHook; /** * `useNilDeleteValue` is a hook that allows you to delete a value from a store. * @returns {@link UseNilDeleteValue} - * @interface */ export const useNilDeleteValue = (): UseNilDeleteValue => { const { client: nilClient } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nil-fetch-store-acl.ts b/packages/client-react-hooks/src/use-nil-fetch-store-acl.ts index e5e1014..458f65f 100644 --- a/packages/client-react-hooks/src/use-nil-fetch-store-acl.ts +++ b/packages/client-react-hooks/src/use-nil-fetch-store-acl.ts @@ -7,25 +7,23 @@ import { useNillion } from "./use-nillion"; /** * `ExecuteArgs` is an interface that can be passed to the `execute` function. - * @param id: `StoreId` or `string` + * @param id - `StoreId` or `string` */ -export interface ExecuteArgs { +interface ExecuteArgs { id: StoreId | string; } type ExecuteResult = StoreAcl; /** * `UseNilFetchStoreAcl` is a hook that allows you to fetch a store acl. - * @property execute executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. - * @property executeAsync executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. - * @interface + * execute - executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. + * executeAsync - executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. */ -export type UseNilFetchStoreAcl = UseNilHook; +type UseNilFetchStoreAcl = UseNilHook; /** * `useNilFetchStoreAcl` is a hook that allows you to fetch a store acl. * @returns {@link UseNilFetchStoreAcl} - * @interface */ export const useNilFetchStoreAcl = (): UseNilFetchStoreAcl => { const { client } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nil-fetch-value.ts b/packages/client-react-hooks/src/use-nil-fetch-value.ts index b8cf05c..b58ff71 100644 --- a/packages/client-react-hooks/src/use-nil-fetch-value.ts +++ b/packages/client-react-hooks/src/use-nil-fetch-value.ts @@ -15,20 +15,20 @@ import { useNillion } from "./use-nillion"; /** * `Options` is an interface that can be passed to the `useNilFetchValue` hook. - * @param type: `NadaValueType` - * @param staleAfter?: `number` + * @param type - `NadaValueType` + * @param staleAfter - `number` */ -export interface Options { +interface Options { type: NadaValueType; staleAfter?: number; } /** * `ExecuteArgs` is an interface that can be passed to the `execute` function. - * @param id: `StoreId` or `string` - * @param name: `NamedValue` or `string` + * @param id - `StoreId` or `string` + * @param name - `NamedValue` or `string` */ -export interface ExecuteArgs { +interface ExecuteArgs { id: StoreId | string; name: NamedValue | string; } @@ -36,11 +36,10 @@ type ExecuteResult = NadaPrimitiveValue; /** * `UseNilFetchValue` is a hook that allows you to fetch a value from a store. - * @property execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. - * @property executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. - * @interface + * execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. + * executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. */ -export type UseNilFetchValue = UseNilHook; +type UseNilFetchValue = UseNilHook; /** * `useNilFetchValue` is a hook that allows you to fetch a value from a store. diff --git a/packages/client-react-hooks/src/use-nil-set-store-acl.ts b/packages/client-react-hooks/src/use-nil-set-store-acl.ts index a7a274d..9bbfb5a 100644 --- a/packages/client-react-hooks/src/use-nil-set-store-acl.ts +++ b/packages/client-react-hooks/src/use-nil-set-store-acl.ts @@ -8,10 +8,10 @@ import { useNillion } from "./use-nillion"; /** * `ExecuteArgs` is an interface that can be passed to the `execute` function. - * @param id: `StoreId` or `string` - * @param acl: `StoreAcl` + * @param id - `StoreId` or `string` + * @param acl - `StoreAcl` */ -export interface ExecuteArgs { +interface ExecuteArgs { id: StoreId | string; acl: StoreAcl; } @@ -19,10 +19,8 @@ type ExecuteResult = ActionId; /** * `UseNilSetStoreAcl` is a hook that allows you to set a store acl. - * @property execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. - * @property executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. - * @interface - * @notExported + * execute - It executes the NilHook synchronously, allowing the user to check for its status via {@link isSuccess} and {@link isError}. + * executeAsync - It executes the NilHook asynchronously, allowing the usage of `async/await` or `.then()`. */ type UseNilSetStoreAcl = UseNilHook; diff --git a/packages/client-react-hooks/src/use-nil-store-program.ts b/packages/client-react-hooks/src/use-nil-store-program.ts index 6b16bca..1bc1863 100644 --- a/packages/client-react-hooks/src/use-nil-store-program.ts +++ b/packages/client-react-hooks/src/use-nil-store-program.ts @@ -8,10 +8,10 @@ import { useNillion } from "./use-nillion"; /** * `ExecuteArgs` is an interface that can be passed to the `execute` function. - * @param name: `ProgramName` or `string` - * @param program: `Uint + * @param name - `ProgramName` or `string` + * @param program - `Uint8Array` */ -export interface ExecuteArgs { +interface ExecuteArgs { name: ProgramName | string; program: Uint8Array; } @@ -22,7 +22,6 @@ type UseNilStoreProgram = UseNilHook; /** * `useNilStoreProgram` is a hook that allows you to store a program in Nillion. * @returns {@link UseNilStoreProgram} - * @interface */ export const useNilStoreProgram = (): UseNilStoreProgram => { const { client: nilClient } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nil-store-value.ts b/packages/client-react-hooks/src/use-nil-store-value.ts index c084c3a..e8f97b7 100644 --- a/packages/client-react-hooks/src/use-nil-store-value.ts +++ b/packages/client-react-hooks/src/use-nil-store-value.ts @@ -13,12 +13,12 @@ import { nilHookBaseResult, UseNilHook } from "./nil-hook-base"; import { useNillion } from "./use-nillion"; /** `ExecuteArgs` is an interface that can be passed to the `execute` function - * @param name: `NamedValue` or `string` - * @param data: `NadaPrimitiveValue` - * @param ttl: `Days` or `number` - * @param acl?: `StoreAcl` + * @param name - `NamedValue` or `string` + * @param data - `NadaPrimitiveValue` + * @param ttl - `Days` or `number` + * @param acl - `StoreAcl` */ -export interface ExecuteArgs { +interface ExecuteArgs { name: NamedValue | string; data: NadaPrimitiveValue; ttl: Days | number; @@ -32,7 +32,6 @@ type UseNilStoreValue = UseNilHook; /** * `useNilStoreValue` is a hook that allows you to store a value in Nillion. * @returns {@link UseNilStoreValue} - * @interface */ export const useNilStoreValue = (): UseNilStoreValue => { const { client: nilClient } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nil-update-value.ts b/packages/client-react-hooks/src/use-nil-update-value.ts index 70a8969..8746482 100644 --- a/packages/client-react-hooks/src/use-nil-update-value.ts +++ b/packages/client-react-hooks/src/use-nil-update-value.ts @@ -12,12 +12,12 @@ import { nilHookBaseResult, UseNilHook } from "./nil-hook-base"; import { useNillion } from "./use-nillion"; /** `ExecuteArgs` is an interface that can be passed to the `execute` function - * @oaran id: `StoreId` or `string` - * @param name: `NamedValue` or `string` - * @param data: `NadaPrimitiveValue` - * @param ttl: `Days` or `number` + * @oaram id - `StoreId` or `string` + * @param name - `NamedValue` or `string` + * @param data - `NadaPrimitiveValue` + * @param ttl - `Days` or `number` */ -export interface ExecuteArgs { +interface ExecuteArgs { id: StoreId | string; name: NamedValue | string; data: NadaPrimitiveValue; @@ -31,7 +31,6 @@ type UseNilUpdateValue = UseNilHook; /** * `useNilUpdateValue` is a hook that allows you to update a value in Nillion. * @returns {@link UseNilUpdateValue} - * @interface */ export const useNilUpdateValue = (): UseNilUpdateValue => { const { client: nilClient } = useNillion(); diff --git a/packages/client-react-hooks/src/use-nillion-auth.ts b/packages/client-react-hooks/src/use-nillion-auth.ts index a8af440..d2d1a42 100644 --- a/packages/client-react-hooks/src/use-nillion-auth.ts +++ b/packages/client-react-hooks/src/use-nillion-auth.ts @@ -22,9 +22,9 @@ export interface UseNillionAuthContext { * It is a union of the `UserSeed` type and a string, which can be used to * create a `UserSeed`. Additionally, it can include a nodeSeed and a signer * field, which can be used to specify a custom signer for the client. - * @param userSeed: `UserSeed` or string - * @param nodeSeed?: string - * @param signer?: "kelpr" or a function that returns a `Promise` + * @param userSeed - `UserSeed` or string + * @param nodeSeed - string + * @param signer - "kelpr" or a function that returns a `Promise` */ export interface UserCredentials { userSeed: UserSeed | string; @@ -41,7 +41,6 @@ export interface UserCredentials { * can be called to log out of the client. * @returns UseNillionAuthContext * @throws Error if NillionContext is not set - * @interface */ export function useNillionAuth(): UseNillionAuthContext { const context = useContext(NillionContext); diff --git a/packages/client-vms/src/nada.ts b/packages/client-vms/src/nada.ts index 48080eb..e91f62d 100644 --- a/packages/client-vms/src/nada.ts +++ b/packages/client-vms/src/nada.ts @@ -12,7 +12,7 @@ import { StoreValueArgs } from "./types"; /** * `toNadaValues` is a function that takes a `NamedValue` or `string` and a `NadaPrimitiveValue` or `StoreValueArgs` and returns a `NadaValues` object. - * @param args: {@link toNadaValuesArgs} + * @param args - {@link toNadaValuesArgs} * @returns {@link NadaValues} * @throws * @example diff --git a/packages/client-vms/src/nilvm/client.ts b/packages/client-vms/src/nilvm/client.ts index 455146f..6570dcc 100644 --- a/packages/client-vms/src/nilvm/client.ts +++ b/packages/client-vms/src/nilvm/client.ts @@ -35,9 +35,9 @@ import * as Wasm from "@nillion/client-wasm"; import { Log } from "../logger"; /* `NilVmClientConfig` is an object that contains the configuration for the NilVmClient - * @param bootnodes: `Multiaddr[]` - * @param clusterId: `ClusterId` - * @param userSeed: `string` + * @param bootnodes - `Multiaddr[]` + * @param clusterId - `ClusterId` + * @param userSeed - `string` */ export const NilVmClientConfig = z.object({ bootnodes: z.array(Multiaddr), @@ -50,7 +50,6 @@ export type NilVmClientConfig = z.infer; /** * `NilVmClient` is a class that allows you to interact with Nillion. - * @class */ export class NilVmClient { // The wasm bundle is loaded asynchronously which can be problematic because most environments don't @@ -63,12 +62,12 @@ export class NilVmClient { private constructor(private _config: NilVmClientConfig) {} - /* `ready` is a boolean that indicates whether the client is ready to be used */ + /** `ready` is a boolean that indicates whether the client is ready to be used */ get ready(): boolean { return this._ready; } - /* `partyId` is a `PartyId` object that represents the party ID of the client */ + /** `partyId` is a `PartyId` object that represents the party ID of the client */ get partyId(): PartyId { this.isReadyGuard(); return PartyId.parse(this._client.party_id); @@ -80,18 +79,18 @@ export class NilVmClient { return UserId.parse(this._client.user_id); } - /* `clusterId` is a `ClusterId` object that represents the cluster ID of the client */ + /** `clusterId` is a `ClusterId` object that represents the cluster ID of the client */ get clusterId(): ClusterId { return this._config.clusterId; } - /* `client` is a `Wasm.NillionClient` object that represents the client */ + /** `client` is a `Wasm.NillionClient` object that represents the client */ get client(): Wasm.NillionClient { this.isReadyGuard(); return this._client; } - /* `connect` is an async function that connects the client to the cluster */ + /** `connect` is an async function that connects the client to the cluster */ async connect(): Promise { if (!globalThis.__NILLION?.initialized) { await init(); @@ -110,7 +109,7 @@ export class NilVmClient { return this._ready; } - /* `isReadyGuard` is a function that checks if the client is ready */ + /** `isReadyGuard` is a function that checks if the client is ready */ private isReadyGuard(): void | never { if (!this._ready) { const message = "NilVmClient not ready. Call `await client.connect()`."; @@ -119,7 +118,7 @@ export class NilVmClient { } } - /* `fetchClusterInfo` is an effect that fetches the cluster information */ + /** `fetchClusterInfo` is an effect that fetches the cluster information */ fetchClusterInfo(): E.Effect { return E.tryPromise(async () => { const response = await this.client.cluster_information(this.clusterId); @@ -129,7 +128,7 @@ export class NilVmClient { }); } - /* `fetchComputeOutput` is an effect that fetches the compute */ + /** `fetchComputeOutput` is an effect that fetches the compute */ fetchComputeOutput(args: { id: ComputeOutputId; }): E.Effect, UnknownException> { @@ -144,7 +143,7 @@ export class NilVmClient { }); } - /* `fetchOperationQuote` is an effect that fetches the operation quote */ + /** `fetchOperationQuote` is an effect that fetches the operation quote */ fetchOperationQuote(args: { operation: IntoWasmQuotableOperation & { type: OperationType }; }): E.Effect { @@ -160,7 +159,7 @@ export class NilVmClient { }); } - /* `fetchValue` is an effect that fetches the value */ + /** `fetchValue` is an effect that fetches the value */ fetchValue(args: { receipt: PaymentReceipt; operation: FetchValue; @@ -185,7 +184,7 @@ export class NilVmClient { }); } - /* `fetchStoreAcl` is an effect that fetches the store acl */ + /** `fetchStoreAcl` is an effect that fetches the store acl */ fetchStoreAcl(args: { receipt: PaymentReceipt; operation: FetchStoreAcl; @@ -209,7 +208,7 @@ export class NilVmClient { }); } - /* `setStoreAcl` is an effect that sets the store acl */ + /** `setStoreAcl` is an effect that sets the store acl */ setStoreAcl(args: { receipt: PaymentReceipt; operation: SetStoreAcl; @@ -236,7 +235,7 @@ export class NilVmClient { }); } - /* `compute` is an effect that computes the operation */ + /** `compute` is an effect that computes the operation */ compute(args: { receipt: PaymentReceipt; operation: Compute; @@ -264,7 +263,7 @@ export class NilVmClient { }); } - /* `storeProgram` is an effect that stores the program */ + /** `storeProgram` is an effect that stores the program */ storeProgram(args: { receipt: PaymentReceipt; operation: StoreProgram; @@ -289,7 +288,7 @@ export class NilVmClient { }); } - /* `deleteProgram` is an effect that deletes the program */ + /** `deleteProgram` is an effect that deletes the program */ deleteValues(args: { id: StoreId }): E.Effect { return E.tryPromise(async () => { const { id } = args; @@ -299,7 +298,7 @@ export class NilVmClient { }); } - /* `deleteProgram` is an effect that deletes the program */ + /** `deleteProgram` is an effect that deletes the program */ updateValues(args: { receipt: PaymentReceipt; operation: UpdateValue; @@ -325,7 +324,7 @@ export class NilVmClient { }); } - /* `storeValues` is an effect that stores the values */ + /** `storeValues` is an effect that stores the values */ storeValues(args: { receipt: PaymentReceipt; operation: StoreValue; @@ -353,6 +352,6 @@ export class NilVmClient { }); } - /* `create` is a static function that creates a new NilVmClient */ + /** `create` is a static function that creates a new NilVmClient */ static create = (args: NilVmClientConfig) => new NilVmClient(args); } diff --git a/packages/client-vms/src/types.ts b/packages/client-vms/src/types.ts index 2004aae..8249da8 100644 --- a/packages/client-vms/src/types.ts +++ b/packages/client-vms/src/types.ts @@ -12,8 +12,8 @@ import { } from "@nillion/client-core"; /** `StoreValueArgs` is an interface that can be passed to the `store` function - * @param data: `NadaPrimitiveValue - * @param secret: `boolean` + * @param data - `NadaPrimitiveValue` + * @param secret - `boolean` */ export interface StoreValueArgs { data: NadaPrimitiveValue; @@ -21,11 +21,10 @@ export interface StoreValueArgs { } /** `NetworkConfig` is an interface that can be passed to the `toNadaValues` function - * @param bootnotes: `Multiaddr[]` - * @param clusterId: `ClusterId` - * @param nilChainId: `ChainId` - * @param nilChainEndpoint: `Url` - * @type + * @param bootnotes - `Multiaddr[]` + * @param clusterId - `ClusterId` + * @param nilChainId - `ChainId` + * @param nilChainEndpoint - `Url` */ export const NetworkConfig = z.object({ bootnodes: z.array(Multiaddr), @@ -36,10 +35,9 @@ export const NetworkConfig = z.object({ export type NetworkConfig = z.infer; /** `UserCredentials` is an interface that can be passed to the `toNadaValues` function - * @param nodeSeed: `NodeSeed` - * @param signer: `OfflineSigner` - * @param userSeed: `UserSeed` - * @type + * @param nodeSeed - `NodeSeed` + * @param signer - `OfflineSigner` + * @param userSeed - `UserSeed` */ export const UserCredentials = z.object({ userSeed: UserSeed,