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

20 lines 731 B
import { filterLeafs, findIndexAndLeaf, } from '../common/utils/find-index-and-leaf.js'; export const findProof = (tree, pubkey) => { const [index, leaf] = findIndexAndLeaf(tree, (leaf) => leaf[1] === pubkey); if (index !== undefined && leaf) { return tree.getProof(index); } return null; }; export const findLeaf = (tree, pubkey) => { const [, leaf] = findIndexAndLeaf(tree, (leaf) => leaf[1] === pubkey); return leaf ? wrapLeaf(leaf) : null; }; export const filterLeafsByNodeOperator = (tree, id) => { return filterLeafs(tree, (leaf) => leaf[0] === id).map(wrapLeaf); }; export const wrapLeaf = (leaf) => ({ pubkey: leaf[1], strikes: leaf[2], }); //# sourceMappingURL=find-proof.js.map