biketrack-app/node_modules/@ethersphere/bee-js/dist/mjs/utils/stamps.js

17 lines
450 B
JavaScript
Raw Normal View History

2022-07-11 10:27:11 +02:00
/**
* Utility function that calculates usage of postage batch based on its utilization, depth and bucket depth.
*
* Be aware for small depths (17, 18) this does not provide that much information as the provided set of distinct values
* is small.
*
* @param utilization
* @param depth
* @param bucketDepth
*/
export function getStampUsage({
utilization,
depth,
bucketDepth
}) {
return utilization / Math.pow(2, depth - bucketDepth);
}