ui: Improve rpc page usability for Decred.
This commit is contained in:
		
							parent
							
								
									aa1e1fd79c
								
							
						
					
					
						commit
						fcf234ef34
					
				@ -98,6 +98,8 @@ def parse_cmd(cmd: str, type_map: str):
 | 
				
			|||||||
            type_ind = type_map[i]
 | 
					            type_ind = type_map[i]
 | 
				
			||||||
        if type_ind == 'i':
 | 
					        if type_ind == 'i':
 | 
				
			||||||
            typed_params.append(int(param))
 | 
					            typed_params.append(int(param))
 | 
				
			||||||
 | 
					        elif type_ind == 'f':
 | 
				
			||||||
 | 
					            typed_params.append(float(param))
 | 
				
			||||||
        elif type_ind == 'b':
 | 
					        elif type_ind == 'b':
 | 
				
			||||||
            typed_params.append(toBool(param))
 | 
					            typed_params.append(toBool(param))
 | 
				
			||||||
        elif type_ind == 'j':
 | 
					        elif type_ind == 'j':
 | 
				
			||||||
@ -265,6 +267,7 @@ class HttpHandler(BaseHTTPRequestHandler):
 | 
				
			|||||||
        summary = swap_client.getSummary()
 | 
					        summary = swap_client.getSummary()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        result = None
 | 
					        result = None
 | 
				
			||||||
 | 
					        cmd = ''
 | 
				
			||||||
        coin_type = -1
 | 
					        coin_type = -1
 | 
				
			||||||
        coin_id = -1
 | 
					        coin_id = -1
 | 
				
			||||||
        call_type = 'cli'
 | 
					        call_type = 'cli'
 | 
				
			||||||
@ -282,11 +285,16 @@ class HttpHandler(BaseHTTPRequestHandler):
 | 
				
			|||||||
                        coin_type = Coins(Coins.XMR)
 | 
					                        coin_type = Coins(Coins.XMR)
 | 
				
			||||||
                    elif coin_id in (-5,):
 | 
					                    elif coin_id in (-5,):
 | 
				
			||||||
                        coin_type = Coins(Coins.LTC)
 | 
					                        coin_type = Coins(Coins.LTC)
 | 
				
			||||||
 | 
					                    elif coin_id in (-6,):
 | 
				
			||||||
 | 
					                        coin_type = Coins(Coins.DCR)
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
                        coin_type = Coins(coin_id)
 | 
					                        coin_type = Coins(coin_id)
 | 
				
			||||||
                except Exception:
 | 
					                except Exception:
 | 
				
			||||||
                    raise ValueError('Unknown Coin Type')
 | 
					                    raise ValueError('Unknown Coin Type')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if coin_type in (Coins.DCR,):
 | 
				
			||||||
 | 
					                    call_type = 'http'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    cmd = get_data_entry(form_data, 'cmd')
 | 
					                    cmd = get_data_entry(form_data, 'cmd')
 | 
				
			||||||
                except Exception:
 | 
					                except Exception:
 | 
				
			||||||
