@lidofinance/lido-ethereum-sdk
Version:
<div style="display: flex;" align="center"> <h1 align="center">Lido Ethereum SDK</h1> </div>
14 lines • 677 B
JavaScript
export const calcShareRate = (totalEther, totalShares, precision) => Number((totalEther * precision) / totalShares) / Number(precision);
export const sharesToSteth = (shares, totalEther, totalShares, precision) => (shares * totalEther * precision) / (totalShares * precision);
export const requestWithBlockStep = async (step, fromBlock, toBlock, request) => {
let from = fromBlock;
const result = [];
while (from <= toBlock) {
const to = from + BigInt(step);
const nextResult = await request(from, to > toBlock ? toBlock : to);
result.push(...nextResult);
from = to + 1n;
}
return result;
};
//# sourceMappingURL=utils.js.map