Skip to content

Client-side JavaScript SDK to read/write wallets and transactions to Lotion-based coin

License

Notifications You must be signed in to change notification settings

reforest/fungus

Repository files navigation

fungus

Client-side JavaScript SDK to read/write wallets and transactions to Basecoin

Stack Diagram

Usage

import Fungus from 'reforest-fungus';
const fungus = new Fungus({
    lotionUrl: 'localhost:3000' // Ensure lotion is running on port 3000
})

const privateKey = fungus.generatePrivateKey().toString('hex');
const address = fungus.createPublicKey(privateKey).toString('hex');
let balance; 

fungus.getBalance(address).then(b=>{
    balance = b;
    console.log(balance);
}).catch(err=>{
    console.error(err);
})

// save it savely somewhere, for example(bad)
localStorage.setItem('privateKey', privateKey);

API

  • generatePrivateKey
  • createPublicKey
  • getBalance
  • createTransaction
  • getAllTransactions

Running example

npm run example

Releases

No releases published

Packages

No packages published