Skip to content

Commit

Permalink
docs(sdk): test basic typedoc formatting, @see directive
Browse files Browse the repository at this point in the history
  • Loading branch information
sammccord committed Jul 18, 2024
1 parent bdefead commit c325314
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
5 changes: 0 additions & 5 deletions packages/sdk/src/Actions/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import { InvalidComponentInterfaceError } from '../errors';
import { ContractAction } from './ContractAction';
import { ERC721MintAction } from './ERC721MintAction';

/**
* @groupDescription Actions
* These functions are available for...
* @module
*/
export { ContractAction, ERC721MintAction };

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/src/Actions/ContractAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export type { ContractActionPayload };
export { prepareContractActionPayload };

/**
* Description placeholder
*
* @group Actions
*
* @export
* @class ContractAction
* @typedef {ContractAction}
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/Actions/ERC721MintAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export { prepareERC721MintActionPayload };
/**
* Description placeholder
*
* @group Actions
* @export
* @class ERC721MintAction
* @typedef {ERC721MintAction}
Expand Down
58 changes: 38 additions & 20 deletions packages/sdk/src/BoostRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ import type { ReadParams, WriteParams } from './utils';
export { RegistryType };

/**
* Description placeholder
* The fixed address for the Boost Registry.
* By default, `new BoostRegistry` will use this address if not otherwise provided.
*
* @type {Address}
*/
export const BOOST_REGISTRY_ADDRESS: Address = import.meta.env
.VITE_BOOST_REGISTRY_ADDRESS;

/**
* Description placeholder
* Instantiation options for a previously deployed Boost Registry
*
* @export
* @interface BoostRegistryDeployedOptions
Expand All @@ -39,15 +40,15 @@ export const BOOST_REGISTRY_ADDRESS: Address = import.meta.env
*/
export interface BoostRegistryDeployedOptions extends DeployableOptions {
/**
* Description placeholder
* The address for a Boost Registry, if different than `BOOST_REGISTRY_ADDRESS`
*
* @type {?Address}
*/
address?: Address;
}

/**
* Description placeholder
* A typeguard to determine if instantiation is using a custom address.
*
* @param {*} opts
* @returns {opts is BoostRegistryDeployedOptions}
Expand All @@ -60,17 +61,19 @@ function isBoostRegistryDeployed(
}

/**
* Description placeholder
* The Boost Registry does not take any construction arguments, so if you'd like to deploy a new Boost Registry, pass an explicit null to the `address` field.
*
* @export
* @interface BoostRegistryOptionsWithPayload
* @typedef {BoostRegistryOptionsWithPayload}
* @extends {DeployableOptions}
*/
export interface BoostRegistryOptionsWithPayload extends DeployableOptions {}
export interface BoostRegistryOptionsWithPayload extends DeployableOptions {
address: null;
}

/**
* Description placeholder
* A typeguard to determine if the user is intending to deploy a new Boost Registry before usage
*
* @param {*} opts
* @returns {opts is BoostRegistryOptionsWithPayload}
Expand All @@ -79,11 +82,24 @@ function isBoostRegistryDeployable(
// biome-ignore lint/suspicious/noExplicitAny: type guard
opts: any,
): opts is BoostRegistryOptionsWithPayload {
return !opts.address;
return opts.address === null;
}

/**
* Description placeholder
* Instantiation options for a Boost Registry.
*
* @example
* To target Boost's Registry, omit the address field.
* Otherwise, supply a custom address to a previously deployed custom Boost Registry.
* You can also pass `{ address: null }` if you are intending to deploy a new Boost Registry.
* ```ts
* let registry = new BoostRegistry({ config, account })
* // or
* registry = new BoostRegistry({ config, account, address: CUSTOM_ADDRESS })
* // or
* registry = new BoostRegistry({ config, account, address: null })
* await registry.deploy()
* ```
*
* @export
* @typedef {BoostRegistryConfig}
Expand All @@ -93,8 +109,10 @@ export type BoostRegistryConfig =
| BoostRegistryOptionsWithPayload;

/**
* Description placeholder
* Constructs a new Boost Registry. A registry for base implementations and cloned instances.
* This contract is used to register base implementations and deploy new instances of those implementations for use within the Boost protocol.
*
* @see {@link BoostRegistryConfig}
* @export
* @class BoostRegistry
* @typedef {BoostRegistry}
Expand All @@ -104,31 +122,32 @@ export class BoostRegistry extends Deployable<never[]> {
/**
* Creates an instance of BoostRegistry.
*
* @see {@link BoostRegistryConfig}
* @constructor
* @param {BoostRegistryConfig} param0
* @param {Config} param0.config
* @param {Account} param0.account
* @param {Config} param0.config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)
* @param {Account} param0.account - [Viem Local Account](https://viem.sh/docs/accounts/local)
* @param {({ address?: Address; } | {})} param0....options
*/
constructor({ config, account, ...options }: BoostRegistryConfig) {
if (isBoostRegistryDeployed(options) && options.address) {
super({ account, config }, options.address);
} else if (isBoostRegistryDeployable(options) && !BOOST_REGISTRY_ADDRESS) {
} else if (isBoostRegistryDeployable(options)) {
super({ account, config }, []);
} else {
super({ account, config }, BOOST_REGISTRY_ADDRESS);
}
}

/**
* Description placeholder
* Register a new base implementation of a given type
*
* @public
* @async
* @param {RegistryType} registryType
* @param {string} name
* @param {Address} implementation
* @param {?WriteParams<typeof boostRegistryAbi, 'register'>} [params]
* @param {RegistryType} registryType - The base type for the implementation
* @param {string} name - A name for the implementation (must be unique within the given type)
* @param {Address} implementation - The address of the implementation contract
* @param {?WriteParams<typeof boostRegistryAbi, 'register'>} [params] - Optional params to provide the underlying Viem contract call
* @returns {unknown}
*/
public async register(
Expand All @@ -143,8 +162,7 @@ export class BoostRegistry extends Deployable<never[]> {
}

/**
* Description placeholder
*
* @see {@link register}
* @public
* @async
* @param {RegistryType} registryType
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/src/Deployable/Contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { type HashAndSimulatedResult, awaitResult } from '../utils';
*/
export class Contract {
/**
* Description placeholder
*
* @see [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial)
* @protected
* @type {Config}
*/
Expand Down

0 comments on commit c325314

Please sign in to comment.