rpc

package
v0.0.9-Bytes Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 38 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.

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 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 NewArchiveRequest added in v0.0.2

type NewArchiveRequest struct {
	Data []byte `json:"data"`
}

NewArchiveRequest for RPC request

type NewPublicOfferingRequest added in v0.0.2

type NewPublicOfferingRequest struct {
	Nonce      uint64 `json:"nonce"`
	From       string `json:"from"`
	Value      string `json:"value"`
	Action     uint8  `json:"action"`
	EnableSPO  bool   `json:"enable_spo"`
	CryptoType string `json:"crypto_type"`
	Signature  string `json:"signature"`
	Pubkey     string `json:"pubkey"`
	TokenId    int32  `json:"token_id"`
	TokenName  string `json:"token_name"`
}

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"`
	TokenId    int32  `json:"token_id"`
}

NewTxrequest for RPC request

func (*NewTxRequest) DecodeMsg added in v0.0.2

func (z *NewTxRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*NewTxRequest) EncodeMsg added in v0.0.2

func (z *NewTxRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*NewTxRequest) MarshalMsg added in v0.0.2

func (z *NewTxRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*NewTxRequest) Msgsize added in v0.0.2

func (z *NewTxRequest) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*NewTxRequest) UnmarshalMsg added in v0.0.2

func (z *NewTxRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type NewTxsRequests added in v0.0.2

type NewTxsRequests struct {
	Txs []NewTxRequest `json:"txs"`
}

func (*NewTxsRequests) DecodeMsg added in v0.0.2

func (z *NewTxsRequests) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*NewTxsRequests) EncodeMsg added in v0.0.2

func (z *NewTxsRequests) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*NewTxsRequests) MarshalMsg added in v0.0.2

func (z *NewTxsRequests) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*NewTxsRequests) Msgsize added in v0.0.2

func (z *NewTxsRequests) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*NewTxsRequests) UnmarshalMsg added in v0.0.2

func (z *NewTxsRequests) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

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          interface{} `json:"result"`
	ContractAddress string      `json:"contract_address"`
}

type RpcController

type RpcController struct {
	P2pServer          *p2p.Server
	Og                 *og.Og
	TxBuffer           *pool.TxBuffer
	TxCreator          *txmaker.OGTxCreator
	SyncerManager      *syncer.SyncManager
	PerformanceMonitor *performance.PerformanceMonitor
	NewRequestChan     chan archive2.TxBaseType
	AnnSensus          *annsensus.AnnSensus
	FormatVerifier     *verifier.TxFormatVerifier
}

func (*RpcController) BftStatus added in v0.0.2

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

func (*RpcController) BufferDependencyCache added in v0.0.3

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

func (*RpcController) BufferKnownCache added in v0.0.3

func (r *RpcController) BufferKnownCache(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) ConfirmStatus added in v0.0.2

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

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 common.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) GetPoolHashes added in v0.0.2

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

func (*RpcController) GetToken added in v0.0.2

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

func (*RpcController) LatestTokenId added in v0.0.2

func (r *RpcController) LatestTokenId(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) NetIo added in v0.0.2

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

func (*RpcController) NewAccount

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

func (*RpcController) NewArchive added in v0.0.2

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

func (*RpcController) NewPublicOffering added in v0.0.2

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

func (*RpcController) NewRouter added in v0.0.2

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

func (*RpcController) NewSecondOffering added in v0.0.2

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

func (*RpcController) NewTransaction

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

func (*RpcController) NewTransactions added in v0.0.2

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

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) TokenDestroy added in v0.0.2

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

todo optimize later

func (*RpcController) Tokens added in v0.0.2

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

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