@ -309,18 +317,24 @@ class HttpHandler(BaseHTTPRequestHandler):
 | 
				
			|||||||
                    result = json.dumps(rv, indent=4)
 | 
					                    result = json.dumps(rv, indent=4)
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    if call_type == 'http':
 | 
					                    if call_type == 'http':
 | 
				
			||||||
 | 
					                        ci = swap_client.ci(coin_type)
 | 
				
			||||||
                        method, params = parse_cmd(cmd, type_map)
 | 
					                        method, params = parse_cmd(cmd, type_map)
 | 
				
			||||||
                        if coin_id == -5:
 | 
					                        if coin_id == -6:
 | 
				
			||||||
                            rv = swap_client.ci(coin_type).rpc_wallet_mweb(method, params)
 | 
					                            rv = ci.rpc_wallet(method, params)
 | 
				
			||||||
 | 
					                        elif coin_id == -5:
 | 
				
			||||||
 | 
					                            rv = ci.rpc_wallet_mweb(method, params)
 | 
				
			||||||
                        else:
 | 
					                        else:
 | 
				
			||||||
                            rv = swap_client.ci(coin_type).rpc_wallet(method, params)
 | 
					                            if coin_type in (Coins.DCR, ):
 | 
				
			||||||
 | 
					                                rv = ci.rpc(method, params)
 | 
				
			||||||
 | 
					                            else:
 | 
				
			||||||
 | 
					                                rv = ci.rpc_wallet(method, params)
 | 
				
			||||||
                        if not isinstance(rv, str):
 | 
					                        if not isinstance(rv, str):
 | 
				
			||||||
                            rv = json.dumps(rv, indent=4)
 | 
					                            rv = json.dumps(rv, indent=4)
 | 
				
			||||||
                        result = cmd + '\n' + rv
 | 
					                        result = cmd + '\n' + rv
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
                        result = cmd + '\n' + swap_client.callcoincli(coin_type, cmd)
 | 
					                        result = cmd + '\n' + swap_client.callcoincli(coin_type, cmd)
 | 
				
			||||||
            except Exception as ex:
 | 
					            except Exception as ex:
 | 
				
			||||||
                result = str(ex)
 | 
					                result = cmd + '\n' + str(ex)
 | 
				
			||||||
                if self.server.swap_client.debug is True:
 | 
					                if self.server.swap_client.debug is True:
 | 
				
			||||||
                    self.server.swap_client.log.error(traceback.format_exc())
 | 
					                    self.server.swap_client.log.error(traceback.format_exc())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -330,6 +344,8 @@ class HttpHandler(BaseHTTPRequestHandler):
 | 
				
			|||||||
        with_xmr: bool = any(c[0] == Coins.XMR for c in coins)
 | 
					        with_xmr: bool = any(c[0] == Coins.XMR for c in coins)
 | 
				
			||||||
        coins = [c for c in coins if c[0] != Coins.XMR]
 | 
					        coins = [c for c in coins if c[0] != Coins.XMR]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if any(c[0] == Coins.DCR for c in coins):
 | 
				
			||||||
 | 
					            coins.append((-6, 'Decred Wallet'))
 | 
				
			||||||
        if any(c[0] == Coins.LTC for c in coins):
 | 
					        if any(c[0] == Coins.LTC for c in coins):
 | 
				
			||||||
            coins.append((-5, 'Litecoin MWEB Wallet'))
 | 
					            coins.append((-5, 'Litecoin MWEB Wallet'))
 | 
				
			||||||
        if with_xmr:
 | 
					        if with_xmr:
 | 
				
			||||||
 | 
				
			|||||||
@ -564,7 +564,7 @@ class DCRInterface(Secp256k1Interface):
 | 
				
			|||||||
    def withdrawCoin(self, value: float, addr_to: str, subfee: bool = False) -> str:
 | 
					    def withdrawCoin(self, value: float, addr_to: str, subfee: bool = False) -> str:
 | 
				
			||||||
        if subfee:
 | 
					        if subfee:
 | 
				
			||||||
            raise ValueError('TODO')
 | 
					            raise ValueError('TODO')
 | 
				
			||||||
        params = [addr_to, value]
 | 
					        params = [addr_to, float(value)]
 | 
				
			||||||
        return self.rpc_wallet('sendtoaddress', params)
 | 
					        return self.rpc_wallet('sendtoaddress', params)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def isAddressMine(self, address: str, or_watch_only: bool = False) -> bool:
 | 
					    def isAddressMine(self, address: str, or_watch_only: bool = False) -> bool:
 | 
				
			||||||
 | 
				
			|||||||
