API Reference
Types
TypeScript type definitions for the Skillz Market SDK.
Types
Complete TypeScript type definitions exported by the SDK.
Consumer Types
Skill
interface Skill {
id: string;
slug: string;
name: string;
description: string | null;
price: string;
currency: string;
endpoint: string;
inputSchema: Record<string, unknown> | null;
outputSchema: Record<string, unknown> | null;
paymentAddress: string;
isActive: boolean;
creatorId: string;
createdAt: string;
updatedAt: string;
groups?: SkillGroup[]; // Groups this skill belongs to
}SkillGroup
interface SkillGroup {
id: string;
slug: string;
name: string;
description: string | null;
icon: string | null;
creatorId: string;
isActive: boolean;
createdAt: string;
updatedAt: string;
}
interface SkillGroupWithSkills extends SkillGroup {
skills: Skill[];
creator: Creator | null;
}Creator
interface Creator {
id: string;
walletAddress: string;
name: string | null;
avatar: string | null;
bio: string | null;
createdAt: string;
}Review
interface Review {
id: string;
skillId: string;
consumerAddress: string;
score: number;
comment: string | null;
createdAt: string;
}SearchFilters
interface SearchFilters {
category?: string;
minPrice?: string;
maxPrice?: string;
creator?: string;
group?: string; // Filter by group slug
}SkillzMarketOptions
interface SkillzMarketOptions {
apiUrl?: string;
wallet?: WalletConfig;
network?: `${string}:${string}`;
}WalletConfig
import type { Hex } from 'viem';
import type { PrivateKeyAccount } from 'viem/accounts';
type WalletConfig = PrivateKeyAccount | Hex;Creator Types
SkillOptions
interface SkillOptions {
price: string;
description?: string;
timeout?: number;
inputSchema?: JsonSchema;
outputSchema?: JsonSchema;
groups?: string[]; // Per-skill groups (merged with global)
}JsonSchema
interface JsonSchema {
type: string;
properties?: Record<string, JsonSchema>;
required?: string[];
items?: JsonSchema;
[key: string]: unknown;
}SkillHandler
type SkillHandler<TInput = unknown, TOutput = unknown> = (
input: TInput
) => Promise<TOutput>;SkillDefinition
interface SkillDefinition<TInput = unknown, TOutput = unknown> {
options: SkillOptions;
handler: SkillHandler<TInput, TOutput>;
parsedPrice: ParsedPrice;
}SkillsMap
type SkillsMap = Record<string, SkillDefinition<any, any>>;ParsedPrice
interface ParsedPrice {
amount: string;
currency: 'USDC';
}ServeOptions
interface ServeOptions {
port?: number;
wallet?: string; // 42-char address or 66-char private key
apiKey?: string; // API key for registration
network?: `${string}:${string}`;
facilitatorUrl?: string;
appName?: string;
onCall?: (skillName: string, input: unknown) => void;
onError?: (skillName: string, error: Error) => void;
register?: RegistrationOptions;
trackCalls?: boolean;
apiUrl?: string;
}BatchOptions
interface BatchOptions {
concurrency?: number; // Max concurrent requests (default: 5)
}RegistrationOptions
interface RegistrationOptions {
apiUrl?: string;
endpoint: string;
enabled?: boolean;
onError?: 'throw' | 'warn' | 'silent';
groups?: string[]; // Global groups (merged with per-skill)
batch?: BatchOptions;
}RegistrationResult
interface RegistrationResult {
name: string;
success: boolean;
slug?: string;
error?: string;
}RegisterOptions
interface RegisterOptions {
apiKey: string;
paymentAddress: Address;
endpoint: string;
apiUrl?: string;
onError?: 'throw' | 'warn' | 'silent';
groups?: string[]; // Global groups (merged with per-skill)
batch?: BatchOptions;
}SkillUpdateData
interface SkillUpdateData {
description?: string;
price?: string;
groups?: string[]; // Replaces existing groups
inputSchema?: JsonSchema;
outputSchema?: JsonSchema;
isActive?: boolean;
}UpdateResult
interface UpdateResult {
slug: string;
success: boolean;
error?: string;
}UpdateOptions
interface UpdateOptions {
apiKey: string;
apiUrl?: string;
}ConfigStatus
interface ConfigStatus {
configured: boolean;
apiKey: boolean;
walletAddress: boolean;
issues: string[];
}Importing Types
Consumer Types
import type {
Skill,
SkillGroup,
SkillGroupWithSkills,
Creator,
Review,
SearchFilters,
SkillzMarketOptions,
WalletConfig,
} from '@skillzmarket/sdk';Creator Types
import type {
SkillOptions,
SkillHandler,
SkillDefinition,
SkillsMap,
ServeOptions,
RegistrationOptions,
RegistrationResult,
RegisterOptions,
ParsedPrice,
JsonSchema,
BatchOptions,
SkillUpdateData,
UpdateResult,
UpdateOptions,
} from '@skillzmarket/sdk/creator';Usage Examples
Typed Consumer
import { SkillzMarket } from '@skillzmarket/sdk';
import type { Skill, SearchFilters } from '@skillzmarket/sdk';
const market = new SkillzMarket({ wallet: '0x...' });
const filters: SearchFilters = {
category: 'text',
maxPrice: '0.01',
};
const skills: Skill[] = await market.search('AI', filters);Typed Creator
import { skill, serve, checkConfig } from '@skillzmarket/sdk/creator';
import type { SkillOptions, ServeOptions } from '@skillzmarket/sdk/creator';
// Check configuration
const config = checkConfig();
if (!config.configured) {
console.error('Issues:', config.issues);
process.exit(1);
}
interface MyInput {
text: string;
}
interface MyOutput {
result: string;
}
const options: SkillOptions = {
price: '$0.001',
description: 'Process text',
};
const mySkill = skill<MyInput, MyOutput>(options, async ({ text }) => {
return { result: text.toUpperCase() };
});
const serveOptions: ServeOptions = {
port: 3002,
register: {
endpoint: 'https://example.com',
enabled: true,
},
};
serve({ mySkill }, serveOptions);