contract-support
v1.1.3
Published
Support compile and interact with ethereum smart contract
Downloads
15
Readme
#ETHEREUM CONTRACT SUPPORT
##Install my package
const contractSup = require('contract-support')
###Get contract interface (abi)
contractName : name file contract, example : HelloWorld.sol
link : link to contract file
subContractName : name of contract you want to get interface
let interface = contractSup.getContractInterface(contractName, link, subContractName);
###Get contract bytecode
contractName : name file contract, example : HelloWorld.sol
link : link to contract file
subContractName : name of contract you want to get byte code
let interface = contractSup.getContractBytecode(contractName, link, subContractName);
###Get deploy data of new contract
web3Instance : instance of web3
from : address of sender
abi : abi of contract
byteCode : byte code of contract
to get web3Instance, you can use (ether-transaction) npm package, for example:
const et = require('ether-transaction')
let ts = new et.TransactionService('wss://rinkeby.infura.io/ws')
let web3Instance = ts.getWeb3Instance()
let newContractData = contractSup.getDeployData(web3Instance, from, abi, byteCode);
###Get estimate gas when deploy new contract
web3Instance : instance of web3
from : address of sender
abi : abi of contract
byteCode : byte code of contract
let gasLimit = await contractSup.getEstimateDeployGas(web3Instance, from, abi, byte)