@ -49,6 +49,9 @@ class FIROInterface(BTCInterface):
 | 
				
			|||||||
        # load with -hdseed= parameter
 | 
					        # load with -hdseed= parameter
 | 
				
			||||||
        pass
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def checkWallets(self) -> int:
 | 
				
			||||||
 | 
					        return 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def getNewAddress(self, use_segwit, label='swap_receive'):
 | 
					    def getNewAddress(self, use_segwit, label='swap_receive'):
 | 
				
			||||||
        return self.rpc('getnewaddress', [label])
 | 
					        return self.rpc('getnewaddress', [label])
 | 
				
			||||||
        # addr_plain = self.rpc('getnewaddress', [label])
 | 
					        # addr_plain = self.rpc('getnewaddress', [label])
 | 
				
			||||||
 | 
				
			|||||||
@ -84,6 +84,9 @@ class NAVInterface(BTCInterface):
 | 
				
			|||||||
        # Load with -importmnemonic= parameter
 | 
					        # Load with -importmnemonic= parameter
 | 
				
			||||||
        pass
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def checkWallets(self) -> int:
 | 
				
			||||||
 | 
					        return 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def getWalletSeedID(self):
 | 
					    def getWalletSeedID(self):
 | 
				
			||||||
        return self.rpc('getwalletinfo')['hdmasterkeyid']
 | 
					        return self.rpc('getwalletinfo')['hdmasterkeyid']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,9 @@ class PIVXInterface(BTCInterface):
 | 
				
			|||||||
        # No multiwallet support
 | 
					        # No multiwallet support
 | 
				
			||||||
        self.rpc_wallet = make_rpc_func(self._rpcport, self._rpcauth, host=self._rpc_host)
 | 
					        self.rpc_wallet = make_rpc_func(self._rpcport, self._rpcauth, host=self._rpc_host)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def checkWallets(self) -> int:
 | 
				
			||||||
 | 
					        return 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def signTxWithWallet(self, tx):
 | 
					    def signTxWithWallet(self, tx):
 | 
				
			||||||
        rv = self.rpc('signrawtransaction', [tx.hex()])
 | 
					        rv = self.rpc('signrawtransaction', [tx.hex()])
 | 
				
			||||||
        return bytes.fromhex(rv['hex'])
 | 
					        return bytes.fromhex(rv['hex'])
 | 
				
			||||||
 | 
				
			|||||||
@ -149,7 +149,7 @@
 | 
				
			|||||||
                      <div class="custom-select">
 | 
					                      <div class="custom-select">
 | 
				
			||||||
                        <div class="relative">
 | 
					                        <div class="relative">
 | 
				
			||||||
                          {{ input_down_arrow_offer_svg | safe }}
 | 
					                          {{ input_down_arrow_offer_svg | safe }}
 | 
				
			||||||
                          <select class="select cursor-not-allowed disabled-select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_from" name="coin_from" onchange="set_rate('coin_from');" disabled>
 | 
					                          <select class="select cursor-not-allowed disabled-select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_from" name="coin_from" disabled>
 | 
				
			||||||
                            <option value="-1">Select coin you send</option>
 | 
					                            <option value="-1">Select coin you send</option>
 | 
				
			||||||
                            {% for c in coins_from %}
 | 
					                            {% for c in coins_from %}
 | 
				
			||||||
                            <option{% if data.coin_from==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}
 | 
					                            <option{% if data.coin_from==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}
 | 
				
			||||||
@ -164,7 +164,7 @@
 | 
				
			|||||||
                    <div class="w-full md:w-1/2 p-3">
 | 
					                    <div class="w-full md:w-1/2 p-3">
 | 
				
			||||||
                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Send</p>
 | 
					                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Send</p>
 | 
				
			||||||
                      <div class="relative">
 | 
					                      <div class="relative">
 | 
				
			||||||
                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input hover:border-blue-500 pr-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_from" name="amt_from" value="{{ data.amt_from }}" onchange="set_rate('amt_from');" readonly>
 | 
					                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input hover:border-blue-500 pr-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_from" name="amt_from" value="{{ data.amt_from }}" readonly>
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    {% if data.swap_style == 'xmr' %}
 | 
					                    {% if data.swap_style == 'xmr' %}
 | 
				
			||||||
