simolus3 / web3dart

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

Could not format because the source could not be parsed: #149

Closed raegartargarian closed 3 years ago

raegartargarian commented 3 years ago

when I try to generate code for interacting with this smart contract's abi and I run

flutter packages pub run build_runner watch

it gives this error:

web3dart:abi_generator on lib/voucher.abi.json (cached):

Could not format because the source could not be parsed:

line 17, column 55 of .: Expected an identifier.
   ╷
17 │ Future<Fingerprints> fingerprints(_i1.EthereumAddress ) async  { final function = self.function('fingerprints');
   │                                                       ^
   ╵
line 55, column 41 of .: Expected an identifier.
   ╷
55 │ Future<Vouchers> vouchers(_i2.Uint8List ) async  { final function = self.function('vouchers');
[
    {
        "inputs": [
            {
                "internalType": "uint256",
                "name": "price",
                "type": "uint256"
            }
        ],
        "stateMutability": "nonpayable",
        "type": "constructor"
    },
    {
        "anonymous": false,
        "inputs": [],
        "name": "ContractDeprecated",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "internalType": "address",
                "name": "customer",
                "type": "address"
            },
            {
                "indexed": false,
                "internalType": "string",
                "name": "reason",
                "type": "string"
            }
        ],
        "name": "FingerprintInvalidated",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "internalType": "address",
                "name": "previousOwner",
                "type": "address"
            },
            {
                "indexed": true,
                "internalType": "address",
                "name": "newOwner",
                "type": "address"
            }
        ],
        "name": "OwnershipTransferred",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "internalType": "address",
                "name": "customer",
                "type": "address"
            },
            {
                "indexed": false,
                "internalType": "bytes32",
                "name": "voucherID",
                "type": "bytes32"
            }
        ],
        "name": "VoucherIssued",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": false,
                "internalType": "uint256",
                "name": "previousPrice",
                "type": "uint256"
            },
            {
                "indexed": false,
                "internalType": "uint256",
                "name": "newPrice",
                "type": "uint256"
            }
        ],
        "name": "VoucherPriceChanged",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "internalType": "bytes32",
                "name": "voucherID",
                "type": "bytes32"
            },
            {
                "indexed": false,
                "internalType": "string",
                "name": "reason",
                "type": "string"
            }
        ],
        "name": "VoucherRejected",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "internalType": "bytes32",
                "name": "voucherID",
                "type": "bytes32"
            },
            {
                "components": [
                    {
                        "internalType": "bytes32",
                        "name": "firstName",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "lastName",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "country",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "dateOfBirth",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "sex",
                        "type": "bytes32"
                    }
                ],
                "indexed": false,
                "internalType": "struct IdenfyVerification.Fingerprint",
                "name": "fingerprint",
                "type": "tuple"
            }
        ],
        "name": "VoucherVerified",
        "type": "event"
    },
    {
        "inputs": [],
        "name": "buyVoucher",
        "outputs": [],
        "stateMutability": "payable",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "uint256",
                "name": "newPrice",
                "type": "uint256"
            }
        ],
        "name": "changeVoucherPrice",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [],
        "name": "deprecateContract",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "address",
                "name": "",
                "type": "address"
            }
        ],
        "name": "fingerprints",
        "outputs": [
            {
                "internalType": "bytes32",
                "name": "firstName",
                "type": "bytes32"
            },
            {
                "internalType": "bytes32",
                "name": "lastName",
                "type": "bytes32"
            },
            {
                "internalType": "bytes32",
                "name": "country",
                "type": "bytes32"
            },
            {
                "internalType": "bytes32",
                "name": "dateOfBirth",
                "type": "bytes32"
            },
            {
                "internalType": "bytes32",
                "name": "sex",
                "type": "bytes32"
            }
        ],
        "stateMutability": "view",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "address",
                "name": "customer",
                "type": "address"
            },
            {
                "internalType": "string",
                "name": "reason",
                "type": "string"
            }
        ],
        "name": "invalidateFingerprint",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [],
        "name": "isDeprecated",
        "outputs": [
            {
                "internalType": "bool",
                "name": "",
                "type": "bool"
            }
        ],
        "stateMutability": "view",
        "type": "function"
    },
    {
        "inputs": [],
        "name": "owner",
        "outputs": [
            {
                "internalType": "address",
                "name": "",
                "type": "address"
            }
        ],
        "stateMutability": "view",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "bytes32",
                "name": "voucherID",
                "type": "bytes32"
            },
            {
                "internalType": "string",
                "name": "reason",
                "type": "string"
            }
        ],
        "name": "rejectVoucher",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "address",
                "name": "newOwner",
                "type": "address"
            }
        ],
        "name": "transferOwnership",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "bytes32",
                "name": "voucherID",
                "type": "bytes32"
            },
            {
                "components": [
                    {
                        "internalType": "bytes32",
                        "name": "firstName",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "lastName",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "country",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "dateOfBirth",
                        "type": "bytes32"
                    },
                    {
                        "internalType": "bytes32",
                        "name": "sex",
                        "type": "bytes32"
                    }
                ],
                "internalType": "struct IdenfyVerification.Fingerprint",
                "name": "fingerprint",
                "type": "tuple"
            }
        ],
        "name": "verifyVoucher",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "inputs": [],
        "name": "voucherPrice",
        "outputs": [
            {
                "internalType": "uint256",
                "name": "",
                "type": "uint256"
            }
        ],
        "stateMutability": "view",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "bytes32",
                "name": "",
                "type": "bytes32"
            }
        ],
        "name": "vouchers",
        "outputs": [
            {
                "internalType": "address",
                "name": "customer",
                "type": "address"
            },
            {
                "internalType": "enum IdenfyVerification.VoucherState",
                "name": "state",
                "type": "uint8"
            }
        ],
        "stateMutability": "view",
        "type": "function"
    },
    {
        "inputs": [
            {
                "internalType": "address payable",
                "name": "to",
                "type": "address"
            }
        ],
        "name": "withdraw",
        "outputs": [],
        "stateMutability": "nonpayable",
        "type": "function"
    }
]
simolus3 commented 3 years ago

Were you able to resolve this? I think we should add default names for variables if they're empty.

raegartargarian commented 3 years ago

On Thu, May 13, 2021 at 12:30 AM Simon Binder @.***> wrote:

Were you able to resolve this? I think we should add default names for variables if they're empty.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/simolus3/web3dart/issues/149#issuecomment-840058596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJPNRCJYAKLIXLBZN73DFALTNLM5VANCNFSM44Y57MHQ .

Hi, yes it is better to fill them with something. I have solved my problem thanks. Also one other thing is that the value parameter is not used in the estimate-gas RPC method, please add it