question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ethers: bytes argument generating the wrong type

See original GitHub issue

great project and works quite well with ethers v4

however, for a function declaration like function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes _data) typechain for ethers generates the following declaration:

    safeTransferFrom(
      _from: string,
      _to: string,
      _id: number | string,
      _amount: number | string,
      _data: (string)[]
    ): Promise<ContractTransaction>;

the _data: (string)[] argument is wrong, and should be: _data: Uint8Array

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ricmoocommented, Dec 2, 2018

I haven’t pushed it yet, because it does support tuples yet. Should I push it now and worry about tuples later?

1reaction
quezakcommented, Feb 20, 2019

Any update on this? BTW: the culprit here looks to be in parsing the evm typesbytes actually gets interpreted as bytes1[], hence in ethers output it’s mapped to string[]. Isn’t this interpretation wrong in the first place? IMHO bytes should be interpreted as a separate EvmType and mapped to Buffer | Uint8Array or something.

    case "bytes":
return new ArrayType(new BytesType(1));
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found