ethereum-contract
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

INSTALL

npm install ethereum-contract

USAGE

usage examples:

import { FunctionParameter, ContractFunction, ContractABI } from 'ethereum-contract';
import BN from 'bn.js';

const address: string = '0x8e41fa729ed07b39b2cf004187b710a55e840bc5';
const amount: BN = new BN(123).mul(new BN(10).pow(new BN(18)));
const parameters: FunctionParameter[] = [
  new FunctionParameter('address', ContractABI.parseType('address')),
  new FunctionParameter('uint', ContractABI.parseType('uint'))
];
const func: ContractFunction = new ContractFunction('transfer', parameters);

console.log(func.encode([address, amount]));
// a9059cbb0000000000000000000000008e41fa729ed07b39b2cf004187b710a55e840bc5000000000000000000000000000000000000000000000006aaf7c8516d0c0000

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i ethereum-contract

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

50.2 kB

Total Files

47

Last publish

Collaborators

  • litaoh