jsonrpc

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvNodeState

func ConvNodeState(msg *types.SingleBytes) interface{}

func ConvertUnit

func ConvertUnit(n *big.Int, unit string) (string, error)

func CovPayloadJson

func CovPayloadJson(tx *InOutTx)

CovPayloadJson unmarshal payload bytes and store it to member variable PayloadJson .

func MarshalJSON

func MarshalJSON(i interface{}) string

func ParseBase58Tx

func ParseBase58Tx(jsonTx []byte) ([]*types.Tx, error)

func ParseBase58TxBody

func ParseBase58TxBody(jsonTx []byte) (*types.TxBody, error)

func ParseTxBody

func ParseTxBody(tb *InOutTxBody) (msg *types.TxBody, err error)

func ParseUnit

func ParseUnit(s string) (*big.Int, error)

Types

type EncodingType

type EncodingType int
const (
	Raw EncodingType = 0 + iota
	Base58
	Obj
)

func ParseEncodingType added in v2.6.0

func ParseEncodingType(s string) EncodingType

type InOutAbi

type InOutAbi struct {
	Version        string           `json:"version"`
	Language       string           `json:"language"`
	Functions      []*InOutFunction `json:"functions"`
	StateVariables []*InOutStateVar `json:"stateVariables"`
}

func ConvAbi

func ConvAbi(msg *types.ABI) *InOutAbi

type InOutAccount

type InOutAccount struct {
	Address string `json:"address,omitempty"`
}

func ConvAccount

func ConvAccount(msg *types.Account) *InOutAccount

type InOutAccountList

type InOutAccountList struct {
	Accounts []*InOutAccount `json:"accounts,omitempty"`
}

func ConvAccounts

func ConvAccounts(msg *types.AccountList) *InOutAccountList

type InOutAccountVoteInfo

type InOutAccountVoteInfo struct {
	Staking *InOutStaking    `json:"staking,omitempty"`
	Voting  []*InOutVoteInfo `json:"voting,omitempty"`
}

func ConvInOutAccountVoteInfo

func ConvInOutAccountVoteInfo(msg *types.AccountVoteInfo) *InOutAccountVoteInfo

type InOutBLConfEntries

type InOutBLConfEntries struct {
	Enabled bool     `json:"enabled,omitempty"`
	Entries []string `json:"entries,omitempty"`
}

func ConvBLConfEntries

func ConvBLConfEntries(msg *types.BLConfEntries) *InOutBLConfEntries

type InOutBalance

type InOutBalance struct {
	Balance string `json:"balance"`
}

func ConvBalance

func ConvBalance(msg *types.State) *InOutBalance

type InOutBlock

type InOutBlock struct {
	Hash   string            `json:"hash,omitempty"`
	Header *InOutBlockHeader `json:"header,omitempty"`
	Body   *InOutBlockBody   `json:"body,omitempty"`
}

func ConvBlock

func ConvBlock(msg *types.Block) *InOutBlock

type InOutBlockBody

type InOutBlockBody struct {
	Txs []*InOutTx `json:"txs,omitempty"`
}

func ConvBlockBody

func ConvBlockBody(msg *types.BlockBody) *InOutBlockBody

type InOutBlockBodyPaged

type InOutBlockBodyPaged struct {
	Total  uint32     `json:"total,omitempty"`
	Offset uint32     `json:"offset,omitempty"`
	Size   uint32     `json:"size,omitempty"`
	Txs    []*InOutTx `json:"txs,omitempty"`
}

func ConvBlockBodyPaged

func ConvBlockBodyPaged(msg *types.BlockBodyPaged) *InOutBlockBodyPaged

type InOutBlockHeader

type InOutBlockHeader struct {
	ChainID          string `json:"chainID,omitempty"`
	Version          int32  `json:"version,omitempty"`
	PrevBlockHash    string `json:"prevBlockHash,omitempty"`
	BlockNo          uint64 `json:"blockNo,omitempty"`
	Timestamp        int64  `json:"timestamp,omitempty"`
	BlockRootHash    string `json:"blockRootHash,omitempty"`
	TxsRootHash      string `json:"txsRootHash,omitempty"`
	ReceiptsRootHash string `json:"receiptsRootHash,omitempty"`
	Confirms         uint64 `json:"confirms,omitempty"`
	PubKey           string `json:"pubKey,omitempty"`
	PeerID           string `json:"peerID,omitempty"`
	CoinbaseAccount  string `json:"coinbaseAccount,omitempty"`
	Sign             string `json:"sign,omitempty"`
	Consensus        string `json:"consensus,omitempty"`
}

