Skip to content

Conversation

@Polybius93
Copy link
Contributor

Refactor Attestor Chain ID Implementation and Add Validation Utilities

Overview

Refactored the AttestorChainID implementation to use TypeScript enums and added utility functions for chain ID validation. This enhances type safety and provides better tools for working with different chain types.

New Features

Attestor Chain ID Refactoring

  • Replaced string union type with proper TypeScript enums (EVMAttestorChainID and XRPLAttestorChainID)
  • Split XRPL chains into their own dedicated enum for better organization
  • Added evm-bsctestnet to supported EVM chains

Chain ID Validation Utilities

  • isSupportedChainID(): Validates if a string is a recognized attestor chain ID
  • isEVMChainID(): Checks if a chain ID belongs to an EVM blockchain
  • isXRPLChainID(): Checks if a chain ID belongs to the XRPL ecosystem

Implementation Details

  • Used enum pattern for better IDE autocompletion and type checking
  • Maintained backward compatibility with existing chain ID string values
  • Added comprehensive type guards to simplify chain-specific code paths

Version Bump

Incremented package version from 2.6.4 to 2.6.5 for this non-breaking enhancement.

@Polybius93 Polybius93 force-pushed the feat/updated-attestor-chain-id branch from 39b13d2 to 4dcafb8 Compare March 4, 2025 15:08
@Polybius93 Polybius93 merged commit 4b565fd into main Mar 4, 2025
5 checks passed
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.

3 participants