rpc

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Amount uint64 `json:"amount"`
}

type BaseClient

type BaseClient struct {
	// contains filtered or unexported fields
}

func (*BaseClient) ReadResponse

func (bk *BaseClient) ReadResponse(resp *resty.Response) ([]byte, error)

type Block

type Block struct {
	// contains filtered or unexported fields
}

func (*Block) GetByHash

func (blk *Block) GetByHash(hash string) (*BlockResponse, error)

func (*Block) GetByHeight

func (blk *Block) GetByHeight(height uint32) (*BlockResponse, error)

type BlockResponse

type BlockResponse struct {
	Header       *Header      `json:"header"` // block headero
	Transactions []*crypto.Tx `json:"txns"`   // Block transactions, in format of "tx" command
}

type Client

type Client struct {
	Wallet *Wallet
	Tx     *Tx
	Block  *Block
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseAddress string) *Client

func (*Client) NodeInfo

func (cl *Client) NodeInfo() (*response.Node, error)

type ErrorResponse

type ErrorResponse struct {
	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}
type Header struct {
	Type        uint32 `json:"type"`         // Block type
	Hash        string `json:"hash"`         // Hash
	Height      uint32 `json:"height"`       // Height
	Size        uint64 `json:"size"`         // Size
	Version     uint32 `json:"version"`      // Block version information (note, this is signed)
	PrevBlock   string `json:"prev_block"`   // The hash value of the previous block this particular block references
	MerkleRoot  string `json:"merkle_root"`  // The reference to a Merkle tree collection which is a hash of all transactions related to this block
	Timestamp   uint32 `json:"timestamp"`    // A timestamp recording when this block was created (Will overflow in 2106[2])
	Bits        uint32 `json:"bits"`         // Not used
	Nonce       uint32 `json:"nonce"`        // The nonce used to generate this block… to allow variations of the header and compute different hashes
	Seed        string `json:"seed"`         // The random seed, not used
	TxnCount    uint32 `json:"txn_count"`    // Transaction count
	AdviceCount uint32 `json:"advice_count"` // Advise list count
	Script      string `json:"script"`       // The node's (block owner) signature
}

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

func (*Tx) GetByHashList

func (tx *Tx) GetByHashList(hashes ...string) ([]TxResponse, error)

func (*Tx) GetHashListByAddress

func (tx *Tx) GetHashListByAddress(address string) ([]string, error)

func (*Tx) GetHashListByHeight

func (tx *Tx) GetHashListByHeight(height int) ([]string, error)

func (*Tx) Publish

func (tx *Tx) Publish(txData crypto.Tx) (*TxPublishResponse, error)

func (*Tx) Validate

func (tx *Tx) Validate(txData crypto.Tx) error

type TxPublishResponse

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

type TxResponse

type TxResponse struct {
	Size               uint32 `json:"size"`
	Block              string `json:"block"` // block hash
	Confirmed          uint32 `json:"confirmed"`
	ConfirmedTimestamp uint32 `json:"confirmed_timestamp"`
	Total              int    `json:"total,omitempty"`
	*crypto.Tx
}

func (*TxResponse) UnmarshalJSON

func (txr *TxResponse) UnmarshalJSON(data []byte) error

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

func (*Wallet) GetBalance

func (w *Wallet) GetBalance(address string) (uint64, error)

func (*Wallet) GetUnspent

func (w *Wallet) GetUnspent(address string) ([]*crypto.TransactionInputOutpoint, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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