Closed marekyggdrasil closed 3 years ago
* grin-wallet --version: grin-wallet 5.0.0-beta.4
* grin --version: grin node 5.0.0-rc.1
* Linux debian 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
* wallet address: grin1cwutd4sr0t0ac62764r9vz6wkgpmnmpheynh5tw56zvczvh8apdszxp25w
* Python version 3.7.3
* Python script needed: https://github.com/grinfans/grin.py/blob/main/wallet_v3.py
Run a wallet in Foreign API listener mode in a separate window.
~$ grin-wallet listen
Password:
20201230 09:43:54.861 WARN grin_wallet_controller::controller - Starting TOR Hidden Service for API listener at address yo4lnvqdplp5y2k62vdfmc2owib3t3bxzetxulou2cmycmxh5bnsplqd, binding to 127.0.0.1:3415
20201230 09:44:00.922 WARN grin_wallet_controller::controller - Starting HTTP Foreign listener API server at 127.0.0.1:3415.
20201230 09:44:00.923 WARN grin_wallet_controller::controller - HTTP Foreign listener started.
20201230 09:44:00.923 WARN grin_wallet_controller::controller - Slatepack Address is: grin1cwutd4sr0t0ac62764r9vz6wkgpmnmpheynh5tw56zvczvh8apdszxp25w
This starts an HTTP Foreign API server. Alternatively, Tor could be used.
I used the example of issue #49 to perform the request:
$ curl -v -d '{"jsonrpc": "2.0", "method": "check_version", "id": 1, "params":[]}' http://127.0.0.1:3415/v2/foreign
This the response I received:
* Expire in 0 ms for 6 (transfer 0x557816c04f90)
* Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x557816c04f90)
* Connected to 127.0.0.1 (127.0.0.1) port 3415 (#0)
> POST /v2/foreign HTTP/1.1
> Host: 127.0.0.1:3415
> User-Agent: curl/7.64.0
> Accept: */*
> Content-Length: 67
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 67 out of 67 bytes
< HTTP/1.1 200 OK
< access-control-allow-origin: *
< access-control-allow-headers: Content-Type, Authorization
< content-type: application/json
< content-length: 159
< date: Wed, 30 Dec 2020 08:45:24 GMT
<
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"Ok": {
"foreign_api_version": 2,
"supported_slate_versions": [
"V4"
]
}
}
* Connection #0 to host 127.0.0.1 left intact
This corresponds to the example here.
The test did run as expected.
Good work @ndcroos !
Description Goal of this issue is to test the check_version API method
Prerequisites
Test procedure
Expected result:
Result should correspond to the example
Include the output of command
and your environment