Documentation
¶
Index ¶
- Variables
- func ParseCoin(coinStr string) (minCoin sdk.Coin, err error)
- func ParseCoins(coinsStr string) (coins sdk.Coins, err error)
- type ABCIMessageLog
- type ABCIMessageLogs
- type AddNewKey
- type BankSendBody
- type DeleteKeyBody
- type Result
- type SearchTxsResult
- type Server
- func (s *Server) BankSend(w http.ResponseWriter, r *http.Request)
- func (s *Server) Broadcast(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteKey(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetKey(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetKeys(w http.ResponseWriter, r *http.Request)
- func (s *Server) PostKeys(w http.ResponseWriter, r *http.Request)
- func (s *Server) PutKey(w http.ResponseWriter, r *http.Request)
- func (s *Server) Router() *mux.Router
- func (s *Server) Sign(w http.ResponseWriter, r *http.Request)
- func (s *Server) SimulateGas(txbytes []byte) (res uint64, err error)
- func (s *Server) VersionHandler(w http.ResponseWriter, r *http.Request)
- type SignBody
- type StringTag
- type StringTags
- type Tag
- type Tags
- type TxResponse
- type UpdateKeyBody
Constants ¶
This section is empty.
Variables ¶
var ( TagAction = "action" TagCategory = "category" TagSender = "sender" TagSrcValidator = "source-validator" TagDstValidator = "destination-validator" TagDelegator = "delegator" )
common tags
Functions ¶
Types ¶
type ABCIMessageLog ¶
type ABCIMessageLog struct {
MsgIndex uint16 `json:"msg_index"`
Success bool `json:"success"`
Log string `json:"log"`
}
ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
type ABCIMessageLogs ¶
type ABCIMessageLogs []ABCIMessageLog
ABCIMessageLogs represents a slice of ABCIMessageLog.
func ParseABCILogs ¶
func ParseABCILogs(logs string) (res ABCIMessageLogs, err error)
ParseABCILogs attempts to parse a stringified ABCI tx log into a slice of ABCIMessageLog types. It returns an error upon JSON decoding failure.
func (ABCIMessageLogs) String ¶
func (logs ABCIMessageLogs) String() (str string)
String implements the fmt.Stringer interface for the ABCIMessageLogs type.
type AddNewKey ¶
type AddNewKey struct {
Name string `json:"name"`
Password string `json:"password"`
Mnemonic string `json:"mnemonic,omitempty"`
Account int `json:"account,string,omitempty"`
Index int `json:"index,string,omitempty"`
}
AddNewKey is the necessary data for adding a new key
type BankSendBody ¶
type BankSendBody struct {
Sender sdk.AccAddress `json:"sender"`
Reciever sdk.AccAddress `json:"reciever"`
Amount string `json:"amount"`
ChainID string `json:"chain_id"`
Memo string `json:"memo,omitempty"`
Fees string `json:"fees,omitempty"`
GasAdjustment string `json:"gas_adjustment,omitempty"`
}
BankSendBody contains the necessary data to make a send transaction
func (BankSendBody) Marshal ¶
func (sb BankSendBody) Marshal() []byte
type DeleteKeyBody ¶
type DeleteKeyBody struct {
Password string `json:"password"`
}
DeleteKeyBody request
func (DeleteKeyBody) Marshal ¶
func (u DeleteKeyBody) Marshal() []byte
type Result ¶
type Result struct {
// Code is the response code, is stored back on the chain.
Code sdk.CodeType
// Codespace is the string referring to the domain of an error
Codespace sdk.CodespaceType
// Data is any data returned from the app.
// Data has to be length prefixed in order to separate
// results from multiple msgs executions
Data []byte
// Log contains the txs log information. NOTE: nondeterministic.
Log string
// GasWanted is the maximum units of work we allow this tx to perform.
GasWanted uint64
// GasUsed is the amount of gas actually consumed. NOTE: unimplemented
GasUsed uint64
// Tags are used for transaction indexing and pubsub.
Tags Tags
}
Result is the union of ResponseFormat and ResponseCheckTx.
type SearchTxsResult ¶
type SearchTxsResult struct {
TotalCount int `json:"total_count"` // Count of all txs
Count int `json:"count"` // Count of txs in current page
PageNumber int `json:"page_number"` // Index of current page, start from 1
PageTotal int `json:"page_total"` // Count of total pages
Limit int `json:"limit"` // Max count txs per page
Txs []TxResponse `json:"txs"` // List of txs in current page
}
SearchTxsResult defines a structure for querying txs pageable
func NewSearchTxsResult ¶
func NewSearchTxsResult(totalCount, count, page, limit int, txs []TxResponse) SearchTxsResult
type Server ¶
type Server struct {
Port int `json:"port"`
KeyDir string `json:"key_dir"`
Node string `json:"node"`
Version string `yaml:"version,omitempty"`
Commit string `yaml:"commit,omitempty"`
Branch string `yaml:"branch,omitempty"`
}
Server represents the API server
func (*Server) BankSend ¶
func (s *Server) BankSend(w http.ResponseWriter, r *http.Request)
BankSend handles the /tx/bank/send route
func (*Server) DeleteKey ¶
func (s *Server) DeleteKey(w http.ResponseWriter, r *http.Request)
DeleteKey is the handler for the DELETE /keys/{name}
func (*Server) GetKey ¶
func (s *Server) GetKey(w http.ResponseWriter, r *http.Request)
GetKey is the handler for the GET /keys/{name}
func (*Server) GetKeys ¶
func (s *Server) GetKeys(w http.ResponseWriter, r *http.Request)
GetKeys is the handler for the GET /keys
func (*Server) PostKeys ¶
func (s *Server) PostKeys(w http.ResponseWriter, r *http.Request)
PostKeys is the handler for the POST /keys
func (*Server) PutKey ¶
func (s *Server) PutKey(w http.ResponseWriter, r *http.Request)
PutKey is the handler for the PUT /keys/{name}
func (*Server) Sign ¶
func (s *Server) Sign(w http.ResponseWriter, r *http.Request)
Sign handles the /tx/sign route
func (*Server) SimulateGas ¶
SimulateGas simulates gas for a transaction
func (*Server) VersionHandler ¶
func (s *Server) VersionHandler(w http.ResponseWriter, r *http.Request)
VersionHandler handles the /version route
type SignBody ¶
type SignBody struct {
Tx json.RawMessage `json:"tx"`
Name string `json:"name"`
Password string `json:"password"`
ChainID string `json:"chain_id"`
AccountNumber string `json:"account_number"`
Sequence string `json:"sequence"`
}
SignBody is the body for a sign request
type StringTag ¶
A KVPair where the Key and Value are both strings, rather than []byte
func TagToStringTag ¶
Conversion function from a []byte tag to a string tag
type StringTags ¶
type StringTags []StringTag
A slice of StringTag
func TagsToStringTags ¶
func TagsToStringTags(tags Tags) StringTags
Conversion function from Tags to a StringTags
func (StringTags) String ¶
func (st StringTags) String() string
type Tags ¶
Type synonym for convenience
type TxResponse ¶
type TxResponse struct {
Height int64 `json:"height"`
TxHash string `json:"txhash"`
Code uint32 `json:"code,omitempty"`
Data string `json:"data,omitempty"`
RawLog string `json:"raw_log,omitempty"`
Logs ABCIMessageLogs `json:"logs,omitempty"`
Info string `json:"info,omitempty"`
GasWanted int64 `json:"gas_wanted,omitempty"`
GasUsed int64 `json:"gas_used,omitempty"`
Tags StringTags `json:"tags,omitempty"`
Codespace string `json:"codespace,omitempty"`
Tx sdk.Tx `json:"tx,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
}
TxResponse defines a structure containing relevant tx data and metadata. The tags are stringified and the log is JSON decoded.
func NewResponseFormatBroadcastTx ¶
func NewResponseFormatBroadcastTx(res *ctypes.ResultBroadcastTx) TxResponse
NewResponseFormatBroadcastTx returns a TxResponse given a ResultBroadcastTx from tendermint
func NewResponseFormatBroadcastTxCommit ¶
func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) TxResponse
NewResponseFormatBroadcastTxCommit returns a TxResponse given a ResultBroadcastTxCommit from tendermint.
func NewResponseResultTx ¶
NewResponseResultTx returns a TxResponse given a ResultTx from tendermint
func (TxResponse) Empty ¶
func (r TxResponse) Empty() bool
Empty returns true if the response is empty
func (TxResponse) String ¶
func (r TxResponse) String() string
type UpdateKeyBody ¶
type UpdateKeyBody struct {
NewPassword string `json:"new_password"`
OldPassword string `json:"old_password"`
}
UpdateKeyBody update key password request REST body
func (UpdateKeyBody) Marshal ¶
func (u UpdateKeyBody) Marshal() []byte