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

18 lines
588 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStampUsage = void 0;
/**
* 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
*/
function getStampUsage({ utilization, depth, bucketDepth }) {
return utilization / Math.pow(2, depth - bucketDepth);
}
exports.getStampUsage = getStampUsage;