Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Sep 5, 2024
1 parent b0c2455 commit f145974
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pkg/address/validate_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ func ValidateAddressForChain(address string, chainID int64, additionalChains []c
case chains.Network_zeta:
return nil
case chains.Network_btc:
{
addr, err := chains.DecodeBtcAddress(address, chainID)
if err != nil {
return fmt.Errorf("invalid address %s , chain %d: %s", address, chainID, err)
}
if !chains.IsBtcAddressSupported(addr) {
return fmt.Errorf("unsupported address %s", address)
}
return nil
}
return ValidateBTCAddress(address, chainID)
case chains.Network_polygon:
return ValidateEthereumAddress(address)
case chains.Network_bsc:
Expand All @@ -57,3 +48,14 @@ func ValidateEthereumAddress(address string) error {
}
return nil
}

func ValidateBTCAddress(address string, chainID int64) error {
addr, err := chains.DecodeBtcAddress(address, chainID)
if err != nil {
return fmt.Errorf("invalid address %s , chain %d: %s", address, chainID, err)
}
if !chains.IsBtcAddressSupported(addr) {
return fmt.Errorf("unsupported address %s", address)
}
return nil
}

0 comments on commit f145974

Please sign in to comment.