{% include 'header.html' %} <h3>Offer {{ offer_id }}</h3> {% if refresh %} <p><a href=/offer/{{ offer_id }}>Page Refresh: {{ refresh }} second</a></p> {% else %} <p><a href=/offer/{{ offer_id }}>refresh</a></p> {% endif %} {% for m in messages %} <p>{{ m }}</p> {% endfor %} {% for m in err_messages %} <p class="error_msg">Error: {{ m }}</p> {% endfor %} {% if sent_bid_id %} <p><a href="/bid/{{ sent_bid_id }}">Sent Bid {{ sent_bid_id }}</a></p> {% endif %} <table> <tr><td>Offer State</td><td>{{ data.state }}</td></tr> <tr><td>Coin From</td><td>{{ data.coin_from }}</td></tr> <tr><td>Coin To</td><td>{{ data.coin_to }}</td></tr> <tr><td>Amount From</td><td>{{ data.amt_from }} {{ data.tla_from }}</td></tr> <tr><td>Amount To</td><td>{{ data.amt_to }} {{ data.tla_to }}</td></tr> <tr><td>Minimum Bid Amount</td><td>{{ data.amt_bid_min }} {{ data.tla_from }}</td></tr> <tr><td>Rate</td><td>{{ data.rate }}</td></tr> <tr><td title="Total coin-from value of completed bids, that this node is involved in">Amount Swapped</td><td>{{ data.amt_swapped }} {{ data.tla_from }}</td></tr> <tr><td title="If bids can be sent with a different amount">Amount Variable</td><td>{{ data.amount_negotiable }}</td></tr> <tr><td title="If bids can be sent with a different amount">Rate Variable</td><td>{{ data.rate_negotiable }}</td></tr> <tr><td>Script Lock Type</td><td>{{ data.lock_type }}</td></tr> <tr><td>Script Lock Value</td><td>{{ data.lock_value }} {{ data.lock_value_hr }}</td></tr> {% if data.addr_to == "Public" %} <tr><td>Address To</td><td>{{ data.addr_to }}</td></tr> {% else %} <tr><td>Address To</td><td><a class="monospace" href="/identity/{{ data.addr_to }}">{{ data.addr_to }}</a> {{ data.addr_to_label }}</td></tr> {% endif %} <tr><td>Address From</td><td><a class="monospace" href="/identity/{{ data.addr_from }}">{{ data.addr_from }}</a> {{ data.addr_from_label }}</td></tr> <tr><td>Created At</td><td>{{ data.created_at | formatts }}</td></tr> <tr><td>Expired At</td><td>{{ data.expired_at | formatts }}</td></tr> <tr><td>Sent</td><td>{{ data.sent }}</td></tr> <tr><td>Revoked</td><td>{{ data.was_revoked }}</td></tr> {% if data.sent == 'True' %} <tr><td>Auto Accept Strategy</td> <td> {% if data.automation_strat_id == -1 %} None {% else %} <a class="monospace" href="/automationstrategy/{{ data.automation_strat_id }}">{{ data.automation_strat_label }}</a> {% endif %} </td></tr> {% endif %} {% if data.xmr_type == true %} <tr><td>Chain A offer fee rate</td><td>{{ data.a_fee_rate }}</td></tr> <tr><td>Chain A local fee rate</td><td>{{ data.a_fee_rate_verify }}, fee source: {{ data.a_fee_rate_verify_src }} {% if data.a_fee_warn == true %} WARNING {% endif %}</td></tr> {% endif %} </table> <form method="post"> {% if data.show_bid_form %} <br/><h4>New Bid</h4> <p>You will send <span id="bid_amt_to">{{ data.amt_to }}</span> {{ data.tla_to }} and receive <span id="bid_amt_from">{{ data.amt_from }}</span> {{ data.tla_from }} {% if data.xmr_type == true %} (excluding {{ data.amt_from_lock_spend_tx_fee }} {{ data.tla_from }} in tx fees). {% else %} (excluding a tx fee). {% endif %} </p> <table> <tr><td>Send From Address</td><td> <select name="addr_from"> {% for a in addrs %} <option value="{{ a[0] }}" {% if data.nb_addr_from==a[0] %} selected{% endif %}>{{ a[0] }} {{ a[1] }}</option> {% endfor %} <option value="-1" {% if data.nb_addr_from=="-1" %} selected{% endif %}>-- New Address --</option> </select> </td></tr> {% if data.amount_negotiable == true %} <tr><td>Amount</td><td><input type="text" id="bid_amount" name="bid_amount" value="{{ data.bid_amount }}" onchange="updateBidParams('amount');"></td></tr> {% endif %} {% if data.rate_negotiable == true %} <tr><td>Rate</td><td><input type="text" id="bid_rate" name="bid_rate" value="{{ data.bid_rate }}" onchange="updateBidParams('rate');"></td></tr> {% endif %} <tr><td>Minutes valid</td><td><input type="number" name="validmins" min="10" max="1440" value="{{ data.nb_validmins }}"></td></tr> {% if data.debug_ui == true %} <tr><td>Debug Option</td><td><select name="debugind"> <option{% if data.debug_ind=="-1" %} selected{% endif %} value="-1">-- None --</option> {% for a in data.debug_options %} <option{% if data.debug_ind==a[0] %} selected{% endif %} value="{{ a[0] }}">{{ a[1] }}</option> {% endfor %} </select></td></tr> {% endif %} <tr><td> <input type="submit" name="sendbid" value="Send Bid"> <input type="submit" name="cancel" value="Cancel"> <input name="check_rates" type="button" value="Lookup Rates" onclick='lookup_rates();'> </td></tr> </table> {% else %} <input type="submit" name="newbid" value="New Bid"> {% if data.sent == 'True' and data.was_revoked != true %} <input name="revoke_offer" type="submit" value="Revoke Offer" onclick="return confirmPopup();"> {% endif %} <input name="check_rates" type="button" value="Lookup Rates" onclick='lookup_rates();'> {% endif %} <input type="hidden" id="coin_from" value="{{ data.coin_from_ind }}"> <input type="hidden" id="coin_to" value="{{ data.coin_to_ind }}"> <input type="hidden" id="amt_var" value="{{ data.amount_negotiable }}"> <input type="hidden" id="rate_var" value="{{ data.rate_negotiable }}"> <input type="hidden" id="amount_from" value="{{ data.amt_from }}"> <input type="hidden" id="offer_rate" value="{{ data.rate }}"> <input type="hidden" name="formid" value="{{ form_id }}"> </form> <p id="rates_display"></p> <h4>Bids</h4> <table> <tr><th>Bid ID</th><th>Bid Amount</th><th>Bid Rate</th><th>Bid Status</th><th>Identity From</th></tr> {% for b in bids %} <tr><td><a class="monospace" href=/bid/{{ b[0] }}>{{ b[0] }}</a></td><td>{{ b[1] }}</td><td>{{ b[3] }}</td><td>{{ b[2] }}</td><td><a class="monospace" href=/identity/{{ b[4] }}>{{ b[4] }}</a></td></tr> {% endfor %} </table> <p><a href="/">home</a></p> <script> const xhr_rates = new XMLHttpRequest(); xhr_rates.onload = () => { if (xhr_rates.status == 200) { const obj = JSON.parse(xhr_rates.response); inner_html = '<h4>Rates</h4><pre><code>' + JSON.stringify(obj, null, ' ') + '</code></pre>'; document.getElementById('rates_display').innerHTML = inner_html; } } function lookup_rates() { const coin_from = document.getElementById('coin_from').value; const coin_to = document.getElementById('coin_to').value; if (coin_from == '-1' || coin_to == '-1') { alert('Coins from and to must be set first.'); return; } inner_html = '<h4>Rates</h4><p>Updating...</p>'; document.getElementById('rates_display').innerHTML = inner_html; xhr_rates.open('POST', '/json/rates'); xhr_rates.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr_rates.send('coin_from='+coin_from+'&coin_to='+coin_to); } const xhr_bid_params = new XMLHttpRequest(); xhr_bid_params.onload = () => { if (xhr_bid_params.status == 200) { const obj = JSON.parse(xhr_bid_params.response); document.getElementById('bid_amt_to').innerHTML = obj['amount_to']; } } function updateBidParams(value_changed) { const coin_from = document.getElementById('coin_from').value; const coin_to = document.getElementById('coin_to').value; const amt_var = document.getElementById('amt_var').value; const rate_var = document.getElementById('rate_var').value; let amt_from = ''; let rate = ''; if (amt_var == 'True') { amt_from = document.getElementById('bid_amount').value; } else { amt_from = document.getElementById('amount_from').value; } if (rate_var == 'True') { rate = document.getElementById('bid_rate').value; } else { rate = document.getElementById('offer_rate').value; } if (value_changed == 'amount') { document.getElementById('bid_amt_from').innerHTML = amt_from; } xhr_bid_params.open('POST', '/json/rate'); xhr_bid_params.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr_bid_params.send('coin_from='+coin_from+'&coin_to='+coin_to+'&rate='+rate+'&amt_from='+amt_from); } function confirmPopup() { return confirm("Are you sure?"); } </script> </body></html>