fetchSelectorOpenChain method
Implementation
Future<ExternalContractFunction?> fetchSelectorOpenChain(
String selector,
) async {
selector = selector.startsWith("0x") ? selector : "0x$selector";
final endpoint =
"$_openchainEndpoint/lookup?function=$selector&filter=true";
final uri = Uri.parse(endpoint);
if (functionCache.containsKey(endpoint)) {
return await functionCache[endpoint]!.future;
}
final future = _openchainRequest(uri, selector);
final completer = Completer<ExternalContractFunction?>();
functionCache[endpoint] = completer;
try {
final function = await future;
completer.complete(function);
return function;
} catch (e) {
completer.complete(null);
return null;
}
}