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