@admin-jigsaw/jigsaw-sdk
Version:
Returns predefined data for Jigsaw platform and exposes functionality to retrieve the necessary data
16 lines (15 loc) • 670 B
JavaScript
import { PROTOCOL_STRATEGY_MAP } from "../constants/strategiesConstants";
/**
* Returns the protocol name based on the provided strategy address.
* @param {Address} stratAddress - The strategy address to look up.
* @returns {string | null} - The corresponding protocol name or null if not found.
*/
export function getProtocolByStrategy(stratAddress) {
for (var _i = 0, _a = Object.entries(PROTOCOL_STRATEGY_MAP); _i < _a.length; _i++) {
var _b = _a[_i], protocol = _b[0], strategies = _b[1];
if (strategies.includes(stratAddress)) {
return protocol;
}
}
return null; // Return null if no matching strategy is found
}