Documentation
¶
Index ¶
- Constants
- func NewGetBlock(is int) []byte
- func NewGetTransaction(id string) []byte
- func NewZGetTotalBalance(minConfirmations int) []byte
- func NewZListAddresses() []byte
- func NewZListReceivedByAddress(fromAddress string) []byte
- func NewZSendMany(fromAddress string, amounts []ZcashAmount) []byte
- func NewZValidateAddress(address string) []byte
- type Block
- type Hex
- type Method
- type Transaction
- type ZGetTotalBalanceResponse
- type ZValidateAddressResponse
- type ZcashAmount
- type ZcashClient
- type ZcashResult
- type ZcashTransaction
Constants ¶
const ( GetBlock Method = "getblock" GetTransaction Method = "gettransaction" ZGetTotalBalance = "z_gettotalbalance" ZListAddresses = "z_listaddresses" ZListReceivedByAddress = "z_listreceivedbyaddress" ZSendMany = "z_sendmany" ZValidateAddress = "z_validateaddress" )
Constant block of Method assignments
Variables ¶
This section is empty.
Functions ¶
func NewGetBlock ¶
NewGetBlock constructs a properly formatted getblock request
func NewGetTransaction ¶
NewGetTransaction constructs a properly formatted gettransaction request
func NewZGetTotalBalance ¶
NewZGetTotalBalance constructs a properly formatted z_gettotalbalance request
func NewZListAddresses ¶
func NewZListAddresses() []byte
NewZListAddresses constructs a properly formatted z_listaddresses request
func NewZListReceivedByAddress ¶
NewZListReceivedByAddress constructs a properly formatted z_listreceivedbyaddress request
func NewZSendMany ¶
func NewZSendMany(fromAddress string, amounts []ZcashAmount) []byte
NewZSendMany constructs a properly formatted z_sendmany request
func NewZValidateAddress ¶
NewZValidateAddress constructs a properly formatted z_validateaddress request
Types ¶
type Hex ¶
type Hex string
Hex encapsulates behaviour related to zcash hex encoding of certain fields like memo and keys
type Transaction ¶
type Transaction struct {
Time int `json:"time"`
}
Transaction encapsulates the result of GetTransaction TODO: currently this only supports time so we can obtain an ordered list of transactions
type ZGetTotalBalanceResponse ¶
type ZGetTotalBalanceResponse struct {
Transparent string `json:"transparent"`
Private string `json:"private"`
Total string `json:"total"`
}
ZGetTotalBalanceResponse encapsulates the result returned from a z_gettotalbalance request
type ZValidateAddressResponse ¶
type ZValidateAddressResponse struct {
IsValid bool `json:"isvalid"`
Address string `json:"address"`
Type string `json:"type"`
IsMine bool `json:"ismine"`
Diversifier Hex `json:"diversifier"`
DiversifiedTransmissionKey Hex `json:"diversifiedtransmissionkey"`
}
ZValidateAddressResponse encapsulates the result returned from a z_validateaddress request
type ZcashAmount ¶
type ZcashAmount struct {
Address string `json:"address"`
Amount float64 `json:"amount"`
Memo Hex `json:"memo"`
}
ZcashAmount an object representing an amount to send in z_sendmany
func NewZcashAmount ¶
func NewZcashAmount(toAddress string, memo string, amount float64) ZcashAmount
NewZcashAmount generates a new ZcashAmount object with a properly hex encoded memo field
type ZcashClient ¶
type ZcashClient interface {
GetTotalBalance(minConfirmations int) (float64, error)
GetTransaction(string) (Transaction, error)
ListAddresses() ([]string, error)
ListReceivedTransactionsByAddress(string) ([]ZcashTransaction, error)
GetBlock(int) (Block, error)
SendOne(string, string, string, float64) ([]byte, error)
ValidateAddress(address string) (ZValidateAddressResponse, error)
}
ZcashClient defines an interface for any zcash client to present.
func NewLocalClient ¶
func NewLocalClient(username, password string) ZcashClient
NewLocalClient creates a new Zcash rpc client over a local address
func NewOnionClient ¶
func NewOnionClient(onion string, username, password string, acn connectivity.ACN) ZcashClient
NewOnionClient creates a new Zcash rpc client over an onion address
type ZcashResult ¶
type ZcashResult struct {
Result interface{} `json:"result"`
}
ZcashResult represents the result of a zcash operation. Result can be any one of a number of defined types.
type ZcashTransaction ¶
type ZcashTransaction struct {
TransactionID string `json:"txid"`
Amount float64 `json:"amount"`
Memo Hex `json:"memo"`
Change bool `json:"change"`
OutIndex int `json:"outindex"`
// The following parameters are not provided by the zcash node
Address string `json:"address"`
}
ZcashTransaction defines a transaction received to a zaddress