renameType method

String renameType(
  1. String type
)

Implementation

String renameType(String type) {
  type = type.trim();
  if (type.isEmpty || type == '()') {
    return 'Null';
  }
  type = type.replaceAll('T::', '');
  type = type.replaceAll('VecDeque<', 'Vec<');
  type = type.replaceAll('<T>', '');
  type = type.replaceAll('<T, I>', '');
  type = type.replaceAll('&\'static[u8]', 'Bytes');
  type = type.replaceAll('<Lookup as StaticLookup>::Source', 'Address');

  type = type.trim();
  if (type.isEmpty) {
    return 'Null';
  }
  return type;
}