@agentdao/core
Version:
Core functionality, skills, and ready-made UI components for AgentDAO - Web3 subscriptions, content generation, social media, help support, live chat, RSS fetching, web search, and agent pricing integration
144 lines (143 loc) • 4.05 kB
TypeScript
export interface AgentPricingConfig {
agent: {
id: number;
name: string;
description: string;
developer_name: string;
developer_avatar?: string;
};
pricing: {
is_available_for_hire: boolean;
platform_commission_rate: number;
payment_wallet_address?: string;
pricing_plans: Record<string, any>;
accepted_tokens: Record<string, any>;
esh_token_addresses: Record<string, string>;
esh_token_metadata: Record<string, any>;
usage_limits: Record<string, any>;
rate_limits: Record<string, any>;
};
integration: {
api_documentation?: string;
integration_guide?: string;
webhook_url?: string;
api_base_url?: string;
requires_api_key: boolean;
requires_webhook: boolean;
custom_headers: Record<string, any>;
};
features: {
features_enabled: string[];
tags: string[];
categories: string[];
supported_languages: string[];
};
}
export interface AgentPricingSDKOptions {
baseUrl?: string;
apiKey?: string;
headers?: Record<string, string>;
}
export declare class AgentPricingSDK {
private baseUrl;
private agentId;
private apiKey?;
private headers;
constructor(agentId: number, options?: AgentPricingSDKOptions);
/**
* Set API key for authentication
*/
setApiKey(apiKey: string): void;
/**
* Add custom headers
*/
setHeaders(headers: Record<string, string>): void;
/**
* Fetch the pricing configuration for this agent
*/
getPricingConfig(): Promise<AgentPricingConfig>;
/**
* Get all pricing plans for this agent
*/
getPricingPlans(): Promise<Record<string, any>>;
/**
* Get all accepted tokens for this agent
*/
getAcceptedTokens(): Promise<Record<string, any>>;
/**
* Get ESH token addresses for this agent
*/
getEshTokenAddresses(): Promise<Record<string, string>>;
/**
* Get ESH token metadata for this agent
*/
getEshTokenMetadata(): Promise<Record<string, any>>;
/**
* Check if this agent is available for hire
*/
isAvailableForHire(): Promise<boolean>;
/**
* Get usage limits for this agent
*/
getUsageLimits(): Promise<Record<string, any>>;
/**
* Get rate limits for this agent
*/
getRateLimits(): Promise<Record<string, any>>;
/**
* Check if a specific feature is enabled for this agent
*/
hasFeature(featureName: string): Promise<boolean>;
/**
* Get all enabled features for this agent
*/
getEnabledFeatures(): Promise<string[]>;
/**
* Get agent tags
*/
getTags(): Promise<string[]>;
/**
* Get agent categories
*/
getCategories(): Promise<string[]>;
/**
* Get supported languages
*/
getSupportedLanguages(): Promise<string[]>;
/**
* Get integration information
*/
getIntegrationInfo(): Promise<{
api_documentation?: string;
integration_guide?: string;
webhook_url?: string;
api_base_url?: string;
requires_api_key: boolean;
requires_webhook: boolean;
custom_headers: Record<string, any>;
}>;
/**
* Validate if a user can access the agent based on pricing plans
* This is a helper method that can be used for access control
*/
validateAccess(userPlan?: string, userToken?: string): Promise<{
hasAccess: boolean;
reason?: string;
requiredPlan?: string;
requiredToken?: string;
}>;
/**
* Get agent information
*/
getAgentInfo(): Promise<{
id: number;
name: string;
description: string;
developer_name: string;
developer_avatar?: string;
}>;
}
/**
* Factory function to create AgentPricingSDK instance
*/
export declare function createAgentPricingSDK(agentId: number, options?: AgentPricingSDKOptions): AgentPricingSDK;