Skip to content

Conversation

@SeddikBellamine
Copy link
Contributor

@SeddikBellamine SeddikBellamine commented Jul 22, 2025

🚀 Multi-Chain Configuration and Experimental Networks Support

📋 Overview

This PR introduces comprehensive multi-chain configuration support and experimental networks functionality to the Web3Telegram SDK. It enables developers to use the SDK across different blockchain networks, including experimental networks like Arbitrum Sepolia testnet.

🔧 Key Features

Multi-Chain Configuration

  • Flexible Chain Configuration: Refactored chain configuration system to support multiple networks
  • Dynamic Chain Detection: Automatic chain detection from provider
  • Configurable Network Parameters: Each chain can have its own configuration for:
    • Dapp addresses and ENS names
    • Workerpool addresses
    • Data protector subgraph URLs
    • IPFS gateways and upload URLs
    • Whitelist smart contract addresses

Experimental Networks Support

  • Arbitrum Sepolia Testnet: Added support for Arbitrum Sepolia testnet (Chain ID: 421614)
  • Experimental Network Flag: New allowExperimentalNetworks option to control access
  • Safety Warnings: Clear documentation about experimental network limitations
  • Opt-in Access: Experimental networks are disabled by default for safety

🛠️ Technical Implementation

Configuration System

// New chain configuration structure
export const CHAIN_CONFIG: Record<number, ChainConfig> = {
  134: {
    // Bellecour
    name: 'bellecour',
    dappAddress: 'web3telegram.apps.iexec.eth',
    // ... other config
  },
  421614: {
    // Arbitrum Sepolia (Experimental)
    name: 'arbitrum-sepolia-testnet',
    dappAddress: 'web3telegram.apps.iexec.eth',
    isExperimental: true,
    // ... other config
  },
};

SDK Changes

// New configuration option
interface Web3TelegramConfigOptions {
  allowExperimentalNetworks?: boolean; // Default: false
}

// Updated provider function
const provider = getWeb3Provider(privateKey, {
  host: 421614, // Custom chain
  allowExperimentalNetworks: true,
});

// SDK instantiation with experimental networks
const web3telegram = new IExecWeb3telegram(provider, {
  allowExperimentalNetworks: true,
});

🔄 Backward Compatibility

  • Fully Backward Compatible: Existing code continues to work without changes
  • Default Behavior: Bellecour remains the default network
  • Gradual Migration: Developers can opt-in to new features when ready

🧪 Testing

  • Comprehensive Test Coverage: Added extensive tests for experimental networks
  • E2E Tests: Updated all end-to-end tests to work with new configuration
  • Unit Tests: Updated unit tests for new functionality
  • Error Handling: Tests for proper error handling when experimental networks are disabled

📚 Documentation

  • TypeScript Types: Full type safety with proper JSDoc comments
  • API Documentation: Clear documentation for new options
  • Usage Examples: Examples for both stable and experimental networks

🔒 Security & Safety

  • Experimental Network Warnings: Clear warnings about experimental network limitations
  • Opt-in Design: Experimental networks require explicit opt-in
  • Network Validation: Proper validation of supported networks
  • Error Messages: Clear error messages for unsupported configurations

📦 Dependencies

  • Updated iexec: Upgraded to v8.16.1 for latest features and security patches

🎯 Use Cases

Development & Testing

// Use Arbitrum Sepolia for testing
const testProvider = getWeb3Provider(privateKey, {
  host: 421614,
  allowExperimentalNetworks: true,
});

const testSDK = new IExecWeb3telegram(testProvider, {
  allowExperimentalNetworks: true,
});

Production (Bellecour)

// Default behavior - no changes needed
const provider = getWeb3Provider(privateKey);
const sdk = new IExecWeb3telegram(provider);

🚨 Important Notes

Experimental Networks Disclaimer

⚠️ Experimental networks are networks on which the iExec stack is partially deployed. These networks can be subject to instabilities or discontinuities. Access is provided without warranties.

Migration Guide

  • No Action Required: Existing applications continue to work unchanged
  • Opt-in Features: New features require explicit configuration
  • Gradual Adoption: Can be adopted incrementally

🔗 Related Issues

  • Enables multi-chain deployment support
  • Provides testing infrastructure for new networks
  • Improves developer experience with flexible configuration

📋 Checklist

  • Multi-chain configuration system
  • Experimental networks support
  • Backward compatibility maintained
  • Comprehensive test coverage
  • TypeScript type safety
  • Documentation updated
  • Error handling implemented
  • Security considerations addressed

Breaking Changes: None - this is a fully backward-compatible enhancement.

Copy link
Member

@PierreJeanjacquot PierreJeanjacquot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PierreJeanjacquot PierreJeanjacquot marked this pull request as draft July 23, 2025 09:35
@PierreJeanjacquot
Copy link
Member

set to draft until npm package with kubo-rpc-client fix is published

@PierreJeanjacquot PierreJeanjacquot marked this pull request as ready for review July 23, 2025 12:37
@SeddikBellamine SeddikBellamine merged commit 26715d1 into main Jul 23, 2025
4 checks passed
@SeddikBellamine SeddikBellamine deleted the feat/multi-chain-config branch July 23, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants