ensureClassicAddress static method
Ensures that the provided address is a classic XRP address, and if not, converts it to a classic address.
This method checks if the provided address is a classic XRP address; if it is, the address is returned unchanged. If the address is an X-Address, it is decoded and converted to a classic address using hashToAddress.
address
The address to be checked and ensured as a classic XRP address.
returns The classic XRP address after ensuring it.
Implementation
static String ensureClassicAddress(String address) {
if (isClassicAddress(address)) {
return address;
}
final addrHash = decodeXAddress(address, null).item1;
return hashToAddress(addrHash);
}