xrpc

package
v0.0.0-...-d2b8996 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeaderResult

type BlockHeaderResult struct {
	Hash              string  `json:"hash"`
	Confirmations     int64   `json:"confirmations"`
	Height            int64   `json:"height"`
	Version           int64   `json:"version"`
	VersionHex        string  `json:"versionHex"`
	MerkleRoot        string  `json:"merkleroot"`
	Time              uint64  `json:"time"`
	MedianTime        int64   `json:"mediantime"`
	Nonce             int64   `json:"nonce"`
	Bits              string  `json:"bits"`
	Difficulty        float64 `json:"difficulty"`
	ChainWork         string  `json:"chainwork"`
	PreviousBlockHash []byte  `json:"previousblockhash"`
	NextBlockHash     []byte  `json:"nextblockhash"`
}

BlockHeaderResult -- response for `GetBlockHeader` RPC call.

type BlockResult

type BlockResult struct {
	Hash          string              `json:"hash"`
	Confirmations uint64              `json:"confirmations"`
	StrippedSize  int32               `json:"strippedsize"`
	Size          int32               `json:"size"`
	Weight        int32               `json:"weight"`
	Height        int64               `json:"height"`
	Version       int32               `json:"version"`
	VersionHex    string              `json:"versionHex"`
	MerkleRoot    string              `json:"merkleroot"`
	Tx            []TransactionResult `json:"tx,omitempty"`
	NTx           uint32              `json:"nTx"`
	Time          int64               `json:"time"`
	Nonce         uint32              `json:"nonce"`
	Bits          string              `json:"bits"`
	Difficulty    float64             `json:"difficulty"`
	ChainWork     string              `json:"chainwork"`
	PreviousHash  string              `json:"previousblockhash"`
	NextHash      string              `json:"nextblockhash,omitempty"`
}

BlockResult --

type Client

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

Client -- RPC client.

func NewClient

func NewClient(host string, user string, pass string) *Client

NewClient -- creates Client.

func (*Client) GetBlock

func (c *Client) GetBlock(hash string) (*BlockResult, error)

GetBlock -- gets verbose block by hash.

func (*Client) GetBlockCount

func (c *Client) GetBlockCount() (int, error)

GetBlockCount -- gets block number of blocks in the longest blockchain.

func (*Client) GetBlockHash

func (c *Client) GetBlockHash(height int) (string, error)

GetBlockHash -- get block hash by height.

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(hash string) (*BlockHeaderResult, error)

GetBlockHeader -- gets block header by block hash.

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Error --

type Request

type Request struct {
	Method string        `json:"method"`
	Params []interface{} `json:"params"`
	ID     uint64        `json:"id"`
}

Request -- request for RPC.

type Response

type Response struct {
	ID     uint64           `json:"id"`
	Result *json.RawMessage `json:"result"`
	Error  *Error           `json:"error"`
}

Response -- response for RPC.

type ScriptPubKey

type ScriptPubKey struct {
	Asm       string   `json:"asm"`
	Hex       string   `json:"hex"`
	ReqSigs   int      `json:"reqSigs,omitempty"`
	Type      string   `json:"type"`
	Addresses []string `json:"addresses,omitempty"`
}

ScriptPubKey --

type ScriptSig

type ScriptSig struct {
	Asm string `json:"asm"`
	Hex string `json:"hex"`
}

ScriptSig --

type TransactionResult

type TransactionResult struct {
	Hex      string `json:"hex"`
	Txid     string `json:"txid"`
	Version  int32  `json:"version"`
	Size     uint32 `json:"size"`
	Vsize    uint32 `json:"vsize"`
	Weight   uint32 `json:"weight"`
	LockTime uint32 `json:"locktime"`
	Vin      []Vin  `json:"vin"`
	Vout     []Vout `json:"vout"`
}

TransactionResult -- a raw transaction.

type Vin

type Vin struct {
	Coinbase  string    `json:"coinbase"`
	Txid      string    `json:"txid"`
	Vout      int       `json:"vout"`
	ScriptSig ScriptSig `json:"scriptSig"`
	Sequence  uint32    `json:"sequence"`
}

Vin -- vin.

type Vout

type Vout struct {
	Value        float64      `json:"value"`
	N            int          `json:"n"`
	ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
}

Vout -- vout.

Jump to

Keyboard shortcuts

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