rpc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxStatusNotFound  = "not_found"
	TxStatusPending   = "pending"
	TxStatusFinalized = "finalized"
	TxStatusAbandoned = "abandoned"
)
View Source
const (
	TxTypeCoinbase = byte(iota)
	TxTypeSlash
	TxTypeSend
	TxTypeReserveFund
	TxTypeReleaseFund
	TxTypeServicePayment
	TxTypeSplitRule
	TxTypeSmartContract
	TxTypeDepositStake
	TxTypeWithdrawStake
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupChainArgs

type BackupChainArgs struct {
	Start  uint64 `json:"start"`
	End    uint64 `json:"end"`
	Config string `json:"config"`
}

type BackupChainCorrectionArgs added in v1.0.5

type BackupChainCorrectionArgs struct {
	SnapshotHeight uint64      `json:"snapshot_height"`
	EndBlockHash   common.Hash `json:"end_block_hash"`
	Config         string      `json:"config"`
	ExclusionTxs   []string    `json:"exclusion_txs"`
}

type BackupChainCorrectionResult added in v1.0.5

type BackupChainCorrectionResult struct {
	ChainFile    string            `json:"chain_correction_file"`
	BlockHashMap map[uint64]string `json:"block_hash_map"`
}

type BackupChainResult

type BackupChainResult struct {
	ActualStartHeight uint64 `json:"actual_start_height"`
	ActualEndHeight   uint64 `json:"actual_end_height"`
	ChainFile         string `json:"chain_file"`
}

type BackupSnapshotArgs

type BackupSnapshotArgs struct {
	Config string `json:"config"`
	Height uint64 `json:"height"`
}

type BackupSnapshotResult

type BackupSnapshotResult struct {
	SnapshotFile string `json:"snapshot_file"`
}

type BlockHashVcpPair

type BlockHashVcpPair struct {
	BlockHash  common.Hash
	Vcp        *core.ValidatorCandidatePool
	HeightList *types.HeightList
}

type BroadcastRawTransactionArgs

type BroadcastRawTransactionArgs struct {
	TxBytes string `json:"tx_bytes"`
}

type BroadcastRawTransactionAsyncArgs

type BroadcastRawTransactionAsyncArgs struct {
	TxBytes string `json:"tx_bytes"`
}

type BroadcastRawTransactionAsyncResult

type BroadcastRawTransactionAsyncResult struct {
	TxHash string `json:"hash"`
}

type BroadcastRawTransactionResult

type BroadcastRawTransactionResult struct {
	TxHash string            `json:"hash"`
	Block  *core.BlockHeader `json:"block",rlp:"nil"`
}

type CallSmartContractArgs

type CallSmartContractArgs struct {
	SctxBytes string `json:"sctx_bytes"`
}

type CallSmartContractResult

type CallSmartContractResult struct {
	VmReturn        string            `json:"vm_return"`
	ContractAddress common.Address    `json:"contract_address"`
	GasUsed         common.JSONUint64 `json:"gas_used"`
	VmError         string            `json:"vm_error"`
}

type Callback

type Callback struct {
	Callback func(*core.Block)
	// contains filtered or unexported fields
}

type Client

type Client interface {
	Call(name string, args []interface{}, result interface{}) error
}

func NewClient

func NewClient(url string) Client

type GetAccountArgs

type GetAccountArgs struct {
	Name    string `json:"name"`
	Address string `json:"address"`
	Preview bool   `json:"preview"` // preview the account balance from the ScreenedView
}

type GetAccountResult

type GetAccountResult struct {
	*types.Account
	Address string `json:"address"`
}

type GetBlockArgs

type GetBlockArgs struct {
	Hash common.Hash `json:"hash"`
}

type GetBlockByHeightArgs

type GetBlockByHeightArgs struct {
	Height common.JSONUint64 `json:"height"`
}

type GetBlockResult

type GetBlockResult struct {
	*GetBlockResultInner
}

type GetBlockResultInner

type GetBlockResultInner struct {
	ChainID   string            `json:"chain_id"`
	Epoch     common.JSONUint64 `json:"epoch"`
	Height    common.JSONUint64 `json:"height"`
	Parent    common.Hash       `json:"parent"`
	TxHash    common.Hash       `json:"transactions_hash"`
	StateHash common.Hash       `json:"state_hash"`
	Timestamp *common.JSONBig   `json:"timestamp"`
	Proposer  common.Address    `json:"proposer"`

	Children []common.Hash    `json:"children"`
	Status   core.BlockStatus `json:"status"`

	Hash common.Hash `json:"hash"`
	Txs  []Tx        `json:"transactions"`
}

type GetPeersArgs added in v1.1.0

type GetPeersArgs struct{}

type GetPeersResult added in v1.1.0

type GetPeersResult struct {
	Peers []string `json:"peers"`
}

type GetPendingTransactionsArgs

type GetPendingTransactionsArgs struct {
}

type GetPendingTransactionsResult

type GetPendingTransactionsResult struct {
	TxHashes []string `json:"tx_hashes"`
}

type GetSplitRuleArgs

type GetSplitRuleArgs struct {
	ResourceID string `json:"resource_id"`
}

type GetSplitRuleResult

type GetSplitRuleResult struct {
	*types.SplitRule
}

type GetStatusArgs

type GetStatusArgs struct{}

type GetStatusResult

type GetStatusResult struct {
	Address                    string            `json:"address"`
	PeerID                     string            `json:"peer_id"`
	LatestFinalizedBlockHash   common.Hash       `json:"latest_finalized_block_hash"`
	LatestFinalizedBlockHeight common.JSONUint64 `json:"latest_finalized_block_height"`
	LatestFinalizedBlockTime   *common.JSONBig   `json:"latest_finalized_block_time"`
	LatestFinalizedBlockEpoch  common.JSONUint64 `json:"latest_finalized_block_epoch"`
	CurrentEpoch               common.JSONUint64 `json:"current_epoch"`
	CurrentTime                *common.JSONBig   `json:"current_time"`
	Syncing                    bool              `json:"syncing"`
}

type GetTransactionArgs

type GetTransactionArgs struct {
	Hash string `json:"hash"`
}

type GetTransactionResult

type GetTransactionResult struct {
	BlockHash   common.Hash       `json:"block_hash"`
	BlockHeight common.JSONUint64 `json:"block_height"`
	Status      TxStatus          `json:"status"`
	TxHash      common.Hash       `json:"hash"`
	Type        byte              `json:"type"`
	Tx          types.Tx          `json:"transaction"`
}

type GetVcpByHeightArgs

type GetVcpByHeightArgs struct {
	Height common.JSONUint64 `json:"height"`
}

type GetVcpResult

type GetVcpResult struct {
	BlockHashVcpPairs []BlockHashVcpPair
}

type GetVersionArgs

type GetVersionArgs struct {
}

type GetVersionResult

type GetVersionResult struct {
	Version   string `json:"version"`
	GitHash   string `json:"git_hash"`
	Timestamp string `json:"timestamp"`
}

type HTTPClient

type HTTPClient struct {
	*jsonrpc.RPCClient
}

func (HTTPClient) Call

func (c HTTPClient) Call(name string, args []interface{}, result interface{}) error

type RPCResponse

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

func (*RPCResponse) GetObject

func (r *RPCResponse) GetObject(toType interface{}) error

type ThetaRPCServer

type ThetaRPCServer struct {
	*ThetaRPCService
	// contains filtered or unexported fields
}

ThetaRPCServer is an instance of RPC service.

func NewThetaRPCServer

func NewThetaRPCServer(mempool *mempool.Mempool, ledger *ledger.Ledger, dispatcher *dispatcher.Dispatcher,
	chain *blockchain.Chain, consensus *consensus.ConsensusEngine) *ThetaRPCServer

NewThetaRPCServer creates a new instance of ThetaRPCServer.

func (*ThetaRPCServer) Start

func (t *ThetaRPCServer) Start(ctx context.Context)

Start creates the main goroutine.

func (*ThetaRPCServer) Stop

func (t *ThetaRPCServer) Stop()

Stop notifies all goroutines to stop without blocking.

func (*ThetaRPCServer) Wait

func (t *ThetaRPCServer) Wait()

Wait blocks until all goroutines stop.

type ThetaRPCService

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

func (*ThetaRPCService) BackupChain

func (t *ThetaRPCService) BackupChain(args *BackupChainArgs, result *BackupChainResult) error

func (*ThetaRPCService) BackupChainCorrection added in v1.0.5

func (t *ThetaRPCService) BackupChainCorrection(args *BackupChainCorrectionArgs, result *BackupChainCorrectionResult) error

func (*ThetaRPCService) BackupSnapshot

func (t *ThetaRPCService) BackupSnapshot(args *BackupSnapshotArgs, result *BackupSnapshotResult) error

func (*ThetaRPCService) BroadcastRawTransaction

func (t *ThetaRPCService) BroadcastRawTransaction(
	args *BroadcastRawTransactionArgs, result *BroadcastRawTransactionResult) (err error)

func (*ThetaRPCService) BroadcastRawTransactionAsync

func (t *ThetaRPCService) BroadcastRawTransactionAsync(
	args *BroadcastRawTransactionAsyncArgs, result *BroadcastRawTransactionAsyncResult) (err error)

func (*ThetaRPCService) CallSmartContract

func (t *ThetaRPCService) CallSmartContract(args *CallSmartContractArgs, result *CallSmartContractResult) (err error)

CallSmartContract calls the smart contract. However, calling a smart contract does NOT modify the globally consensus state. It can be used for dry run, or for retrieving info from smart contracts without actually spending gas.

func (*ThetaRPCService) GetAccount

func (t *ThetaRPCService) GetAccount(args *GetAccountArgs, result *GetAccountResult) (err error)

func (*ThetaRPCService) GetBlock

func (t *ThetaRPCService) GetBlock(args *GetBlockArgs, result *GetBlockResult) (err error)

func (*ThetaRPCService) GetBlockByHeight

func (t *ThetaRPCService) GetBlockByHeight(args *GetBlockByHeightArgs, result *GetBlockResult) (err error)

func (*ThetaRPCService) GetPeers added in v1.1.0

func (t *ThetaRPCService) GetPeers(args *GetPeersArgs, result *GetPeersResult) (err error)

func (*ThetaRPCService) GetPendingTransactions

func (t *ThetaRPCService) GetPendingTransactions(args *GetPendingTransactionsArgs, result *GetPendingTransactionsResult) (err error)

func (*ThetaRPCService) GetSplitRule

func (t *ThetaRPCService) GetSplitRule(args *GetSplitRuleArgs, result *GetSplitRuleResult) (err error)

func (*ThetaRPCService) GetStatus

func (t *ThetaRPCService) GetStatus(args *GetStatusArgs, result *GetStatusResult) (err error)

func (*ThetaRPCService) GetTransaction

func (t *ThetaRPCService) GetTransaction(args *GetTransactionArgs, result *GetTransactionResult) (err error)

func (*ThetaRPCService) GetVcpByHeight

func (t *ThetaRPCService) GetVcpByHeight(args *GetVcpByHeightArgs, result *GetVcpResult) (err error)

func (*ThetaRPCService) GetVersion

func (t *ThetaRPCService) GetVersion(args *GetVersionArgs, result *GetVersionResult) (err error)

type Tx

type Tx struct {
	types.Tx `json:"raw"`
	Type     byte        `json:"type"`
	Hash     common.Hash `json:"hash"`
}

type TxCallbackManager

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

func NewTxCallbackManager

func NewTxCallbackManager() *TxCallbackManager

func (*TxCallbackManager) AddCallback

func (m *TxCallbackManager) AddCallback(txHash common.Hash, cb func(*core.Block))

func (*TxCallbackManager) RemoveCallback

func (m *TxCallbackManager) RemoveCallback(txHash common.Hash) (cb *Callback, exists bool)

func (*TxCallbackManager) Trim

func (m *TxCallbackManager) Trim()

type TxStatus

type TxStatus string

type TxType

type TxType byte

type WSClient

type WSClient struct {
	*jsonrpc2.Client
	// contains filtered or unexported fields
}

func (*WSClient) Call

func (c *WSClient) Call(name string, args []interface{}, result interface{}) error

Jump to

Keyboard shortcuts

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