fromStr static method

ModuleId fromStr(
  1. String moduleId
)

Converts a string literal to a ModuleId moduleId String literal in format "AccountAddress::module_name", e.g. "0x1::coin"

Implementation

static ModuleId fromStr(String moduleId) {
  final parts = moduleId.split("::");
  if (parts.length != 2) {
    throw ArgumentError("Invalid module id.");
  }
  return ModuleId(AccountAddress.fromHex(HexString(parts[0]).hex()), Identifier(parts[1]));
}