api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBech32MainPrefix   = "panacea"
	DefaultCoinType           = 371
	DefaultFullFundraiserPath = "44'/371'/0'/0/0"
)

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

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

	Bech32MainPrefix   string
	CoinType           uint32
	FullFundraiserPath string
}

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

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

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

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

Router returns the router

func (*Server) SetSdkConfig

func (s *Server) SetSdkConfig()

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 auth.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

Jump to

Keyboard shortcuts

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