@ -220,7 +220,7 @@
 | 
				
			|||||||
                      <div class="custom-select">
 | 
					                      <div class="custom-select">
 | 
				
			||||||
                        <div class="relative">
 | 
					                        <div class="relative">
 | 
				
			||||||
                          {{ input_down_arrow_offer_svg | safe }}
 | 
					                          {{ input_down_arrow_offer_svg | safe }}
 | 
				
			||||||
                          <select class="cursor-not-allowed disabled-select select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_to" name="coin_to" onchange="set_rate('coin_to');" disabled>
 | 
					                          <select class="cursor-not-allowed disabled-select select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_to" name="coin_to" disabled>
 | 
				
			||||||
                            <option value="-1"></option>
 | 
					                            <option value="-1"></option>
 | 
				
			||||||
                            {% for c in coins %}
 | 
					                            {% for c in coins %}
 | 
				
			||||||
                            <option{% if data.coin_to==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
 | 
					                            <option{% if data.coin_to==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
 | 
				
			||||||
@ -235,7 +235,7 @@
 | 
				
			|||||||
                    <div class="w-full md:w-1/2 p-3">
 | 
					                    <div class="w-full md:w-1/2 p-3">
 | 
				
			||||||
                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Get</p>
 | 
					                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Get</p>
 | 
				
			||||||
                      <div class="relative">
 | 
					                      <div class="relative">
 | 
				
			||||||
                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input hover:border-blue-500 pr-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_to" name="amt_to" value="{{ data.amt_to }}" onchange="set_rate('amt_to');" readonly>
 | 
					                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input hover:border-blue-500 pr-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_to" name="amt_to" value="{{ data.amt_to }}" readonly>
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    {% if data.swap_style == 'xmr' and coin_to != '6' %}
 | 
					                    {% if data.swap_style == 'xmr' and coin_to != '6' %}
 | 
				
			||||||
@ -301,7 +301,7 @@
 | 
				
			|||||||
                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
 | 
					                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
 | 
				
			||||||
                        {{ select_rate_svg | safe }}
 | 
					                        {{ select_rate_svg | safe }}
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                      <input class="cursor-not-allowed disabled-input pl-10 hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" id="rate" name="rate" value="{{ data.rate }}" onchange="set_rate('rate');" readonly>
 | 
					                      <input class="cursor-not-allowed disabled-input pl-10 hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" id="rate" name="rate" value="{{ data.rate }}" readonly>
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -157,7 +157,7 @@
 | 
				
			|||||||
                      <div class="custom-select">
 | 
					                      <div class="custom-select">
 | 
				
			||||||
                        <div class="relative">
 | 
					                        <div class="relative">
 | 
				
			||||||
                          {{ input_down_arrow_offer_svg | safe }}
 | 
					                          {{ input_down_arrow_offer_svg | safe }}
 | 
				
			||||||
                          <select class="select cursor-not-allowed disabled-select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_from" name="coin_from" onchange="set_rate('coin_from');" disabled>
 | 
					                          <select class="select cursor-not-allowed disabled-select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_from" name="coin_from" disabled>
 | 
				
			||||||
                            <option value="-1">Select coin you send</option>
 | 
					                            <option value="-1">Select coin you send</option>
 | 
				
			||||||
                            {% for c in coins_from %}
 | 
					                            {% for c in coins_from %}
 | 
				
			||||||
                            <option{% if data.coin_from==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
 | 
					                            <option{% if data.coin_from==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
 | 
				
			||||||
@ -171,7 +171,7 @@
 | 
				
			|||||||
                    <div class="w-full md:w-1/2 p-3">
 | 
					                    <div class="w-full md:w-1/2 p-3">
 | 
				
			||||||
                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Send</p>
 | 
					                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Send</p>
 | 
				
			||||||
                      <div class="relative">
 | 
					                      <div class="relative">
 | 
				
			||||||
                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input appearance-none pr-10 bg-gray-50 text-gray-900 appearance-none dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_from" name="amt_from" value="{{ data.amt_from }}" onchange="set_rate('amt_from');" readonly>
 | 
					                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input appearance-none pr-10 bg-gray-50 text-gray-900 appearance-none dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_from" name="amt_from" value="{{ data.amt_from }}" readonly>
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    {% if data.swap_style == 'xmr' %}
 | 
					                    {% if data.swap_style == 'xmr' %}
 | 
				
			||||||
@ -217,7 +217,7 @@
 | 
				
			|||||||
                      <div class="custom-select">
 | 
					                      <div class="custom-select">
 | 
				
			||||||
                        <div class="relative">
 | 
					                        <div class="relative">
 | 
				
			||||||
                          {{ input_down_arrow_offer_svg | safe }}
 | 
					                          {{ input_down_arrow_offer_svg | safe }}
 | 
				
			||||||
                          <select class="select cursor-not-allowed disabled-select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_to" name="coin_to" onchange="set_rate('coin_to');" disabled>
 | 
					                          <select class="select cursor-not-allowed disabled-select hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" id="coin_to" name="coin_to" disabled>
 | 
				
			||||||
                            <option value="-1"></option>
 | 
					                            <option value="-1"></option>
 | 
				
			||||||
                            {% for c in coins %}
 | 
					                            {% for c in coins %}
 | 
				
			||||||
                            <option{% if data.coin_to==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
 | 
					                            <option{% if data.coin_to==c[0] %} selected{% endif %} value="{{ c[0] }}" data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
 | 
				
			||||||
@ -230,7 +230,7 @@
 | 
				
			|||||||
                    <div class="w-full md:w-1/2 p-3">
 | 
					                    <div class="w-full md:w-1/2 p-3">
 | 
				
			||||||
                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Get</p>
 | 
					                      <p class="mb-1.5 font-medium text-base text-coolGray-800 dark:text-white">Amount You Get</p>
 | 
				
			||||||
                      <div class="relative">
 | 
					                      <div class="relative">
 | 
				
			||||||
                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input hover:border-blue-500 pr-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_to" name="amt_to" value="{{ data.amt_to }}" onchange="set_rate('amt_to');" readonly>
 | 
					                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none"> </div> <input class="cursor-not-allowed disabled-input hover:border-blue-500 pr-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-5 focus:ring-0" type="text" id="amt_to" name="amt_to" value="{{ data.amt_to }}" readonly>
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    {% if data.swap_style == 'xmr' and coin_to != '6' %}
 | 
					                    {% if data.swap_style == 'xmr' and coin_to != '6' %}
 | 
				
			||||||
@ -286,7 +286,7 @@
 | 
				
			|||||||
                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
 | 
					                        <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
 | 
				
			||||||
                        {{ select_rate_svg | safe }}
 | 
					                        {{ select_rate_svg | safe }}
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                      <input class="cursor-not-allowed disabled-input pl-10 hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" id="rate" name="rate" value="{{ data.rate }}" onchange="set_rate('rate');" readonly>
 | 
					                      <input class="cursor-not-allowed disabled-input pl-10 hover:border-blue-500 pl-10 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-white text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" id="rate" name="rate" value="{{ data.rate }}" readonly>
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -63,7 +63,7 @@
 | 
				
			|||||||
             <td class="py-3 px-6">
 | 
					             <td class="py-3 px-6">
 | 
				
			||||||
              <div class="relative">
 | 
					              <div class="relative">
 | 
				
			||||||
                {{ input_arrow_down_svg| safe }}
 | 
					                {{ input_arrow_down_svg| safe }}
 | 
				
			||||||
               <select class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" name="coin_type">
 | 
					               <select class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" name="coin_type" id="coin_type" onchange="set_coin();">
 | 
				
			||||||
                <option value="-1" {% if coin_type==-1 %} selected{% endif %}>Select Coin</option>
 | 
					                <option value="-1" {% if coin_type==-1 %} selected{% endif %}>Select Coin</option>
 | 
				
			||||||
                {% for c in coins %}
 | 
					                {% for c in coins %}
 | 
				
			||||||
                <option value="{{ c[0] }}" {% if coin_type==c[0] %} selected{% endif %}>{{ c[1] }}</option>
 | 
					                <option value="{{ c[0] }}" {% if coin_type==c[0] %} selected{% endif %}>{{ c[1] }}</option>
 | 
				
			||||||
@ -72,21 +72,21 @@
 | 
				
			|||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
             </td>
 | 
					             </td>
 | 
				
			||||||
             <td class="py-3 px-6">
 | 
					             <td class="py-3 px-6">
 | 
				
			||||||
              <input class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" name="cmd">
 | 
					              <input class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" name="cmd" id="cmd" oninput="set_method();">
 | 
				
			||||||
             </td>
 | 
					             </td>
 | 
				
			||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
            <tr class="opacity-100 text-gray-500 dark:text-gray-100">
 | 
					            <tr class="opacity-100 text-gray-500 dark:text-gray-100">
 | 
				
			||||||
             <td class="py-3 px-6">
 | 
					             <td class="py-3 px-6">
 | 
				
			||||||
              <div class="relative">
 | 
					              <div class="relative">
 | 
				
			||||||
                {{ input_arrow_down_svg| safe }}
 | 
					                {{ input_arrow_down_svg| safe }}
 | 
				
			||||||
               <select class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" name="call_type">
 | 
					               <select class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" name="call_type" id="call_type" >
 | 
				
			||||||
                <option value="cli" {% if call_type=="cli" %} selected{% endif %}>CLI</option>
 | 
					                <option value="cli" {% if call_type=="cli" %} selected{% endif %}>CLI</option>
 | 
				
			||||||
                <option value="http" {% if call_type=="http" %} selected{% endif %}>HTTP</option>
 | 
					                <option value="http" {% if call_type=="http" %} selected{% endif %}>HTTP</option>
 | 
				
			||||||
               </select>
 | 
					               </select>
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
             </td>
 | 
					             </td>
 | 
				
			||||||
             <td class="py-3 px-6">
 | 
					             <td class="py-3 px-6">
 | 
				
			||||||
              <input class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" name="type_map" title="Convert inputs when using http.  Example: 'sibj' 1st parameter is a string, 2nd is converted to an int then boolean and json object or array">
 | 
					              <input class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" name="type_map" id="type_map" title="Convert inputs when using http.  Example: 'sifbj' 1st parameter is a string, 2nd is converted to an int, 3rd to float then boolean and json object or array">
 | 
				
			||||||
             </td>
 | 
					             </td>
 | 
				
			||||||
           </table>
 | 
					           </table>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
@ -176,4 +176,28 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
{% include 'footer.html' %}
 | 
					{% include 'footer.html' %}
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					    function set_method() {
 | 
				
			||||||
 | 
					        const coin_type = document.getElementById('coin_type').value;
 | 
				
			||||||
 | 
					        if (coin_type == 4 || coin_type == -6) {
 | 
				
			||||||
 | 
					            const cmd = document.getElementById('cmd');
 | 
				
			||||||
 | 
					            const type_map = document.getElementById('type_map');
 | 
				
			||||||
 | 
					            let method = cmd.value.split(' ')[0];
 | 
				
			||||||
 | 
					            if (method == 'sendtoaddress') {
 | 
				
			||||||
 | 
					                type_map.value = 'sf';
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    function set_coin() {
 | 
				
			||||||
 | 
					        const coin_type = document.getElementById('coin_type').value;
 | 
				
			||||||
 | 
					        let call_type = document.getElementById('call_type');
 | 
				
			||||||
 | 
					        if (coin_type == 4 || coin_type == -6) {
 | 
				
			||||||
 | 
					            call_type.disabled = true;
 | 
				
			||||||
 | 
					            call_type.value = 'http';
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            call_type.disabled = false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        set_method();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  </script>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user