getCoinType method

String getCoinType(
  1. String path
)

Implementation

String getCoinType(String path){
  //m / purpose' / coin_type' / account' / change / address_index
  final regex =  RegExp(r"^(m\/)?(\d+'?\/)*\d+'?$");
  if (!regex.hasMatch(path)) throw  ArgumentError("Expected BIP32 Path");
  List<String> splitPath = path.split("/");
  String coinType=splitPath[2].replaceAll("'", "");
  return coinType;
}