Skip to content

🔄 Implement Cross-Chain Token Compatibility Validation #68

@mijinummi

Description

@mijinummi

🧭 Overview

BridgeWise supports multi-chain transfers across Stellar and EVM networks.

To ensure safe and successful transfers, it must validate token compatibility across chains:

  • Prevent users from bridging unsupported or non-existent tokens
  • Provide clear feedback for incompatible token selections
  • Integrate with <BridgeCompare />, useBridgeQuotes(), and transaction execution hooks

This ensures transfers are reliable and reduces failed transactions.


🎯 Problem

  • Not all tokens exist on both source and destination chains
  • Users may attempt unsupported transfers, leading to failed transactions
  • Developers embedding BridgeWise have no automated token validation
  • Lack of validation increases risk of errors and poor UX

Without compatibility checks, BridgeWise cannot provide a safe, production-ready cross-chain experience.


💡 Proposed Solution

Implement a Cross-Chain Token Compatibility Validation Layer that:

  • Maintains a token registry per chain and bridge
  • Validates token availability before quote calculation or transaction execution
  • Returns structured errors/warnings for unsupported token routes
  • Provides hooks (useTokenValidation()) for developers
  • Supports both UI components and headless mode

🛠 Scope of Work

1️⃣ Define Token Registry

interface TokenInfo {
  symbol: string;
  name: string;
  chain: string;
  bridgeSupported: string[];
  decimals: number;
  logoURI?: string;
}
  • Centralized token list for supported bridges and chains
  • Easily updatable and extendable

2️⃣ Implement Validation Logic

  • isTokenSupported(token: string, sourceChain: string, destinationChain: string): boolean

  • Validate before:

    • Fetching quotes (useBridgeQuotes())
    • Initiating transfers (useBridgeExecution())
  • Return structured error messages for UI or headless integration


3️⃣ Hook Implementation

  • useTokenValidation(token: string, sourceChain: string, destinationChain: string)

    • Returns:

      • isValid: boolean
      • errors: string[]
    • SSR-safe

    • Integrates with <BridgeCompare /> to disable unsupported routes


4️⃣ UI Integration

  • <BridgeCompare />: highlight or disable unsupported routes
  • <BridgeStatus />: prevent execution for incompatible tokens
  • Optional tooltip or alert for end-users

5️⃣ Error Handling & Fallbacks

  • Handle unknown tokens gracefully
  • Provide default “unsupported token” warning
  • Ensure hooks and UI do not break with invalid input

📊 Expected Outcome

  • Users cannot attempt unsupported cross-chain transfers
  • Developers have a simple API to validate token compatibility
  • Reduced failed transactions and errors
  • Consistent, safe, production-ready UX across bridges

✅ Acceptance Criteria

  • Token registry implemented per chain and bridge
  • Validation logic functional for all supported routes
  • useTokenValidation() hook available and SSR-safe
  • Integration with <BridgeCompare /> and <BridgeStatus />
  • Structured error messages returned for incompatible tokens
  • Unit tests covering validation logic, hook, and UI integration
  • Documentation updated with usage examples

📈 Measurable Impact

  • Fewer failed transfers due to unsupported tokens
  • Developers can confidently embed BridgeWise without additional validation logic
  • Improved user trust and overall UX
  • Reduced support and troubleshooting effort

🧪 Testing Requirements

  • Test token validation across multiple chains and bridges
  • Simulate unsupported tokens and ensure proper error handling
  • Validate hook output and UI integration
  • Ensure SSR-safe behavior for headless mode
  • Test fallback for unknown or invalid token symbols

📚 Documentation Requirements

  • Add “Token Compatibility Validation” section in README
  • Provide hook usage example:
const { isValid, errors } = useTokenValidation("USDC", "Ethereum", "Stellar");
  • Document integration with <BridgeCompare /> and <BridgeStatus />
  • Include supported token list and update instructions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions