rpcclient

package
v0.0.0-...-4a17716 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 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 Block

type Block struct {
	Hash              string        `json:"hash"`
	Confirmations     int           `json:"confirmations"`
	Size              int           `json:"size"`
	Height            int           `json:"height"`
	Version           int           `json:"version"`
	MerkleRoot        string        `json:"merkleroot"`
	FinalSaplingRoot  string        `json:"finalsaplingroot"`
	TX                []Transaction `json:"tx"`
	Time              int64         `json:"time"`
	Nonce             string        `json:"nonce"`
	Difficulty        float64       `json:"difficulty"`
	PreviousBlockHash string        `json:"previousblockhash"`
	NextBlockHash     string        `json:"nextblockhash"`
	ValuePools        []ValuePool   `json:"valuePools"`
}

func (Block) NumberofTransactions

func (b Block) NumberofTransactions() int

func (Block) TransactionTypes

func (b Block) TransactionTypes() (tTXs, sTXs int)

type ChainTip

type ChainTip struct {
	Hash      string `json:"hash"`
	Height    int    `json:"height"`
	Branchlen int    `json:"branchlen"`
	Status    string `json:"status"`
}

type Client

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

func New

func New(config *ConnConfig) (*Client, error)

func (*Client) GetBestBlockHash

func (c *Client) GetBestBlockHash() (string, error)

func (*Client) GetBlockCount

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

func (*Client) GetBlockHash

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

func (*Client) GetBlockVerboseTx

func (c *Client) GetBlockVerboseTx(hash string) (*GetBlockVerboseResult, error)

func (*Client) GetBlockchainInfo

func (c *Client) GetBlockchainInfo() *GetBlockchainInfo

func (*Client) GetInfo

func (c *Client) GetInfo() *GetInfo

func (*Client) GetMempoolEntry

func (c *Client) GetMempoolEntry(txID string) (*string, error)

func (*Client) GetNetworkInfo

func (c *Client) GetNetworkInfo() (*GetNetworkInfo, error)

func (*Client) GetRawMempool

func (c *Client) GetRawMempool() ([]*chainhash.Hash, error)

func (*Client) GetRawTransaction

func (c *Client) GetRawTransaction(txid string) (string, error)

func (*Client) GetRawTransactionVerbose

func (c *Client) GetRawTransactionVerbose(txid string) (*Transaction, error)

func (*Client) ListUnspent

func (c *Client) ListUnspent() []Unspent

todo , asl Pranav if it's Ok to return upspent as an array

func (*Client) ListUnspentMinMaxAddresses

func (c *Client) ListUnspentMinMaxAddresses(minconf int, maxconf int, addresses []string) ([]Unspent, error)

func (*Client) SendRawTransaction

func (c *Client) SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (string, error)

func (*Client) SendRawTransactionCmd

func (c *Client) SendRawTransactionCmd(hexstring string, allowhighfees bool) (string, error)

type ConnConfig

type ConnConfig struct {
	// Host is the IP address and port of the RPC server you want to connect
	// to.
	Host string

	// User is the username to use to authenticate to the RPC server.
	User string

	// Pass is the passphrase to use to authenticate to the RPC server.
	Pass string
}

type GetBlockVerboseResult

type GetBlockVerboseResult struct {
	Hash             string        `json:"hash"`
	Confirmations    int           `json:"confirmations"`
	Size             int           `json:"size"`
	Height           int64         `json:"height"`
	Version          int           `json:"version"`
	MerkleRoot       string        `json:"merkleroot"`
	FinalSaplingRoot string        `json:"finalsaplingroot"`
	FinalOrchardRoot string        `json:"finalorchardroot"`
	Tx               []Transaction `json:"tx"`
	Time             int64         `json:"time"`
	Nonce            uint32        `json:"nonce"`
	Bits             string        `json:"bits"`
	Difficulty       float64       `json:"difficulty"`
	PreviousHash     string        `json:"previousblockhash"`
	NextHash         string        `json:"nextblockhash,omitempty"`
}

