Giter VIP home page Giter VIP logo

go-monero-rpc-client's Introduction

Hi ๐Ÿ‘‹ My name is Sun

Developer, Freelancer & Solopreneur

  • ๐ŸŒย  I'm based in Frankfurt, Germany
  • ๐Ÿง ย  I'm a code contributor to various open-source projects.
  • ๐Ÿš€ย  In my spare time I work on open-source and my own private projects.
  • ๐Ÿคย  I work for companies as a registered freelancer. Hire me as a Software Developer or DevOps Engineer.

Profile

I worked for multinational companies (finance, hosting, data centers), including the world's volume-wise largest IXP (Internet Exchange Point) in Frankfurt, Germany. I am fast and efficient.

Experience

  • DevOps Engineering: 20+ years
  • Software Development: 10+ years

Expertise

  • API Development
  • Datacenter Engineer
  • Scripting/Automation
  • Backend Development
  • Web Application Development
  • Database Administrator (DBA)
  • Virtualization and Containerization
  • Configuration Management and Deployments

Skills

Golang JavaScript TypeScript HTML5 CSS3 TailwindCSS Supabase

Socials

Badges

My GitHub Stats

omani's GitHub stats

GitHub Streak

Top Langs


Support Me

I accept payments and donations in BTC:

bc1qgezvfp4s0xme8pdv6aaqu9ayfgnv4mejdlv3tx

go-monero-rpc-client's People

Contributors

bonedaddy avatar leonardochaia avatar omani avatar rbrunner7 avatar tumblingman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-monero-rpc-client's Issues

Payments field of ResponseGetPayments and ResponseGetBulkPayments should be a slice

Had to fix this to use these methods.

--- a/wallet/structs.go
+++ b/wallet/structs.go
@@ -479,7 +479,7 @@ type RequestGetPayments struct {
 }
 type ResponseGetPayments struct {
        // list of payments
-       payments struct {
+       Payments []struct {
                // Payment ID matching the input parameter.
                PaymentID string `json:"payment_id"`
                // Transaction hash used as the transaction ID.
@@ -511,7 +511,7 @@ type RequestGetBulkPayments struct {
 }
 type ResponseGetBulkPayments struct {
        // List of payments
-       Payments struct {
+       Payments []struct {
                // Payment ID matching one of the input IDs.
                PaymentID string `json:"payment_id"`
                // Transaction hash used as the transaction ID.

The Payments field of ResponseGetPayments and ResponseGetBulkPayments should be a slice

Had to fix this to use these methods.

--- a/wallet/structs.go
+++ b/wallet/structs.go
@@ -479,7 +479,7 @@ type RequestGetPayments struct {
 }
 type ResponseGetPayments struct {
        // list of payments
-       payments struct {
+       Payments []struct {
                // Payment ID matching the input parameter.
                PaymentID string `json:"payment_id"`
                // Transaction hash used as the transaction ID.
@@ -511,7 +511,7 @@ type RequestGetBulkPayments struct {
 }
 type ResponseGetBulkPayments struct {
        // List of payments
-       Payments struct {
+       Payments []struct {
                // Payment ID matching one of the input IDs.
                PaymentID string `json:"payment_id"`
                // Transaction hash used as the transaction ID.

Zero values are being sent which may not be desired

Take the below example:

package main

import (
	"testing"

	"github.com/leonardochaia/go-monero-rpc-client/wallet"
)

func TestTX(t *testing.T) {
	// Start a wallet client instance
	client := wallet.New(wallet.Config{
		Address: "http://127.0.0.1:18082/json_rpc",
	})
	// get incoming transfers
	resp1, err := client.GetTransfers(&wallet.RequestGetTransfers{
		In:             true,
		FilterByHeight: true,
		MinHeight:      4200,
		// MaxHeight:      21492184123,
	})

	if err != nil {
		t.Fatal(err)
	}

	if len(resp1.In) == 0 {
		t.Log("Expected incoming transfers, got zero")
		t.FailNow()
	}
}

Given that no value is provided for MaxHeight, 0 is being sent, which makes monero-wallet-rpc filter by height < maxHeight which returns no results.

If you provide a huge MaxHeight like the commented line, or if you add omitempty to the struct it works properly.

I propose we add omitempty to all structs that represent incoming parameters, i.e:

type RequestGetTransfers struct {
	// [redacted]
	FilterByHeight bool `json:"filter_by_height,omitempty"`
	// (Optional) Minimum block height to scan for transfers, if filtering by height is enabled.
	MinHeight uint64 `json:"min_height,omitempty"`
	// (Opional) Maximum block height to scan for transfers, if filtering by height is enabled (defaults to max block height).
	MaxHeight uint64 `json:"max_height,omitempty"`
}

What do you guys think? I don't see other workaround other than modifying the library.

Malformatted struct tag on ResponseGetSpendProof

My linter noted this while I was fixing another issue.

--- a/wallet/structs.go
+++ b/wallet/structs.go
@@ -712,7 +712,7 @@ type RequestGetSpendProof struct {
 }
 type ResponseGetSpendProof struct {
        // Spend signature.
-       Signature string `json":signature"`
+       Signature string `json:"signature"`
 }
 
 // CheckSpendProof()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.