UNPKG

@patchworkdev/pdk

Version:

Patchwork Development Kit

72 lines 2.09 kB
import { ContractConfig, ScopeConfig, ValidNameIdentifier } from '@patchworkdev/common'; import { Command } from 'commander'; import { Listr, ListrTaskWrapper } from 'listr2'; import { Chain } from 'viem'; export type TableData = { [key: string]: { [key: string]: string | number; }; }; export type Compute<type> = { [key in keyof type]: type[key]; } & unknown; export type RequiredBy<TType, TKeys extends keyof TType> = Required<Pick<TType, TKeys>> & Omit<TType, TKeys>; export type Network = { chain: Chain; rpc: string; }; export type PatchworkProject = { src?: string; plugins: PDKPlugin[]; name: ValidNameIdentifier; scopes: ScopeConfig[]; contracts: Record<string, ContractConfig | string>; networks?: Record<'local' | 'testnet' | 'mainnet', Network>; }; export type PDKContext = { rootDir: string; config: PatchworkProject; configPath: string; network: 'local' | 'testnet' | 'mainnet'; contracts: { name: string; path: string; abi: string; bytecode: string; md5: string; address: `0x${string}`; }[]; artifacts: Record<string, any>; }; export type PatchworkSetup = { src: string; out: string; scripts: string; }; export type PDKPlugin = { name: string; configProps: any; /** * Called before any compilation/build/codegen to provide setup context to PDK */ /** * Called to initialize and modify the context object. */ /** * Called to generate code or other artifacts using the context object. */ generate?: (props: { context: PDKContext; task: ListrTaskWrapper<PDKContext, any, any>; log?: (message: string) => void; }) => Promise<Listr<PDKContext>> | Listr<PDKContext>; /** * Returns one or more commands to be added to the CLI. */ commands?: (context: PDKContext) => Command; /** * Called when user runs pdk network switch */ onNetworkChange?: (context: PDKContext) => Promise<void> | void; }; //# sourceMappingURL=index.d.ts.map