Skip to main content

    Signature Format Rules

    The canonical signature follows strict formatting rules:
    1. Function name - Exact name from ABI
    2. Opening parenthesis - No space after name
    3. Parameter types - Only types, no names
    4. Comma-separated - No spaces around commas
    5. Closing parenthesis - No trailing content

    Usage Examples

    Basic Signature

    No Parameters

    Complex Parameter Types

    Tuple Arrays

    Computing Selector from Signature

    Type-Safe Signatures

    TypeScript can infer the exact signature type:

    Signature Comparison

    Signatures are used to identify function uniqueness:

    Human-Readable Format

    For display purposes, you may want a human-readable format:

    Fixed vs Dynamic Arrays

    Array notation in signatures:

    Error Handling

    See Also

    • getSelector - Get 4-byte selector from signature
    • encodeParams - Encode function calldata
    • format - Format ABI item to signature with parameter names