api

package
v0.0.0-...-4d27fde Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetLastResult

type GetLastResult struct {
	Hash    string
	Date    string
	Address string
	// In Wei (1 ETH = 10^18 Wei)
	// String type because it can go beyond uint64.
	Amount        string
	Confirmations uint64
}

GetLastResult is result of GetLast method.

type Handler

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

Handler is an API RPC handler.

func NewHandler

func NewHandler(networkID *big.Int, database *reform.DB,
	ethClient eth.Client, genUUIDFunc func() string) *Handler

NewHandler creates a new handler.

func (*Handler) GetLast

func (h *Handler) GetLast(limit uint64) ([]GetLastResult, error)

GetLast returns latest transactions.

func (*Handler) SendETH

func (h *Handler) SendETH(from, to, amount string) (*string, error)

SendETH sends ETH to specific address.

type Server

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

Server is a RPC server.

func NewServer

func NewServer(cfg *config.Config) (*Server, error)

NewServer creates a new API server.

func (*Server) AddHandler

func (s *Server) AddHandler(handler interface{}) error

AddHandler registers a new RPC handler.

func (*Server) Close

func (s *Server) Close() error

Close closes the server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts to listen and to serve requests.

Jump to

Keyboard shortcuts

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