type GetBlockchainInfo

type GetBlockchainInfo struct {
	Chain                string  `json:"chain"`
	Blocks               int     `json:"blocks"`
	Difficulty           float64 `json:"difficulty"`
	VerificationProgress float64 `json:"verificationprogress"`
	SizeOnDisk           float64 `json:"size_on_disk"`
}

GetBlockchainInfo return the zcashd rpc `getblockchaininfo` status https://zcash-rpc.github.io/getblockchaininfo.html

type GetChainTips

type GetChainTips []ChainTip

GetChainTips Return information about all known tips in the block tree https://zcash-rpc.github.io/getchaintips.html

type GetDeprecationInfo

type GetDeprecationInfo struct {
	Version           int    `json:"version"`
	Subversion        string `json:"subversion"`
	DeprecationHeight int    `json:"deprecationheight"`
}

GetDeprecationInfo Returns an object containing current version and deprecation block height. Applicable only on mainnet. https://zcash-rpc.github.io/getdeprecationinfo.html

type GetInfo

type GetInfo struct {
	Version int `json:"version"`
}

GetInfo Returns an object containing various state info. https://zcash-rpc.github.io/getinfo.html

type GetMemPoolInfo

type GetMemPoolInfo struct {
	Size  float64 `json:"size"`
	Bytes float64 `json:"bytes"`
	Usage float64 `json:"usage"`
}

GetMemPoolInfo return the zcashd rpc `getmempoolinfo` https://zcash-rpc.github.io/getmempoolinfo.html

type GetNetworkInfo

type GetNetworkInfo struct {
	Version         uint32         `json:"version"`
	Subversion      string         `json:"subversion"`
	Protocolversion uint32         `json:"protocolversion"`
	Localservices   string         `json:"localservices"`
	Timeoffset      int64          `json:"timeoffset"`
	Connections     uint32         `json:"connections"`
	Networks        []Network      `json:"networks"`
	RelayFee        float64        `json:"relayfee"`
	Localaddresses  []LocalAddress `json:"localaddresses"`
	Warnings        string         `json:"warnings"`
}

GetNetworkInfoResult return the zcashd rpc `getnetworkinfo` https://zcash.github.io/rpc/getnetworkinfo.html

type GetPeerInfo

type GetPeerInfo []PeerInfo

GetPeerInfo Returns data about each connected network node https://zcash-rpc.github.io/getpeerinfo.html

type LocalAddress

type LocalAddress struct {
	Address string `json:"address"`
	Port    int    `json:"port"`
	Score   int    `json:"score"`
}

LocalAddress local address

type Network

type Network struct {
	Name                      string `json:"name"`
	Limited                   bool   `json:"limited"`
	Reachable                 bool   `json:"reachable"`
	Proxy                     string `json:"proxy"`
	ProxyRandomizeCredentials bool   `json:"proxy_randomize_credentials"`
}

Network network info

type PeerInfo

type PeerInfo struct {
	ID             int     `json:"id"`
	Addr           string  `json:"addr"`
	AddrLocal      string  `json:"addrlocal"`
	Services       string  `json:"services"`
	LastSend       int     `json:"lastsend"`
	LastRecv       int     `json:"lastrecv"`
	BytesSent      int     `json:"bytessent"`
	BytesRecv      int     `json:"bytesrecv"`
	Conntime       int     `json:"conntime"`
	Timeoffset     int     `json:"timeoffset"`
	PingTime       float64 `json:"pingtime"`
	PingWait       float64 `json:"pingwait"`
	Version        int     `json:"version"`
	Subver         string  `json:"subver"`
	Inbound        bool    `json:"inbound"`
	Startingheight int     `json:"startingheight"`
	Banscore       int     `json:"banscore"`
	SyncedHeaders  int     `json:"synced_headers"`
	SyncedBlocks   int     `json:"synced_blocks"`
}

type RawMemPool

type RawMemPool struct {
}

type ScriptPubKey

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

type ScriptPubKeyResult

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

