feat: Return a response duh

main
Keith Irwin 2024-04-21 12:17:12 -06:00
parent f51bcf0269
commit ada0f3143d
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
2 changed files with 3 additions and 6 deletions

View File

@ -10,10 +10,7 @@ module.exports = class Wallet {
filename: settings.filename,
password: settings.password,
})
console.log(`Opened wallet "${settings.filename}".`)
} catch (openErr) {
console.log(`Failed to open wallet "${settings.filename}".`)
// create wallet
try {
this.rpc('generate_from_keys', {
@ -24,7 +21,6 @@ module.exports = class Wallet {
viewKey: settings.viewKey,
password: settings.password
})
console.log(`Created wallet "${settings.filename}".`)
} catch (createErr) {
console.error(`Failed to open wallet "${settings.filename}": ${openErr}`)
console.error(`Failed to create wallet "${settings.filename}": ${createErr}`)
@ -33,7 +29,7 @@ module.exports = class Wallet {
}
async rpc(method, params) {
async rpc(method, params=undefined) {
let res; try {
res = await axios.post(`${this.url}/json_rpc`, {
jsonrpc: '2.0',
@ -45,6 +41,7 @@ module.exports = class Wallet {
} catch (err) {
console.error(err)
}
return res
}
}

View File

@ -1,7 +1,7 @@
{
"name": "monero-wallet-rpc-js",
"type": "commonjs",
"version": "1.1.12",
"version": "1.1.13",
"description": "Javascript wrapper for monero-wallet-rpc calls",
"main": "main.js",
"scripts": {