koinos / koinos-rest

The rest microservice provides a REST API for interacting with the Koinos node.
Other
0 stars 1 forks source link

Add path overrides for the dynamic path above for KOIN, VHP, and the Claim contract using the proto-js generated types to interact with those contracts. (Other system contracts can be added later) #9

Closed mvandeberg closed 2 months ago

mvandeberg commented 2 months ago

The REST API already supports the behavior we require.

❯ curl -X 'GET' \
  'http://localhost:3000/v1/contract/claim/get_info' \
  -H 'accept: application/json' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   131    0   131    0     0   6667      0 --:--:-- --:--:-- --:--:--  6894
{
  "value": {
    "total_eth_accounts": 3754,
    "eth_accounts_claimed": 1854,
    "total_koin": "9973874402587865",
    "koin_claimed": "5559687063468140"
  }
}
❯ curl -X 'GET' \
  'http://localhost:3000/v1/contract/koin/total_supply' \
  -H 'accept: application/json' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    28    0    28    0     0   1132      0 --:--:-- --:--:-- --:--:--  1166
{
  "value": "3951501719031254"
}
❯ curl -X 'GET' \
  'http://localhost:3000/v1/contract/vhp/total_supply' \
  -H 'accept: application/json' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    28    0    28    0     0   1340      0 --:--:-- --:--:-- --:--:--  1400
{
  "value": "1736668186011901"
}
❯ curl -X 'GET' \
  'http://localhost:3000/v1/token/koin/total_supply' \  
  -H 'accept: application/json' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    29    0    29    0     0     60      0 --:--:-- --:--:-- --:--:--    60
{
  "value": "39515045.37153799"
}
❯ curl -X 'GET' \
  'http://localhost:3000/v1/token/vhp/total_supply' \
  -H 'accept: application/json' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    29    0    29    0     0   1057      0 --:--:-- --:--:-- --:--:--  1074
{
  "value": "17366654.75040361"
}