ScriptPubKeyResult models the scriptPubKey data of a tx script. It is defined separately since it is used by multiple commands.

type ScriptSig

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

type TXOutSetInfo

type TXOutSetInfo struct {
	Height       int     `json:"height"`
	BestBlock    string  `json:"bestblock"`
	Transactions int     `json:"transactions"`
	TXOuts       int     `json:"txouts"`
	TotalAmount  float64 `json:"total_amount"`
}

type Transaction

type Transaction struct {
	Hex             string                   `json:"hex"`
	Txid            string                   `json:"txid"`
	Version         int                      `json:"version"`
	LockTime        int                      `json:"locktime"`
	ExpiryHeight    int                      `json:"expirtheight"`
	VIn             []VIn                    `json:"vin"`
	VOut            []VOut                   `json:"vout"`
	VJoinSplit      []VJoinSplitTX           `json:"vjoinsplit"`
	ValueBalance    float64                  `json:"valueBalance"`
	VShieldedSpend  []map[string]interface{} `json:"vShieldedSpend"`
	VShieldedOutput []map[string]interface{} `json:"vShieldedOutput"`
}

Transaction describes a zcash tranaction

func (Transaction) ContainsSapling

func (t Transaction) ContainsSapling() bool

ContainsSapling returns if a transaction contains sapling transaction data Check that there is a valueBalance value (positive or negative) Check that there is data for either VShieldedSpend or VShieldedOutput

func (Transaction) ContainsSprout

func (t Transaction) ContainsSprout() bool

ContainsSprout returns if a transaction contains sprout transaction data

func (Transaction) IsMixed

func (t Transaction) IsMixed() bool

IsMixed returns if the transaction contains transparent addresses and shielded transaction data

func (Transaction) IsShielded

func (t Transaction) IsShielded() bool

IsShielded returns if the transaction contains no transparent addresses

func (Transaction) IsTransparent

func (t Transaction) IsTransparent() bool

IsTransparent returns if the transaction contains no shielded addresses

func (Transaction) TransparentInAndOut

func (t Transaction) TransparentInAndOut() bool

TransparentInAndOut return if there are transparent inputs and outputs

type Unspent

type Unspent struct {
	TxID          string  `json:"txid"`
	VOut          uint32  `json:"vout"`
	Generated     bool    `json:"generated"`
	Address       string  `json:"address"`
	ScriptPubKey  string  `json:"scriptPubKey"`
	Amount        float64 `json:"amount"`
	AmountZat     float64 `json:"amountZat"`
	Confirmations int     `json:"confirmations"`
	RedeemScript  string  `json:"redeemScript"`
	Spendable     bool    `json:"spendable"`
}

type VIn

type VIn struct {
	Coinbase  string `json:"coinbase"`
	TxID      string `json:"txid"`
	VOut      int    `json:"vout"`
	ScriptSig ScriptSig
	Sequence  int `json:"sequemce"`
}

func (*VIn) IsCoinBase

func (v *VIn) IsCoinBase() bool

IsCoinBase returns a bool to show if a Vin is a Coinbase one or not.

type VJoinSplitTX

type VJoinSplitTX struct {
	VPubOld float64 `json:"vpub_old"`
	VPubNew float64 `json:"vpub_new"`
}

type VOut

type VOut struct {
	Value        float64
	N            int
	ScriptPubKey ScriptPubKey
}

type ValuePool

type ValuePool struct {
	ID            string  `json:"id"`
	Monitored     bool    `json:"monitored"`
	ChainValue    float64 `json:"chainValue"`
	ChainValueZat float64 `json:"chainValueZat"`
	ValueDelta    float64 `json:"valueDelta"`
	ValueDeltaZat float64 `json:"valueDeltaZat"`
}

type ZGetTotalBalance

type ZGetTotalBalance struct {
	Transparent string `json:"transparent"`
	Private     string `json:"private"`
	Total       string `json:"total"`
}

ZGetTotalBalance return the node's wallet balances https://zcash-rpc.github.io/z_gettotalbalance.html

Jump to

Keyboard shortcuts

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