@chainlink/mcp-server
Version:
Prototype MCP Server for CLL
84 lines • 4.53 kB
JavaScript
"use strict";
/**
* @fileoverview CCIP Configuration Schemas
*
* Shared Zod schemas for validating CCIP configuration data structures.
* These schemas ensure data integrity and provide TypeScript types.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CombinedCcipConfigSchema = exports.CCIPLaneConfigSchema = exports.CCIPRateLimiterConfigSchema = exports.CCIPTokenConfigSchema = exports.CCIPChainConfigSchema = void 0;
const zod_1 = require("zod");
const shared_config_1 = require("./shared-config");
/**
* Schema for blockchain network configuration
* Contains all the essential contract addresses and identifiers for a specific chain
*/
exports.CCIPChainConfigSchema = zod_1.z.object({
feeTokens: zod_1.z.array(zod_1.z.string()), // Tokens accepted for CCIP fees
chainSelector: zod_1.z.string(), // Unique identifier for this chain in CCIP
router: shared_config_1.ContractConfigSchema, // Main CCIP router contract
armProxy: shared_config_1.ContractConfigSchema, // ARM (Anti-fraud Risk Management) contract
registryModule: shared_config_1.ContractConfigSchema.optional(), // Registry for managing configurations
tokenAdminRegistry: shared_config_1.ContractConfigSchema.optional(), // Registry for token administrators
tokenPoolFactory: shared_config_1.ContractConfigSchema.optional(), // Factory for creating token pools
});
/**
* Schema for token configuration on a specific chain
* Defines how a token behaves in CCIP transfers (rates, limits, etc.)
*/
exports.CCIPTokenConfigSchema = zod_1.z.object({
allowListEnabled: zod_1.z.boolean(), // Whether token transfers require allowlist approval
decimals: zod_1.z.number(), // Token decimal places (e.g., 18 for most ERC20s)
name: zod_1.z.string(), // Full token name (e.g., "Chainlink Token")
poolAddress: zod_1.z.string().optional(), // Address of the token pool contract
poolType: zod_1.z.string(), // Type of pool (lockRelease, burnMint, etc.)
symbol: zod_1.z.string(), // Token symbol (e.g., "LINK")
tokenAddress: zod_1.z.string(), // Address of the token contract
});
/**
* Schema for rate limiting configuration
* Controls how fast tokens can be transferred to prevent abuse
*/
exports.CCIPRateLimiterConfigSchema = zod_1.z.object({
capacity: zod_1.z.string(), // Maximum tokens that can be transferred in a burst
isEnabled: zod_1.z.boolean(), // Whether rate limiting is active
rate: zod_1.z.string(), // Rate at which capacity refills (tokens per second)
});
/**
* Schema for CCIP lane configuration
* A "lane" is a directional pathway between two blockchain networks
* Example: Ethereum → Polygon is one lane, Polygon → Ethereum is another
*/
exports.CCIPLaneConfigSchema = zod_1.z.object({
offRamp: shared_config_1.ContractConfigSchema, // Contract on destination chain that receives messages
onRamp: shared_config_1.ContractConfigSchema.extend({
// Contract on source chain that sends messages
enforceOutOfOrder: zod_1.z.boolean().optional(), // Whether messages must be processed in order
}),
rmnPermeable: zod_1.z.boolean(), // Whether ARM can halt this lane for security
supportedTokens: zod_1.z // Tokens that can be transferred through this lane
.record(zod_1.z.object({
rateLimiterConfig: zod_1.z.object({
in: exports.CCIPRateLimiterConfigSchema.optional(), // Rate limits for incoming transfers
out: exports.CCIPRateLimiterConfigSchema.optional(), // Rate limits for outgoing transfers
}),
}))
.optional(),
});
/**
* Complete CCIP configuration schema that combines all data types
* This represents the structure of our unified configuration files
*/
exports.CombinedCcipConfigSchema = zod_1.z.object({
chains: zod_1.z.record(exports.CCIPChainConfigSchema), // All supported blockchain networks
tokens: zod_1.z.record(zod_1.z.record(exports.CCIPTokenConfigSchema)), // Tokens organized by symbol, then by chain
lanes: zod_1.z.record(zod_1.z.record(exports.CCIPLaneConfigSchema)), // Cross-chain lanes organized by source->destination
metadata: zod_1.z.object({
// Information about this configuration file
environment: zod_1.z.string(), // "mainnet" or "testnet"
version: zod_1.z.string(), // Configuration version
lastUpdated: zod_1.z.string(), // When this config was last updated
source: zod_1.z.string(), // Where this config came from
}),
});
//# sourceMappingURL=ccip-config.js.map