export type NetworkType = 'preprod' | 'mainnet'; export type APIEncoding = 'json-url-lzw' | 'json-url-lzma' | 'gzip' | 'base64url'; export type APIVersion = '1' | '2'; export type EncodingHandler = { name: string; encoder: (obj: any, options?: any) => Promise; decoder: (msg: string, options?: any) => Promise; }; export type HandlerInputType = { apiVersion: '1'; network: NetworkType; encoding: 'json-url-lzw'; inputData: string; } | { apiVersion: '2'; network: NetworkType; encoding: 'json-url-lzma' | 'gzip' | 'base64url'; inputData: string; }; export type CLIHandlerContext = { apiVersion: APIVersion; network: NetworkType; encoding: APIEncoding; input: string; /** * Optional wallet referral address appended by the handlers as * the URL query string parameter `ref`. */ refAddress?: string; /** * When true, handlers skip appending the default `networkTag` query string * parameter to generated wallet URLs. */ disableNetworkRouter?: boolean; /** * Optional wallet URL pattern override. * * When provided, handlers will use this URL pattern instead of the built-in * network default, as long as it is a valid absolute URL and contains the * required `{gcscript}` placeholder. */ urlPattern?: string; /** * Optional per-token overrides for generated code snippets. * * Keys can match snippet token keys (e.g. `title`, `twitterUrl`) or raw * placeholder strings (advanced usage). Values are injected as-is. */ snippetArgs?: SnippetArgs; outputFile?: string; template?: string; styles?: string; debug?: boolean; }; /** * Snippet template customization map. * * Values are injected as-is into snippet templates. For JS-literal placeholders * (such as apiVersion/network/encoding/urlPattern) provide a valid JS literal. * * Special key: * - `defaultIntents`: overrides the whole default intents object literal and * allows comments. */ export type SnippetArgs = { [key: string]: string | undefined; defaultIntents?: string; }; export type SourceType = { [name: string]: () => Promise; }; export type ActionHandlerLoaderType = { [action: string]: { [name: string]: () => Promise<(input: CLIHandlerContext) => any>; }; }; export type ActionHandlerType = { [action: string]: { [name: string]: (input: CLIHandlerContext) => any; }; }; export type ExecuteType = { network: NetworkType; action: (input: HandlerInputType) => Promise; source: () => Promise; }; export type ObjectType = { [name: string]: any; }; export type QRTemplateType = 'boxed' | 'printable';