func ConvBlockHeader

func ConvBlockHeader(msg *types.BlockHeader) *InOutBlockHeader

type InOutBlockHeaderList

type InOutBlockHeaderList struct {
	Blocks []*InOutBlock `json:"blocks"`
}

func ConvBlockHeaderList

func ConvBlockHeaderList(msg *types.BlockHeaderList) *InOutBlockHeaderList

type InOutBlockIdx

type InOutBlockIdx struct {
	BlockHash string `json:"blockHash,omitempty"`
	BlockNo   uint64 `json:"blockNo,omitempty"`
}

func ConvBlockIdx

func ConvBlockIdx(msg *types.NewBlockNotice) *InOutBlockIdx

type InOutBlockMetadata

type InOutBlockMetadata struct {
	Hash    string            `json:"hash,omitempty"`
	Header  *InOutBlockHeader `json:"header,omitempty"`
	Txcount int32             `json:"txcount,omitempty"`
	Size    int64             `json:"size,omitempty"`
}

func ConvBlockMetadata

func ConvBlockMetadata(msg *types.BlockMetadata) *InOutBlockMetadata

type InOutBlockMetadataList

type InOutBlockMetadataList struct {
	Blocks []*InOutBlockMetadata `json:"blocks,omitempty"`
}

func ConvListBlockMetadata

func ConvListBlockMetadata(msg *types.BlockMetadataList) *InOutBlockMetadataList

type InOutBlockTransactionCount

type InOutBlockTransactionCount struct {
	Count int `json:"count"`
}

func ConvBlockTransactionCount

func ConvBlockTransactionCount(msg *types.Block) *InOutBlockTransactionCount

type InOutBlockchainStatus

type InOutBlockchainStatus struct {
	Hash          string           `json:"hash"`
	Height        uint64           `json:"height"`
	ConsensusInfo *json.RawMessage `json:"consensusInfo,omitempty"`
	ChainIdHash   string           `json:"chainIdHash"`
	ChainStat     *json.RawMessage `json:"chainStat,omitempty"`
	ChainInfo     *InOutChainInfo  `json:"chainInfo,omitempty"`
}

func ConvBlockchainStatus

func ConvBlockchainStatus(msg *types.BlockchainStatus) *InOutBlockchainStatus

func ConvHexBlockchainStatus

func ConvHexBlockchainStatus(msg *types.BlockchainStatus) *InOutBlockchainStatus

type InOutCert

type InOutCert struct {
	CertVersion uint32    `json:"certVersion,omitempty"`
	ProducerID  string    `json:"producerID,omitempty"`
	CreateTime  time.Time `json:"createTime,omitempty"`
	ExpireTime  time.Time `json:"expireTime,omitempty"`
	AgentID     string    `json:"agentID,omitempty"`
	Addresses   []string  `json:"addresses,omitempty"`
}

func ConvCert

func ConvCert(msg *types.AgentCertificate) *InOutCert

type InOutChainId

type InOutChainId struct {
	Magic     string `json:"magic,omitempty"`
	Public    bool   `json:"public,omitempty"`
	Mainnet   bool   `json:"mainnet,omitempty"`
	Consensus string `json:"consensus,omitempty"`
	Version   int32  `json:"version,omitempty"`
}

func ConvChainId

func ConvChainId(msg *types.ChainId) *InOutChainId

type InOutChainInfo

type InOutChainInfo struct {
	Id               *InOutChainId `json:"id,omitempty"`
	BpNumber         uint32        `json:"bpNumber,omitempty"`
	MaxBlockSize     uint64        `json:"maxblocksize,omitempty"`
	MaxTokens        string        `json:"maxtokens,omitempty"`
	StakingMinimum   string        `json:"stakingminimum,omitempty"`
	Totalstaking     string        `json:"totalstaking,omitempty"`
	GasPrice         string        `json:"gasprice,omitempty"`
	NamePrice        string        `json:"nameprice,omitempty"`
	TotalVotingPower string        `json:"totalvotingpower,omitempty"`
	VotingReward     string        `json:"votingreward,omitempty"`
}

func ConvChainInfo

func ConvChainInfo(msg *types.ChainInfo) *InOutChainInfo

type InOutChainStats

type InOutChainStats struct {
	Report interface{} `json:"report,omitempty"`
}

func ConvChainStat

func ConvChainStat(msg *types.ChainStats) *InOutChainStats

