ethjs-abi icon indicating copy to clipboard operation
ethjs-abi copied to clipboard

No support for tuple type

Open NoahMarconi opened this issue 7 years ago • 9 comments

Issue Type

  • [x] Bug (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#bug-reports)

Description

tuple type is not checked for: https://github.com/ethjs/ethjs-abi/blob/master/src/utils/index.js#L298

Steps to reproduce

https://ethfiddle.com/VxkWJs5sQz

Setter set does not accept tuple type.

NoahMarconi avatar Jun 17 '18 01:06 NoahMarconi

We aren't accepting those, we will be moving over to ethers.js encoding... eventually... or when someone makes a pr!

Ethers accepts tuples

Sent from my iPhone

On Jun 16, 2018, at 9:36 PM, NoahMarconi [email protected] wrote:

Issue Type

Bug (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#bug-reports) Description

tuple type is not checked for: https://github.com/ethjs/ethjs-abi/blob/master/src/utils/index.js#L298

Steps to reproduce

https://ethfiddle.com/VxkWJs5sQz

Setter set does not accept tuple type.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

SilentCicero avatar Jun 17 '18 02:06 SilentCicero

What's involved in moving the encoding to ethers.js? Maybe I can help; I was using ethers.js to encode my data.

EthFiddle is using your lib which is how I ran into the problem.

NoahMarconi avatar Jun 17 '18 03:06 NoahMarconi

I see! It's quite simple, use my method interface but run everything through ethers encode and decodeParams methods

Sent from my iPhone

On Jun 16, 2018, at 11:22 PM, NoahMarconi [email protected] wrote:

What's involved in moving the coding encoding to ethers.js? Maybe I can help; I was using ethers.js to encode my data.

EthFiddle is using your lib which is how I ran into the problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SilentCicero avatar Jun 17 '18 04:06 SilentCicero

So I'm clear, the fix is to update the main index.js methods and defer to ethers.js: https://github.com/ethjs/ethjs-abi/blob/master/src/index.js

Specifically:

  • etherjs-abi.encodeParams -> ethers.AbiCoder.encode
  • etherjs-abi.decodeParams -> ethers.AbiCoder.decode

and that's it?

NoahMarconi avatar Jun 17 '18 17:06 NoahMarconi

Well, the results of ethers is slightly different from the current ethjs abi, so there is some conversion of the output data to an object with both array like and contract method output property names (if available).

Sent from my iPhone

On Jun 17, 2018, at 1:26 PM, NoahMarconi [email protected] wrote:

So I'm clear, the fix is to update the main index.js methods and defer to ethers.js: https://github.com/ethjs/ethjs-abi/blob/master/src/index.js

Specifically:

etherjs-abi.encodeParams -> ethers.AbiCoder.encode etherjs-abi.decodeParams -> ethers.AbiCoder.decode and that's it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SilentCicero avatar Jun 17 '18 18:06 SilentCicero

Hello,

any progress on this issue? Tuples are supported by the EVM for some months already and more and more solidity code take advantage of it.

I'd prefer not to drop ethjs library in my project as it's very lightweight and has a clean API I love to work with :)

Thanks for your feedback

sulliwane avatar Oct 30 '18 10:10 sulliwane

This needs to be swapped out for ethers.js abo module -- it's been on the agenda forever, it's been hard for me to maintain this and keep it up to date -- if you want, I can explain how to patch it it's pretty straight forward!

Richard with Ethers.js Abi keeps his all up to date -- I'll see if I can hack something today

Sent from my iPhone

On Oct 30, 2018, at 11:12 AM, Victor [email protected] wrote:

Hello,

any progress on this issue? Tuples are supported by the EVM for some months already and more and more solidity code take advantage of it.

I'd prefer not to drop ethjs library in my project as it's very lightweight and has a clean API I love to work with :)

Thanks for your feedback

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SilentCicero avatar Oct 30 '18 10:10 SilentCicero

Thanks @SilentCicero for your quick response. Indeed, I'd be interested to have an example for a quick patch ! Many thanks in advance :)

sulliwane avatar Oct 30 '18 16:10 sulliwane

Is there a solution for this here? I'm running into the same issue

KonScanner avatar Jan 10 '23 11:01 KonScanner