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

ReadContract to Coinbase Factory AA contract return unparsed response #2743

Closed
1 task done
asghaier76 opened this issue Sep 19, 2024 · 2 comments
Closed
1 task done
Labels
needs reproduction Misc: Needs Reproduction

Comments

@asghaier76
Copy link

asghaier76 commented Sep 19, 2024

Check existing issues

Viem Version

2.21.5

Current Behavior

When calling getAddress in coinbase AA Factory contract getting this error

URL: https://api.developer.coinbase.com/rpc/v1/base-sepolia/
Request body:
{
"method": "eth_call",
"params": [
{
"data": "0x250b1b4100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000AB5ACC57FB1B38D74A5EcB6a33da8CFDc2ce207d",
"to": "0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a"
},
"latest"
]
}

Raw Call Arguments:
to: 0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a
data: 0x250b1b4100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000AB5ACC57FB1B38D74A5EcB6a33da8CFDc2ce207d

Contract Call:
address: 0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a
function: getAddress(bytes[] owners, uint256 nonce)
args: (["0x000000000000000000000000AB5ACC57FB1B38D74A5EcB6a33da8CFDc2ce207d"], 0)

Docs: https://viem.sh/docs/contract/readContract
Details: Unexpected token p in JSON at position 4
Version: 2.21.5
at getContractError (/var/task/src/functions/rewards.js:81057:10)
at readContract (/var/task/src/functions/rewards.js:82305:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.getAddress (/var/task/src/functions/rewards.js:86727:14)
... 3 lines matching cause stack trace ...
at async Runtime.sendRewardPointsAction [as handler] (/var/task/src/functions/rewards.js:89574:17) {
cause: CallExecutionError: HTTP request failed.

Not sure if the issue is due to missing the id field in the jsonrpc call,

If I try locally
curl -s https://api.developer.coinbase.com/rpc/v1/base-sepolia/
-H "Content-Type: application/json"
-d '{"method":"eth_call","params":[{"data":"0x250b1b4100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000AB5ACC57FB1B38D74A5EcB6a33da8CFDc2ce207d","to":"0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a"},"latest"]}'

I get this response, with id as null which is probably why parsing is failing
{"id":null,"jsonrpc":"2.0","result":"0x0000000000000000000000008ebfb11cbc1c0e3a14b998698ffef075732923c0"}%

but if I include the jsonrps version and id then I get the following response

curl -s https://api.developer.coinbase.com/rpc/v1/base-sepolia/
-H "Content-Type: application/json"
-d '{"jsonrpc": "2.0", "id": 1, "method":"eth_call","params":[{"data":"0x250b1b4100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000754e49da4978bd9FF2e9Bfddd9399898FbB3dEc3","to":"0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a"},"latest"]}

{"id":1,"jsonrpc":"2.0","result":"0x0000000000000000000000001fcef92e1fe743d6e99cb38d757482d74ccb196d"}

Expected Behavior

The call should include the jsonrps version and id

check https://www.jsonrpc.org/specification#id2

Steps To Reproduce

No response

Link to Minimal Reproducible Example

No response

Anything else?

No response

@tmm tmm added the needs reproduction Misc: Needs Reproduction label Sep 19, 2024
Copy link
Contributor

Hello @asghaier76.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2024
Copy link
Contributor

github-actions bot commented Oct 5, 2024

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction Misc: Needs Reproduction
Projects
None yet
Development

No branches or pull requests

2 participants