type InOutChangeClusterStatus

type InOutChangeClusterStatus struct {
	State   string             `json:"status"`
	Error   string             `json:"error"`
	Members []*InOutMemberAttr `json:"members"`
}

type InOutCommitResult

type InOutCommitResult struct {
	Hash    string             `json:"hash,omitempty"`
	Error   types.CommitStatus `json:"error,omitempty"`
	Detail  string             `json:"detail,omitempty"`
	Message string             `json:"message,omitempty"`
}

func ConvCommitResult

func ConvCommitResult(msg *types.CommitResult) *InOutCommitResult

type InOutCommitResultList

type InOutCommitResultList struct {
	Results []*InOutCommitResult `json:"results,omitempty"`
}

func ConvCommitResultList

func ConvCommitResultList(msg *types.CommitResultList) *InOutCommitResultList

type InOutConfChange

type InOutConfChange struct {
	ID      uint64                `json:"ID,omitempty"`
	Type    raftpb.ConfChangeType `json:"type,omitempty"`
	NodeID  uint64                `json:"nodeID,omitempty"`
	Context string                `json:"context,omitempty"`
}

func ConvConfChange

func ConvConfChange(msg *raftpb.ConfChange) *InOutConfChange

type InOutConfChangeProgress

type InOutConfChangeProgress struct {
	State   int32              `json:"state,omitempty"`
	Err     string             `json:"err,omitempty"`
	Members []*InOutMemberAttr `json:"members,omitempty"`
}

type InOutConfigItem

type InOutConfigItem struct {
	Props map[string]string `json:"props,omitempty"`
}

func ConvConfigItem

func ConvConfigItem(msg *types.ConfigItem) *InOutConfigItem

type InOutConsensusInfo

type InOutConsensusInfo struct {
	Type string        `json:"type,omitempty"`
	Info interface{}   `json:"info,omitempty"`
	Bps  []interface{} `json:"bps,omitempty"`
}

func ConvConsensusInfo

func ConvConsensusInfo(msg *types.ConsensusInfo) *InOutConsensusInfo

type InOutContractVarProof

type InOutContractVarProof struct {
	Value             string `json:"value,omitempty"`
	Included          bool   `json:"included,omitempty"`
	MerkleProofLength int    `json:"merkleprooflength,omitempty"`
	Height            uint32 `json:"height,omitempty"`
}

func ConvContractVarProof

func ConvContractVarProof(msg *types.ContractVarProof) *InOutContractVarProof

type InOutEnterpriseConfig

type InOutEnterpriseConfig struct {
	Key    string   `json:"key,omitempty"`
	On     bool     `json:"on"`
	Values []string `json:"values"`
}

func ConvEnterpriseConfig

func ConvEnterpriseConfig(msg *types.EnterpriseConfig) *InOutEnterpriseConfig

type InOutEnterpriseTxStatus

type InOutEnterpriseTxStatus struct {
	Status   string                    `json:"status"`
	Ret      string                    `json:"ret"`
	CCStatus *InOutChangeClusterStatus `json:"change_cluster,omitempty"`
}

type InOutEventList

type InOutEventList struct {
	Events []*types.Event `json:"events,omitempty"`
}

func ConvEvents

func ConvEvents(msg *types.EventList) *InOutEventList

type InOutFunction

type InOutFunction struct {
	Name          string                   `json:"name"`
	Arguments     []*InOutFunctionArgument `json:"arguments"`
	Payable       bool                     `json:"payable"`
	View          bool                     `json:"view"`
	FeeDelegation bool                     `json:"feeDelegation"`
}

func ConvFunction

func ConvFunction(msg *types.Function) *InOutFunction

type InOutFunctionArgument

type InOutFunctionArgument struct {
	Name string `json:"name"`
}

func ConvFunctionArgument

func ConvFunctionArgument(msg *types.FnArgument) *InOutFunctionArgument

type InOutLongPeer

type InOutLongPeer struct {
	*InOutPeer   `json:",inline"`
	ProducerIDs  []string     `json:"producerIDs,omitempty"`
	Certificates []*InOutCert `json:"certificates,omitempty"`
}

func ConvLongPeer

func ConvLongPeer(msg *types.Peer) *InOutLongPeer

type InOutLongPeerList

type InOutLongPeerList struct {
	Peers []*InOutLongPeer `json:"peers,omitempty"`
}

func ConvLongPeerList

func ConvLongPeerList(msg *types.PeerList) *InOutLongPeerList

type InOutMemberAttr

