starknet-devnet-rs icon indicating copy to clipboard operation
starknet-devnet-rs copied to clipboard

API unification - more widespread JSON-RPC API

Open FabijanC opened this issue 1 year ago • 5 comments

Currently Devnet has endpoints such as /mint, /dump, /load, etc. which aren't JSON-RPC based. Similar to how Devnet supports starknet_<METHOD_NAME> JSON-RPC methods, there could be devnet_<METHOD_NAME> methods such as devnet_mint> which would follow JSON-RPC semantics.

For the transition phase, let's keep both REST and JSON-RPC API. E.g. minting should, for now, be possible via both

POST /mint
{ "amount": ..., "address": ... }

and

POST /rpc
{ "method": "devnet_mint", "amount": ..., "address": ... }

And in the future we can just keep the RPC support.

FabijanC avatar May 07 '24 08:05 FabijanC

@FabijanC kindly assign this issue to me, i will like to work on it.

mubarak23 avatar May 07 '24 10:05 mubarak23

@mubarak23 Thanks for commenting, please wait until it is decided whose responsibility this should be.

FabijanC avatar May 08 '24 14:05 FabijanC

@mubarak23 You've been assigned. Please note that the issue description has been updated.

FabijanC avatar May 09 '24 07:05 FabijanC

@FabijanC thank you.

i will take a bit of time to study the code and start working on the issue.

don't mind if you can point me to where is the best to start.

MubarakCinderbuild avatar May 09 '24 07:05 MubarakCinderbuild

You can run Devnet in debug mode, send it a simple RPC request, and see which parts of the code it goes through. You could then see how to expand JsonRpcHandler to support all the Devnet-specific requests. Ideally, you would not use the StarknetRequest enumeration for these requests. Ideally, the RPC and REST endpoints would point to the same internal logic (e.g. only one minting logic implementation, but different endpoints using it).

FabijanC avatar May 09 '24 07:05 FabijanC