@exromany/lido-csm-sdk
Version:
[](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [](h
26 lines • 1.04 kB
JavaScript
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