client

package
v0.0.1-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Mixing defines the number of outputs to include with ours in the ring
	Mixing = uint64(10)
	// RingSize defines the total number of outputs in the ring (N + 1)
	RingSize = uint64(11)
)

Variables

This section is empty.

Functions

func RandomPriority

func RandomPriority() wallet.Priority

RandomPriority returns a random transaction priority note that this can potentially become expensive

Types

type ChurnableAccount

type ChurnableAccount struct {
	AccountIndex uint64
	BaseAddress  string
	Subaddresses []ChurnableSubAdddress
}

ChurnableAccount defines a group of sub addresses we can churn funds from

type ChurnableAccounts

type ChurnableAccounts struct {
	Accounts []ChurnableAccount
}

ChurnableAccounts bundles together all accounts we can churn funds from

type ChurnableSubAdddress

type ChurnableSubAdddress struct {
	AddressIndex uint64
	Address      string
	Balance      uint64
}

ChurnableSubAdddress defines a given address that we can churn funds from

type Client

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

Client is a wrapper around the monero wallet rpc

func NewClient

func NewClient(rpcAddr string) (*Client, error)

NewClient returns a new initialized rpc client wrapper

func (*Client) AddressBalance

func (c *Client) AddressBalance(walletName string, address string, accountIndex uint64, addressIndex ...uint64) (uint64, error)

AddressBalance returns the unlocked funds for the given address TODO(bonedaddy): accept account and subaddress index look up balance for the given address (not the wallet)

func (*Client) Close

func (c *Client) Close() error

Close terminates the RPC client

func (*Client) CreateWallet

func (c *Client) CreateWallet(walletName string) error

CreateWallet is used to create a new monero wallet

func (*Client) GetAccounts

func (c *Client) GetAccounts(walletName string) (*wallet.ResponseGetAccounts, error)

GetAccounts returns all accounts under the wallet

func (*Client) GetAddress

func (c *Client) GetAddress(walletName string, accountIndex uint64, addressIndex ...uint64) (*wallet.ResponseGetAddress, error)

GetAddress returns address information for a given account index optionally filtered by subaddress index

func (*Client) GetChurnableAddresses

func (c *Client) GetChurnableAddresses(walletName string, churnAccountIndex, minBalance uint64) (*ChurnableAccounts, error)

GetChurnableAddresses is used to get addresses that we can churn by sending to ourselves. The account index matching churnAccountIndex is skipped, as this is the account for which we will use to send churned funds to

func (*Client) NewAccount

func (c *Client) NewAccount(walletName, label string) (*wallet.ResponseCreateAccount, error)

NewAccount is used to create a new account with an optional label

func (*Client) NewAddress

func (c *Client) NewAddress(walletName string, accountIndex uint64) (string, error)

NewAddress creates a new address under the given account index

func (*Client) OpenWallet

func (c *Client) OpenWallet(walletName string) error

OpenWallet is used to open the given wallet using it for all subsequent RPC requests

func (*Client) Refresh

func (c *Client) Refresh(walletName string) error

Refresh triggles a total refresh of a wallet scanning all addresses for incoming transactions

func (*Client) Relay

func (c *Client) Relay(walletName, txMetadata string) (string, error)

Relay is used to relay an unbroadcasted transaction returning the tx hash

func (*Client) Rescan

func (c *Client) Rescan(walletName string) error

func (*Client) SaveWallet

func (c *Client) SaveWallet() error

SaveWallet stores the state of the current actively opened wallet

func (*Client) StartMining

func (c *Client) StartMining(walletName string, threads uint64) error

StartMining starts actively mining blocks with the given threads

func (*Client) StopMining

func (c *Client) StopMining(walletName string) error

StopMining stops active mining processes

func (*Client) SweepAll

func (c *Client) SweepAll(opts TransferOpts) (*wallet.ResponseSweepAll, error)

SweepAll is used to sweep all funds from the given account index sending it to the destination address

func (*Client) SweepDust

func (c *Client) SweepDust(walletName string) (*wallet.ResponseSweepDust, error)

SweepDust is used to sweep all unspendable amounts pre-ringCT

func (*Client) SweepSingle

func (c *Client) SweepSingle(opts TransferOpts) (*wallet.ResponseSweepSingle, error)

SweepSingle is used to spend all of a specified unlocked output to an address

func (*Client) Transfer

func (c *Client) Transfer(opts TransferOpts) (*wallet.ResponseTransfer, error)

Transfer is used to transfer funds from the given wallet to the destination address

func (*Client) TransferSplit

func (c *Client) TransferSplit(opts TransferOpts) (*wallet.ResponseTransferSplit, error)

TransferSplit allows splitting up a transaction into smaller one, useful for situations where Transfer returns an error due to to large of a transaction

func (*Client) TxConfirmed

func (c *Client) TxConfirmed(walletName, txHash string) (bool, error)

TxConfirmed returns whether or not the given transaction is confirmed

func (*Client) WalletBalance

func (c *Client) WalletBalance(walletName string) (uint64, error)

WalletBalance returns the entire unlocked balance of all accounts and subaddresses

type TransferOpts

type TransferOpts struct {
	Priority wallet.Priority
	// maps destination address to amount
	Destinations   map[string]uint64
	AccountIndex   uint64   // defaults to 0
	SubaddrIndices []uint64 // options, default is nil which means all
	WalletName     string
	DoNotRelay     bool
}

TransferOpts defines options used to control transfers TODO(bonedaddy): support more than out destination address

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL