Documentation ¶
Overview ¶
Package xmr provides datastructures for dealing with XMR from a client (wallet) perspective.
Index ¶
- Constants
- type AutoRefreshParams
- type Client
- func (cli *Client) AutoRefresh(ctx context.Context, p *AutoRefreshParams) error
- func (cli *Client) Close() error
- func (cli *Client) GetAddress(ctx context.Context, p *GetAddressParams) (*GetAddressResult, error)
- func (cli *Client) GetHeight(ctx context.Context) (*GetHeightResult, error)
- func (cli *Client) GetTransfers(ctx context.Context, p *GetTransfersParams) (*GetTransfersResult, error)
- func (cli *Client) MakeIntegratedAddress(ctx context.Context, p *MakeIntegratedAddressParams) (*MakeIntegratedAddressResult, error)
- func (cli *Client) WatchTransfers(ctx context.Context, cfg *Config)
- func (cli *Client) XfersCh() <-chan *GetTransfersResult
- type Config
- type Daemon
- type DaemonConfig
- type GetAddressParams
- type GetAddressResult
- type GetHeightResult
- type GetTransfersParams
- type GetTransfersResult
- type MakeIntegratedAddressParams
- type MakeIntegratedAddressResult
- type Quantity
- func (q *Quantity) Cmp(other *Quantity) int
- func (q *Quantity) IsZero() bool
- func (q *Quantity) MarshalText() ([]byte, error)
- func (q *Quantity) Set(other *Quantity) *Quantity
- func (q *Quantity) String() string
- func (q *Quantity) UnmarshalText(s []byte) error
- func (q *Quantity) UnmarshalYAML(value *yaml.Node) error
- type Transfer
Constants ¶
const ( MethodGetAddress = "get_address" MethodGetHeight = "get_height" MethodGetTransfers = "get_transfers" MethodMakeIntegratedAddress = "make_integrated_address" MethodAutoRefresh = "auto_refresh" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoRefreshParams ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wallet RPC client instance.
func (*Client) AutoRefresh ¶
func (cli *Client) AutoRefresh(ctx context.Context, p *AutoRefreshParams) error
func (*Client) GetAddress ¶
func (cli *Client) GetAddress(ctx context.Context, p *GetAddressParams) (*GetAddressResult, error)
func (*Client) GetHeight ¶
func (cli *Client) GetHeight(ctx context.Context) (*GetHeightResult, error)
func (*Client) GetTransfers ¶
func (cli *Client) GetTransfers(ctx context.Context, p *GetTransfersParams) (*GetTransfersResult, error)
func (*Client) MakeIntegratedAddress ¶
func (cli *Client) MakeIntegratedAddress(ctx context.Context, p *MakeIntegratedAddressParams) (*MakeIntegratedAddressResult, error)
func (*Client) XfersCh ¶
func (cli *Client) XfersCh() <-chan *GetTransfersResult
type Config ¶
type Config struct { // Daemon is the XMR wallet daemon configuration. Daemon DaemonConfig `yaml:"daemon"` // RecoveryHeight is the height to start scanning for transactions. // This value is only used on first launch. RecoveryHeight uint64 `yaml:"recovery_height"` // URL is the `monero-wallet-rpc` URL. URL string `yaml:"url"` // PollInterval is the wallet poll interval in seconds. PollInterval uint `yaml:"poll_interval"` // DisablePool disables treating transfers in the `pool` state as // complete (More secure, but less responsive). DisablePool bool `yaml:"disable_pool"` // TrackNSF enables tracking transfers that are lower than the // minimum donation threshold. TrackNSF bool `yaml:"track_insufficient_funds"` }
Config is a XMR wallet client configuration.
func (*Config) ApplyDefaults ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is a wallet RPC daemon instance.
type DaemonConfig ¶
type DaemonConfig struct { // Enable makes the shadowchat executable handle launching the // `monero-wallet-rpc` daemon. Enable bool `yaml:"enable"` // ExecutablePath is the path to the `monero-wallet-rpc` binary. ExecutablePath string `yaml:"executable_path"` // WalletPath is the path to the (view only) wallet. WalletPath string `yaml:"wallet_path"` // LogPath is the path to the `moneor-wallet-rpc` log file. LogPath string `yaml:"log_path"` // BindPort is the TCP port to bind to. BindPort uint16 `yaml:"bind_port"` // NodeURL is the upstream Mondero node to connect to. NodeURL string `yaml:"node_url"` // Stagenet indicates if the wallet is a stagenet wallet. Stagenet bool `yaml:"stagenet"` }
DaemonConfig is a XMR wallet RPC daemon configuration.
func (*DaemonConfig) ApplyDefaults ¶
func (cfg *DaemonConfig) ApplyDefaults(def *DaemonConfig)
func (*DaemonConfig) ToCmd ¶
func (cfg *DaemonConfig) ToCmd(ctx context.Context) *exec.Cmd
ToCmd builds a os/exec.Cmd from a DaemonConfig.
func (*DaemonConfig) Validate ¶
func (cfg *DaemonConfig) Validate() error
Validate checks if a Config appears to be valid.
type GetAddressParams ¶
type GetAddressResult ¶
type GetHeightResult ¶
type GetHeightResult struct {
Height uint64 `json:"height"`
}
type GetTransfersParams ¶
type GetTransfersParams struct { In bool `json:"in,omitempty"` Out bool `json:"out,omitempty"` Pending bool `json:"pending,omitempty"` Failed bool `json:"failed,omitempty"` Pool bool `json:"pool,omitempty"` FilterByHeight bool `json:"filter_by_height,omitempty"` MinHeight uint64 `json:"min_height,omitempty"` MaxHeight uint64 `json:"max_height,omitempty"` AccountIndex uint `json:"account_index,omitempty"` SubaddrIndices []uint `json:"subaddr_indices,omitempty"` AllAccounts bool `json:"all_accounts,omitempty"` }
type GetTransfersResult ¶
type GetTransfersResult struct { In []*Transfer `json:"in,omitempty"` Out []*Transfer `json:"out,omitempty"` Pending []*Transfer `json:"pending,omitempty"` Failed []*Transfer `json:"failed,omitempty"` Pool []*Transfer `json:"pool,omitempty"` MaxHeight uint64 `json:"-"` // For our use, not part of the API. }
type Quantity ¶
type Quantity struct {
// contains filtered or unexported fields
}
Quantity is a fixed-point representation of XMR.
func MustNewQuantity ¶
MustNewQuantity constructs a new Quantity from the text representation or panics.
func NewQuantity ¶
NewQuantity constructs a new Quantity from the text representation.
func NewQuantityFrom ¶
NewQuantityFrom constructs a new Quantity from another.
func NewQuantityFromAtomic ¶
NewQuantityFromAtomic constructs a new Quantity from Atomic units.
func (*Quantity) Cmp ¶
Cmp compares `q` and `other`, and returns `-1` iff `q < other`, `0` iff `q == other`, and `1` iff `q > other`.
func (*Quantity) MarshalText ¶
MarshalText returns the text representation of a quantity (in XMR).
func (*Quantity) UnmarshalText ¶
UnmarshalText decodes the text representation of a quantity (in XMR) and sets `q` to the value. On error, `q` is set to `0`.
func (*Quantity) UnmarshalYAML ¶
UnmarshalYAML decodes the YAML representation of a quantity in (XMR) from a YAML, and sets `q` to the value.
type Transfer ¶
type Transfer struct { Address string `json:"address"` Amount uint64 `json:"amount"` Confirmations uint64 `json:"confirmations"` DoubleSpendSeen bool `json:"double_spend_seen"` Fee uint64 `json:"fee"` Height uint64 `json:"height"` Locked bool `json:"locked"` Note string `json:"note"` PaymentID string `json:"payment_id"` SubaddrIndex struct { Major uint `json:"major"` Minor uint `json:"minor"` } `json:"subaddr_index"` SubaddrIndices []struct { Major int `json:"major"` Minor int `json:"minor"` } `json:"subaddr_indices"` SuggestedConfirmationsThreshold uint64 `json:"suggested_confirmations_threshold"` Timestamp uint64 `json:"timestamp"` TxID string `json:"txid"` Type string `json:"type"` UnlockTime uint64 `json:"unlock_time"` }