New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

eth-toolbox

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eth-toolbox

Ethereum Toolbox

latest
Source
npmnpm
Version
0.2.3
Version published
Maintainers
2
Created
Source

eth-toolbox Build Status License: MIT npm

Simple Ethereum toolbox

Table of Contents

Get Started

npm install --save eth-toolbox

Usages

Create Keystore

const ks = await ethToolbox.createKeystore(entropy, password)

Inputs

  • entropy: Random number
  • password: Password to decode keystore

Return value

Return serialize keystore

Decode Keystore

const ks = await ethToolbox.decodeKeystore(keystore, password);

Inputs

  • keystore: Deserialize keystore
  • password: Password to decode keystore

Return value

ks = {
  address,
  privateKey,
}

Send Ether

const tsx = await ethToolbox.sendEther(address, amount, keystore, password);

Inputs

  • address: Ethereum address
  • amount: Amount
  • keystore: Deserialize keystore
  • password: Password to decode keystore

Return value

tsx = {
  from, // Eth address
  to, // Eth address
  value, // Amount
  date, // Date of the transaction
  dether: {
    detherContract, // Boolean
    receive, // Boolean
  },
  etherscan: { // Etherscan link
    kovan,
    ropsten,
    ether,
  },
}

Get All Transactions

const allTsx = await ethToolbox.getAllTsx(address, network, etherScanKey, providerUrl);

Inputs

  • address: Ethereum address
  • network: Network number
  • etherScanKey: API key etherscan
  • providerUrl: Provider URL
Return value
allTsx = [
  {
    etherscan, // Etherscan link
    value, // Amount
    to, // Eth address
    from, // Eth address
    date, // Date of the transaction
    timeStamp, // TimeStamp
    error, // Boolean
    dether: {
      receive, // Boolean
      myEther, // Boolean
    },
  },
  ...
]

Get Balance

const balance = await ethToolbox.getEthBalance(address, providerUrl);

Inputs

  • address: Ethereum address
  • providerUrl: Provider URL

Return value

Return ether amount in address

Account Amount

const amount = await ethToolbox.accountAmount(address, providerUrl);

Inputs

  • address: Ethereum address
  • providerUrl: Provider URL

Return value

{
  usd: {
    price: 338.73,
    balance: 11.70036773046875,
    total: 3963.26556134168,
  },
  eur: {
    price: 284.53,
    balance: 11.70036773046875,
    total: 3329.1056303502733,
  },
  cny: {
    price: 2269.82,
    balance: 11.70036773046875,
    total: 26557.72868197258,
  },
  krw: {
    price: 386628.54,
    balance: 11.70036773046875,
    total: 4523696.093094246,
  },
  jpy: {
    price: 38280.56,
    balance: 11.70036773046875,
    total: 447896.6289282728,
  }
}

Get Seed

const seed = await ethToolbox.getSeed(keystore, password);

Inputs

  • keystore: Deserialize keystore
  • password: Password to decode keystore

Return value

Return seed

Extra tools

Create Vault

const ks = ethToolbox.utils.createVault({ password, seedPhrase, hdPathString });

Inputs

  • password: New password
  • seedPhrase: Seed phrase (12 words)
  • hdPathString

Return value

New serialized keystore

Deserialize keystore

const dsKeystore = ethToolbox.utils.deserializeKeystore(serializedKeystore);

Inputs

  • serializedKeystore: Serialized keystore

Return value

Deserialize keystore

Generate Random Seed

const seed = ethToolbox.utils.generateRandomSeed(entropy);

Inputs

  • entropy

Return value

Random phrase of 12 words

is Address

const test = ethToolbox.utils.isAddr(ethAddr);

Inputs

  • ethAddr: Ethereum address

Return value

Return true if ethAddr is a Etherem address valid

Add 0x

const formated = ethToolbox.utils.add0x(ethAddr);

Inputs

  • ethAddr: Ethereum address

Return value

Formated address

Get Signed web3

const web3 = ethToolbox.utils.getSignedWeb3(privateKey, address)

Inputs

  • privateKey: Private key
  • addressy: Ethereum address

Return value

New Web3 instance

Install

// use npm
npm install --save eth-toolbox

// use yarn
yarn add eth-toolbox

Example

git clone https://github.com/dethertech/eth-toolbox.git
yarn
yarn run example

Dev

git clone https://github.com/dethertech/eth-toolbox.git
cd eth-toolbox
yarn

Test

npm test

Build doc

# Install ESDoc
yarn

# Run ESDoc.
yarn run:doc

Dependencies

Dev Dependencies

Bugs

When you find issues, please report them:

License

Donation

Keywords

Dether

FAQs

Package last updated on 23 Oct 2017

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