Documentation
¶
Index ¶
- type Addr
- type AddressGroup
- type Bans
- type Details
- type Err
- type GetLastHistoryResponse
- type Gettx
- type Info
- type InoutHash
- type NodeInfo
- type OTA
- type RPC
- func (client *RPC) DumpPrivKey() (string, error)
- func (client *RPC) DumpWallet(fname string) error
- func (client *RPC) GetAccount(account string) (string, error)
- func (client *RPC) GetBalance(account string) (float64, error)
- func (client *RPC) GetLastHistory(adr, orHash string, utxoOnly bool) (bool, []*tx.InoutHash, error)
- func (client *RPC) GetLeaves() ([]tx.Hash, error)
- func (client *RPC) GetMinableFeeTx(fee float64) (*tx.Transaction, error)
- func (client *RPC) GetMinableTicketTx() (*tx.Transaction, error)
- func (client *RPC) GetMultisigInfo(adr string) (*tx.MultisigStruct, error)
- func (client *RPC) GetNewAddress(account string) (string, error)
- func (client *RPC) GetNodeinfo() (*NodeInfo, error)
- func (client *RPC) GetOTATxs(num, skip int) ([]*OTA, error)
- func (client *RPC) GetRawTx(txid []string) ([]*tx.Transaction, error)
- func (client *RPC) GetTransaction(txid string) (*Gettx, error)
- func (client *RPC) GetTxsStatus(txid ...string) ([]*TxStatus, error)
- func (client *RPC) ImportWallet(fname string) error
- func (client *RPC) ListAccounts() (map[string]float64, error)
- func (client *RPC) ListAddressGroupings() ([]*AddressGroup, error)
- func (client *RPC) ListBanned() ([]*Bans, error)
- func (client *RPC) ListPeer() ([]Addr, error)
- func (client *RPC) ListTransactions(account string, count, skip int) ([]*Transaction, error)
- func (client *RPC) SendFrom(account, address string, amount float64) (string, error)
- func (client *RPC) SendMany(account string, amounts map[string]float64) (string, error)
- func (client *RPC) SendRawTX(tx *tx.Transaction, typ tx.Type) (string, error)
- func (client *RPC) SendToAddress(address string, amount float64) (string, error)
- func (client *RPC) SetTxFee(amount float64) (bool, error)
- func (client *RPC) Stop() error
- func (client *RPC) ValidateAddress(address string) (*Info, error)
- func (client *RPC) WalletLock() error
- func (client *RPC) WalletPassphrase(pp string, sec int) error
- type Request
- type Response
- type Transaction
- type TxStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressGroup ¶
AddressGroup is a result of ListAddressGroupings.
type Bans ¶
type Bans struct {
Address string `json:"address"`
Created int64 `json:"ban_created"`
Until int64 `json:"banned_until"`
Reason string `json:"ban_reason"`
}
Bans is a struct for listbanned RPC.
type Details ¶
type Details struct {
Account string `json:"account"`
Address string `json:"address"`
Category string `json:"category"`
Amount float64 `json:"amount"`
Vout int64 `json:"vout"`
Fee float64 `json:"fee"`
Abandoned *bool `json:"abandoned,omitempty"`
}
Details is a struct for gettransaction RPC.
type GetLastHistoryResponse ¶
type GetLastHistoryResponse struct {
FromStart bool `json:"from_start"`
InoutHash []*InoutHash `json:"inout_hash"`
}
GetLastHistoryResponse is the response of get_last_history.
type Gettx ¶
type Gettx struct {
Amount float64 `json:"amount"`
Fee float64 `json:"fee"`
Confirmations int `json:"confirmations"`
Blockhash *string `json:"blockhash,omitempty"`
Blockindex *int64 `json:"blockindex,omitempty"`
Blocktime *int64 `json:"blocktime,omitempty"`
Txid string `json:"txid"`
WalletConflicts []string `json:"walletconflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
BIP125Replaceable string `json:"bip125-replaceable"`
Details []*Details `json:"details"`
Hex string `json:"hex"`
}
Gettx is a struct for gettransaction RPC.
type Info ¶
type Info struct {
IsValid bool `json:"isvalid"`
Address string `json:"address"`
ScriptPubKey string `json:"scriptPubkey"`
IsMine bool `json:"ismine"`
IsWatchOnly *bool `json:"iswatchonly,omitempty"`
IsScript *bool `json:"isscript,omitempty"`
Pubkey *string `json:"pubkey,omitempty"`
IsCompressed *bool `json:"iscompressed,omitempty"`
Account *string `json:"account,omitempty"`
}
Info is a struct for validateaddress RPC.
type InoutHash ¶
type InoutHash struct {
Hash string `json:"hash"`
Type tx.InOutHashType `json:"type"`
Index byte `json:"index"`
}
InoutHash is a struct for getlasthistory RPC.
type NodeInfo ¶
type NodeInfo struct {
Version string `json:"version"`
ProtocolVersion int `json:"protocolversion"`
WalletVersion int `json:"walletversion"`
Connections int `json:"connections"`
Proxy string `json:"proxy"`
IsSynced bool `json:"is_synced"`
Testnet byte `json:"testnet"`
Leaves int `json:"leaves"`
Time int64 `json:"time"`
TxNo uint64 `json:"txno"`
Orphants int `json:"orphants"`
Pendings int `json:"pendings"`
Rejected int `json:"rejected"`
}
NodeInfo is a struct for getnodeinfo RPC.
type RPC ¶
type RPC struct {
Endpoint string
User string
Password string
// contains filtered or unexported fields
}
RPC is for calling RPCs.
func (*RPC) DumpPrivKey ¶
DumpPrivKey sends a dumpprivkey RPC.
func (*RPC) DumpWallet ¶
DumpWallet sends a dumpwallet RPC.
func (*RPC) GetAccount ¶
GetAccount sends a getaccount RPC.
func (*RPC) GetBalance ¶
GetBalance sends a getbalance RPC.
func (*RPC) GetLastHistory ¶
GetLastHistory sends a getlasthistory RPC.
func (*RPC) GetMinableFeeTx ¶
func (client *RPC) GetMinableFeeTx(fee float64) (*tx.Transaction, error)
GetMinableFeeTx sends a getminabletx RPC for fee reward.
func (*RPC) GetMinableTicketTx ¶
func (client *RPC) GetMinableTicketTx() (*tx.Transaction, error)
GetMinableTicketTx sends a getminabletx RPC for tiecket reward.
func (*RPC) GetMultisigInfo ¶
func (client *RPC) GetMultisigInfo(adr string) (*tx.MultisigStruct, error)
GetMultisigInfo sends a getmultisiginfo RPC.
func (*RPC) GetNewAddress ¶
GetNewAddress sends a getnewaddress RPC.
func (*RPC) GetNodeinfo ¶
GetNodeinfo sends a getnodeinfo RPC.
func (*RPC) GetRawTx ¶
func (client *RPC) GetRawTx(txid []string) ([]*tx.Transaction, error)
GetRawTx sends a getrawtx RPC.
func (*RPC) GetTransaction ¶
GetTransaction sends a gettransactions RPC.
func (*RPC) GetTxsStatus ¶
GetTxsStatus sends a gettxsstatus RPC.
func (*RPC) ImportWallet ¶
ImportWallet sends a importwallet RPC.
func (*RPC) ListAccounts ¶
ListAccounts sends a listaccounts RPC.
func (*RPC) ListAddressGroupings ¶
func (client *RPC) ListAddressGroupings() ([]*AddressGroup, error)
ListAddressGroupings sends a listaddressgroupings RPC.
func (*RPC) ListBanned ¶
ListBanned sends a listbanned RPC.
func (*RPC) ListTransactions ¶
func (client *RPC) ListTransactions(account string, count, skip int) ([]*Transaction, error)
ListTransactions sends a listtransactions RPC.
func (*RPC) SendToAddress ¶
SendToAddress sends a sendtoaddress RPC.
func (*RPC) ValidateAddress ¶
ValidateAddress sends a validateaddress RPC.
type Request ¶
type Request struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
Request is for parsing request from client.
type Response ¶
type Response struct {
Result interface{} `json:"result"`
Error *Err `json:"error"`
ID interface{} `json:"id"`
}
Response is for respoding to clinete in jsonrpc.
type Transaction ¶
type Transaction struct {
Account *string `json:"account"`
Address string `json:"address"`
Category string `json:"category"`
Amount float64 `json:"amount"`
// Label string `json:"label"`
Vout int64 `json:"vout"`
Fee float64 `json:"fee"`
Confirmations int `json:"confirmations"`
Trusted *bool `json:"trusted,omitempty"`
// Generated bool `json:"generated"`
Blockhash *string `json:"blockhash,omitempty"`
Blockindex *int64 `json:"blockindex,omitempty"`
Blocktime *int64 `json:"blocktime,omitempty"`
Txid string `json:"txid"`
Walletconflicts []string `json:"walletconflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
// Comment string `json:"string"`
// To string `json:"to"`
// Otheraccount string `json:"otheraccount"`
BIP125Replaceable string `json:"bip125-replaceable"`
Abandoned *bool `json:"abandoned,omitempty"`
}
Transaction is a struct for listtransactions RPC.
func (*Transaction) ToDetail ¶
func (dt *Transaction) ToDetail() (*Details, error)
ToDetail converts dt to Details struct.
type TxStatus ¶
type TxStatus struct {
Hash string `json:"hash"`
Exists bool `json:"exists"`
IsRejected bool `json:"is_rejected"`
IsConfirmed bool `json:"is_confirmed"`
}
TxStatus represents a confirmation status of a tx.
func (*TxStatus) IsAccepted ¶
IsAccepted returns true if the tx is confirmed and accepted.