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

ether6 doesn't compabitible vyper generated ABI #3932

Closed
zfy0701 opened this issue Mar 27, 2023 · 5 comments
Closed

ether6 doesn't compabitible vyper generated ABI #3932

zfy0701 opened this issue Mar 27, 2023 · 5 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

@zfy0701
Copy link

zfy0701 commented Mar 27, 2023

Ethers Version

6.2.2

Search Terms

abi

Describe the Problem

Use ABI from https://etherscan.io/address/0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714

simplify a bit and just use code as follow

export const abi = [  {
  "name": "balances",
  "outputs": [
    {
      "type": "uint256",
      "name": ""
    }
  ],
  "inputs": [
    {
      "type": "int128",
      "name": "arg0"
    }
  ],
  "constant": true,
  "payable": false,
  "type": "function"
},]

const contract = new Contract("0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714", abi as any, provider)
const func = contract.getFunction("balances(int128)")
const res = await func(0)

it will report:

Error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.2.2)
    at makeError (file:///Users/fuyaoz/src/sample-ethers6/node_modules/ethers/src.ts/utils/errors.ts:663:21)
    at assert (file:///Users/fuyaoz/src/sample-ethers6/node_modules/ethers/src.ts/utils/errors.ts:680:25)
    at send (file:///Users/fuyaoz/src/sample-ethers6/node_modules/ethers/src.ts/contract/contract.ts:353:9)
    at balances (file:///Users/fuyaoz/src/sample-ethers6/node_modules/ethers/src.ts/contract/contract.ts:395:22)
    at file:///Users/fuyaoz/src/sample-ethers6/src/index.ts:183:19
    at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  code: 'UNSUPPORTED_OPERATION',
  operation: 'sendTransaction'
}

the fragment is like this:
image

If I manually add "stateMutability": "view", to the ABI, then
image

notice the constant field of the fragment become true

Code Snippet

No response

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

@zfy0701 zfy0701 added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Mar 27, 2023
@ricmoo
Copy link
Member

ricmoo commented Mar 27, 2023

Interesting; it’s using the old ABI format with the constant keyword instead of stateMutability. Is this the most recent version of Vyper?

I can add support for fall back onto this legacy key and validate it if both exist.

@zfy0701
Copy link
Author

zfy0701 commented Mar 29, 2023

it's using a very old version: 0.1.0b17

@ricmoo
Copy link
Member

ricmoo commented Mar 30, 2023

I'll add this as an enhancement then, since it is still useful, but might be a few days before published.

Let me know if there is any urgency. Otherwise, if you add "stateMutability": "view" to the JSON, it will also prevent this error. :)

@ricmoo ricmoo added enhancement New feature or improvement. on-deck This Enhancement or Bug is currently being worked on. and removed investigate Under investigation and may be a bug. labels Mar 30, 2023
@zfy0701
Copy link
Author

zfy0701 commented Mar 30, 2023

not urgent and yes I've already used that as a workaround :)

@ricmoo
Copy link
Member

ricmoo commented Apr 7, 2023

This has been added in v6.3.0. Let me know if there are any more problems.

Thanks! :)

@ricmoo ricmoo closed this as completed Apr 7, 2023
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jun 2, 2023
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 14, 2024
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 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