util

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B58JSON added in v1.3.3

func B58JSON(i interface{}) string

func BlockConvBase58Addr

func BlockConvBase58Addr(b *types.Block) string

func ConvBlockchainStatus added in v0.8.1

func ConvBlockchainStatus(in *types.BlockchainStatus) string

func ConvChainInfoMsg added in v1.3.3

func ConvChainInfoMsg(msg *types.ChainInfo) string

func ConvHexBlockchainStatus

func ConvHexBlockchainStatus(in *types.BlockchainStatus) string

func ConvertUnit added in v0.8.2

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 JSON

func JSON(pb protobuf.Message) string

JSON converts protobuf message(struct) to json notation

func LongPeerListToString added in v1.3.3

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 added in v0.8.2

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

func PeerListToString added in v0.8.1

func PeerListToString(p *types.PeerList) string

func ShortPeerListToString added in v1.3.3

func ShortPeerListToString(p *types.PeerList) string

func TxConvBase58Addr

func TxConvBase58Addr(tx *types.Tx) string

func TxConvBase58AddrEx added in v1.3.3

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

func TxInBlockConvBase58Addr

func TxInBlockConvBase58Addr(txInBlock *types.TxInBlock) string

Types

type ConnClient

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

func (*ConnClient) Close

func (c *ConnClient) Close()

type EncodingType added in v1.3.3

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
}

type InOutBlockIdx added in v0.8.1

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 added in v1.3.3

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

type InOutChainId added in v1.3.3

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

type InOutChainInfo added in v1.3.3

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"`
}

type InOutPeer added in v0.8.1

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

func ConvPeer added in v0.8.1

func ConvPeer(p *types.Peer) *InOutPeer

type InOutPeerAddress added in v0.8.1

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 added in v1.3.3

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

func (*InOutTx) String added in v1.3.3

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 added in v1.3.3

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 added in v1.3.3

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

func (*InOutTxInBlock) String added in v1.3.3

func (t *InOutTxInBlock) String() string

type LongInOutPeer added in v1.3.3

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

func ConvPeerLong added in v1.3.3

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