eth-connect icon indicating copy to clipboard operation
eth-connect copied to clipboard

allow tuple inputs as parameters

Open lastraum opened this issue 4 years ago • 2 comments

The current version of web3 allows for tuple input parameters, but this eth-connect lib does not. Can we update eth-connect to mirror web3?

lastraum avatar Feb 28 '21 22:02 lastraum

Hi there, could you provide an example contract and the EIP so we can implement the spec?

Thanks!

menduz avatar Mar 01 '21 11:03 menduz

Sure thing.

Here's a web3 example interacting with a contract on mainnet passing in tuples as parameters.

`var newLeaseDetail = { rentAmount: this.state.web3.utils.toWei("" + this.state.amount, 'ether'), leaseLength: this.state.length, rentToken: this.state.token, dateSigned: 0, isOpen: true, isLeased: false, autoPay: false, monthsPaid: 0, gracePeriod: this.state.grace, autoRegenerate: this.state.auto, deposit: this.state.web3.utils.toWei("" +this.state.deposit, 'ether'), }

dclContract.methods.createLease(newLease, newLeaseDetail, isUpdate).send({from: this.state.account})`

Here's a stack overflow with the same question and simple example https://stackoverflow.com/questions/52620848/how-to-encode-tuple-as-input-parameter-to-function-using-web3j

`contract Test { struct Foo { uint a; string b; address c; }

function bar (Foo memory foo) public {
    c = foo.c;
}

} contract.methods.bar([123, "123", "0xABC...."]).send({ from: '0x...' })`

lastraum avatar Mar 01 '21 16:03 lastraum