Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@glif/filecoin-number
Advanced tools
a javascript package to handle Filecoin numbers like Fil and AttoFil
A wrapper class built around javascript's bignumber. Most questions are best answered from the bignumber readme and docs.
import { FilecoinNumber, Converter } from '@glif/filecoin-number'
// pass a valid bignumber argument, and a denomination ('fil', 'picofil', or 'attofil') to the constructor.
const filecoinNumber = new FilecoinNumber('10000', 'attofil')
// filecoinNumber is an instance of BigNumber, so you can use it as such
filecoinNumber.multiply(7)
// it comes with 2 additional instance methods for showing the filecoin number as a string in attofil or fil
const inPicoFil = filecoinNumber.toPicoFil()
const inAttoFil = filecoinNumber.toAttoFil()
const inFil = filecoinNumber.toFil()
// Use the Converter to convert currencies
const optionalConfig = {
apiURL: 'https://coinmarketproxy.com',
apiKey: 'RIP Kobe',
}
const USDConverter = new Converter('USD', optionalConfig)
await USDConverter.cacheConversionRate()
const USD = USDConverter.fromFIL(1)
const FIL = USDConverter.toFIL(1)
// fromFIL and toFIL take numbers, strings, BigNumbers, and FilecoinNumbers as valid args
const USD = USDConverter.fromFIL(1)
const USD = USDConverter.fromFIL('1')
const USD = USDConverter.fromFIL(new BigNumber(1))
const USD = USDConverter.fromFIL(new FilecoinNumber('1', 'fil'))
We use an APIADDR environment variable in the tests. You can either: (a) add the APIADDR environment variable locally, or (b) use a secrets.js file to export private information
FAQs
a javascript package to handle Filecoin numbers like Fil and AttoFil
The npm package @glif/filecoin-number receives a total of 510 weekly downloads. As such, @glif/filecoin-number popularity was classified as not popular.
We found that @glif/filecoin-number demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.