Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help command returns invalid JSON #596

Open
lukechilds opened this issue Feb 17, 2018 · 2 comments
Open

help command returns invalid JSON #596

lukechilds opened this issue Feb 17, 2018 · 2 comments

Comments

@lukechilds
Copy link
Contributor

lukechilds commented Feb 17, 2018

Currently it has line breaks, JSON does not allow real line-breaks. This throws a parse error in JavaScript so you can't read the response. You need to replace all the line breaks with \n.

So it should be:

{"result":" available localhost RPC commands: \n setprice(base, rel, price, broadcast=1)\nautoprice(base, rel, fixed, minprice, maxprice, margin, refbase, refrel, factor, offset)*\ngoal(coin=*, val=<autocalc>)\nmyprice(base, rel)\nenable(coin)\ndisable(coin)\nnotarizations(coin)\nstatsdisp(starttime=0, endtime=0, gui=, pubkey=, base=, rel=)\nticker(base=, rel=)\ntradesarray(base, rel, starttime=<now>-timescale*1024, endtime=<now>, timescale=60) -> [timestamp, high, low, open, close, relvolume, basevolume, aveprice, numtrades]\npricearray(base, rel, starttime=0, endtime=0, timescale=60) -> [timestamp, avebid, aveask, highbid, lowask]\ngetrawtransaction(coin, txid)\ninventory(coin, reset=0, [passphrase=])\nlastnonce()\nbuy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\nsell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\nwithdraw(coin, outputs[])\nsendrawtransaction(coin, signedtx)\nswapstatus(pending=0)\nswapstatus(coin, limit=10)\nswapstatus(base, rel, limit=10)\nswapstatus(requestid, quoteid, pending=0)\nrecentswaps(limit=3)\nnotarizations(coin)\npublic API:\n getcoins()\ngetcoin(coin)\nportfolio()\ngetpeers()\npassphrase(passphrase, gui, netid=0, seednode=)\nlistunspent(coin, address)\nsetconfirms(coin, numconfirms, maxconfirms=6)\ntrust(pubkey, trust) # positive to trust, 0 for normal, negative to blacklist\nbalance(coin, address)\nbalances(address)\nfundvalue(address=, holdings=[], divisor=0)\norderbook(base, rel, duration=3600)\ngetprices()\ngetmyprice(base, rel)\ngetprice(base, rel)\n//sendmessage(base=coin, rel=, pubkey=zero, <argjson method2>)\n//getmessages(firsti=0, num=100)\n//deletemessages(firsti=0, num=100)\nsecretaddresses(prefix='secretaddress', passphrase, num=10, pubtype=60, taddr=0)\nelectrum(coin, ipaddr, port)\nsnapshot(coin, height)\nsnapshot_balance(coin, height, addresses[])\ndividends(coin, height, <args>)\nstop()\nbot_list()\nbot_statuslist()\nbot_buy(base, rel, maxprice, relvolume) -> botid\nbot_sell(base, rel, minprice, basevolume) -> botid\nbot_settings(botid, newprice, newvolume)\nbot_status(botid)\nbot_stop(botid)\nbot_pause(botid)\ninstantdex_deposit(weeks, amount, broadcast=1)\ninstantdex_claim()\njpg(srcfile, destfile, power2=7, password, data=, required, ind=0)\n"}

Instead of the current:

{"result":" available localhost RPC commands: 
 setprice(base, rel, price, broadcast=1)
autoprice(base, rel, fixed, minprice, maxprice, margin, refbase, refrel, factor, offset)*
goal(coin=*, val=<autocalc>)
myprice(base, rel)
enable(coin)
disable(coin)
notarizations(coin)
statsdisp(starttime=0, endtime=0, gui=, pubkey=, base=, rel=)
ticker(base=, rel=)
tradesarray(base, rel, starttime=<now>-timescale*1024, endtime=<now>, timescale=60) -> [timestamp, high, low, open, close, relvolume, basevolume, aveprice, numtrades]
pricearray(base, rel, starttime=0, endtime=0, timescale=60) -> [timestamp, avebid, aveask, highbid, lowask]
getrawtransaction(coin, txid)
inventory(coin, reset=0, [passphrase=])
lastnonce()
buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)
sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)
withdraw(coin, outputs[])
sendrawtransaction(coin, signedtx)
swapstatus(pending=0)
swapstatus(coin, limit=10)
swapstatus(base, rel, limit=10)
swapstatus(requestid, quoteid, pending=0)
recentswaps(limit=3)
notarizations(coin)
public API:
 getcoins()
getcoin(coin)
portfolio()
getpeers()
passphrase(passphrase, gui, netid=0, seednode=)
listunspent(coin, address)
setconfirms(coin, numconfirms, maxconfirms=6)
trust(pubkey, trust) # positive to trust, 0 for normal, negative to blacklist
balance(coin, address)
balances(address)
fundvalue(address=, holdings=[], divisor=0)
orderbook(base, rel, duration=3600)
getprices()
getmyprice(base, rel)
getprice(base, rel)
//sendmessage(base=coin, rel=, pubkey=zero, <argjson method2>)
//getmessages(firsti=0, num=100)
//deletemessages(firsti=0, num=100)
secretaddresses(prefix='secretaddress', passphrase, num=10, pubtype=60, taddr=0)
electrum(coin, ipaddr, port)
snapshot(coin, height)
snapshot_balance(coin, height, addresses[])
dividends(coin, height, <args>)
stop()
bot_list()
bot_statuslist()
bot_buy(base, rel, maxprice, relvolume) -> botid
bot_sell(base, rel, minprice, basevolume) -> botid
bot_settings(botid, newprice, newvolume)
bot_status(botid)
bot_stop(botid)
bot_pause(botid)
instantdex_deposit(weeks, amount, broadcast=1)
instantdex_claim()
jpg(srcfile, destfile, power2=7, password, data=, required, ind=0)
"}
@jl777
Copy link
Owner

jl777 commented Feb 18, 2018

Is this really a high priority, there are external packages that already are parsing the current format, also it is readable output for cli users. since barterDEX isnt strictly following JSON standard, maybe it is ok to keep this as it is?

@lukechilds
Copy link
Contributor Author

lukechilds commented Feb 18, 2018

Sure, not high priority, just making you aware of issues as I find them.

DeckerSU pushed a commit to DeckerSU/SuperNET that referenced this issue Nov 5, 2022
jl777#592 (jl777#596)

* WIP. Using different executors for Electrum connect loop and requests prevents deadlock.

* Use .await instead of blocking .wait() in utxo get_tx_details_by_hash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants