-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathelectrum
executable file
·38 lines (32 loc) · 1.17 KB
/
electrum
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Enable a coin via electrum
# With automation=1 it will also attempt to set required confirmations
#
# @author webworker01
# @link https://developers.atomicdex.io/basic-docs/atomicdex-api-legacy/electrum.html
#
scriptpath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $scriptpath/main
if [[ -z $1 ]]; then
echo "You must specify a coin"
exit 0
fi
coin=${1^^}
filename="${scriptpath}/coins/electrums/${coin}"
if test -f ${filename}; then
electrumstring=$(jq -c '[.[] | select(.protocol=="SSL") | {url:.url, protocol:.protocol}]' $filename)
if [[ ${electrumstring} == "[]" ]]; then
electrumstring=$(jq -c '[.[] | {url:.url, protocol:.protocol}]' $filename)
fi
else
echo "Coin electrum file doesn't exist"
exit 0
fi
electrumstring=${electrumstring//\"protocol\":null/\"protocol\":\"TCP\"}
echo "${coin} exists! Connecting..."
echo ${electrumstring}
jq . <<< $(curl -s --url "http://127.0.0.1:7783" --data '{"method":"electrum","coin":"'${coin}'","servers":'${electrumstring}',"userpass":"'${userpass}'"}')
if (( $automation > 0 )); then
${scriptpath}/set_required_confirmations ${coin} ${required_confirmations}
fi