web3dart icon indicating copy to clipboard operation
web3dart copied to clipboard

How to init the contract object like web3js

Open edgeowner opened this issue 7 years ago • 1 comments

eg.

  • web3.eth.Contract(mycontract.abi,contractAddress)

edgeowner avatar Oct 17 '18 09:10 edgeowner

Hey, the contract API of this library still is a bit rough and not very similar to web3js. You might want to take a look at this example which uses the CryptoKittens smart contract as an example. The idea is that you first create the ABI from the json definition using ContractABI.parseFromJSON and then construct a DeployedContact with that ABI, the target address, your credentials and the client instance. You can then use that class to send transactions or call methods interacting with the smart contract.

simolus3 avatar Oct 17 '18 14:10 simolus3