https://github.com/cryptape/ckb-rpc-mock-data
https://github.com/cryptape/ckb-rpc-mock-data
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cryptape/ckb-rpc-mock-data
- Owner: cryptape
- Created: 2023-07-20T03:57:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T06:33:52.000Z (almost 2 years ago)
- Last Synced: 2024-09-10T03:39:44.147Z (almost 2 years ago)
- Language: Python
- Homepage: https://ckb-rpc-mock-data.vercel.app
- Size: 349 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGE.LOG
Awesome Lists containing this project
README
### CKB RPC Mock Data
#### start
```shell
pip install -r requirements.txt
python api/index.py
```
### api
#### get test
click link http://localhost:5000/
#### test
- get
- get test message
- post
- mock ckb rpc ,will check request ,if request == request.json ,return response.json
#### JS Adapter Demo
- When adding new test cases, you only need to focus on the RPC you want to call.
```shell
it("[tx]",async ()=>{
let data = request("http://127.0.0.1:5000/test/estimate_cycles/[tx]")
let requestData = data['request']
let responseData = data['response']
let RPCClient = new RPC("http://127.0.0.1:5000/test/estimate_cycles/[tx]");
let tx = toTransaction(requestData["params"][0])
// @ts-ignore
let response = await RPCClient.estimateCycles(tx)
expect(response.cycles).toEqual(responseData["result"]["cycles"])
})
```