@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
75 lines (74 loc) • 2.44 kB
TypeScript
import { ethers } from 'ethers';
import { Web3SubscriptionConfig, Subscription, SubscriptionStatus, BillingPeriod, Plan, PlanPricing, RevenueStats } from './types';
export declare class Web3SubscriptionSkill {
private config;
private provider;
private signer?;
constructor(config: Web3SubscriptionConfig);
/**
* Set the signer for transactions
*/
setSigner(signer: ethers.Signer): void;
/**
* Create a new subscription
*/
createSubscription(userAddress: string, planId: string, billingPeriod: BillingPeriod): Promise<Subscription>;
/**
* Check subscription status for a user
*/
checkSubscription(userAddress: string): Promise<SubscriptionStatus>;
/**
* Cancel a subscription
*/
cancelSubscription(userAddress: string): Promise<boolean>;
/**
* Get subscription history for a user
*/
getSubscriptionHistory(userAddress: string): Promise<Subscription[]>;
/**
* Change billing period for existing subscription
*/
changeBillingPeriod(userAddress: string, newPeriod: BillingPeriod): Promise<boolean>;
/**
* Get prorated amount for plan/billing period change
*/
getProratedAmount(userAddress: string, newPlanId: string, newPeriod: BillingPeriod): Promise<number>;
/**
* Get plan pricing information
*/
getPlanPricing(planId: string): Promise<PlanPricing>;
/**
* Get all available plans
*/
getAvailablePlans(): Promise<Plan[]>;
/**
* Calculate savings percentage for a billing period
*/
calculateSavings(planId: string, period: BillingPeriod): Promise<number>;
/**
* Get ADAO token balance for a user
*/
getADaoBalance(userAddress: string): Promise<number>;
/**
* Approve ADAO tokens for spending
*/
approveADao(userAddress: string, amount: number): Promise<boolean>;
/**
* Update plan configuration (admin only)
*/
updatePlan(planId: string, plan: any): Promise<boolean>;
/**
* Get revenue statistics (admin only)
*/
getRevenueStats(): Promise<RevenueStats>;
/**
* Get ADAO token price in USD
*/
getADaoPrice(): Promise<number>;
/**
* Estimate gas for subscription transaction
*/
estimateGas(userAddress: string, planId: string, period: BillingPeriod): Promise<number>;
private generateSubscriptionId;
private calculateMonthlyPrice;
}