type InOutMemberAttr struct {
	ID      uint64 `json:"ID,omitempty"`
	Name    string `json:"name,omitempty"`
	Address string `json:"address,omitempty"`
	PeerID  string `json:"peerID,omitempty"`
}

func ConvMemberAttr

func ConvMemberAttr(msg *types.MemberAttr) *InOutMemberAttr

type InOutMetrics

type InOutMetrics struct {
	Peers []*InOutPeerMetric `json:"peers,omitempty"`
}

func ConvMetrics

func ConvMetrics(msg *types.Metrics) *InOutMetrics

type InOutNameInfo

type InOutNameInfo struct {
	Name        string `json:"name"`
	Owner       string `json:"owner"`
	Destination string `json:"destination"`
}

func ConvNameInfo

func ConvNameInfo(msg *types.NameInfo) *InOutNameInfo

type InOutNodeState

type InOutNodeState struct {
	AccountsSvc map[string]interface{} `json:"AccountsSvc,omitempty"`
	ChainSvc    map[string]interface{} `json:"ChainSvc,omitempty"`
	MemPoolSvc  map[string]interface{} `json:"MemPoolSvc,omitempty"`
	RPCSvc      map[string]interface{} `json:"RPCSvc,omitempty"`
	SyncerSvc   map[string]interface{} `json:"SyncerSvc,omitempty"`
	MapSvc      map[string]interface{} `json:"mapSvc,omitempty"`
	P2pSvc      map[string]interface{} `json:"p2pSvc,omitempty"`
}

type InOutPayload

type InOutPayload struct {
	Name string        `json:"name,omitempty"`
	Arg  []interface{} `json:"arg,omitempty"`
}

type InOutPeer

type InOutPeer struct {
	Role      string            `json:"peerrole,omitempty"`
	Address   *InOutPeerAddress `json:"address,omitempty"`
	BestBlock *InOutBlockIdx    `json:"bestblock,omitempty"`
	LastCheck time.Time         `json:"lastCheck,omitempty"`
	State     string            `json:"state,omitempty"`
	Hidden    bool              `json:"hidden,omitempty"`
	SelfPeer  bool              `json:"selfpeer,omitempty"`
	Version   string            `json:"version,omitempty"`
}

func ConvPeer

func ConvPeer(msg *types.Peer) *InOutPeer

type InOutPeerAddress

type InOutPeerAddress struct {
	Address string `json:"address,omitempty"`
	Port    string `json:"port,omitempty"`
	PeerID  string `json:"peerID,omitempty"`
}

func ConvPeerAddress

func ConvPeerAddress(msg *types.PeerAddress) *InOutPeerAddress

type InOutPeerList

type InOutPeerList struct {
	Peers []*InOutPeer `json:"peers"`
}

func ConvPeerList

func ConvPeerList(msg *types.PeerList) *InOutPeerList

type InOutPeerMetric

type InOutPeerMetric struct {
	PeerID string `json:"peerID,omitempty"`
	SumIn  int64  `json:"sumIn,omitempty"`
	AvrIn  int64  `json:"avrIn,omitempty"`
	SumOut int64  `json:"sumOut,omitempty"`
	AvrOut int64  `json:"avrOut,omitempty"`
}

func ConvPeerMetric

func ConvPeerMetric(msg *types.PeerMetric) *InOutPeerMetric

type InOutQueryContract

type InOutQueryContract struct {
	Result string `json:"result"`
}

func ConvQueryContract

func ConvQueryContract(msg *types.SingleBytes) *InOutQueryContract

type InOutQueryContractState

type InOutQueryContractState struct {
	ContractProof *InOutStateAndPoof       `json:"contractProof,omitempty"`
	VarProofs     []*InOutContractVarProof `json:"varProofs,omitempty"`
}

func ConvQueryContractState

func ConvQueryContractState(msg *types.StateQueryProof) *InOutQueryContractState

type InOutReceipts

type InOutReceipts struct {
	Receipts []*types.Receipt `json:"receipts"`
	BlockNo  uint64           `json:"blockNo,omitempty"`
}

func ConvReceipts

func ConvReceipts(msg *types.Receipts) *InOutReceipts

type InOutServerInfo

type InOutServerInfo struct {
	Status map[string]string           `json:"status,omitempty"`
	Config map[string]*InOutConfigItem `json:"config,omitempty"`
}

func ConvServerInfo

func ConvServerInfo(msg *types.ServerInfo) *InOutServerInfo

type InOutShortPeerList

