Skip to content

Add EVM-compatible JSON RPC wrapper to Paima #407

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

Merged
merged 9 commits into from
Aug 7, 2024
Merged

Conversation

SebastienGllmt
Copy link
Contributor

@SebastienGllmt SebastienGllmt commented Aug 5, 2024

With this change, you can now query the current block number of a Paima rollup using EVM JSON RPC queries

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:3333/rpc/evm

I've only implemented a few of the endpoints (some of them can't be implemented), but hopefully we can implement the few required to improve interoperability of Paima-based apps with existing tools

In the same PR, I also introduced a new typed getPaimaNodeRestClient so you can call @paima/rest endpoints with automatically generated type definitions instead of having to manually copy the types in the middleware everytime

TODO

  • verify params actually match the types
  • InternalRpcError swallows the internal error which makes it not show up anywhere. It seems internal errors need a specific shape to work (see RpcError)
  • Fix the generated error types for @paima/rest

Blockers

See #411

@SebastienGllmt SebastienGllmt merged commit d841e26 into master Aug 7, 2024
@SebastienGllmt SebastienGllmt deleted the json-rpc branch August 7, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant