api

package
v1.0.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: BSD-3-Clause Imports: 15 Imported by: 59

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormattedTx added in v1.0.3

type FormattedTx struct {
	Tx       string `json:"tx"`
	Encoding string `json:"encoding"`
}

FormattedTx defines a JSON formatted struct containing a Tx in CB58 format

type GetTxArgs added in v1.0.3

type GetTxArgs struct {
	TxID     ids.ID `json:"txID"`
	Encoding string `json:"encoding"`
}

GetTxArgs ...

type JSONAddress added in v1.0.3

type JSONAddress struct {
	Address string `json:"address"`
}

JSONAddress contains an address

type JSONAddresses added in v1.0.3

type JSONAddresses struct {
	Addresses []string `json:"addresses"`
}

JSONAddresses contains a list of address

type JSONChangeAddr added in v1.0.3

type JSONChangeAddr struct {
	ChangeAddr string `json:"changeAddr"`
}

JSONChangeAddr is the address change is sent to, if any

type JSONFromAddrs added in v1.0.3

type JSONFromAddrs struct {
	From []string `json:"from"`
}

JSONFromAddrs is a list of addresses to send funds from

type JSONSpendHeader added in v1.0.3

type JSONSpendHeader struct {
	UserPass
	JSONFromAddrs
	JSONChangeAddr
}

JSONSpendHeader is 3 arguments to a method that spends (including those with tx fees) 1) The username/password 2) The addresses used in the method 3) The address to send change to

type JSONTxID added in v1.0.3

type JSONTxID struct {
	TxID ids.ID `json:"txID"`
}

JSONTxID contains the ID of a transaction

type JSONTxIDChangeAddr added in v1.0.3

type JSONTxIDChangeAddr struct {
	JSONTxID
	JSONChangeAddr
}

JSONTxIDChangeAddr is a tx ID and change address

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server maintains the HTTP router

func (*Server) AddAliases

func (s *Server) AddAliases(endpoint string, aliases ...string) error

AddAliases registers aliases to the server

func (*Server) AddAliasesWithReadLock

func (s *Server) AddAliasesWithReadLock(endpoint string, aliases ...string) error

AddAliasesWithReadLock registers aliases to the server assuming the http read lock is currently held.

func (*Server) AddChainRoute added in v0.8.0

func (s *Server) AddChainRoute(handler *common.HTTPHandler, ctx *snow.Context, base, endpoint string, loggingWriter io.Writer) error

AddChainRoute registers a route to a chain's handler

func (*Server) AddRoute

func (s *Server) AddRoute(handler *common.HTTPHandler, lock *sync.RWMutex, base, endpoint string, loggingWriter io.Writer) error

AddRoute registers a route to a handler.

func (*Server) Call

func (s *Server) Call(
	writer http.ResponseWriter,
	method,
	base,
	endpoint string,
	body io.Reader,
	headers map[string]string,
) error

Call ...

func (*Server) Dispatch

func (s *Server) Dispatch() error

Dispatch starts the API server

func (*Server) DispatchTLS

func (s *Server) DispatchTLS(certFile, keyFile string) error

DispatchTLS starts the API server with the provided TLS certificate

func (*Server) Initialize

func (s *Server) Initialize(
	log logging.Logger,
	factory logging.Factory,
	host string,
	port uint16,
	authEnabled bool,
	authPassword string,
) error

Initialize creates the API server at the provided host and port

func (*Server) RegisterChain

func (s *Server) RegisterChain(ctx *snow.Context, vmIntf interface{})

RegisterChain registers the API endpoints associated with this chain That is, add <route, handler> pairs to server so that http calls can be made to the vm

type SuccessResponse added in v0.8.0

type SuccessResponse struct {
	Success bool `json:"success"`
}

SuccessResponse indicates success of an API call

type UserPass added in v0.8.0

type UserPass struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

UserPass contains a username and a password

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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