@exromany/lido-csm-sdk
Version:
[](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [](h
30 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseNodeOperatorAddedEvents = void 0;
const lido_ethereum_sdk_1 = require("@lidofinance/lido-ethereum-sdk");
const viem_1 = require("viem");
const index_js_1 = require("../../abi/index.js");
const NODE_OPERATOR_ADDED_EVENT = (0, viem_1.getAbiItem)({
abi: index_js_1.CSModuleAbi,
name: 'NodeOperatorAdded',
});
const NODE_OPERATOR_ADDED_SIGNATURE = (0, viem_1.toEventHash)(NODE_OPERATOR_ADDED_EVENT);
const parseNodeOperatorAddedEvents = async (receipt) => {
for (const log of receipt.logs) {
if (log.topics[0] !== NODE_OPERATOR_ADDED_SIGNATURE)
continue;
const parsedLog = (0, viem_1.decodeEventLog)({
abi: [NODE_OPERATOR_ADDED_EVENT],
strict: true,
data: log.data,
topics: log.topics,
});
return parsedLog.args.nodeOperatorId;
}
throw new lido_ethereum_sdk_1.SDKError({
message: 'could not find NodeOperatorAdded event in transaction',
code: lido_ethereum_sdk_1.ERROR_CODE.TRANSACTION_ERROR,
});
};
exports.parseNodeOperatorAddedEvents = parseNodeOperatorAddedEvents;
//# sourceMappingURL=parse-node-operator-added-events.js.map