api

package
v0.0.0-...-cd98764 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK      = 0
	Unknown = 1
)

Variables

This section is empty.

Functions

func Error

func Error(err error) error

func ErrorCode

func ErrorCode(code uint32) error

func ErrorDepth

func ErrorDepth(err error, depth int) error

Types

type BaseInfo

type BaseInfo struct {
	NonceLatest  *hexutil.Uint64 `json:"nonceLatest"`
	NoncePending *hexutil.Uint64 `json:"noncePending"`
	GasPrice     *hexutil.Big    `json:"gasPrice"`
	NetworkID    uint64          `json:"networkID"`
	Balance      *hexutil.Big    `json:"balance"`
}

type Config

type Config struct {
	CandidateFee uint64
	VoteFee      uint64
}

type GetBaseInfoArgs

type GetBaseInfoArgs struct {
	Address common.Address `json:"address"`
}

GetBaseInfoArgs address

type NotifyConfig

type NotifyConfig struct {
	Server      string
	Username    string
	Password    string
	ClientID    string
	QoS         byte
	PrefixTopic string // topic = <PrefixTopic>/<address>/<confirmedBlock>
}

type SendRawTxArgs

type SendRawTxArgs struct {
	Tx   hexutil.Bytes `json:"tx"`
	Wait uint64        `json:"wait"`
}

SendRawTxArgs represents the arguments to sumbit a new transaction into the transaction pool.

type SendTxArgs

type SendTxArgs struct {
	From      common.Address `json:"from"`
	Tx        hexutil.Bytes  `json:"tx"`
	Signature hexutil.Bytes  `json:"signature"`
	Wait      uint64         `json:"wait"`
}

SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.

type Server

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

Server is used to implement forceproto.ForceServer.

func NewServer

func NewServer(rpcURL string, notify *NotifyConfig) (*Server, error)

NewServer listen and server

func (*Server) GetBaseInfo

func (s *Server) GetBaseInfo(ctx context.Context, args GetBaseInfoArgs) (*BaseInfo, error)

func (*Server) SendRawTransaction

func (s *Server) SendRawTransaction(ctx context.Context, args SendRawTxArgs) (common.Hash, error)

func (*Server) SendTransaction

func (s *Server) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)

type TransferTx

type TransferTx struct {
	From        common.Address  `json:"from"`
	To          *common.Address `json:"to"`
	Value       *big.Int        `json:"value"`
	Hash        common.Hash     `json:"hash"`
	Data        []byte          `json:"data"`
	BlockNumber *big.Int        `json:"blockNumber"`
}

func (*TransferTx) MarshalJSON

func (c *TransferTx) MarshalJSON() ([]byte, error)

MarshalJSON encodes to json format.

func (*TransferTx) UnmarshalJSON

func (c *TransferTx) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes from json format to a TransferTx.

Jump to

Keyboard shortcuts

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