Neverending Plethora of Modules
Introducing npm Teams! Private packages + team management tools.Learn more »

eth-send

0.0.9 • Public • Published

eth-send

Simple way to send ether.

License NPM version

Install

npm install eth-send

Getting started

const send = require('eth-send')
 
;(async () => {
  const txHash = await send({
    from: '4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
    to: '0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0',
    amount: '0.01',
    network: 'rinkeby'
  })
 
  console.log(txHash) // 0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00
})()
 

example

CLI

Install:

npm install -g eth-send

Example of sending ether on testnet from an account loaded via the private key, to another address:

$ eth_send \
  --from 4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d \
  --to 0xffcf8fdee72ac11b5c542428b35eef5769c409f0 \
  --amount 0.01 \
  --network rinkeby
 
sending transaction:
 
network:  rinkeby
from:     0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
to:       0xffcf8fdee72ac11b5c542428b35eef5769c409f0
amount:   0.01 ETH (10000000000000000 wei)
gas:      21000
gasPrice: 1 gwei
 
tx hash:  0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00
 
https://rinkeby.etherscan.io/tx/0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

Use the silent flag to only return the transaction hash:

$ eth_send [...] --silent
 
0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

You may use a custom provider in the network flag:

$ eth_send [...] --network https://rinkeby.infura.io/

The sender private key can be set as an environment variable:

FROM=4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d eth_send [....]

Piping ETH amount to send:

echo 0.1 | eth_send [...]
 
0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

Show help:

$ eth_send --help
 
  Simple way to send ether.
 
  Usage
  $ eth_send --from <private-key> --to <address> --amount <ether> --network <network> [--silent]
 
  Options
    --from, -f Private key of sender (required)
    --to, -t Address to send to (required)
    --amount, -a Ether amount to send (required)
    --value , -v Wei amount to send (alternative to --amount)
    --network, -n Network name or network provider URI (default "mainnet")
    --gasPrice, -p Gas price in wei
    --gas, -g Gas limit
    --data, -d Transaction data
    --silent, -s Silent output
 
  Examples
  $ eth_send --from 4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d --to 0xffcf8fdee72ac11b5c542428b35eef5769c409f0 --amount 0.01 --network rinkeby --silent
 
  0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

Test

npm test

License

MIT

Install

npm i eth-send

DownloadsWeekly Downloads

0

Version

0.0.9

License

MIT

Unpacked Size

11.3 kB

Total Files

8

Last publish

Collaborators

  • avatar