getChainsFromRequiredNamespace static method

List<String> getChainsFromRequiredNamespace({
  1. required String nsOrChainId,
  2. required RequiredNamespace requiredNamespace,
})

If the namespace is a chain, add it to the list and return it Otherwise, get the chains from the required namespaces

Implementation

static List<String> getChainsFromRequiredNamespace({
  required String nsOrChainId,
  required RequiredNamespace requiredNamespace,
}) {
  List<String> chains = [];
  if (isValidChainId(nsOrChainId)) {
    chains.add(nsOrChainId);
  } else if (requiredNamespace.chains != null) {
    // We are assuming that the namespace is a chain
    // Validate the requiredNamespace before it is sent here
    chains.addAll(requiredNamespace.chains!);
  }

  return chains;
}