Documentation ¶
Overview ¶
********************************************************************** # File Name: cita_method.go # Author: TiDao # mail: tidao2049@gmail.com # Created Time: 2020-09-11 13:19:39 ********************************************************************
********************************************************************** # File Name: main.go # Author: TiDao # mail: tidao2049@gmail.com # Created Time: 2020-09-09 11:38:46 ********************************************************************
********************************************************************** # File Name: http_method.go # Author: TiDao # mail: tidao2049@gmail.com # Created Time: 2020-04-20 16:41:52 ********************************************************************
Index ¶
- func Get(url string) ([]byte, error)
- func Post(url string, input []byte) ([]byte, error)
- type Bft
- type BodyFalse
- type BodyTrue
- type Bool
- type CallRequest
- type Error
- func BlockNumber(req *Request, Result *string, url string) (Error, error)
- func Call(req *Request, Result *string, url string) (Error, error)
- func GetBalance(req *Request, Result *string, url string) (Error, error)
- func GetBlockFalse(req *Request, Result *ResultBlockFalse, url string) (Error, error)
- func GetBlockHeader(req *Request, Result *string, url string) (Error, error)
- func GetBlockTrue(req *Request, Result *ResultBlockTrue, url string) (Error, error)
- func GetFilterChanges(req *Request, Result *[]string, url string) (Error, error)
- func GetFilterLogs(req *Request, Result *[]ResultLogs, url string) (Error, error)
- func GetLogs(req *Request, Result *[]ResultLogs, url string) (Error, error)
- func GetMetaData(req *Request, Result *ResultMetaData, url string) (Error, error)
- func GetStateProof(req *Request, Result *string, url string) (Error, error)
- func GetStorageAt(req *Request, Result *string, url string) (Error, error)
- func GetTransaction(req *Request, Result *ResultTransaction, url string) (Error, error)
- func GetTransactionProof(req *Request, Result *string, url string) (Error, error)
- func GetTransactionReceipt(req *Request, Result *ResultTransactionReceipt, url string) (Error, error)
- func GetVersion(req *Request, Result *ResultVersion, url string) (Error, error)
- func NewBlockFilter(req *Request, Result *string, url string) (Error, error)
- func NewFilter(req *Request, Result *string, url string) (Error, error)
- func PeerCount(req *Request, Result *string, url string) (Error, error)
- func PeersInfo(req *Request, Result *ResultPeerInfo, url string) (Error, error)
- func UninstallFilter(req *Request, Result *bool, url string) (Error, error)
- type Filter
- type Header
- type Logs
- type Proof
- type Request
- type Response
- type ResultBlockFalse
- type ResultBlockTrue
- type ResultLogs
- type ResultMetaData
- type ResultPeerInfo
- type ResultRawTransaction
- type ResultTransaction
- type ResultTransactionReceipt
- type ResultVersion
- type String
- type Transactions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bft ¶
type Bft struct { Proposal string `json:"proposal"` Height int32 `json:"height"` Round int32 `json:"round"` Commits map[string]string `json:"commits"` }
easyjson
func (Bft) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Bft) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Bft) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Bft) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type BodyFalse ¶
type BodyFalse struct {
Transactions []string `json:"transactions"`
}
easyjson
func (BodyFalse) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (BodyFalse) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*BodyFalse) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BodyFalse) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type BodyTrue ¶
type BodyTrue struct {
Transactions []ResultTransaction `json:"transactions"`
}
easyjson
func (BodyTrue) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (BodyTrue) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*BodyTrue) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BodyTrue) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type CallRequest ¶
type CallRequest struct { From string `json:"from,moitempty"` To string `json:"to"` Data string `json:"data,moitempt"` }
easyjson
func (CallRequest) MarshalEasyJSON ¶
func (v CallRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (CallRequest) MarshalJSON ¶
func (v CallRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*CallRequest) UnmarshalEasyJSON ¶
func (v *CallRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*CallRequest) UnmarshalJSON ¶
func (v *CallRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Error ¶
easyjson
func GetBlockFalse ¶
func GetBlockFalse(req *Request, Result *ResultBlockFalse, url string) (Error, error)
func GetBlockTrue ¶
func GetBlockTrue(req *Request, Result *ResultBlockTrue, url string) (Error, error)
func GetFilterChanges ¶
func GetFilterLogs ¶
func GetFilterLogs(req *Request, Result *[]ResultLogs, url string) (Error, error)
func GetMetaData ¶
func GetMetaData(req *Request, Result *ResultMetaData, url string) (Error, error)
func GetTransaction ¶
func GetTransaction(req *Request, Result *ResultTransaction, url string) (Error, error)
func GetTransactionProof ¶
func GetTransactionReceipt ¶
func GetTransactionReceipt(req *Request, Result *ResultTransactionReceipt, url string) (Error, error)
func GetVersion ¶
func GetVersion(req *Request, Result *ResultVersion, url string) (Error, error)
func (Error) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Error) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Error) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Error) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Filter ¶
type Filter struct { FromBlock string `json:"fromBlock,omitempty"` ToBlock string `json:"toBlock,omitempty"` Address []string `json:"address,omitempty"` Topics []string `json:"topics,omitempty"` }
easyjson
func (Filter) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Filter) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Filter) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Filter) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Header ¶
type Header struct { Timestamp time.Duration `json:"timestamp"` PrevHash string `json:"prevHash"` StateRoot string `json:"stateRoot"` TransactionsRoot string `json:"transactionsRoot"` ReceiptsRoot string `json:"receiptsRoot"` QuotaUsed string `json:"quotaUsed"` Number string `json:"number"` Proposer string `json:"proposer"` Proof Proof `json:"proof"` }
easyjson
func (Header) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Header) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Header) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Header) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Logs ¶
type Logs struct { Id int32 `json:"id"` Jsonrpc string `json:"jsonrpc"` Result []ResultLogs `json:"result,omitempty"` Error Error `json:"error,omitempty"` }
easyjson
func (Logs) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Logs) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Logs) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Logs) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Proof ¶
type Proof struct {
Bft Bft `json:"Bft"`
}
easyjson
func (Proof) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Proof) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Proof) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Proof) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Request ¶
type Request struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params []interface{} `json:"params"` Id int32 `json:"id"` }
requst body type easyjson
func (Request) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Request) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Request) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Request) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Response ¶
type Response struct { Id int32 `json:"id"` Jsonrpc string `json:"jsonrpc"` Result json.RawMessage `json:"result,omitempty"` Error Error `json:"error,omitempty"` }
response body type easyjson
func (Response) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Response) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Response) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Response) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ResultBlockFalse ¶
type ResultBlockFalse struct { Version int16 `json:"version"` Hash string `json:"hash"` Header Header `json:"header"` Body BodyFalse `json:"body"` }
easyjson
func (ResultBlockFalse) MarshalEasyJSON ¶
func (v ResultBlockFalse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultBlockFalse) MarshalJSON ¶
func (v ResultBlockFalse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultBlockFalse) UnmarshalEasyJSON ¶
func (v *ResultBlockFalse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultBlockFalse) UnmarshalJSON ¶
func (v *ResultBlockFalse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultBlockTrue ¶
type ResultBlockTrue struct { Version int16 `json:"version"` Hash string `json:"hash"` Header Header `json:"header"` Body BodyTrue `json:"body"` }
easyjson
func (ResultBlockTrue) MarshalEasyJSON ¶
func (v ResultBlockTrue) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultBlockTrue) MarshalJSON ¶
func (v ResultBlockTrue) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultBlockTrue) UnmarshalEasyJSON ¶
func (v *ResultBlockTrue) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultBlockTrue) UnmarshalJSON ¶
func (v *ResultBlockTrue) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultLogs ¶
type ResultLogs struct { Address string `json:"address"` Topic []string `json:"topic"` Data string `json:"data"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` TransactionIndex string `json:"transactionIndex"` TransactionHash string `json:"transactionHash"` LogIndex string `json:"logIndex"` TransactionLogIndex string `json:"transactionLogIndex"` }
easyjson
func (ResultLogs) MarshalEasyJSON ¶
func (v ResultLogs) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultLogs) MarshalJSON ¶
func (v ResultLogs) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultLogs) UnmarshalEasyJSON ¶
func (v *ResultLogs) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultLogs) UnmarshalJSON ¶
func (v *ResultLogs) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultMetaData ¶
type ResultMetaData struct { ChainId int16 `json:"chainId"` ChainIdV1 string `json:"chainIdV1"` ChainName string `json:"chainName"` Operator string `json:"operator"` GenesisTimestamp time.Duration `json:"genesisTimestamp"` Validators []string `json:"validators"` BlockInterval time.Duration `json:"blockInterval"` TokenName string `json:"tokenName"` TokenAvatar string `json:"tokenAvatar"` Version int32 `json:"version"` EconomicalModel int16 `json:"economicalModel"` Website string `json:"website,omitempty"` }
chainId, Integer - version < 1 时的 chain_id, 用来防止重放攻击 chainIdV1, Quantity - version > 1 时的 chain_id chainName, String - 链名称 operator, String - 链的运营者 genesisTimestamp, Integer - 创世块时间戳 validators, [Data20] - 验证者地址集合 blockInterval Integer - 出块间隔 tokenName, String - Token 名称 tokenSymbol, String - Token 标识 tokenAvatar, String - Token 标志 version, Integer - 链版本 economicalModel, EconomicalModel - 链经济模型 easyjson
func (ResultMetaData) MarshalEasyJSON ¶
func (v ResultMetaData) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultMetaData) MarshalJSON ¶
func (v ResultMetaData) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultMetaData) UnmarshalEasyJSON ¶
func (v *ResultMetaData) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultMetaData) UnmarshalJSON ¶
func (v *ResultMetaData) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultPeerInfo ¶
type ResultPeerInfo struct { Amount int32 `json:"amount"` Peers map[string]string `json:"peers"` ErrorMessage string `json:"errorMessage"` }
easyjson
func (ResultPeerInfo) MarshalEasyJSON ¶
func (v ResultPeerInfo) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultPeerInfo) MarshalJSON ¶
func (v ResultPeerInfo) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultPeerInfo) UnmarshalEasyJSON ¶
func (v *ResultPeerInfo) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultPeerInfo) UnmarshalJSON ¶
func (v *ResultPeerInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultRawTransaction ¶
easyjson
func (ResultRawTransaction) MarshalEasyJSON ¶
func (v ResultRawTransaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultRawTransaction) MarshalJSON ¶
func (v ResultRawTransaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultRawTransaction) UnmarshalEasyJSON ¶
func (v *ResultRawTransaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultRawTransaction) UnmarshalJSON ¶
func (v *ResultRawTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultTransaction ¶
type ResultTransaction struct { Hash string `json:"hash,omitempty"` Content string `json:"content,omitempty"` From string `json:"from,omitempty"` BlockNumber string `json:"blockNumber,omitempty"` BlockHash string `json:"blockHash,omitempty"` Index string `json:"index,omitempty'` }
easyjson
func (ResultTransaction) MarshalEasyJSON ¶
func (v ResultTransaction) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultTransaction) MarshalJSON ¶
func (v ResultTransaction) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultTransaction) UnmarshalEasyJSON ¶
func (v *ResultTransaction) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultTransaction) UnmarshalJSON ¶
func (v *ResultTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultTransactionReceipt ¶
type ResultTransactionReceipt struct { TransactionHash string `json:"transactionHash"` TransactionIndex string `json"transactionIndex"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` CumulativeQuotaUsed string `json:"cumulativeQuotaUsed"` QuotaUsed string `json:"quotaUsed"` ConstractAddress string `json:"constractAddress"` Logs []ResultLogs `json:"logs"` Root string `json:"root"` LogsBloom string `json:"logsBloom"` }
Object - 回执对象: transactionHash: Data32 - 交易哈希 transactionIndex: Quantity - 交易 index blockHash: Data32 - 交易所在块的块哈希 blockNumber: Quantity - 交易所在块的块高度 cumulativeQuotaUsed: Quantity - 块中该交易之前(包含该交易)的所有交易消耗的 quota 总量 quotaUsed: Quantity - 交易消耗的 quota 数量 contractAddress: Data20 - 如果是部署合约, 这个地址指的是新创建出来的合约地址. 否则为空 logs: Array - 交易产生的日志集合 root: Data32 - 状态树根 errorMessage: String 错误信息
回执错误: No transaction permission - 没有发交易权限 No contract permission - 没有创建合约权限 Not enough base quota - 基础配额 不够 Block quota limit reached - 达到块配额限制 Account quota limit reached - 达到账户配额限制 Out of quota - 配额不够 Jump position wasn't marked with JUMPDEST instruction - EVM 内部错误 Instruction is not supported - EVM 内部错误 Not enough stack elements to execute instruction - EVM 内部错误 Execution would exceed defined Stack Limit - EVM 内部错误 EVM internal error - EVM 内部错误 Mutable call in static context - EVM 内部错误 Out of bounds - EVM 内部错误 Reverted - EVM 内部错误,REVERTED instruction
easyjson
func (ResultTransactionReceipt) MarshalEasyJSON ¶
func (v ResultTransactionReceipt) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultTransactionReceipt) MarshalJSON ¶
func (v ResultTransactionReceipt) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultTransactionReceipt) UnmarshalEasyJSON ¶
func (v *ResultTransactionReceipt) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultTransactionReceipt) UnmarshalJSON ¶
func (v *ResultTransactionReceipt) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ResultVersion ¶
type ResultVersion struct {
SoftwareVersion string `json:"softwareVersion"`
}
easyjson
func (ResultVersion) MarshalEasyJSON ¶
func (v ResultVersion) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultVersion) MarshalJSON ¶
func (v ResultVersion) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultVersion) UnmarshalEasyJSON ¶
func (v *ResultVersion) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultVersion) UnmarshalJSON ¶
func (v *ResultVersion) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Transactions ¶
easyjson
func (Transactions) MarshalEasyJSON ¶
func (v Transactions) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Transactions) MarshalJSON ¶
func (v Transactions) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Transactions) UnmarshalEasyJSON ¶
func (v *Transactions) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Transactions) UnmarshalJSON ¶
func (v *Transactions) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface