simolus3 / web3dart

Ethereum library, written in Dart.
MIT License
442 stars 273 forks source link

Could not format generated source. This is likely a bug in web3dart #191

Closed Hanggi closed 3 years ago

Hanggi commented 3 years ago

Run pub run build_runner build got error following:

...
[SEVERE] web3dart:abi_generator on lib/contracts/contract.abi.json (cached):
Could not format generated source. This is likely a bug in web3dart
...
simolus3 commented 3 years ago

Could you please post the definition of lib/contracts/contract.abi.json?

Hanggi commented 3 years ago

I even tried the abi.json file in example, but got the save error. https://github.com/simolus3/web3dart/blob/master/example/token.abi.json

I extracted the abi json file from truffle build, which copied the content of abi property.

And I can also generate .go file successfully by following abigen command:

$ abigen --abi build/contract.abi --pkg contract --out contract.go

The contract.abi file is totally same as the contract.abi.json file. So I think there is no problem with the abi.json file.

(Are there any thing I can have a try to solve the error?) Thank you

nqhoa84 commented 3 years ago

I got the same issue, abi is copied from here: https://bscscan.com/address/0xb92ab7c1edcb273aba24b0656ceb3681654805d2#code

Hanggi commented 3 years ago

It's solved... contract.abi.json was not real command I executed.

The real abi.json file name was 'order-contract' which contains '-' , it results the generated class name is class order-contract.

Maybe we need add some hints to README.md file? lol