api

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = "terra"
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = "terrapub"
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = "terravaloper"
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = "terravaloperpub"
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = "terravalcons"
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = "terravalconspub"
)

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (AddNewKey) Marshal

func (ak AddNewKey) Marshal() []byte

Marshal - no-lint

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"`
	Gas           string         `json:"gas,omitempty"`
	GasPrices     string         `json:"gas_prices,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

Marshal - nolint

type DeleteKeyBody

type DeleteKeyBody struct {
	Password string `json:"password"`
}

DeleteKeyBody request

func (DeleteKeyBody) Marshal

func (u DeleteKeyBody) Marshal() []byte

Marshal - no-lint

type EncodeResponse

type EncodeResponse struct {
	TxBytes string `json:"txbytes"`
	TxID    string `json:"txid"`
}

EncodeResopnse nolint

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)

TODO - query epoch & query tax-rate & query tax-cap & compute fee (stability & gas) BankSend handles the /tx/bank/send route

func (*Server) Broadcast

func (s *Server) Broadcast(w http.ResponseWriter, r *http.Request)

Marshal - no-lint

func (*Server) DeleteKey

func (s *Server) DeleteKey(w http.ResponseWriter, r *http.Request)

DeleteKey is the handler for the DELETE /keys/{name}

func (*Server) EncodeTx

func (s *Server) EncodeTx(w http.ResponseWriter, r *http.Request)

Marshal - no-lint

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) Router

func (s *Server) Router() *mux.Router

Router returns the router

func (*Server) Sign

func (s *Server) Sign(w http.ResponseWriter, r *http.Request)

Sign handles the /tx/sign route

func (*Server) SimulateGas

func (s *Server) SimulateGas(txbytes []byte) (res uint64, err error)

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"`
	Passphrase    string          `json:"passphrase"`
	ChainID       string          `json:"chain_id"`
	AccountNumber string          `json:"account_number"`
	Sequence      string          `json:"sequence"`
}

SignBody is the body for a sign request

func (SignBody) Marshal

func (sb SignBody) Marshal() []byte

Marshal returns the json byte representation of the sign body

func (SignBody) StdSignMsg

func (sb SignBody) StdSignMsg() (stdSign txbldr.StdSignMsg, stdTx auth.StdTx, err error)

StdSignMsg returns a StdSignMsg from a SignBody request

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

Marshal - no-lint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL