isValidAccounts static method

bool isValidAccounts({
  1. required List<String> accounts,
  2. required String context,
})

Loops through each account, and validates it Context is used to provide more information in the error message

Implementation

static bool isValidAccounts({
  required List<String> accounts,
  required String context,
}) {
  for (String account in accounts) {
    if (!NamespaceUtils.isValidAccount(account)) {
      throw Errors.getSdkError(
        Errors.UNSUPPORTED_ACCOUNTS,
        context:
            '$context, account $account should conform to "namespace:chainId:address" format',
      ).toSignError();
    }
  }

  return true;
}