Skip to main content

Try it Live

Run Hardfork examples in the interactive playground

    Operator-Style API

    gt mimics the > operator for clearer code:
    import { CANCUN, LONDON } from 'tevm'
    
    // Operator-style (reads like > operator)
    if (CANCUN.gt(LONDON)) {
      // ...
    }
    
    // Equivalent semantic form
    if (CANCUN.isAfter(LONDON)) {
      // ...
    }
    

    Usage Patterns

    Version Detection

    import { Hardfork, CANCUN } from 'tevm'
    
    const fork = Hardfork(config.hardfork)
    
    if (fork.gt(CANCUN)) {
      console.warn("Running unknown post-Cancun hardfork")
    }
    

    Network Configuration

    import { Hardfork, PRAGUE } from 'tevm'
    
    function isExperimental(fork: BrandedHardfork): boolean {
      return fork.gt(PRAGUE)
    }
    

    Chronological Ordering

    Uses chronological deployment order:
    LONDON (11) < MERGE (14) < SHANGHAI (15) < CANCUN (16) < PRAGUE (17)
    

    Strict Inequality

    Returns false when versions are equal:
    import { CANCUN } from 'tevm'
    
    CANCUN.gt(CANCUN)  // false - not strictly greater
    

    Performance

    Time Complexity: O(1) - Array index comparison Typical Time: ~10-20ns per call

    See Also

    • isAfter - Semantic equivalent
    • gte - Greater than or equal
    • lt - Strictly less than