Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow tuple inputs as parameters #40

Open
lastraum opened this issue Feb 28, 2021 · 2 comments
Open

allow tuple inputs as parameters #40

lastraum opened this issue Feb 28, 2021 · 2 comments

Comments

@lastraum
Copy link

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?

@menduz
Copy link
Member

menduz commented Mar 1, 2021

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

Thanks!

@lastraum
Copy link
Author

lastraum commented Mar 1, 2021

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...' })`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants