rpc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const ShutdownTimeoutSeconds = 5

Variables

This section is empty.

Functions

func Response

func Response(c *gin.Context, status int, err error, data interface{})

Types

type AutoTxClient

type AutoTxClient interface {
	SetTxIntervalUs(i int)
}

type Consensus

type Consensus struct {
	Dkg *annsensus.DKGInfo `json:"dkg"`
	Bft *annsensus.BFTInfo `json:"bft"`
}

type Monitor

type Monitor struct {
	Port    string     `json:"port"`
	ShortId string     `json:"short_id"`
	Peers   []Peer     `json:"peers,omitempty"`
	SeqId   uint64     `json:"seq_id"`
	Tps     *Tps       `json:"tps"`
	Status  SyncStatus `json:"status"`
}

type NewAccountRequest

type NewAccountRequest struct {
	Algorithm string `json:"algorithm"`
}

NewAccountRequest for RPC request

type NewQueryContractReq

type NewQueryContractReq struct {
	Address string `json:"address"`
	Data    string `json:"data"`
}

type NewTxRequest

type NewTxRequest struct {
	Nonce      string `json:"nonce"`
	From       string `json:"from"`
	To         string `json:"to"`
	Value      string `json:"value"`
	Data       string `json:"data"`
	CryptoType string `json:"crypto_type"`
	Signature  string `json:"signature"`
	Pubkey     string `json:"pubkey"`
}

NewTxrequest for RPC request

type NodeStatus

type NodeStatus struct {
	NodeInfo  *p2p.NodeInfo   `json:"node_info"`
	PeersInfo []*p2p.PeerInfo `json:"peers_info"`
}

NodeStatus

type Peer

type Peer struct {
	Addr    string `json:"addr"`
	ShortId string `json:"short_id"`
	Link    bool   `json:"link"`
}

type ReceiptResponse

type ReceiptResponse struct {
	TxHash          string `json:"tx_hash"`
	Status          int    `json:"status"`
	Result          string `json:"result"`
	ContractAddress string `json:"contract_address"`
}

type RpcController

type RpcController struct {
	P2pServer          *p2p.Server
	Og                 *og.Og
	TxBuffer           *og.TxBuffer
	TxCreator          *og.TxCreator
	SyncerManager      *syncer.SyncManager
	PerformanceMonitor *performance.PerformanceMonitor
	AutoTxCli          AutoTxClient
	NewRequestChan     chan types.TxBaseType
	AnnSensus          *annsensus.AnnSensus
}

func (*RpcController) AutoTx

func (r *RpcController) AutoTx(c *gin.Context)

func (*RpcController) ConStatus

func (r *RpcController) ConStatus(c *gin.Context)

func (*RpcController) Confirm

func (r *RpcController) Confirm(c *gin.Context)

Confirm checks if tx has already been confirmed.

func (*RpcController) ContractPayload

func (r *RpcController) ContractPayload(c *gin.Context)

func (*RpcController) Debug

func (r *RpcController) Debug(c *gin.Context)

func (*RpcController) DebugCallerCall

func (r *RpcController) DebugCallerCall(setvalue string) error

func (*RpcController) DebugCallerCreate

func (r *RpcController) DebugCallerCreate() error

func (*RpcController) DebugCreateContract

func (r *RpcController) DebugCreateContract() error

func (*RpcController) DebugCreateTxAndSendToBuffer

func (r *RpcController) DebugCreateTxAndSendToBuffer(from, to types.Address, value *math.BigInt, data []byte, nonce uint64) error

func (*RpcController) DebugQueryContract

func (r *RpcController) DebugQueryContract() ([]byte, error)

func (*RpcController) DebugSetContract

func (r *RpcController) DebugSetContract(n string) error

func (*RpcController) Genesis

func (r *RpcController) Genesis(c *gin.Context)

func (*RpcController) Monitor

func (r *RpcController) Monitor(c *gin.Context)

func (*RpcController) NetInfo

func (r *RpcController) NetInfo(c *gin.Context)

PeersInfo network information

func (*RpcController) NewAccount

func (r *RpcController) NewAccount(c *gin.Context)

func (*RpcController) NewTransaction

func (r *RpcController) NewTransaction(c *gin.Context)

func (*RpcController) Newrouter

func (rpc *RpcController) Newrouter() *gin.Engine

func (*RpcController) OgPeersInfo

func (r *RpcController) OgPeersInfo(c *gin.Context)

func (*RpcController) PeersInfo

func (r *RpcController) PeersInfo(c *gin.Context)

PeersInfo peers information

func (*RpcController) Performance

func (r *RpcController) Performance(c *gin.Context)

func (*RpcController) Query

func (r *RpcController) Query(c *gin.Context)

Query query

func (*RpcController) QueryBalance

func (r *RpcController) QueryBalance(c *gin.Context)

func (*RpcController) QueryContract

func (r *RpcController) QueryContract(c *gin.Context)

func (*RpcController) QueryNonce

func (r *RpcController) QueryNonce(c *gin.Context)

func (*RpcController) QueryReceipt

func (r *RpcController) QueryReceipt(c *gin.Context)

func (*RpcController) QueryShare

func (r *RpcController) QueryShare(c *gin.Context)

func (*RpcController) Sequencer

func (r *RpcController) Sequencer(c *gin.Context)

func (*RpcController) Status

func (r *RpcController) Status(c *gin.Context)

Status node status

func (*RpcController) SyncStatus

func (r *RpcController) SyncStatus(c *gin.Context)

Status node status

func (*RpcController) Tps

func (r *RpcController) Tps(c *gin.Context)

func (*RpcController) Transaction

func (r *RpcController) Transaction(c *gin.Context)

Transaction get transaction

func (*RpcController) Transactions

func (r *RpcController) Transactions(c *gin.Context)

Transactions query Transactions

func (*RpcController) Validator

func (r *RpcController) Validator(c *gin.Context)

type RpcServer

type RpcServer struct {
	C *RpcController
	// contains filtered or unexported fields
}

func NewRpcServer

func NewRpcServer(port string) *RpcServer

func (*RpcServer) Name

func (srv *RpcServer) Name() string

func (*RpcServer) Start

func (srv *RpcServer) Start()

func (*RpcServer) Stop

func (srv *RpcServer) Stop()

type SequenceRequester

type SequenceRequester interface {
	GenerateRequest()
}

SequenceRequester

type SyncStatus

type SyncStatus struct {
	Id                       string `json:"id"`
	SyncMode                 string `json:"syncMode"`
	CatchupSyncerStatus      string `json:"catchupSyncerStatus"`
	CatchupSyncerEnabled     bool   `json:"catchupSyncerEnabled"`
	IncrementalSyncerEnabled bool   `json:"incrementalSyncerEnabled"`
	Height                   uint64 `json:"height"`
	LatestHeight             uint64 `json:"latestHeight"`
	BestPeer                 string `json:"bestPeer"`
	Error                    string `json:"error"`
	Txid                     uint32 `json:"txid"`
}

type Tps

type Tps struct {
	Num     int     `json:"num"`
	TxCount int     `json:"tx_num"`
	Seconds float64 `json:"duration"`
}

type TxRequester

type TxRequester interface {
	GenerateRequest(from int, to int)
}

TxRequester

Jump to

Keyboard shortcuts

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