mirror of
https://github.com/codex-storage/nim-json-rpc.git
synced 2025-02-24 00:48:12 +00:00
Initial commit
This commit is contained in:
parent
6b3d7916c7
commit
5a8fe44789
46
README
Normal file
46
README
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Nim-eth-rpc
|
||||||
|
|
||||||
|
Nim-eth-rpc is designed to provide remote procedure calls to the Nimbus Ethereum research project.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
* Nim 17.3 and up
|
||||||
|
|
||||||
|
`git clone https://github.com/status-im/nim-eth-rpc`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Server
|
||||||
|
|
||||||
|
```nim
|
||||||
|
import rpcserver, asyncdispatch
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
var srv = newRpcServer("")
|
||||||
|
asyncCheck srv.serve()
|
||||||
|
runForever()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Client
|
||||||
|
|
||||||
|
```nim
|
||||||
|
import rpcclient, asyncdispatch, json
|
||||||
|
|
||||||
|
proc main {.async.} =
|
||||||
|
var client = newRpcClient()
|
||||||
|
await client.connect("localhost", Port(8545))
|
||||||
|
let response = waitFor client.web3_clientVersion(newJNull())
|
||||||
|
echo response.result.pretty
|
||||||
|
|
||||||
|
waitFor main()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
||||||
|
|
||||||
|
Please make sure to update tests as appropriate.
|
||||||
|
|
||||||
|
## License
|
||||||
|
[MIT](https://choosealicense.com/licenses/mit/)
|
Loading…
x
Reference in New Issue
Block a user