util

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CodeVersion = 0xC0

Variables

This section is empty.

Functions

func BlockConvBase58Addr

func BlockConvBase58Addr(b *types.Block) string

func ConvBlockchainStatus added in v0.8.1

func ConvBlockchainStatus(in *types.BlockchainStatus) 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 DecodeCode

func DecodeCode(encodedCode string) ([]byte, error)

func EncodeCode

func EncodeCode(code []byte) string

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 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 TxConvBase58Addr

func TxConvBase58Addr(tx *types.Tx) 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 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
}

type InOutPeer added in v0.8.1

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

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
	Body *InOutTxBody
}

func ConvTx

func ConvTx(tx *types.Tx) *InOutTx

type InOutTxBody

type InOutTxBody struct {
	Nonce     uint64
	Account   string
	Recipient string
	Amount    string
	Payload   string
	Limit     uint64
	Price     string
	Type      types.TxType
	Sign      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

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