import { ContractCallMetadataInterface } from '../../shared';

export const validateMetadata = (maybeMetadata: unknown): maybeMetadata is ContractCallMetadataInterface => {
  if (
    maybeMetadata &&
    typeof maybeMetadata === 'object' &&
    '_metadata' in maybeMetadata &&
    maybeMetadata._metadata &&
    typeof maybeMetadata._metadata === 'object'
  ) {
    return true;
  }

  return false;
};
