diff --git a/gui/serializers.py b/gui/serializers.py
index 89a6949..9cb936d 100644
--- a/gui/serializers.py
+++ b/gui/serializers.py
@@ -5,12 +5,14 @@ from .models import LocalSettings, Payments, PaymentHops, Invoices, Forwards, Ch
##FUTURE UPDATE 'exclude' TO 'fields'
class PaymentSerializer(serializers.HyperlinkedModelSerializer):
+ id = serializers.IntegerField(source='index')
payment_hash = serializers.ReadOnlyField()
class Meta:
model = Payments
exclude = []
class InvoiceSerializer(serializers.HyperlinkedModelSerializer):
+ id = serializers.IntegerField(source='index')
r_hash = serializers.ReadOnlyField()
creation_date = serializers.ReadOnlyField()
settle_date = serializers.ReadOnlyField()
diff --git a/gui/templates/base.html b/gui/templates/base.html
index b8f5546..af5df03 100644
--- a/gui/templates/base.html
+++ b/gui/templates/base.html
@@ -30,6 +30,32 @@
"fee": f => ({innerHTML: parseFloat(f.fee.toFixed(3)).toLocaleString()}),
"ppm": f => ({innerHTML: parseInt(f.ppm.toFixed(0)).toLocaleString()}),
}
+ let {fee, ppm} = routed_template
+ const payments_template = Object.assign({}, {
+ "creation_date": p => ({innerHTML: formatDate(p.creation_date), title: adjustTZ(p.creation_date) }),
+ "value": p => ({innerHTML: p.value.intcomma()}),
+ "fee": p => ({innerHTML: parseFloat(p.fee.toFixed(3)).toLocaleString()})
+ }, {ppm}, {
+ "status": p => ({innerHTML: ['Unknown', 'In-Flight', 'Succeeded', 'Failed'][p.status]}),
+ "chan_out_alias": p => ({innerHTML: p.chan_out_alias||'---'}),
+ "chan_out": p => ({innerHTML: p.status == 2 && p.chan_out !== 'MPP' ? `${(BigInt(p.chan_out)>>40n)+'x'+(BigInt(p.chan_out)>>16n & BigInt('0xFFFFFF'))+'x'+(BigInt(p.chan_out) & BigInt('0xFFFF'))}` : p.chan_out || '---' }),
+ "payment_hash": p => ({innerHTML: `${p.payment_hash.substring(0,7)}`}),
+ "rebal_chan": p => ({innerHTML: (p.rebal_chan || '').length > 0 ? 'Yes' : 'No'}),
+ "keysend_preimage": p => ({innerHTML: p.keysend_preimage ? 'Yes' : 'No'})
+ }
+ )
+ let {creation_date, value, keysend_preimage} = payments_template
+ const invoices_template = Object.assign({}, {creation_date}, {
+ "settle_date": i => ({innerHTML: formatDate(i.settle_date), title: adjustTZ(i.settle_date)})
+ }, {value}, {
+ "amt_paid": i => ({innerHTML: i.amt_paid.intcomma()}),
+ "state": i => ({innerHTML: ['Open', 'Settled', 'Cancelled', 'Accepted'][i.state]}),
+ "chan_in_alias": i => ({innerHTML: i.chan_in_alias||'---'}),
+ "chan_in": i => ({innerHTML: i.chan_in? `${(BigInt(i.chan_in)>>40n)+'x'+(BigInt(i.chan_in)>>16n & BigInt('0xFFFFFF'))+'x'+(BigInt(i.chan_in) & BigInt('0xFFFF'))}` : '---'}),
+ "r_hash": i => ({innerHTML: `${i.r_hash.substring(0,7)}`}),
+ "keysend_preimage": i => ({innerHTML: keysend_preimage(i).innerHTML, title: i.message }),
+ }
+ )
const wire_failures = "0|1|2|3|4|5|6|Expiry Too Soon|8|9|10|Amount Below Minimum|Fee Insufficient|13|14|Temporary Channel Failure|16|17|Unknown Next Peer|19|20|21|Expiry Too Far".split('|')
const failure_details = "0|---|2|3|4|HTLC Exceeds Max|Insufficient Balance|7|8|9|10|11|12|Invoice Not Open|14|15|16|17|18|19|Invalid Keysend|21|Circular Route".split('|')
const failedHTLCs_template = {
diff --git a/gui/templates/channel.html b/gui/templates/channel.html
index d3c4b66..830742c 100644
--- a/gui/templates/channel.html
+++ b/gui/templates/channel.html
@@ -336,7 +336,7 @@
- |
+ |
Load More
|
@@ -346,43 +346,33 @@
{% include 'rebalances_table.html' with count=5 last_hop_pubkey=channel.remote_pubkey load_count=5 title='
Rebalance Requests' %}
-{% if payments %}
-
+
-
+
| Timestamp |
- Hash |
- Value |
- Fee Paid |
- PPM Paid |
- Status |
- Chan Out Alias |
- Chan Out ID |
- Route |
- Keysend |
+ Value |
+ Fee Paid |
+ PPM Paid |
+ Status |
+ Chan Out Alias |
+ Chan Out ID |
+ Hash |
+ Rebalance |
+ Keysend |
- {% for payment in payments %}
-
- | {{ payment.creation_date|naturaltime }} |
- {{ payment.payment_hash }} |
- {{ payment.value|add:"0"|intcomma }} |
- {{ payment.fee|intcomma }} |
- {{ payment.ppm|intcomma }} |
- {% if payment.status == 1 %}In-Flight{% elif payment.status == 2 %}Succeeded{% elif payment.status == 3 %}Failed{% else %}{{ payment.status }}{% endif %} |
- {% if payment.status == 2 %}{% if payment.chan_out_alias == '' %}---{% else %}{{ payment.chan_out_alias }}{% endif %}{% else %}---{% endif %} |
- {% if payment.status == 2 %}{{ payment.chan_out }}{% else %}---{% endif %} |
- {% if payment.status == 2 %}Open{% else %}---{% endif %} |
- {% if payment.keysend_preimage != None %}Yes{% else %}No{% endif %} |
-
- {% endfor %}
+
+
+ |
+ Load More
+ |
+
+
-{% endif %}
-{% if invoices %}
-
+
-
+
| Created |
Settled |
@@ -394,22 +384,15 @@
Channel In |
Keysend |
- {% for invoice in invoices %}
-
- | {{ invoice.creation_date|naturaltime }} |
- {% if invoice.state == 1 %}{{ invoice.settle_date|naturaltime }}{% else %}---{% endif %} |
- {{ invoice.r_hash }} |
- {{ invoice.value|add:"0"|intcomma }} |
- {% if invoice.state == 1 %}{{ invoice.amt_paid|intcomma }}{% else %}---{% endif %} |
- {% if invoice.state == 0 %}Open{% elif invoice.state == 1 %}Settled{% elif invoice.state == 2 %}Canceled{% else %}{{ invoice.state }}{% endif %} |
- {% if invoice.state == 1 %}{% if invoice.chan_in_alias == '' %}---{% else %}{{ invoice.chan_in_alias }}{% endif %}{% else %}---{% endif %} |
- {% if invoice.state == 1 and invoice.chan_in != None %}{{ invoice.chan_in }}{% else %}---{% endif %} |
- {% if invoice.keysend_preimage != None %}Yes{% else %}No{% endif %} |
-
- {% endfor %}
+
+
+ |
+ Load More
+ |
+
+
-{% endif %}