@openzeppelin/contracts-ui-builder-adapter-evm
Version:
EVM Adapter for Contracts UI Builder
11 lines (9 loc) • 474 B
text/typescript
import type { ContractFunction } from '@openzeppelin/contracts-ui-builder-types';
/**
* Determines if a function is a view/pure function (read-only).
* @param functionDetails The function details from the contract schema.
* @returns True if the function is read-only, false otherwise.
*/
export function isEvmViewFunction(functionDetails: ContractFunction): boolean {
return functionDetails.stateMutability === 'view' || functionDetails.stateMutability === 'pure';
}