mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
[R4R] Prepare develop for merge (#372)
* feat: add swagger * add version info for mainnet * feat: reorganize to prepare for develop merge * feat: update readme
This commit is contained in:
parent
32f6b60c6b
commit
97dc4f6432
12
README.md
12
README.md
@ -25,18 +25,20 @@
|
|||||||
|
|
||||||
Reference implementation of Kava, a blockchain for cross-chain DeFi. Built using the [comsos-sdk](https://github.com/cosmos/cosmos-sdk).
|
Reference implementation of Kava, a blockchain for cross-chain DeFi. Built using the [comsos-sdk](https://github.com/cosmos/cosmos-sdk).
|
||||||
|
|
||||||
|
## Mainnet
|
||||||
|
|
||||||
## Quick Start
|
Note, the current recommended version of the software for mainnet is v0.3.2. The master branch of this repository contains considerable development work since the last mainnet release and is __not__ runnable on mainnet.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
git checkout v0.3.2
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Mainnet
|
## Testnet
|
||||||
|
|
||||||
Note, the current reccomended version of the software for mainnet is v0.3.1.
|
The recommended version of the software for kava-testnet-4000 is v0.4.1. For further information on joining the testnet, head over to the [testnet repo](https://github.com/Kava-Labs/kava-testnets).
|
||||||
|
|
||||||
To join the latest testnet, head over to the [testnet repo](https://github.com/Kava-Labs/kava-testnets).
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -1,61 +1,4 @@
|
|||||||
|
|
||||||
# Contrib
|
# Contrib
|
||||||
|
|
||||||
## Rest server requests
|
Resources and examples for running and interacting with the kava blockchain.
|
||||||
|
|
||||||
### Setup
|
|
||||||
|
|
||||||
Before making a request, query account information for the signing account. Note the 'accountnumber' and 'sequence' fields, we'll need them later in order to send our request:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kvcli q auth account $(kvcli keys show accB -a)
|
|
||||||
```
|
|
||||||
|
|
||||||
If testing locally, start the Kava rest server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kvcli rest-server
|
|
||||||
```
|
|
||||||
|
|
||||||
Now we'll create an unsigned request, sign it, and broadcast it to the Kava blockchain via the rest server. Note that if you're using the mainnet or testnet, the host IP address will need to be updated to point at an active rest server instead of http://127.0.0.1.
|
|
||||||
|
|
||||||
### Create CDP example request
|
|
||||||
|
|
||||||
Format the base request in create-cdp.json. You'll need to update the 'from', 'chain-id', 'account_number', 'sequence', and 'gas' as appropriate. Then, populate the CDP creation request's params 'owner', 'collateral', and 'principal'. An example formatted request can be found in `example-create-cdp.json`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create an unsigned request
|
|
||||||
curl -H "Content-Type: application/json" -X PUT -d @./contrib/requests/create-cdp.json http://127.0.0.1:1317/cdp | jq > ./contrib/requests/create-cdp-unsigned.json
|
|
||||||
|
|
||||||
# Sign the request
|
|
||||||
kvcli tx sign ./contrib/requests/create-cdp-unsigned.json --from accB --offline --chain-id testing --sequence 1 --account-number 2 | jq > ./contrib/requests/broadcast-create-cdp.json
|
|
||||||
|
|
||||||
# Broadcast the request
|
|
||||||
kvcli tx broadcast ./contrib/requests/broadcast-create-cdp.json
|
|
||||||
```
|
|
||||||
|
|
||||||
Congratulations, you've just created a CDP on Kava using the rest server!
|
|
||||||
|
|
||||||
### Post market price example request
|
|
||||||
|
|
||||||
Note that only market oracles can post prices, other senders will have their transactions rejected by Kava.
|
|
||||||
|
|
||||||
Format the base request in post-price.json. You'll need to update the 'from', 'chain-id', 'account_number', 'sequence', and 'gas' as appropriate. Then, populate the post price request's params 'from', 'market_id', 'price', and 'expiry'. An example formatted request can be found in `example-post-price.json`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create an unsigned request
|
|
||||||
curl -H "Content-Type: application/json" -X PUT -d @./contrib/requests/post-price.json http://127.0.0.1:1317/pricefeed/postprice | jq > ./contrib/requests/post-price-unsigned.json
|
|
||||||
|
|
||||||
|
|
||||||
# Sign the request
|
|
||||||
kvcli tx sign ./contrib/requests/post-price-unsigned.json --from validator --offline --chain-id testing --sequence 96 --account-number 0 | jq > ./contrib/requests/broadcast-post-price.json
|
|
||||||
|
|
||||||
# Broadcast the request
|
|
||||||
kvcli tx broadcast ./contrib/requests/broadcast-post-price.json
|
|
||||||
```
|
|
||||||
|
|
||||||
Congratulations, you've just posted a current market price on Kava using the rest server!
|
|
||||||
|
|
||||||
## Governance proposals
|
|
||||||
|
|
||||||
Example governance proposals are located in `/proposal_examples`.
|
|
||||||
|
62
contrib/testnet-4000/README.md
Normal file
62
contrib/testnet-4000/README.md
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Testnet-4000
|
||||||
|
|
||||||
|
Resources and examples for running and interacting with kava-testnet-4000
|
||||||
|
|
||||||
|
## Rest server requests
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
Before making a request, query account information for the signing account. Note the 'accountnumber' and 'sequence' fields, we'll need them later in order to send our request:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kvcli q auth account $(kvcli keys show accB -a)
|
||||||
|
```
|
||||||
|
|
||||||
|
If testing locally, start the Kava rest server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kvcli rest-server
|
||||||
|
```
|
||||||
|
|
||||||
|
Now we'll create an unsigned request, sign it, and broadcast it to the Kava blockchain via the rest server. Note that if you're using the mainnet or testnet, the host IP address will need to be updated to point at an active rest server instead of http://127.0.0.1.
|
||||||
|
|
||||||
|
### Create CDP example request
|
||||||
|
|
||||||
|
Format the base request in create-cdp.json. You'll need to update the 'from', 'chain-id', 'account_number', 'sequence', and 'gas' as appropriate. Then, populate the CDP creation request's params 'owner', 'collateral', and 'principal'. An example formatted request can be found in `example-create-cdp.json`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create an unsigned request
|
||||||
|
curl -H "Content-Type: application/json" -X PUT -d @./contrib/requests/create-cdp.json http://127.0.0.1:1317/cdp | jq > ./contrib/requests/create-cdp-unsigned.json
|
||||||
|
|
||||||
|
# Sign the request
|
||||||
|
kvcli tx sign ./contrib/requests/create-cdp-unsigned.json --from accB --offline --chain-id testing --sequence 1 --account-number 2 | jq > ./contrib/requests/broadcast-create-cdp.json
|
||||||
|
|
||||||
|
# Broadcast the request
|
||||||
|
kvcli tx broadcast ./contrib/requests/broadcast-create-cdp.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Congratulations, you've just created a CDP on Kava using the rest server!
|
||||||
|
|
||||||
|
### Post market price example request
|
||||||
|
|
||||||
|
Note that only market oracles can post prices, other senders will have their transactions rejected by Kava.
|
||||||
|
|
||||||
|
Format the base request in post-price.json. You'll need to update the 'from', 'chain-id', 'account_number', 'sequence', and 'gas' as appropriate. Then, populate the post price request's params 'from', 'market_id', 'price', and 'expiry'. An example formatted request can be found in `example-post-price.json`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create an unsigned request
|
||||||
|
curl -H "Content-Type: application/json" -X PUT -d @./contrib/requests/post-price.json http://127.0.0.1:1317/pricefeed/postprice | jq > ./contrib/requests/post-price-unsigned.json
|
||||||
|
|
||||||
|
|
||||||
|
# Sign the request
|
||||||
|
kvcli tx sign ./contrib/requests/post-price-unsigned.json --from validator --offline --chain-id testing --sequence 96 --account-number 0 | jq > ./contrib/requests/broadcast-post-price.json
|
||||||
|
|
||||||
|
# Broadcast the request
|
||||||
|
kvcli tx broadcast ./contrib/requests/broadcast-post-price.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Congratulations, you've just posted a current market price on Kava using the rest server!
|
||||||
|
|
||||||
|
## Governance proposals
|
||||||
|
|
||||||
|
Example governance proposals are located in `/proposal_examples`.
|
BIN
swagger-ui/favicon-16x16.png
Normal file
BIN
swagger-ui/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 B |
BIN
swagger-ui/favicon-32x32.png
Normal file
BIN
swagger-ui/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 628 B |
60
swagger-ui/index.html
Normal file
60
swagger-ui/index.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!-- HTML for static distribution bundle build -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Swagger UI</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||||
|
<style>
|
||||||
|
html
|
||||||
|
{
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: -moz-scrollbars-vertical;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after
|
||||||
|
{
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
body
|
||||||
|
{
|
||||||
|
margin:0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
|
||||||
|
<script src="./swagger-ui-bundle.js"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js"> </script>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
// Begin Swagger UI call region
|
||||||
|
const ui = SwaggerUIBundle({
|
||||||
|
url: "./swagger.yaml",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
})
|
||||||
|
// End Swagger UI call region
|
||||||
|
|
||||||
|
window.ui = ui
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
68
swagger-ui/oauth2-redirect.html
Normal file
68
swagger-ui/oauth2-redirect.html
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<title>Swagger UI: OAuth2 Redirect</title>
|
||||||
|
<body onload="run()">
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
function run () {
|
||||||
|
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||||
|
var sentState = oauth2.state;
|
||||||
|
var redirectUrl = oauth2.redirectUrl;
|
||||||
|
var isValid, qp, arr;
|
||||||
|
|
||||||
|
if (/code|token|error/.test(window.location.hash)) {
|
||||||
|
qp = window.location.hash.substring(1);
|
||||||
|
} else {
|
||||||
|
qp = location.search.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
arr = qp.split("&")
|
||||||
|
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
|
||||||
|
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||||
|
function (key, value) {
|
||||||
|
return key === "" ? value : decodeURIComponent(value)
|
||||||
|
}
|
||||||
|
) : {}
|
||||||
|
|
||||||
|
isValid = qp.state === sentState
|
||||||
|
|
||||||
|
if ((
|
||||||
|
oauth2.auth.schema.get("flow") === "accessCode"||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorizationCode"
|
||||||
|
) && !oauth2.auth.code) {
|
||||||
|
if (!isValid) {
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "warning",
|
||||||
|
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qp.code) {
|
||||||
|
delete oauth2.state;
|
||||||
|
oauth2.auth.code = qp.code;
|
||||||
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
|
} else {
|
||||||
|
let oauthErrorMsg
|
||||||
|
if (qp.error) {
|
||||||
|
oauthErrorMsg = "["+qp.error+"]: " +
|
||||||
|
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||||
|
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "error",
|
||||||
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
</script>
|
134
swagger-ui/swagger-ui-bundle.js
Normal file
134
swagger-ui/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
swagger-ui/swagger-ui-bundle.js.map
Normal file
1
swagger-ui/swagger-ui-bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
22
swagger-ui/swagger-ui-standalone-preset.js
Normal file
22
swagger-ui/swagger-ui-standalone-preset.js
Normal file
File diff suppressed because one or more lines are too long
1
swagger-ui/swagger-ui-standalone-preset.js.map
Normal file
1
swagger-ui/swagger-ui-standalone-preset.js.map
Normal file
File diff suppressed because one or more lines are too long
4
swagger-ui/swagger-ui.css
Normal file
4
swagger-ui/swagger-ui.css
Normal file
File diff suppressed because one or more lines are too long
1
swagger-ui/swagger-ui.css.map
Normal file
1
swagger-ui/swagger-ui.css.map
Normal file
File diff suppressed because one or more lines are too long
9
swagger-ui/swagger-ui.js
Normal file
9
swagger-ui/swagger-ui.js
Normal file
File diff suppressed because one or more lines are too long
1
swagger-ui/swagger-ui.js.map
Normal file
1
swagger-ui/swagger-ui.js.map
Normal file
File diff suppressed because one or more lines are too long
2532
swagger-ui/swagger.yaml
Normal file
2532
swagger-ui/swagger.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user