KyberNetwork / wallet-cache

MIT License
7 stars 167 forks source link

Cached server for KYBER wallet

Build

docker build . -t cached

Run

docker run -p 3001:3001 cached


## One command to build and run with docker-compose

docker-compose -f docker-compose-staging.yml up --build

APIs (these APIs will be expired after Jan 20 2019)

New APIs

Cache version

(GET) Return latest block number of network

Response:

{
    "data": "4790885",
    "success": true
}

2. Get Rate USD

/rateUSD

(GET) Return USD price of token base on it's expectedRate

Response:

{
    "data": [
        {
            "symbol": "ETH",
            "price_usd": "150.110255"
        }
    ],
    "success": true
}

3. Get rate

/rate

(GET) Return rate of token with eth (expectedRate and minRate)

Response:

{
    "data": [
        {
            "source": "POWR",
            "dest": "ETH",
            "rate": "580350000000000",
            "minRate": "562939500000000"
        },
        {
            "source": "REQ",
            "dest": "ETH",
            "rate": "251549999999999",
            "minRate": "244003499999999"
        }
    ],
    "success": true
    }

4. Get kyberEnabled

/kyberEnabled

(GET) Return kyberEnabled from contract

Response:

{
    "data": true,
    "success": true
}

5. Get maxGasPrice

/maxGasPrice

(GET) Return max GasPrice from contract

Response:

{
    "data": "50000000000",
    "success": true
}

6. Get gasPrice

/gasPrice

(GET) Return gasPrice get from https://ethgasstation.info/

Response:

{
    "data": {
        "fast": "10",
        "standard": "5.55",
        "low": "1.1",
        "default": "5.55"
    },
    "success": true
}

9. Get gasPrice

/rateETH

(GET) Return USD price of ETH from Coingecko

Response:

{
    "data": "150.480634",
    "success": true
}

10. Get cacheVersion

/cacheVersion

(GET) Return current cache version

Response:

{
    "data": "14:40:42 09-01-2019",
    "success": true
}

11. Get UserInfo

/users?address=0x2262d4f6312805851e3b27c40db2c7282e6e4a42

(GET) Return User stats info

Response:

{
    "cap": 40304044000000000000,
    "kyced": true,
    "rich": false
}

12. Get source amount from dest amount

/sourceAmount?source=TUSD&dest=ETH&destAmount=500

(GET) Return Source Amount

Response:

{
  "success": true,
  "value": "129808.7692"
}

13. Get reference price

/refprice?base=KNC&quote=ETH

(GET) Return reference price Price is the average price from multiple source data (Chainlink, Bandchain, Kyber). If Chainlink doesn't have price for requested pair, then final price will be average of Bandchain and Kyber prices. If both Chainlink and Bandchain don't have price for requested pair, then final price will be Kyber price. Response:

{
  "success": true,
  "value": "0.0032"
}