handler

package
v3.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//block
	GET_BLK_INFO   = "/v1/block/height"
	GET_BLK_DETAIL = "/v1/block/detail"

	// Transaction
	SEND_TRANSACTION       = "/v1/transaction/send"
	GET_TRANSACTION        = "/v1/transaction/get"
	GET_TRANSACTION_STATUS = "/v1/transaction/status"
	GET_HASH_FOR_SIGN      = "/v1/transaction/getHashForSign"
	GET_HASH_FOR_SIGN2     = "/v1/transaction/getHashForSign2"

	//Account
	GET_ACCOUNT_BRIEF   = "/v1/account/brief"
	GET_ACCOUNT         = "/v1/account/info"
	GET_TRANSFER_CREDIT = "/v1/balance/GetTransferCredit"

	//Contract
	GET_CONTRACT_ABI  = "/v1/contract/abi"
	GET_CONTRACT_CODE = "/v1/contract/code"

	// Common query
	QUERY_DB_VALUE = "/v1/common/queryDB"
	JSON_TO_BIN    = "/v1/common/jsontobin"

	//node
	GET_GEN_BLK_TIME = "/v1/node/generateblocktime"
	GET_CONN_COUNT   = "/v1/node/connectioncount"

	//delegate
	GET_ALL_DELEFATE = "/v1/delegate/getall"

	//global
	GET_GLOBAL_STAKED             = "/v1/global/stakedbalance"
	GET_FORECAST_RESOURCE_BALANCE = "/v1/resource/forecastresource"

	//p2p
	GET_ALL_PEERINFO           = "/v1/p2p/getpeers"
	CONNECT_PEER_BY_ADDRESS    = "/v1/p2p/connectpeer"
	DISCONNECT_PEER_BY_ADDRESS = "/v1/p2p/disconnectpeer"
	GET_PEER_STATE_BY_ADDRESS  = "/v1/p2p/getpeerstate"

	//MutlSign
	Proposal_Review = "/v1/proposal/review"
)

Variables

This section is empty.

Functions

func ConnetPeerbyAddress

func ConnetPeerbyAddress(w http.ResponseWriter, r *http.Request)

GetPeers get all peers

func DisConnectPeerbyAddress

func DisConnectPeerbyAddress(w http.ResponseWriter, r *http.Request)

GetPeers get all peers

func GetAccount

func GetAccount(w http.ResponseWriter, r *http.Request)

GetAccount query account info

func GetAccountBrief

func GetAccountBrief(w http.ResponseWriter, r *http.Request)

GetAccountBrief query account public key

func GetBlock

func GetBlock(w http.ResponseWriter, r *http.Request)

GetBlock query block

func GetBlockHeader

func GetBlockHeader() (*api.GetInfoResponse_Result, error)

func GetContract

func GetContract(contractName string) (*role.Contract, error)

func GetContractAbi

func GetContractAbi(w http.ResponseWriter, r *http.Request)

func GetContractCode

func GetContractCode(w http.ResponseWriter, r *http.Request)

func GetGenerateBlockTime

func GetGenerateBlockTime(w http.ResponseWriter, r *http.Request)

Node

func GetInfo

func GetInfo(w http.ResponseWriter, r *http.Request)

GetInfo query chain info

func GetKeyValue

func GetKeyValue(w http.ResponseWriter, r *http.Request)

func GetPeerStatebyAddress

func GetPeerStatebyAddress(w http.ResponseWriter, r *http.Request)

GetPeers get all peers

func GetTransaction

func GetTransaction(w http.ResponseWriter, r *http.Request)

GetTransaction get transaction by Trx hash

func GetTransactionStatus

func GetTransactionStatus(w http.ResponseWriter, r *http.Request)

func GetTransferCredit

func GetTransferCredit(w http.ResponseWriter, r *http.Request)

func GetTrxHashForSign

func GetTrxHashForSign(sender, contract, method string, param []byte, h *api.GetInfoResponse) ([]byte, *types.Transaction, error)

func JsonToBin

func JsonToBin(w http.ResponseWriter, r *http.Request)

func NewRouter

func NewRouter() *mux.Router

func ParseTransactionParam

func ParseTransactionParam(r role.RoleInterface, Param []byte, Contract string, Method string) (interface{}, error)

func PushTrx

func PushTrx(intTrx *types.Transaction) (comtool.ResponseStruct, error)

func PushTrxReq

func PushTrxReq(signature string, trx *types.BasicTransaction) (*message.PushTrxReq, error)

func ReviewProposal

func ReviewProposal(w http.ResponseWriter, r *http.Request)

func SendTransaction

func SendTransaction(w http.ResponseWriter, r *http.Request)

SendTransaction send transaction

func SetChainActorPid

func SetChainActorPid(tpid *actor.PID)

SetChainActorPid set chain actor pid

func SetRoleIntf

func SetRoleIntf(tpid role.RoleInterface, env *actionenv.ActorEnv)

SetChainActorPid set chain actor pid

func SetTrxPreHandleActorPid

func SetTrxPreHandleActorPid(tpid *actor.PID)

SetTrxActorPid set trx actor pid

Types

type ApiService

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

ApiService is actor service

type BlockTransaction

type BlockTransaction struct {
	Transaction     *Transaction
	ResourceReceipt *types.ResourceReceipt
	TrxHash         string
}

type ListWalletResponse_Result

type ListWalletResponse_Result struct {
	WalletPath  string `protobuf:"bytes,1,opt,name=wallet_path,json=walletPath" json:"wallet_path"`
	AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName" json:"account_name"`
}

type NewAccount

type NewAccount struct {
	Account   string ` json:"account"`
	PublicKey string `json:"public_key"`
}

type ResponseStruct

type ResponseStruct struct {
	Errcode uint32      `json:"errcode"`
	Msg     string      `json:"msg"`
	Result  interface{} `json:"result"`
}

type ResponseStructs

type ResponseStructs []ResponseStruct

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

type Routes

type Routes []Route

type Transaction

type Transaction struct {
	Version     uint32      `json:"version"`
	CursorNum   uint64      `json:"cursor_num"`
	CursorLabel uint32      `json:"cursor_label"`
	Lifetime    uint64      `json:"lifetime"`
	Sender      string      `json:"sender"`
	Contract    string      `json:"contract"`
	Method      string      `json:"method"`
	Param       interface{} `json:"param"`
	SigAlg      uint32      `json:"sig_alg"`
	Signature   string      `json:"signature"`
}

type TransactionStatus

type TransactionStatus struct {
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

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