UNPKG

@exromany/lido-csm-sdk

Version:

[![GitHub license](https://img.shields.io/github/license/lidofinance/lido-csm-sdk?color=limegreen)](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [![Version npm](https://img.shields.io/npm/v/@lidofinance/lido-csm-sdk?label=version)](h

26 lines 1.04 kB
import { ERROR_CODE, SDKError } from '@lidofinance/lido-ethereum-sdk'; import { decodeEventLog, getAbiItem, toEventHash } from 'viem'; import { CuratedModuleAbi } from '../../abi/index.js'; const NODE_OPERATOR_ADDED_EVENT = getAbiItem({ abi: CuratedModuleAbi, name: 'NodeOperatorAdded', }); const NODE_OPERATOR_ADDED_SIGNATURE = toEventHash(NODE_OPERATOR_ADDED_EVENT); export const parseCuratedModuleNodeOperatorAddedEvents = async (receipt) => { for (const log of receipt.logs) { if (log.topics[0] !== NODE_OPERATOR_ADDED_SIGNATURE) continue; const parsedLog = decodeEventLog({ abi: [NODE_OPERATOR_ADDED_EVENT], strict: true, data: log.data, topics: log.topics, }); return parsedLog.args.nodeOperatorId; } throw new SDKError({ message: 'could not find NodeOperatorAdded event in transaction', code: ERROR_CODE.TRANSACTION_ERROR, }); }; //# sourceMappingURL=parse-curated-module-node-operator-added-events.js.map