iso-filecoin
Version:
Isomorphic filecoin abstractions for RPC, signatures, address, token and wallet
52 lines (35 loc) • 1.47 kB
Markdown
[](https://www.npmjs.com/package/iso-filecoin)
[](https://github.com/fission-codes/filecoin/actions/workflows/iso-filecoin.yml)
Filecoin Javascript Standard Library. Used by the [Metamask Filecoin Wallet](https://github.com/filecoin-project/filsnap) and [Ledger Live Filecoin app](https://www.ledger.com/coin/wallet/filecoin).
## Install
```bash
pnpm install iso-filecoin
```
## Usage
```js
import { Token } from 'iso-filecoin/token'
import * as Wallet from 'iso-filecoin/wallet'
Token.fromFIL(1).toPicoFIL().toString() // '1000000000000'
const mnemonic = Wallet.generateMnemonic()
const seed = Wallet.mnemonicToSeed(mnemonic)
const account = Wallet.accountFromSeed(
seed,
'SECP256K1',
"m/44'/461'/0'/0/0"
)
const account = Wallet.accountFromMnemonic(
mnemonic,
'SECP256K1',
"m/44'/461'/0'/0/0"
)
const address = account.address.toString()
// 'f17levgrkmq7jeloew44ixqokvl4qdozvmacidp7i'
```
Check [docs website](https://filecoin.hugomrdias.dev)
Read contributing [guidelines](../../.github/CONTRIBUTING.md).
[](https://codespaces.new/hugomrdias/filecoin)
[](../../license) © [Hugo Dias](http://hugodias.me)