electrumrpc: github.com/MarinX/electrumrpc Index | Files

package electrumrpc

import "github.com/MarinX/electrumrpc"

Index

Package Files

electrumrpc.go methods.go models.go

type Balance Uses

type Balance struct {
    Confirmed   string `json:"confirmed"`
    Unconfirmed string `json:"unconfirmed"`
    Unmatured   string `json:"unmatured"`
    Lightning   string `json:"lightning"`
}

Balance model

type Client Uses

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

Client holds the JSON RPC HTTP client with Basic Auth

func New Uses

func New(username, password, addr string, httpClient *http.Client) *Client

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 Uses

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 Uses

func (c *Client) Call(method string, params interface{}, result interface{}) error

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 Uses

func (c *Client) ClearRequests() (err error)

ClearRequests removes all payment requests

func (*Client) CreateNewAddress Uses

func (c *Client) CreateNewAddress() (res string, err error)

CreateNewAddress creates a new receiving address, beyond the gap limit of the wallet

func (*Client) GetAddressBalance Uses

func (c *Client) GetAddressBalance(address string) (res Balance, err error)

GetAddressBalance returns balance for given address

func (*Client) GetBalance Uses

func (c *Client) GetBalance() (res Balance, err error)

GetBalance return the balance of your wallet.

func (*Client) GetFeeRate Uses

func (c *Client) GetFeeRate(feeMethod FeeMethod) (res uint64, err error)

GetFeeRate returns current suggested fee rate (in sat/kvByte), according to config settings or supplied parameters

func (*Client) GetRequest Uses

func (c *Client) GetRequest(btcAddress string) (res PaymentRequest, err error)

GetRequest returns a payment request

func (*Client) GetSeed Uses

func (c *Client) GetSeed(password string) (res string, err error)

GetSeed returns the generation seed of your wallet

func (*Client) GetServers Uses

func (c *Client) GetServers() (res map[string]Server, err error)

GetServers returns the list of available servers

func (*Client) GetTransaction Uses

func (c *Client) GetTransaction(txid string) (res Transaction, err error)

GetTransaction retrieve a transaction by id

func (*Client) GetUnusedAddress Uses

func (c *Client) GetUnusedAddress() (res string, err error)

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 Uses

func (c *Client) IsMine(address string) (res bool, err error)

IsMine checks if address is in wallet. Return true if and only address is in wallet

func (*Client) ListAdddresses Uses

func (c *Client) ListAdddresses() (res []string, err error)

ListAdddresses returns the list of all addresses in your wallet @TODO, support optional arguments to filter the results

func (*Client) ListRequest Uses

func (c *Client) ListRequest(pending, expired, paid bool) (res []PaymentRequest, err error)

ListRequest lists the payment requests you made

func (*Client) RemoveRequest Uses

func (c *Client) RemoveRequest(btcAddress string) (res bool, err error)

RemoveRequest removes a payment request Returns true if removal was successful

func (*Client) SignMessage Uses

func (c *Client) SignMessage(btcAddress, message string) (res string, err error)

SignMessage signs a message with a key

func (*Client) ValidateAddress Uses

func (c *Client) ValidateAddress(address string) (res bool, err error)

ValidateAddress check that an address is valid

func (*Client) VerifyMessage Uses

func (c *Client) VerifyMessage(btcAddress, signature, message string) (res bool, err error)

VerifyMessage verifies a signature

func (*Client) Version Uses

func (c *Client) Version() (res string, err error)

Version returns the version of Electrum.

type FeeMethod Uses

type FeeMethod string

FeeMethod is fee estimation method

const (
    // FeeMethodNone is for none
    FeeMethodNone FeeMethod = ""
    // FeeMethodStatic is for static
    FeeMethodStatic FeeMethod = "static"
    // FeeMethodEta is for eta
    FeeMethodEta FeeMethod = "eta"
    // FeeMethodMempool is for mempool
    FeeMethodMempool FeeMethod = "mempool"
)

type PaymentRequest Uses

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 Server Uses

type Server struct {
    S       string `json:"s"`
    Pruning string `json:"pruning"`
    Version string `json:"version"`
}

Server is electrum server information

type SignMessageRequest Uses

type SignMessageRequest struct {
    Address  string `json:"address"`
    Message  string `json:"message"`
    Password string `json:"password,omitempty"`
}

SignMessageRequest is model for signmessage method

type Transaction Uses

type Transaction struct {
    Hex      string `json:"hex"`
    Complete bool   `json:"complete"`
    Final    bool   `json:"final"`
}

Transaction is bitcoin transaction model

type VerifyMessageRequest Uses

type VerifyMessageRequest struct {
    Address   string `json:"address"`
    Signature string `json:"signature"`
    Message   string `json:"message"`
}

VerifyMessageRequest is model for verifymessage method

Package electrumrpc imports 5 packages (graph). Updated 2019-12-29. Refresh now. Tools for package owners.