Browse Source

Merge pull request #422 from DeckerSU/dev-decker-dev

dexscripts for Windows samples (see how_to_use.md)
etomic
jl777 7 years ago
committed by GitHub
parent
commit
b5968bc144
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      iguana/dexscripts.win32/1-client.cmd
  2. 7
      iguana/dexscripts.win32/2-getuserpass.cmd
  3. 4
      iguana/dexscripts.win32/balance.cmd
  4. BIN
      iguana/dexscripts.win32/curl.exe
  5. 4
      iguana/dexscripts.win32/enable.cmd
  6. 4
      iguana/dexscripts.win32/getcoin.cmd
  7. 4
      iguana/dexscripts.win32/getutxos.cmd
  8. 24
      iguana/dexscripts.win32/how_to_use.md
  9. BIN
      iguana/dexscripts.win32/images/userpass.png
  10. BIN
      iguana/dexscripts.win32/images/userpass_usage.png
  11. 4
      iguana/dexscripts.win32/inventory.cmd
  12. 4
      iguana/dexscripts.win32/listunspent.cmd
  13. 4
      iguana/dexscripts.win32/orderbook.cmd
  14. 1
      iguana/dexscripts.win32/passphrase
  15. 4
      iguana/dexscripts.win32/portfolio.cmd
  16. 5
      iguana/dexscripts.win32/snapshot.cmd
  17. 0
      iguana/dexscripts.win32/userpass

16
iguana/dexscripts.win32/1-client.cmd

@ -0,0 +1,16 @@
@echo off
set USERHOME=%APPDATA:\=\\%
rem [!] Coins config now taked from coins.json file, no need to put in environment variable
rem ---------------------------------------------------------------------------------------
rem set COINS=[{\"coin\":\"REVS\",\"active\":1,\"asset\":\"REVS\",\"rpcport\":10196}]
rem marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"mypassphrase\", \"coins\":%COINS%}"
set COINS=\"\"
set /p PASSPHRASE=<passphrase
rem , \"canbind\":1
rem marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}" 1> marketmaker.log 2>&1
marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}"

7
iguana/dexscripts.win32/2-getuserpass.cmd

@ -0,0 +1,7 @@
@echo off
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":null,\"method\":\"enable\",\"coin\":\" \"}" -s > userpass.json
for /f "tokens=2 delims=:," %%a in (' find "userpass" "userpass.json" ') do (
echo UserPass: %%~a
echo %%~a > userpass
)
del userpass.json

4
iguana/dexscripts.win32/balance.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"balance\",\"coin\":\"KMD\",\"address\":\"RSpP2Nffy379SwF1cAkooNg6vwPHpakCpC\"}"

BIN
iguana/dexscripts.win32/curl.exe

Binary file not shown.

4
iguana/dexscripts.win32/enable.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"enable\",\"coin\":\"REVS\"}"

4
iguana/dexscripts.win32/getcoin.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"getcoin\",\"coin\":\"KMD\"}"

4
iguana/dexscripts.win32/getutxos.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"getutxos\",\"coin\":\"KMD\"}"

24
iguana/dexscripts.win32/how_to_use.md

@ -0,0 +1,24 @@
## DexScripts for Windows. How to use? ##
**1.** Before start you should put scripts and following binaries into one folder:
- curl.exe (required for all scripts)
- marketmaker.exe
- libcurl.dll (required to run marketmaker)
- nanomsg.dll (required to run marketmaker)
**2.** Don't forget to put `coins.json` file into a same folder. This file is available it this repo.
**3.** Type your passphrase into passphrase file in this folder (you should create file with name `passphrase` and without extension) and run `1-client.cmd`. This will run marketmaker. Next step is to obtain userpass needed for other scripts, you can simply copy and paste it from marketmaker output on startup into userpass file.
![](./images/userpass.png)
Or run `2-getuserpass.cmd` to fill userpass file automatically.** NB!** To get userpass you shouldn't run any scripts between 1-client.cmd and 2-getuserpass.cmd launching.
Sample output of correct `2-getuserpass.cmd` usage is:
![](./images/userpass_usage.png)
You should see your userpass on screen, and after it will automatically copied in userpass file. It's important to all other scripts to have this password in userpass file. If output of `2-getuserpass.cmd` is not same as showed on screen above - wait some seconds and run `2-getuserpass.cmd` again. Also make sure that you have allowed marketmaker to accept incoming connections in your Windows Firewall (first time launched system should automatically asked for it).
**4.** For using other scripts please refer to barterDEX API. Or **barterDEX API Summary by Category** document by *shossain*.

BIN
iguana/dexscripts.win32/images/userpass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
iguana/dexscripts.win32/images/userpass_usage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

4
iguana/dexscripts.win32/inventory.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"inventory\",\"coin\":\"KMD\"}"

4
iguana/dexscripts.win32/listunspent.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"listunspent\",\"coin\":\"KMD\",\"address\":\"RSpP2Nffy379SwF1cAkooNg6vwPHpakCpC\"}"

4
iguana/dexscripts.win32/orderbook.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"orderbook\",\"base\":\"KMD\",\"rel\":\"REVS\"}"

1
iguana/dexscripts.win32/passphrase

@ -0,0 +1 @@
your_very_strong_secret_passphrase

4
iguana/dexscripts.win32/portfolio.cmd

@ -0,0 +1,4 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"portfolio\"}"

5
iguana/dexscripts.win32/snapshot.cmd

@ -0,0 +1,5 @@
@echo off
set /p TMPUSERPASS=<userpass
set USERPASS=%TMPUSERPASS: =%
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"snapshot\",\"coin\":\"KMD\",\"height\":%1}"

0
iguana/dexscripts.win32/userpass

Loading…
Cancel
Save