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

ethers Interface throws EE Error: expected ID; error #4548

Closed
melancholu opened this issue Jan 17, 2024 · 2 comments
Closed

ethers Interface throws EE Error: expected ID; error #4548

melancholu opened this issue Jan 17, 2024 · 2 comments
Assignees
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6

Comments

@melancholu
Copy link

melancholu commented Jan 17, 2024

Ethers Version

6.x.x

Search Terms

interface, EE Error: expected ID,

Describe the Problem

ethers Interface throws error. I've tried all v6.x.x and all the same but it worked with v5.7.0. so I guess something is changed between them. ofc I used ethers.utils.Interface with v5.7.0.

Code Snippet

const iface = new ethers.Interface([
    'function receive(bytes)',
])
const functionFragment = iface.getFunction('receive')

Contract ABI

No response

Errors

EE Error: expected ID; got {"depth":0,"linkBack":-1,"linkNext":-1,"match":-1,"type":"KEYWORD","text":"receive","offset":9,"value":-1}
    at TokenString.popType (file:https:///Users/lemonada/Desktop/lemon/Node/test/node_modules/ethers/lib.esm/abi/fragments.js:69:19)
    at consumeName (file:https:///Users/lemonada/Desktop/lemon/Node/test/node_modules/ethers/lib.esm/abi/fragments.js:241:19)
    at FunctionFragment.from (file:https:///Users/lemonada/Desktop/lemon/Node/test/node_modules/ethers/lib.esm/abi/fragments.js:1141:26)
    at Fragment.from (file:https:///Users/lemonada/Desktop/lemon/Node/test/node_modules/ethers/lib.esm/abi/fragments.js:730:58)
    at Fragment.from (file:https:///Users/lemonada/Desktop/lemon/Node/test/node_modules/ethers/lib.esm/abi/fragments.js:718:29)
    at new Interface (file:https:///Users/lemonada/Desktop/lemon/Node/test/node_modules/ethers/lib.esm/abi/interface.js:149:37)
    at file:https:///Users/lemonada/Desktop/lemon/Node/test/ethers-coder.js:11:15
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Environment

No response

Environment (Other)

No response

@melancholu melancholu added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Jan 17, 2024
@ricmoo
Copy link
Member

ricmoo commented Jan 17, 2024

The name receive is reserved. Can you try just "receive(bytes)" (drop the word “function”)?

@ricmoo ricmoo removed the investigate Under investigation and may be a bug. label Jan 18, 2024
@ricmoo ricmoo added enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. labels Feb 14, 2024
@ricmoo
Copy link
Member

ricmoo commented Feb 14, 2024

The error were improved in v6.11.0. The issue was using a function with a reserved name, and can be resolved by dropping the function specifier (as it is a receive fallback). Let me know if you still have any issues.

Thanks! :)

@ricmoo ricmoo closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants