functionFromSelector method

AbiFunctionFragment functionFromSelector(
  1. String selectorHex
)

Retrieves a function fragment from the contract ABI based from selector.

Implementation

AbiFunctionFragment functionFromSelector(String selectorHex) {
  final selector = BytesUtils.fromHexString(selectorHex)
      .sublist(0, ABIConst.selectorLength);
  return functions
      .singleWhere((element) => bytesEqual(selector, element.selector));
}