lumiap-calc
v1.0.2
Published
A package to calculate LumiaP based on the current timestamp and lumiaP_t0.
Readme
LumiaP Calculator
This project provides a simple npm package for calculating LumiaP based on the current timestamp and a given initial value (lumiaP_t0).
Installation
To install the package, run the following command:
npm install lumiap-calcUsage
To use the Lumia Power Calculator, you can import the calculateLumiaP function from the package:
const { calculateLumiaP, calculateMinLockPeriod } = require('lumiap-calc');
// Example usage
const lumiaP_t0 = 100; // initial value
const lumiaP = calculateLumiaP(userLumiaP_t0);
console.log(`Calculated LumiaP: ${lumiaP}`);
const userMinLockPeriod = calculateMinLockPeriod(userLumiaP_t0, userLumiaLocked, userLockEndDate)
console.log(`Calculated userMinLockPeriod: ${userMinLockPeriod}`);
Functionality
The calculateLumiaP function takes an initial value (userLumiaP_t0) and computes the LumiaP based on the current timestamp. The calculation logic is defined in the src/calculator.js file.
The calculateMinLockPeriod function takes (userLumiaP_t0, userLumiaLocked, userLockEndDate), these values are available using Subgraph.
Testing
To run the tests for this package, use the following command:
npm testThis will execute the unit tests defined in the test/calculator.test.js file.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
