Closed 0xp3gasus closed 2 years ago
Response payloads do not response methods or currencies. HTTP, RPC and WS methods registration has been improve.
Fixes #162
None
Test A. Calling ETH Method over RPC
curl --location --request POST 'http://localhost:80/eth/regtest/rpc' \ --header 'Content-Type: application/json' \ --data-raw '{ "id": 1609070896412, "method": "getHeight", "params": {}, "jsonrpc": "2.0" }'
{ "id": 1609070896412, "jsonrpc": "2.0", "result": { "latestBlockIndex": "14617285", "latestBlockHash": "0x23e3930172383f71dd1c2e3a288e724586cdea3e5bc33dde152b356f70dbf3d6" } }
Test B. Calling ETH Method over HTTP
curl --location --request GET 'http://localhost:80/eth/regtest/getHeight'
{ "latestBlockIndex": "14617291", "latestBlockHash": "0x7a7c67926773e4eafb45a9f810f4e83eb2d68f86305d47f3f335bc90139f4c21" }
Test C. Calling ETH WS method
{ "id": 1650394532, "jsonrpc": "2.0", "method": "subscribeToNewBlocks", "params": {} }
{ "id": 1650394532, "jsonrpc": "2.0", "result": { "subscribed": true } }
Test E. Calling ETH unknown method
curl --location --request POST 'http://localhost:80/eth/regtest/getAddressBalancee' \ --header 'Content-Type: application/json' \ --data-raw '{ "address": "0x625ACaEdeF812d2842eFd2Fb0294682A868455bd" }'
{ "message": "Not found", "code": 404 }
Test D. Calling ETH method with different HTTP method
curl --location --request GET 'http://localhost:80/eth/regtest/getAddressBalance' \ --header 'Content-Type: application/json' \ --data-raw '{ "address": "0x625ACaEdeF812d2842eFd2Fb0294682A868455bd" }'
{ "message": "Method not allowed", "code": 405 }
Test F. Calling BTC Method over RPC
curl --location --request POST 'http://localhost:80/btc/regtest/rpc' \ --header 'Content-Type: application/json' \ --data-raw '{ "id": 1609070896412, "method": "getHeight", "params": {}, "jsonrpc": "2.0" }'
{ "id": 1609070896412, "jsonrpc": "2.0", "result": { "latestBlockIndex": "0", "latestBlockHash": "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206" } }
Test G. Calling BTC Method over HTTP
curl --location --request POST 'http://localhost:80/btc/regtest/getHeight'
{ "latestBlockIndex": "0", "latestBlockHash": "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206" }
Test H. Calling BTC WS method
{ "id": 1650397385, "jsonrpc": "2.0", "method": "subscribeToNewBlocks", "params": {} }
{ "id": 1650397385, "jsonrpc": "2.0", "result": { "subscribed": true } }
Test I. Calling BTC unknown method
curl --location --request POST 'http://localhost:80/btc/regtest/getHeightttt'
Test J. Calling BTC method with different HTTP method
Test Configuration:
cat /etc/os-release
uname -sr
uname -m
Docs PR related # Other PR related #
Description
Response payloads do not response methods or currencies. HTTP, RPC and WS methods registration has been improve.
Fixes #162
Dependencies (if any)
None
Type of change
How Has This Been Tested?
Test A. Calling ETH Method over RPC
Test B. Calling ETH Method over HTTP
Test C. Calling ETH WS method
Test E. Calling ETH unknown method
Test D. Calling ETH method with different HTTP method
Test F. Calling BTC Method over RPC
Test G. Calling BTC Method over HTTP
Test H. Calling BTC WS method
Test I. Calling BTC unknown method
Test J. Calling BTC method with different HTTP method
Test Configuration:
cat /etc/os-release
): macOS 12.2.1uname -sr
): Darwin 21.3.0uname -m
): x86_64Related PR or Docs PR
Docs PR related # Other PR related #
Good practices to consider