rpc

package
v0.0.0-...-990a888 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(options *RpcOptions) (bool, error)

func Cmd

func Cmd(command string, options *RpcOptions, args ...interface{}) ([]byte, error)

func CmdAsSingleResult

func CmdAsSingleResult(command string, options *RpcOptions, args ...interface{}) (interface{}, error)

func GetRawMempool

func GetRawMempool(options *RpcOptions) ([]string, error)

func SendRawTransaction

func SendRawTransaction(rawTxn string, options *RpcOptions) (string, error)

Types

type MempoolRPCResult

type MempoolRPCResult struct {
	RpcRequest
	Result []string `json:"result"`
}

type RawTxIn

type RawTxIn struct {
	Txid      string `json:"txid"`
	Vout      uint32 `json:"vout"`
	ScriptSig string `json:"scriptSig"`
	Sequence  uint32 `json:"sequence"`
}

type RawTxOut

type RawTxOut struct {
	Value        float32 `json:"value"`
	ScriptPubKey string  `json:"scriptPubKey"`
}

type RawTxn

type RawTxn struct {
	Version  uint32     `json:"version"`
	Locktime uint32     `json:"locktime"`
	Vin      []RawTxIn  `json:"vin"`
	Vout     []RawTxOut `json:"vout"`
}

func CreateRawTransaction

func CreateRawTransaction(inputs UnspentTxs, outputs map[string]float32, options *RpcOptions) (RawTxn, error)

type RpcOptions

type RpcOptions struct {
	Host    string
	Port    string
	User    string
	Pass    string
	Testnet bool
}

type RpcRequest

type RpcRequest struct {
	Error struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
	Id string `json:"id"`
}

type SignedTx

type SignedTx struct {
	Hex      string `json:"hex"`
	Complete bool   `json:"complete"`
	Errors   []struct {
		Txid      string `json:"txid"`
		Vout      uint32 `json:"vout"`
		ScriptSig string `json:"scriptSig"`
		Sequence  uint32 `json:"sequence"`
		Error     string `json:"error"`
	} `json:"errors"`
}

func SignRawTransaction

func SignRawTransaction(txn RawTxn, prevTxns UnspentTxs, options *RpcOptions) (SignedTx, error)

type SignedTxRPCResult

type SignedTxRPCResult struct {
	RpcRequest
	Result SignedTx `json:"result`
}

type TxnBuf

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

type UnspentTx

type UnspentTx struct {
	Txid          string  `json:"txid"`
	Vout          int     `json:"vout"`
	Address       string  `json:"address,omitempty"`
	ScriptPubKey  string  `json:"scriptPubKey,omitempty"`
	Amount        float32 `json:"amount,omitempty"`
	Confirmations int64   `json:"confirmations,omitempty"`
	Spendable     bool    `json:"spendable,omitempty"`
	Solvable      bool    `json:"solvable,omitempty"`
	Priority      float32 `json:"priority,omitempty"`
}

type UnspentTxRPCResult

type UnspentTxRPCResult struct {
	RpcRequest
	Result UnspentTxs `json:"result"`
}

type UnspentTxs

type UnspentTxs []UnspentTx

func ListUnspent

func ListUnspent(options *RpcOptions) (UnspentTxs, error)

func (UnspentTxs) Len

func (slice UnspentTxs) Len() int

func (UnspentTxs) Less

func (slice UnspentTxs) Less(i, j int) bool

func (UnspentTxs) Swap

func (slice UnspentTxs) Swap(i, j int)

Jump to

Keyboard shortcuts

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