Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@harmony-js/account

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harmony-js/account

account and wallet for harmony

  • 0.0.18
  • npm
  • Socket score

Version published
Weekly downloads
422
decreased by-6.01%
Maintainers
1
Weekly downloads
 
Created
Source

Features

  1. Account instance
  2. Create Account
  3. Import prv key
  4. Import/Export keystore file
  5. BIP39
  6. BIP44
  7. [WIP] Sign txn/message
  8. getBalance
  9. Wallet CRUD

Wallet Usage


import { Wallet } from '@harmony-js/account';

const wallet = new Wallet();

const mnes = wallet.generateMnemonic();

// add mnemonic and use index=0
const accountA = wallet.addByMnemonic(mnes,0);

// this account instance will be the wallet's signer by default
console.log(wallet.signer.address === accountA.address)
// true

wallet.encryptAccount(accountA.address,'easy password')
    .then((encrypted)=>{
        console.log(encrypted.privateKey);
        // private key now is keyStoreV3 format string

        wallet.decryptAccount(accountA.address,'easy password')
            .then((decrypted)=>{
                console.log(decrypted.privateKey);
                // now private key is recovered
            })
    });


wallet.accounts
// it will display accounts addresses live in wallet

wallet.getAccount(accountA.address);
// it will get account instance by using address as reference

wallet.removeAccount(accountA.address);
// it will remove account instance from wallet

wallet.createAccount();
// it will create a new acount instance

wallet.addByPrivateKey(key);
// you can add private key directly as well

FAQs

Package last updated on 29 May 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc