0.1.25 • Published 6 years ago

contract-utils v0.1.25

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

contract-utils

Contract utility library for Ethereum, to easily sign and send raw transactions

npm version Build Status dependencies Status devDependencies Status Coverage Status

Installation:

  • npm install contract-utils --save

How to use:

const { Transaction } = require('contract-utils');
const contracts = {
  'erc20': { // contract name
    address: '', // contract address
    abi: [], // contract abi
  },
};
const Transaction = new Transaction('http://localhost:8545', contracts);

// Example signing and sending transaction to a custom ERC20 contract
const txData = {
  contractName: 'erc20', // contract name from 'contracts' object
  privateKey: 'privateKey', // private key to sign the transaction
  gasLimit: 200000, //   optional: (default: 200000)
  value: 0, // optional value sent in ether (wei) if function is 'payable' (default: 0)
};
Transaction.send(
  txData,
  'transfer', // method to be called in the contract
  '0x...', // @param1
  1000000000000000000, // @param2
  // ...other params
)
.then(console.log);
0.1.25

6 years ago

0.1.24

6 years ago

0.1.23

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago