isValidChains function

ErrorObject? isValidChains(
  1. String key,
  2. List<String> chains,
  3. String context
)

Implementation

ErrorObject? isValidChains(
  String key,
  List<String> chains,
  String context,
) {
  ErrorObject? error;
  chains.forEach((chain) {
    if (error != null) return;
    if (!isValidChainId(chain) || !chain.contains(key)) {
      error = getSdkError(
        SdkErrorKey.UNSUPPORTED_CHAINS,
        context:
            '$context, chain $chain should be a string and conform to "namespace:chainId" format',
      );
    }
  });

  return error;
}