util

package
v0.0.0-...-2c813a9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B58JSON

func B58JSON(i interface{}) string

func BlockConvBase58Addr

func BlockConvBase58Addr(b *types.Block) string

func ConvBlockchainStatus

func ConvBlockchainStatus(in *types.BlockchainStatus) string

func ConvChainInfoMsg

func ConvChainInfoMsg(msg *types.ChainInfo) string

func ConvHexBlockchainStatus

func ConvHexBlockchainStatus(in *types.BlockchainStatus) string

func ConvertUnit

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

func FillTxBody

func FillTxBody(source *InOutTxBody, target *types.TxBody) error

func GetClient

func GetClient(serverAddr string, opts []grpc.DialOption) interface{}

func GetConn

func GetConn(serverAddr string, opts []grpc.DialOption) *grpc.ClientConn

func JSON

func JSON(pb protobuf.Message) string

JSON converts protobuf message(struct) to json notation

func LongPeerListToString

func LongPeerListToString(p *types.PeerList) string

func ParseBase58Tx

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

func ParseBase58TxBody

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

func ParseUnit

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

func PeerListToString

func PeerListToString(p *types.PeerList) string

func ShortPeerListToString

func ShortPeerListToString(p *types.PeerList) string

func TxConvBase58Addr

func TxConvBase58Addr(tx *types.Tx) string

func TxConvBase58AddrEx

func TxConvBase58AddrEx(tx *types.Tx, payloadType EncodingType) string

func TxInBlockConvBase58Addr

func TxInBlockConvBase58Addr(txInBlock *types.TxInBlock) string

Types

type ConnClient

type ConnClient struct {
	types.MeyCoinRPCServiceClient
	// contains filtered or unexported fields
}

func (*ConnClient) Close

func (c *ConnClient) Close()

type EncodingType

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

type InOutBlock

type InOutBlock struct {
	Hash   string
	Header InOutBlockHeader
	Body   InOutBlockBody
}

func ConvBlock

func ConvBlock(b *types.Block) *InOutBlock

type InOutBlockBody

type InOutBlockBody struct {
	Txs []*InOutTx
}

type InOutBlockHeader

type InOutBlockHeader struct {
	ChainID          string
	PrevBlockHash    string
	BlockNo          uint64
	Timestamp        int64
	BlockRootHash    string
	TxRootHash       string
	ReceiptsRootHash string
	Confirms         uint64
	PubKey           string
	Sign             string
	CoinbaseAccount  string
	Consensus        string
}

type InOutBlockIdx

type InOutBlockIdx struct {
	BlockHash string
	BlockNo   uint64
}

type InOutBlockchainStatus

type InOutBlockchainStatus struct {
	Hash          string
	Height        uint64
	ConsensusInfo *json.RawMessage `json:",omitempty"`
	ChainIdHash   string
	ChainStat     *json.RawMessage `json:",omitempty"`
	ChainInfo     *InOutChainInfo  `json:",omitempty"`
}

type InOutCert

type InOutCert struct {
	CertVersion uint32
	ProducerID  string
	CreateTime  time.Time
	ExpireTime  time.Time
	AgentID     string
	Addresses   []string
}

type InOutChainId

type InOutChainId struct {
	Magic     string
	Public    bool
	Mainnet   bool
	Consensus string
	Version   int32
}

type InOutChainInfo

type InOutChainInfo struct {
	Chainid          InOutChainId
	BpNumber         uint32
	MaxBlockSize     uint64
	MaxTokens        string
	StakingMinimum   string `json:",omitempty"`
	StakingTotal     string `json:",omitempty"`
	GasPrice         string `json:",omitempty"`
	NamePrice        string `json:",omitempty"`
	TotalVotingPower string `json:",omitempty"`
	VotingReward     string `json:",omitempty"`
}

type InOutPeer

type InOutPeer struct {
	Role      string
	Address   InOutPeerAddress
	BestBlock InOutBlockIdx
	LastCheck time.Time
	State     string
	Hidden    bool
	Self      bool
	Version   string
}

func ConvPeer

func ConvPeer(p *types.Peer) *InOutPeer

type InOutPeerAddress

type InOutPeerAddress struct {
	Address string
	Port    string
	PeerId  string
}

type InOutTx

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

func ConvTx

func ConvTx(tx *types.Tx) *InOutTx

func ConvTxEx

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

func (*InOutTx) String

func (t *InOutTx) String() string

type InOutTxBody

type InOutTxBody struct {
	Nonce       uint64       `json:",omitempty"`
	Account     string       `json:",omitempty"`
	Recipient   string       `json:",omitempty"`
	Amount      string       `json:",omitempty"`
	Payload     string       `json:",omitempty"`
	GasLimit    uint64       `json:",omitempty"`
	GasPrice    string       `json:",omitempty"`
	Type        types.TxType `json:",omitempty"`
	ChainIdHash string       `json:",omitempty"`
	Sign        string       `json:",omitempty"`
}

func (*InOutTxBody) String

func (b *InOutTxBody) String() string

type InOutTxIdx

type InOutTxIdx struct {
	BlockHash string
	Idx       int32
}

type InOutTxInBlock

type InOutTxInBlock struct {
	TxIdx *InOutTxIdx
	Tx    *InOutTx
}

func ConvTxInBlock

func ConvTxInBlock(txInBlock *types.TxInBlock) *InOutTxInBlock

func ConvTxInBlockEx

func ConvTxInBlockEx(txInBlock *types.TxInBlock, payloadType EncodingType) *InOutTxInBlock

func (*InOutTxInBlock) String

func (t *InOutTxInBlock) String() string

type LongInOutPeer

type LongInOutPeer struct {
	InOutPeer
	ProducerIDs  []string
	Certificates []*InOutCert
}

func ConvPeerLong

func ConvPeerLong(p *types.Peer) *LongInOutPeer

Directories

Path Synopsis
Package encoding defines interfaces shared by other packages that convert data to and from byte-level and textual representations.
Package encoding defines interfaces shared by other packages that convert data to and from byte-level and textual representations.
json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.

Jump to

Keyboard shortcuts

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