MCPcopy Create free account
hub / github.com/QuipNetwork/cpp-sdk / parseAddress

Method parseAddress

src/cli.cpp:1062–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1060}
1061
1062Address 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
1079Amount CLI::parseAmount(const std::string &amount) const {
1080 try {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected