mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
4599caca07
* query get price implemented - /pricefeed/price/xrp:usd * query rawprices implemented - /pricefeed/rawprices/xrp:usd * refactored to QueryWithMarketIDParams, added rest logic for QueryOracles * new query get oracles implemented for cli and rest - /pricefeed/oracles/xrp:usd * tx postprice implemented - /pricefeed/postprice/{MsgPostPrice} * updated contrib with post-price examples and added to README * added cliCtx.WithHeight(height) and removed import comment
26 lines
666 B
Go
26 lines
666 B
Go
package rest
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/client/context"
|
|
"github.com/cosmos/cosmos-sdk/types/rest"
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
const (
|
|
RestMarketID = "market_id"
|
|
)
|
|
|
|
// PostPriceReq defines the properties of a PostPrice request's body.
|
|
type PostPriceReq struct {
|
|
BaseReq rest.BaseReq `json:"base_req"`
|
|
MarketID string `json:"market_id"`
|
|
Price string `json:"price"`
|
|
Expiry string `json:"expiry"`
|
|
}
|
|
|
|
// RegisterRoutes - Central function to define routes that get registered by the main application
|
|
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {
|
|
registerQueryRoutes(cliCtx, r)
|
|
registerTxRoutes(cliCtx, r)
|
|
}
|