Documentation
¶
Index ¶
- type Balance
- type Client
- func (c *Client) AddRequest(amount float64, memo string, expiration uint64) (res PaymentRequest, err error)
- func (c *Client) Call(method string, params interface{}, result interface{}) error
- func (c *Client) ClearRequests() (err error)
- func (c *Client) CreateNewAddress() (res string, err error)
- func (c *Client) GetAddressBalance(address string) (res Balance, err error)
- func (c *Client) GetBalance() (res Balance, err error)
- func (c *Client) GetFeeRate(feeMethod FeeMethod) (res uint64, err error)
- func (c *Client) GetRequest(btcAddress string) (res PaymentRequest, err error)
- func (c *Client) GetSeed(password string) (res string, err error)
- func (c *Client) GetServers() (res map[string]Server, err error)
- func (c *Client) GetTransaction(txid string) (res Transaction, err error)
- func (c *Client) GetUnusedAddress() (res string, err error)
- func (c *Client) IsMine(address string) (res bool, err error)
- func (c *Client) ListAdddresses() (res []string, err error)
- func (c *Client) ListRequest(pending, expired, paid bool) (res []PaymentRequest, err error)
- func (c *Client) RemoveRequest(btcAddress string) (res bool, err error)
- func (c *Client) SignMessage(btcAddress, message string) (res string, err error)
- func (c *Client) ValidateAddress(address string) (res bool, err error)
- func (c *Client) VerifyMessage(btcAddress, signature, message string) (res bool, err error)
- func (c *Client) Version() (res string, err error)
- type FeeMethod
- type PaymentRequest
- type RequestError
- type Server
- type SignMessageRequest
- type Transaction
- type VerifyMessageRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balance ¶
type Balance struct { Confirmed string `json:"confirmed"` Unconfirmed string `json:"unconfirmed"` Unmatured string `json:"unmatured"` Lightning string `json:"lightning"` }
Balance model
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the JSON RPC HTTP client with Basic Auth
func New ¶
New creates new client with username and password Optional, you can set your own http.Client If http.Client is not specified, the http.DefaultClient will be used
func (*Client) AddRequest ¶
func (c *Client) AddRequest(amount float64, memo string, expiration uint64) (res PaymentRequest, err error)
AddRequest creates a payment request, using the first unused address of the wallet
func (*Client) Call ¶
Call is a method for calling JSON RPC endpoint Method is public - so if some func is missing, you can call here with your own model
func (*Client) ClearRequests ¶
ClearRequests removes all payment requests
func (*Client) CreateNewAddress ¶
CreateNewAddress creates a new receiving address, beyond the gap limit of the wallet
func (*Client) GetAddressBalance ¶
GetAddressBalance returns balance for given address
func (*Client) GetBalance ¶
GetBalance return the balance of your wallet.
func (*Client) GetFeeRate ¶
GetFeeRate returns current suggested fee rate (in sat/kvByte), according to config settings or supplied parameters
func (*Client) GetRequest ¶
func (c *Client) GetRequest(btcAddress string) (res PaymentRequest, err error)
GetRequest returns a payment request
func (*Client) GetServers ¶
GetServers returns the list of available servers
func (*Client) GetTransaction ¶
func (c *Client) GetTransaction(txid string) (res Transaction, err error)
GetTransaction retrieve a transaction by id
func (*Client) GetUnusedAddress ¶
GetUnusedAddress returns the first unused address of the wallet, or None if all addresses are used An address is considered as used if it has received a transaction, or if it is used in a payment request.
func (*Client) IsMine ¶
IsMine checks if address is in wallet. Return true if and only address is in wallet
func (*Client) ListAdddresses ¶
ListAdddresses returns the list of all addresses in your wallet @TODO, support optional arguments to filter the results
func (*Client) ListRequest ¶
func (c *Client) ListRequest(pending, expired, paid bool) (res []PaymentRequest, err error)
ListRequest lists the payment requests you made
func (*Client) RemoveRequest ¶
RemoveRequest removes a payment request Returns true if removal was successful
func (*Client) SignMessage ¶
SignMessage signs a message with a key
func (*Client) ValidateAddress ¶
ValidateAddress check that an address is valid
func (*Client) VerifyMessage ¶
VerifyMessage verifies a signature
type PaymentRequest ¶
type PaymentRequest struct { ID string `json:"id"` Amount uint64 `json:"amount"` Expiration uint64 `json:"exp"` Address string `json:"address"` Memo string `json:"memo"` URI string `json:"URI"` Status string `json:"status"` AmountBTC string `json:"amount (BTC)"` Time uint64 `json:"time"` }
PaymentRequest is electrum payment request model
type RequestError ¶
func (*RequestError) Error ¶
func (r *RequestError) Error() string
type Server ¶
type Server struct { S string `json:"s"` Pruning string `json:"pruning"` Version string `json:"version"` }
Server is electrum server information
type SignMessageRequest ¶
type SignMessageRequest struct { Address string `json:"address"` Message string `json:"message"` Password string `json:"password,omitempty"` }
SignMessageRequest is model for signmessage method
type Transaction ¶
type Transaction struct { Hex string `json:"hex"` Complete bool `json:"complete"` Final bool `json:"final"` }
Transaction is bitcoin transaction model
type VerifyMessageRequest ¶
type VerifyMessageRequest struct { Address string `json:"address"` Signature string `json:"signature"` Message string `json:"message"` }
VerifyMessageRequest is model for verifymessage method