type InOutShortPeerList struct {
	Peers []string `json:"peers,omitempty"`
}

func ConvShortPeerList

func ConvShortPeerList(msg *types.PeerList) *InOutShortPeerList

type InOutStaking

type InOutStaking struct {
	Amount string `json:"amount,omitempty"`
	When   uint64 `json:"when,omitempty"`
}

func ConvStaking

func ConvStaking(msg *types.Staking) *InOutStaking

type InOutState

type InOutState struct {
	Nonce       uint64 `json:"nonce"`
	Balance     string `json:"balance"`
	Account     string `json:"account,omitempty"`
	Stake       string `json:"stake,omitempty"`
	Total       string `json:"total,omitempty"`
	VotingPower string `json:"votingpower,omitempty"`
	When        uint64 `json:"when,omitempty"`
	NextAction  uint64 `json:"nextaction,omitempty"`
	IsContract  bool   `json:"isContract"`
}

func ConvState

func ConvState(msg *types.State) *InOutState

type InOutStateAndPoof

type InOutStateAndPoof struct {
	Nonce             uint64 `json:"nonce"`
	Balance           string `json:"balance"`
	Account           string `json:"account,omitempty"`
	Included          bool   `json:"included,omitempty"`
	MerkleProofLength int    `json:"merkle proof length,omitempty"`
	Height            uint32 `json:"height,omitempty"`
}

func ConvStateAndPoof

func ConvStateAndPoof(msg *types.AccountProof) *InOutStateAndPoof

type InOutStateVar

type InOutStateVar struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Len  int32  `json:"len"`
}

func ConvStateVar

func ConvStateVar(msg *types.StateVar) *InOutStateVar

type InOutTx

type InOutTx struct {
	Hash string       `json:"hash,omitempty"`
	Body *InOutTxBody `json:"body,omitempty"`
}

func ConvTx

func ConvTx(msg *types.Tx, payloadType EncodingType) (tx *InOutTx)

func (*InOutTx) String

func (t *InOutTx) String() string

type InOutTxBody

type InOutTxBody struct {
	Nonce       uint64          `json:"nonce,omitempty"`
	Account     string          `json:"account,omitempty"`
	Recipient   string          `json:"recipient,omitempty"`
	Amount      string          `json:"amount,omitempty"`
	Payload     any             `json:"payload,omitempty"`
	PayloadJson *types.CallInfo `json:"payloadJson,omitempty"`
	GasLimit    uint64          `json:"gasLimit,omitempty"`
	GasPrice    string          `json:"gasPrice,omitempty"`
	Type        types.TxType    `json:"type,omitempty"`
	ChainIdHash string          `json:"chainIdHash,omitempty"`
	Sign        string          `json:"sign,omitempty"`
}

func ConvTxBody

func ConvTxBody(msg *types.TxBody, payloadType EncodingType) *InOutTxBody

func (*InOutTxBody) String

func (b *InOutTxBody) String() string

type InOutTxIdx

type InOutTxIdx struct {
	BlockHash string `json:"blockHash,omitempty"`
	Idx       int32  `json:"idx,omitempty"`
}

func ConvTxIdx

func ConvTxIdx(msg *types.TxIdx) *InOutTxIdx

type InOutTxInBlock

type InOutTxInBlock struct {
	TxIdx *InOutTxIdx `json:"txIdx"`
	Tx    *InOutTx    `json:"tx"`
}

func ConvTxInBlock

func ConvTxInBlock(msg *types.TxInBlock, payloadType EncodingType) *InOutTxInBlock

func (*InOutTxInBlock) String

func (t *InOutTxInBlock) String() string

type InOutVote

type InOutVote struct {
	Candidate string `json:"candidate,omitempty"`
	Amount    string `json:"amount,omitempty"`
}

func ConvVote

func ConvVote(msg *types.Vote, id string) *InOutVote

type InOutVoteInfo

type InOutVoteInfo struct {
	Id         string   `json:"id,omitempty"`
	Candidates []string `json:"candidates,omitempty"`
	Amount     string   `json:"amount,omitempty"`
}

func ConvVoteInfo

func ConvVoteInfo(msg *types.VoteInfo) *InOutVoteInfo

type InOutVotes

type InOutVotes struct {
	Votes []*InOutVote `json:"votes,omitempty"`
	Id    string       `json:"id,omitempty"`
}

func ConvVotes

func ConvVotes(msg *types.VoteList, id string) *InOutVotes

Jump to

Keyboard shortcuts

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