| 1060 | } |
| 1061 | |
| 1062 | Address CLI::parseAddress(const std::string &address) const { |
| 1063 | // Validate Ethereum address: must be 42 chars, start with 0x, and be hex |
| 1064 | if (address.size() != 42 || address.substr(0, 2) != "0x") { |
| 1065 | throw std::runtime_error( |
| 1066 | "Invalid address format: must be 0x followed by 40 hex characters"); |
| 1067 | } |
| 1068 | for (size_t i = 2; i < 42; ++i) { |
| 1069 | char c = address[i]; |
| 1070 | if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || |
| 1071 | (c >= 'A' && c <= 'F'))) { |
| 1072 | throw std::runtime_error( |
| 1073 | "Invalid address format: contains non-hex character"); |
| 1074 | } |
| 1075 | } |
| 1076 | return address; |
| 1077 | } |
| 1078 | |
| 1079 | Amount CLI::parseAmount(const std::string &amount) const { |
| 1080 | try { |
nothing calls this directly
no outgoing calls
no test coverage detected