monero

package module
v0.0.0-...-9abb258 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 4 Imported by: 0

README

GO-MONERO

A monero RPC client library and program.

TODO

  • Add digest authentication.

Go programs

Usage: monero-cli [-p PORT] ...

A simple monero RPC client.

  -B                  : View balance.
  -R AMOUNT [-d DESC] : Print payment URI and payment ID, height to charge.
  -P URI              : Pay payment URI.
  -C HEIGHT PAYID...  : Check payments.
  -L aiopfd           : List transfers (all,in,out,pending,failed,[d]pool)
  -A                  : Get height.

Copyright (c) 2023 Harkaitz Agirre, harkaitz.aguirre@gmail.com

Go struct Monero

package monero // import "."

type Monero struct {
    u.RPC
    RecipientName string
}

func CreateMonero(port int) (m Monero)
func (m *Monero) GetBalance() (b Balance, err error)
func (m *Monero) GetBulkPayments(height XMRHeight, ids ...XMRPaymentID) (tl []XMRPayment, err error)
func (m *Monero) GetHeight() (h XMRHeight, err error)
func (m *Monero) GetTransfers(sels string) (tl []XMRTransfer, err error)
func (m *Monero) MakeIntegratedAddress() (a XMRAddress, i XMRPaymentID, h XMRHeight, err error)
func (m *Monero) MakeURI(amount XMRAtom, desc string) (uri string, id XMRPaymentID, h XMRHeight, err error)
func (m *Monero) ParseURI(uri string) (uriS XMRURI, err error)
func (m *Monero) PayURI(uri string) (err error)
func (m *Monero) SearchPayment(l []XMRPayment, id XMRPaymentID) (*XMRPayment, bool)
func (m *Monero) Transfer(id XMRPaymentID, d []XMRDestination) (err error)
func (m *Monero) UpdateBlockAge(tl []XMRPayment) (err error)

Collaborating

For making bug reports, feature requests and donations visit one of the following links:

  1. gemini://harkadev.com/oss/
  2. https://harkadev.com/oss/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TitleXMRPayment string = fmt.Sprintf(
	"%-20v %-10v %-12v %-12v",
	"PaymentID",
	"Amount",
	"BlockHeight",
	"BlockAge",
)
View Source
var TitleXMRTransfer string = fmt.Sprintf(
	"%-8v %-8v %-12v %v",
	"Type",
	"Locked",
	"Amount",
	"PaymentID",
)

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Balance         XMRAtom `json:"balance"`
	BlocksToUnlock  int64   `json:"blocks_to_unlock"`
	UnlockedBalance XMRAtom `json:"unlocked_balance"`
}

func (Balance) String

func (b Balance) String() (s string)

type Monero

type Monero struct {
	u.RPC
	RecipientName string
}

func CreateMonero

func CreateMonero(port int) (m Monero)

func (*Monero) GetBalance

func (m *Monero) GetBalance() (b Balance, err error)

func (*Monero) GetBulkPayments

func (m *Monero) GetBulkPayments(height XMRHeight, ids ...XMRPaymentID) (tl []XMRPayment, err error)

func (*Monero) GetHeight

func (m *Monero) GetHeight() (h XMRHeight, err error)

func (*Monero) GetTransfers

func (m *Monero) GetTransfers(sels string) (tl []XMRTransfer, err error)

func (*Monero) MakeIntegratedAddress

func (m *Monero) MakeIntegratedAddress() (a XMRAddress, i XMRPaymentID, h XMRHeight, err error)

func (*Monero) MakeURI

func (m *Monero) MakeURI(amount XMRAtom, desc string) (uri string, id XMRPaymentID, h XMRHeight, err error)

func (*Monero) ParseURI

func (m *Monero) ParseURI(uri string) (uriS XMRURI, err error)

func (*Monero) PayURI

func (m *Monero) PayURI(uri string) (err error)

func (*Monero) PayURIAmount

func (m *Monero) PayURIAmount(uri string, amount XMRAtom) (err error)

func (*Monero) SearchPayment

func (m *Monero) SearchPayment(l []XMRPayment, id XMRPaymentID) (*XMRPayment, bool)

func (*Monero) Transfer

func (m *Monero) Transfer(id XMRPaymentID, d []XMRDestination) (err error)

func (*Monero) UpdateBlockAge

func (m *Monero) UpdateBlockAge(tl []XMRPayment) (err error)

type XMR

type XMR float64

func StrXMR

func StrXMR(f string) (t XMR, err error)

func (XMR) ToAtom

func (f XMR) ToAtom() (t XMRAtom)

type XMRAddress

type XMRAddress string

func StrXMRAddress

func StrXMRAddress(str string) (t XMRAddress, err error)

type XMRAtom

type XMRAtom int64

func StrXMRAtom

func StrXMRAtom(str string) (atom XMRAtom, err error)

func (XMRAtom) ToXMR

func (f XMRAtom) ToXMR() (t XMR)

type XMRDestination

type XMRDestination struct {
	Address XMRAddress `json:"address"`
	Amount  XMRAtom    `json:"amount"`
}

type XMRHeight

type XMRHeight uint64

func StrXMRHeight

func StrXMRHeight(str string) (h XMRHeight, err error)

func (XMRHeight) String

func (h XMRHeight) String() (s string)

type XMRPayment

type XMRPayment struct {
	PaymentID   XMRPaymentID `json:"payment_id"`
	Amount      XMRAtom      `json:"amount"`
	BlockHeight XMRHeight    `json:"block_height"`
	BlockAge    XMRHeight    `json:"-"`
}

func (XMRPayment) String

func (p XMRPayment) String() string

type XMRPaymentID

type XMRPaymentID string
var EmptyXMRPaymentID XMRPaymentID = ""

func StrXMRPaymentID

func StrXMRPaymentID(str string) (t XMRPaymentID, err error)

type XMRTransfer

type XMRTransfer struct {
	Address      XMRAddress       `json:"address"`
	Amount       XMRAtom          `json:"amount"`
	Fee          XMRAtom          `json:"fee"`
	Locked       bool             `json:"locked"`
	PaymentID    XMRPaymentID     `json:"payment_id"`
	TxID         string           `json:"txid"`
	Type         string           `json:"type"`
	UnlockTime   float64          `json:"unlock_time"`
	Destinations []XMRDestination `json:"destinations"`
}

func (XMRTransfer) String

func (t XMRTransfer) String() string

func (*XMRTransfer) TotalAmount

func (t *XMRTransfer) TotalAmount() (r XMRAtom)

type XMRURI

type XMRURI struct {
	Amount        XMRAtom    `json:"amount"`
	Address       XMRAddress `json:"address"`
	RecipientName string     `json:"recipient_name"`
	TxDescription string     `json:"tx_description"`
}

Directories

Path Synopsis
cmd
monero-cli command

Jump to

Keyboard shortcuts

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