@gorbchain-xyz/chaindecode
Version:
GorbchainSDK V1.3+ - Complete Solana development toolkit with advanced cryptography, messaging, and collaboration features. Build secure applications with blockchain, DeFi, and end-to-end encryption.
81 lines (80 loc) • 2.52 kB
TypeScript
/**
* Network Configuration System for Gorbchain SDK v2
* Provides network-specific configurations and capabilities
*/
export interface TokenPrograms {
/** Standard SPL Token Program */
spl?: string;
/** Token-2022 Program */
token2022?: string;
/** Custom token programs specific to the network */
custom?: string[];
}
export interface NetworkFeatures {
/** Supports standard SPL tokens */
standardTokens: boolean;
/** Supports custom token programs */
customTokens: boolean;
/** Supports NFT operations */
nftSupport: boolean;
/** Supports token metadata */
metadataSupport: boolean;
/** Supports transaction decoding */
transactionDecoding: boolean;
}
export interface NetworkConfig {
/** Human-readable network name */
name: string;
/** RPC endpoint URL */
rpcEndpoint: string;
/** Supported token programs */
tokenPrograms: TokenPrograms;
/** RPC methods supported by this network */
supportedMethods: string[];
/** Network feature capabilities */
features: NetworkFeatures;
/** Network-specific settings */
settings: {
/** Default timeout for requests */
timeout: number;
/** Default retry attempts */
retries: number;
/** Rate limiting (requests per second) */
rateLimit: number;
};
}
/**
* Predefined network configurations
*/
export declare const NETWORK_CONFIGS: Record<string, NetworkConfig>;
/**
* Get network configuration by name or RPC endpoint
*/
export declare function getNetworkConfig(identifier: string): NetworkConfig | null;
/**
* Detect network configuration from RPC endpoint
*/
export declare function detectNetworkFromEndpoint(rpcEndpoint: string): NetworkConfig | null;
/**
* Create a custom network configuration
*/
export declare function createCustomNetworkConfig(baseConfig: Partial<NetworkConfig> & {
name: string;
rpcEndpoint: string;
}): NetworkConfig;
/**
* Validate network configuration
*/
export declare function validateNetworkConfig(config: NetworkConfig): string[];
/**
* Get all available network names
*/
export declare function getAvailableNetworks(): string[];
/**
* Check if a network supports a specific feature
*/
export declare function networkSupportsFeature(networkName: string, feature: keyof NetworkFeatures): boolean;
/**
* Check if a network supports a specific RPC method
*/
export declare function networkSupportsMethod(networkName: string, method: string): boolean;