rpc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockTplTransaction

type BlockTplTransaction struct {
	Data string `json:"data"`
	TxId string `json:"txid"`
	Fee  int64  `json:"fee"`
}

type CoinBaseAux

type CoinBaseAux struct {
	Flags string `json:"flags"`
}

type GetBlockReply

type GetBlockReply struct {
	Height       uint32  `json:"height"`
	Hash         string  `json:"hash"`
	Nonce        uint32  `json:"nonce"`
	Difficulty   float64 `json:"difficulty"`
	Transactions []Tx    `json:"tx"`
}

type GetBlockTemplateReplyPart

type GetBlockTemplateReplyPart struct {
	Version                  uint32                `json:"version"`
	PreviousBlockHash        string                `json:"previousblockhash"`
	Transactions             []BlockTplTransaction `json:"transactions"`
	CoinBaseAux              CoinBaseAux           `json:"coinbaseaux"`
	CoinBaseValue            int64                 `json:"coinbasevalue"`
	CurTime                  uint32                `json:"curtime"`
	Bits                     string                `json:"bits"`
	Target                   string                `json:"target"`
	Height                   uint32                `json:"height"`
	DefaultWitnessCommitment string                `json:"default_witness_commitment"`
}

type JSONRpcResp

type JSONRpcResp struct {
	Id     *json.RawMessage       `json:"id"`
	Result *json.RawMessage       `json:"result"`
	Error  map[string]interface{} `json:"error"`
}

type MasterNode

type MasterNode struct {
	Payee  string `json:"payee"`
	Script string `json:"script"`
	Amount int64  `json:"amount"`
}

type RPCClient

type RPCClient struct {
	sync.RWMutex
	Url  string
	Name string
	// contains filtered or unexported fields
}

func NewRPCClient

func NewRPCClient(name, url, timeout string) *RPCClient

func (*RPCClient) Check

func (r *RPCClient) Check() bool

func (*RPCClient) GetBlockByHash

func (r *RPCClient) GetBlockByHash(hash string) (*GetBlockReply, error)

func (*RPCClient) GetBlockHashByHeight

func (r *RPCClient) GetBlockHashByHeight(height int64) (string, error)

func (*RPCClient) GetPendingBlock

func (r *RPCClient) GetPendingBlock() (*GetBlockTemplateReplyPart, error)

func (*RPCClient) GetPrevBlockHash

func (r *RPCClient) GetPrevBlockHash() (string, error)

func (*RPCClient) Sick

func (r *RPCClient) Sick() bool

func (*RPCClient) SubmitBlock

func (r *RPCClient) SubmitBlock(params []interface{}) error

type Tx

type Tx struct {
	TxId string `json:"txid"`
	Vin  []Vin  `json:"vin"`
	Vout []Vout `json:"vout"`
}

type TxReceipt

type TxReceipt struct {
	TxHash    string `json:"transactionHash"`
	GasUsed   string `json:"gasUsed"`
	BlockHash string `json:"blockHash"`
	Status    string `json:"status"`
}

func (*TxReceipt) Confirmed

func (r *TxReceipt) Confirmed() bool

func (*TxReceipt) Successful

func (r *TxReceipt) Successful() bool

Use with previous method

type Vin

type Vin struct {
	PrevOutHash string `json:"txid"`
	PrevOutN    uint32 `json:"vout"`
}

type Vout

type Vout struct {
	Value    float64 `json:"value"`
	ValueSat int64   `json:"valueSat"`
	N        uint32  `json:"n"`
}

Jump to

Keyboard shortcuts

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