GithubHelp home page GithubHelp logo

mymonero / mymonero-utils Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 19.0 20.19 MB

A collection of npm packages providing the core functionality to the web, desktop, and android apps

JavaScript 99.51% CMake 0.05% Shell 0.01% C++ 0.31% Ruby 0.01% Java 0.04% Objective-C 0.01% Swift 0.06% TypeScript 0.01%

mymonero-utils's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

mymonero-utils's Issues

please add an international language for ease of use if possible thank you in advance.

Describe your feature request

please add an international language for ease of use if possible thank you in advance.

please add an international language for ease of use if possible thank you in advance.

What problem does this feature solve? [optional]

please add an international language for ease of use if possible thank you in advance.

Additional context [optional]

Fee property is not in Lightwallet API spec for get_address_txs

I noticed when using mymonero-utils that there is a fee property used in a few places for calculating tx amounts, etc. This property in mymonero-utils originates from the get_address_tx response object from api.mymonero.com, but it's not actually part of the lightwallet spec. This results in issues when using the library with a different light wallet server as they don't send the fee property.

If possible, it would be great if the .fee call was replaced with a function for calculating and setting the fee amount on each past tx's internally, and ultimately remove the usage of that API property.

Suggestion- remove dangerous defaulted api.mymonero.com values from mymonero-utils

I'll preface this issue with, I know this is MyMonero's library and obviously it makes sense that these defaults are here.

There are a number of references to api.mymonero.com scattered throughout the mymonero-utils codebase as fallback default values for important api requests. I find these defaults to be highly dangerous for anyone building open source tools that use these libraries, in that a simple mistake, or a missed setting of a variable will result in the unintentional doxxing of private wallet data to MyMonero.

I recommend either setting these default values to localhost, adding in appropriate error handling in the event the values aren't set, and/or removing the references entirely as they are bad for privacy, not very helpful for the ecosystem, and they don't encourage anyone using or contributing back to these libraries. MyMonero should be able to set these values from their Apps.

constructor (netType = 'MAINNET', url = 'https://api.mymonero.com') {

Broadcast of multiple destination tx fails

Description

On stagenet, I'm not able to broadcast (using LWS) transactions with multiple destinations crafted with @mymonero/mymonero-monero-client. Destination addresses are not integrated addresses and I have not specified a paymentId (following what's written here). I can also confirm that I have enough unlocked balance for the transaction.

  • Can you reproduce the issue?

Steps to reproduce

Run this code snippet replacing placeholders with your wallet keys and primary address.

const axios = require("axios")
const LWSClient = require("@mymonero/mymonero-lws-client")

const httpClient = axios.create({ baseURL: PRIVATE_LWS_URL })
const options = {
  httpClient,
  appName: "MyMonero",
  appVersion: "1.1.25",
  apiKey: PRIVATE_VIEW_KEY
}

const lwsClient = new LWSClient(options)

// Check account
lwsClient.login(PRIVATE_VIEW_KEY, PRIMARY_ADDRESS, false)

const WABridge = await require("@mymonero/mymonero-monero-client")({})

const unspentOuts = await lwsClient.unspentOutputs(PRIVATE_VIEW_KEY, PRIMARY_ADDRESS)

const txOptions = {
  priority: 1,
  address: PRIMARY_ADDRESS,
  privateViewKey: PRIVATE_VIEW_KEY,
  publicSpendKey: PUBLIC_SPEND_KEY,
  privateSpendKey: PRIVATE_SPEND_KEY,
  shouldSweep: false,
  paymentId: "",
  nettype: "STAGENET",
  unspentOuts,
  async randomOutsCb(numberOfOuts) {
    return await lwsClient.randomOutputs(numberOfOuts)
  }
}

const singleDestinationTx = await WABridge.createTransaction({
  ...txOptions,
  destinations: [
    {
      send_amount: "0.1",
      to_address: "53QvrbYs8eQ1aDZDjZ1FPhaffgBvNEBewF3nk4A6KKbYcPLGddfvU5SAG1BgDtx5RYhm8uCwZHVcfHbo9TbooE5TD3ufe3G"
    }
  ]
})

const doubleDestinationTx = await WABridge.createTransaction({
  ...txOptions,
  destinations: [
    {
      send_amount: "0.1",
      to_address: "53QvrbYs8eQ1aDZDjZ1FPhaffgBvNEBewF3nk4A6KKbYcPLGddfvU5SAG1BgDtx5RYhm8uCwZHVcfHbo9TbooE5TD3ufe3G"
    },
    {
      send_amount: "0.2",
      to_address: "79iUszJcoNW2LcHmdCrgbGbq6unuzH9RkdmsGi29TrFL4VHfbz5SrBLJLEXYmPMqc3JQEqqg8h8WVc7aBMXCa2uRTMWjjuC"
    }
  ]
})

const result1 = await lwsClient.submitRawTx(singleDestinationTx.serialized_signed_tx)
console.log(result1) // Working properly

const result2 = await lwsClient.submitRawTx(doubleDestinationTx.serialized_signed_tx)
console.log(result2) // Not working, 500 error, tx seems invalid

Expected behavior:

Both transactions working properly.

Actual behavior:

Transaction with multiple destinations fails to broadcast.

Versions

  • @mymonero/mymonero-lws-client: ^3.0.0
  • @mymonero/mymonero-monero-client: ^3.0.0
  • axios: ^1.5.1

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.