Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kybernetwork/wallet-cache
https://github.com/kybernetwork/wallet-cache
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kybernetwork/wallet-cache
- Owner: KyberNetwork
- License: mit
- Created: 2018-01-26T12:06:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T01:18:05.000Z (almost 2 years ago)
- Last Synced: 2024-06-19T02:05:57.341Z (7 months ago)
- Language: Go
- Size: 5.04 MB
- Stars: 7
- Watchers: 5
- Forks: 167
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# 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)
- /getLatestBlock: return latest block number of network
- /getRateUSD: return USD price of token base on it's expectedRate
- /getRate: return rate of token with eth (expectedRate and minRate)
- /getKyberEnabled: get kyberEnabled from contract
- /getMaxGasPrice: get max GasPrice from contract
- /getGasPrice: return gasPrice get from https://ethgasstation.info/
- /getRateETH: return USD price of ETH from Coingecko## New APIs
- /latestBlock: return latest block number of network
- /rateUSD: return USD price of token base on it's expectedRate
- /rate: return rate of token with eth (expectedRate and minRate)
- /kyberEnabled: get kyberEnabled from contract
- /maxGasPrice: get max GasPrice from contract
- /gasPrice: return gasPrice get from https://ethgasstation.info/
- /rateETH: return USD price of ETH from Coingecko
- /users: ```params: address=0x2262d4f6312805851e3b27c40db2c7282e6e4a42``` return user stats info
- /sourceAmount: ```params: ?source=TUSD&dest=ETH&destAmount=500``` calculate and return relative src amount when having dest amount
## Cache version
- /cacheVersion: return current cache version
### 1. Get Latest Block
`/latestBlock`(GET) Return latest block number of network
Response:
```javascript
{
"data": "4790885",
"success": true
}
```### 2. Get Rate USD
`/rateUSD`(GET) Return USD price of token base on it's expectedRate
Response:
```javascript
{
"data": [
{
"symbol": "ETH",
"price_usd": "150.110255"
}
],
"success": true
}
```### 3. Get rate
`/rate`(GET) Return rate of token with eth (expectedRate and minRate)
Response:
```javascript
{
"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:
```javascript
{
"data": true,
"success": true
}
```### 5. Get maxGasPrice
`/maxGasPrice`(GET) Return max GasPrice from contract
Response:
```javascript
{
"data": "50000000000",
"success": true
}
```### 6. Get gasPrice
`/gasPrice`(GET) Return gasPrice get from https://ethgasstation.info/
Response:
```javascript
{
"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:
```javascript
{
"data": "150.480634",
"success": true
}
```### 10. Get cacheVersion
`/cacheVersion`(GET) Return current cache version
Response:
```javascript
{
"data": "14:40:42 09-01-2019",
"success": true
}
```### 11. Get UserInfo
`/users?address=0x2262d4f6312805851e3b27c40db2c7282e6e4a42`(GET) Return User stats info
Response:
```javascript
{
"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:
```javascript
{
"success": true,
"value": "129808.7692"
}
```### 13. Get reference price
`/refprice?base=KNC"e=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:
```javascript
{
"success": true,
"value": "0.0032"
}
```