UNPKG

@venly/wallet-mcp

Version:

Production-ready MCP server enabling AI agents to perform Web3 wallet operations through Venly's blockchain infrastructure. Supports 14+ networks including Ethereum, Polygon, Arbitrum, and stablecoin operations.

289 lines 12.3 kB
/** * Venly API Type Definitions * * Comprehensive TypeScript types for Venly Wallet-as-a-Service API * Based on Venly API v4.0 specification */ import { z } from 'zod'; // ============================================================================ // Validation Schemas // ============================================================================ export const SecretTypeSchema = z.enum([ 'ETHEREUM', 'MATIC', 'BSC', 'ARBITRUM', 'AVAX', 'BITCOIN', 'LITECOIN', 'OPTIMISM', 'BASE', 'GOERLI', 'MUMBAI', 'BSC_TESTNET', 'ARBITRUM_GOERLI', 'FUJI' ]); export const WalletTypeSchema = z.enum(['WHITE_LABEL', 'APPLICATION', 'IMPORTED']); export const CreateWalletRequestSchema = z.object({ secretType: SecretTypeSchema, walletType: WalletTypeSchema, identifier: z.string().optional(), description: z.string().optional(), pincode: z.string().min(4).max(20).optional() }); export const TransactionRequestSchema = z.object({ type: z.enum(['TRANSFER', 'TOKEN_TRANSFER', 'CONTRACT_EXECUTION', 'NFT_TRANSFER', 'MULTI_TOKEN_TRANSFER']), walletId: z.string().min(1), to: z.string().min(1), secretType: SecretTypeSchema, value: z.number().min(0).optional(), tokenAddress: z.string().optional(), data: z.string().optional(), gasLimit: z.number().min(0).optional(), gasPrice: z.number().min(0).optional(), nonce: z.number().min(0).optional() }); export const ExecuteTransactionRequestSchema = z.object({ transactionRequest: TransactionRequestSchema, pincode: z.string().optional() }); export const FiatProviderSchema = z.enum(['TRANSAK', 'MOONPAY', 'RAMP_NETWORK']); export const FiatOnrampRequestSchema = z.object({ walletId: z.string().min(1), fiatAmount: z.number().min(0).optional(), fiatCurrency: z.string().min(3).max(3).optional(), // ISO 4217 currency codes cryptoAmount: z.number().min(0).optional(), cryptoCurrency: z.string().optional(), cryptoNetwork: z.string().optional(), provider: FiatProviderSchema, returnUrl: z.string().url().optional(), webhookUrl: z.string().url().optional(), email: z.string().email().optional(), selectedCountryCode: z.string().length(2).optional() // ISO 3166-1 alpha-2 }); export const FiatOfframpRequestSchema = z.object({ walletId: z.string().min(1), cryptoAmount: z.number().min(0).optional(), cryptoCurrency: z.string().optional(), cryptoNetwork: z.string().optional(), fiatCurrency: z.string().min(3).max(3).optional(), // ISO 4217 currency codes fiatAmount: z.number().min(0).optional(), provider: FiatProviderSchema, returnUrl: z.string().url().optional(), email: z.string().email().optional(), refundWalletAddress: z.string().optional(), selectedCountryCode: z.string().length(2).optional() // ISO 3166-1 alpha-2 }); // ============================================================================ // Webhook Types // ============================================================================ export var WebhookEventType; (function (WebhookEventType) { // Venly Native Events (NFT-API) WebhookEventType["CONTRACT_CREATION_SUCCEEDED"] = "CONTRACT_CREATION_SUCCEEDED"; WebhookEventType["CONTRACT_CREATION_FAILED"] = "CONTRACT_CREATION_FAILED"; WebhookEventType["TOKEN_TYPE_CREATION_SUCCEEDED"] = "TOKEN_TYPE_CREATION_SUCCEEDED"; WebhookEventType["TOKEN_TYPE_CREATION_FAILED"] = "TOKEN_TYPE_CREATION_FAILED"; WebhookEventType["TOKEN_CREATION_SUCCEEDED"] = "TOKEN_CREATION_SUCCEEDED"; WebhookEventType["TOKEN_CREATION_FAILED"] = "TOKEN_CREATION_FAILED"; // Extended Events (Hybrid Implementation) WebhookEventType["TRANSACTION_CONFIRMED"] = "TRANSACTION_CONFIRMED"; WebhookEventType["TRANSACTION_FAILED"] = "TRANSACTION_FAILED"; WebhookEventType["TRANSACTION_PENDING"] = "TRANSACTION_PENDING"; WebhookEventType["TRANSACTION_DROPPED"] = "TRANSACTION_DROPPED"; WebhookEventType["BALANCE_CHANGED"] = "BALANCE_CHANGED"; WebhookEventType["PORTFOLIO_VALUE_CHANGED"] = "PORTFOLIO_VALUE_CHANGED"; WebhookEventType["TOKEN_RECEIVED"] = "TOKEN_RECEIVED"; WebhookEventType["TOKEN_SENT"] = "TOKEN_SENT"; })(WebhookEventType || (WebhookEventType = {})); // ============================================================================ // Webhook Validation Schemas // ============================================================================ export const WebhookEventTypeSchema = z.nativeEnum(WebhookEventType); export const WebhookFiltersSchema = z.object({ minimumAmount: z.number().min(0).optional(), tokenAddresses: z.array(z.string()).optional(), thresholdPercentage: z.number().min(0).max(100).optional(), contractAddresses: z.array(z.string()).optional(), fromAddresses: z.array(z.string()).optional(), toAddresses: z.array(z.string()).optional() }); export const WebhookConfigSchema = z.object({ walletId: z.string().min(1), eventTypes: z.array(WebhookEventTypeSchema).min(1), callbackUrl: z.string().url(), secretKey: z.string().min(16), isActive: z.boolean().default(true), filters: WebhookFiltersSchema.optional(), description: z.string().optional() }); export const SetupWebhookRequestSchema = z.object({ walletId: z.string().min(1), eventTypes: z.array(WebhookEventTypeSchema).min(1), callbackUrl: z.string().url(), filters: WebhookFiltersSchema.optional(), description: z.string().optional() }); // ============================================================================ // Workflow Orchestration Types // ============================================================================ export var WorkflowStepType; (function (WorkflowStepType) { WorkflowStepType["VENLY_TRANSACTION"] = "VENLY_TRANSACTION"; WorkflowStepType["FIAT_CONVERSION"] = "FIAT_CONVERSION"; WorkflowStepType["EXTERNAL_MCP_CALL"] = "EXTERNAL_MCP_CALL"; WorkflowStepType["WEBHOOK_TRIGGER"] = "WEBHOOK_TRIGGER"; WorkflowStepType["CONDITION_CHECK"] = "CONDITION_CHECK"; WorkflowStepType["DATA_EXPORT"] = "DATA_EXPORT"; })(WorkflowStepType || (WorkflowStepType = {})); export var WorkflowStatus; (function (WorkflowStatus) { WorkflowStatus["PENDING"] = "PENDING"; WorkflowStatus["RUNNING"] = "RUNNING"; WorkflowStatus["COMPLETED"] = "COMPLETED"; WorkflowStatus["FAILED"] = "FAILED"; WorkflowStatus["CANCELLED"] = "CANCELLED"; WorkflowStatus["PAUSED"] = "PAUSED"; })(WorkflowStatus || (WorkflowStatus = {})); export var WorkflowTriggerType; (function (WorkflowTriggerType) { WorkflowTriggerType["MANUAL"] = "MANUAL"; WorkflowTriggerType["WEBHOOK_EVENT"] = "WEBHOOK_EVENT"; WorkflowTriggerType["SCHEDULED"] = "SCHEDULED"; WorkflowTriggerType["BALANCE_THRESHOLD"] = "BALANCE_THRESHOLD"; WorkflowTriggerType["PRICE_CHANGE"] = "PRICE_CHANGE"; })(WorkflowTriggerType || (WorkflowTriggerType = {})); // ============================================================================ // Financial Data Export Types // ============================================================================ export var ExportFormat; (function (ExportFormat) { ExportFormat["CSV"] = "CSV"; ExportFormat["JSON"] = "JSON"; ExportFormat["PDF"] = "PDF"; ExportFormat["XLSX"] = "XLSX"; })(ExportFormat || (ExportFormat = {})); // ============================================================================ // Workflow Validation Schemas // ============================================================================ export const WorkflowStepTypeSchema = z.nativeEnum(WorkflowStepType); export const WorkflowStatusSchema = z.nativeEnum(WorkflowStatus); export const WorkflowTriggerTypeSchema = z.nativeEnum(WorkflowTriggerType); export const ExportFormatSchema = z.nativeEnum(ExportFormat); export const WorkflowConditionSchema = z.object({ field: z.string().min(1), operator: z.enum(['equals', 'greater_than', 'less_than', 'contains', 'not_equals']), value: z.unknown(), logicalOperator: z.enum(['AND', 'OR']).optional() }); export const RetryPolicySchema = z.object({ maxRetries: z.number().min(0).max(10), baseDelay: z.number().min(100), maxDelay: z.number().min(1000), backoffMultiplier: z.number().min(1).max(5), retryableErrors: z.array(z.string()).optional() }); export const WorkflowStepSchema = z.object({ id: z.string().min(1), name: z.string().min(1), type: WorkflowStepTypeSchema, mcpServer: z.string().optional(), action: z.string().min(1), parameters: z.record(z.unknown()), conditions: z.array(WorkflowConditionSchema).optional(), retryPolicy: RetryPolicySchema.optional(), timeout: z.number().min(1).optional(), dependsOn: z.array(z.string()).optional(), parallel: z.boolean().optional() }); export const WorkflowTemplateSchema = z.object({ name: z.string().min(1), description: z.string().min(1), steps: z.array(WorkflowStepSchema).min(1), triggers: z.array(z.object({ type: WorkflowTriggerTypeSchema, conditions: z.array(WorkflowConditionSchema).optional(), schedule: z.string().optional(), webhookEventTypes: z.array(WebhookEventTypeSchema).optional(), isActive: z.boolean().default(true) })), metadata: z.object({ version: z.string().default('1.0.0'), author: z.string().min(1), description: z.string().min(1), tags: z.array(z.string()), category: z.string().min(1), estimatedDuration: z.number().min(1).optional(), complexity: z.enum(['LOW', 'MEDIUM', 'HIGH']) }), inputSchema: z.record(z.unknown()).optional(), outputSchema: z.record(z.unknown()).optional(), isActive: z.boolean().default(true) }); export const OptimizationCriteriaSchema = z.object({ priority: z.enum(['COST', 'SPEED', 'RELIABILITY', 'BALANCED']), maxSlippage: z.number().min(0).max(100).optional(), maxPriceImpact: z.number().min(0).max(100).optional(), preferredNetworks: z.array(SecretTypeSchema).optional(), avoidNetworks: z.array(SecretTypeSchema).optional(), maxHops: z.number().min(1).max(10).optional() }); export const ExportRequestSchema = z.object({ walletIds: z.array(z.string().min(1)).min(1), format: ExportFormatSchema, dateRange: z.object({ start: z.string().datetime(), end: z.string().datetime() }), includeMetadata: z.boolean().default(true), filters: z.object({ tokenAddresses: z.array(z.string()).optional(), transactionTypes: z.array(z.string()).optional(), minAmount: z.number().min(0).optional(), maxAmount: z.number().min(0).optional() }).optional() }); // ============================================================================ // User Management Validation Schemas // ============================================================================ export const SigningMethodTypeSchema = z.enum(['PIN', 'EMERGENCY_CODE', 'BIOMETRIC']); export const CreateUserRequestSchema = z.object({ reference: z.string().optional(), signingMethod: z.object({ type: SigningMethodTypeSchema, value: z.string().optional() }).optional() }); export const UpdateUserRequestSchema = z.object({ reference: z.string().optional() }); export const CreateSigningMethodRequestSchema = z.object({ type: SigningMethodTypeSchema, value: z.string().optional() }); export const CreateUserWalletRequestSchema = z.object({ userId: z.string().min(1), secretType: SecretTypeSchema, walletType: WalletTypeSchema.optional(), identifier: z.string().optional(), description: z.string().optional(), isPrimary: z.boolean().optional() }); export const SetPrimaryWalletRequestSchema = z.object({ userId: z.string().min(1), walletId: z.string().min(1), secretType: SecretTypeSchema }); export const UserFiltersSchema = z.object({ reference: z.string().optional(), createdAfter: z.string().datetime().optional(), createdBefore: z.string().datetime().optional(), hasSigningMethod: SigningMethodTypeSchema.optional() }); export const ListUsersRequestSchema = z.object({ page: z.number().min(0).optional(), size: z.number().min(1).max(100).optional(), filters: UserFiltersSchema.optional() }); //# sourceMappingURL=venly.js.map