mymonero / mymonero-utils Goto Github PK
View Code? Open in Web Editor NEWA collection of npm packages providing the core functionality to the web, desktop, and android apps
A collection of npm packages providing the core functionality to the web, desktop, and android apps
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.
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.
^3.0.0
^3.0.0
^1.5.1
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.
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.
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.
please add an international language for ease of use if possible thank you in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.