Package Exports
- lumiap-calc
- lumiap-calc/src/calculator.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lumiap-calc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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-calc
Usage
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 test
This 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.