From 07ea47522f2ffcfed0f876f99e83adb5c15dc234 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 2 Apr 2018 12:24:31 +0300 Subject: [PATCH] Getfee --- iguana/exchanges/LP_commands.c | 14 ++++++++++++++ iguana/exchanges/getfee | 3 +++ 2 files changed, 17 insertions(+) create mode 100755 iguana/exchanges/getfee diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index aa105413d..f859aea5e 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -168,6 +168,7 @@ timelock(coin, duration, destaddr=(tradeaddr), amount)\n\ unlockedspend(coin, txid)\n\ opreturndecrypt(coin, txid, passphrase)\n\ getendpoint(port=5555)\n\ +getfee(coin)\n\ listtransactions(coin, address, count=10, skip=0)\n\ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ \"}")); @@ -579,6 +580,19 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ return(jprint(LP_address_balance(ptr,jstr(argjson,"address"),1),1)); else return(clonestr("{\"error\":\"cant find coind\"}")); } + else if ( strcmp(method,"getfee") == 0 ) + { + uint64_t txfee; + if ( (ptr= LP_coinsearch(coin)) != 0 ) + { + txfee = LP_txfeecalc(ptr,0,0); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"coin",coin); + jaddnum(retjson,"txfee",dstr(txfee)); + return(jprint(retjson,1)); + } else return(clonestr("{\"error\":\"cant find coind\"}")); + } else if ( strcmp(method,"electrum") == 0 ) { if ( (ptr= LP_coinsearch(coin)) != 0 ) diff --git a/iguana/exchanges/getfee b/iguana/exchanges/getfee new file mode 100755 index 000000000..147bd344f --- /dev/null +++ b/iguana/exchanges/getfee @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"getfee\",\"coin\":\"BTC\"}"