zclient

package
v0.0.0-...-78b1b1e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ZcashHost = "127.0.0.1"
	ZcashPort = 8232
	ZcashUser = "test"
	ZcashPw   = "pw"
)
View Source
const (
	DefaultInitialBlocks = 15
)
View Source
const ZcashClientErrorCode = 100

Variables

This section is empty.

Functions

func BlockGenerator

func BlockGenerator(zc ZcashClient) chan ZcashBlockResult

Types

type ZCashMockClient

type ZCashMockClient struct {
	InitialBlocks int
}

func NewDefaultMock

func NewDefaultMock() *ZCashMockClient

func (*ZCashMockClient) CallZcash

func (zc *ZCashMockClient) CallZcash(method string, zresult nativejson.RawMessage) ZCashResponse

func (*ZCashMockClient) CallZcashJson

func (zc *ZCashMockClient) CallZcashJson(method string, params []interface{}) ZCashResponse

func (*ZCashMockClient) GetBlockCount

func (zc *ZCashMockClient) GetBlockCount() (int, error)

func (*ZCashMockClient) GetZBlock

func (zc *ZCashMockClient) GetZBlock(height int) ZcashBlockResult

func (*ZCashMockClient) SendMany

func (zc *ZCashMockClient) SendMany(from string, to string, amount float32) ZCashResponse

func (*ZCashMockClient) SetHost

func (zc *ZCashMockClient) SetHost(host string)

func (*ZCashMockClient) SetPort

func (zc *ZCashMockClient) SetPort(port int)

func (*ZCashMockClient) SubmitBlock

func (zc *ZCashMockClient) SubmitBlock(zblk nativejson.RawMessage) error

func (*ZCashMockClient) SuggestBlock

func (zc *ZCashMockClient) SuggestBlock() ZcashBlockResult

func (*ZCashMockClient) ValidateBlock

func (zc *ZCashMockClient) ValidateBlock(zblk nativejson.RawMessage) error

type ZCashRequest

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

type ZCashRequestJson

type ZCashRequestJson struct {
	Params nativejson.RawMessage `json:"params"`
	Method string                `json:"method"`
	ID     string                `json:"id"`
}

type ZCashResponse

type ZCashResponse struct {
	Result nativejson.RawMessage `json:"result"`
	Error  *ZcashError           `json:"error"`
	ID     string                `json:"id"`
}

type ZcashBlockResult

type ZcashBlockResult struct {
	Block     nativejson.RawMessage `json:"block"`
	Timestamp int64                 `json:"timestamp"`
	Error     error
}

type ZcashClient

type ZcashClient interface {
	SetHost(host string)
	SetPort(port int)
	SendMany(from string, to string, amount float32) ZCashResponse
	GetBlockCount() (int, error)
	GetZBlock(height int) ZcashBlockResult
	ValidateBlock(zblk nativejson.RawMessage) error
	SubmitBlock(zblk nativejson.RawMessage) error
	SuggestBlock() ZcashBlockResult
	CallZcash(method string, zresult nativejson.RawMessage) ZCashResponse
	CallZcashJson(method string, params []interface{}) ZCashResponse
}

type ZcashError

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

func (*ZcashError) Error

func (zc *ZcashError) Error() error

type ZcashHTTPClient

type ZcashHTTPClient struct {
	Host     string
	Port     int
	User     string
	Password string
}

func (*ZcashHTTPClient) CallZcash

func (zc *ZcashHTTPClient) CallZcash(method string, zresult nativejson.RawMessage) ZCashResponse

func (*ZcashHTTPClient) CallZcashJson

func (zc *ZcashHTTPClient) CallZcashJson(method string, params []interface{}) ZCashResponse

func (*ZcashHTTPClient) GetBlockCount

func (zc *ZcashHTTPClient) GetBlockCount() (int, error)

func (*ZcashHTTPClient) GetCompleteHost

func (zc *ZcashHTTPClient) GetCompleteHost() string

func (*ZcashHTTPClient) GetHost

func (zc *ZcashHTTPClient) GetHost() string

func (*ZcashHTTPClient) GetPassword

func (zc *ZcashHTTPClient) GetPassword() string

func (*ZcashHTTPClient) GetPort

func (zc *ZcashHTTPClient) GetPort() int

func (*ZcashHTTPClient) GetUser

func (zc *ZcashHTTPClient) GetUser() string

func (*ZcashHTTPClient) GetZBlock

func (zc *ZcashHTTPClient) GetZBlock(height int) ZcashBlockResult

func (*ZcashHTTPClient) SendMany

func (zc *ZcashHTTPClient) SendMany(from string, to string, amount float32) ZCashResponse

func (*ZcashHTTPClient) SetHost

func (zc *ZcashHTTPClient) SetHost(host string)

func (*ZcashHTTPClient) SetPort

func (zc *ZcashHTTPClient) SetPort(port int)

func (*ZcashHTTPClient) SubmitBlock

func (zc *ZcashHTTPClient) SubmitBlock(zblk nativejson.RawMessage) error

func (*ZcashHTTPClient) SuggestBlock

func (zc *ZcashHTTPClient) SuggestBlock() ZcashBlockResult

func (*ZcashHTTPClient) ValidateBlock

func (zc *ZcashHTTPClient) ValidateBlock(zblk nativejson.RawMessage) error

Jump to

Keyboard shortcuts

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