diff --git a/fn_pay.js b/fn_pay.js
index 239d8c5..e778494 100644
--- a/fn_pay.js
+++ b/fn_pay.js
@@ -4,7 +4,6 @@ const TYPE_MONEY_REQUEST = "MoneyRequests",
const cashierUPI = {};
-//https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressTransactions?token=rupee&floAddress=FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf
//For regular users
const User = {};
const cashierStatus = {};
diff --git a/fn_ui.js b/fn_ui.js
index 57e1d7f..a8fd0b3 100644
--- a/fn_ui.js
+++ b/fn_ui.js
@@ -41,7 +41,7 @@ userUI.sendMoneyToUser = function() {
let confirmation = confirm(`Do you want to SEND ${amount} to ${floID}?`);
if (!confirmation)
return alert("Cancelled");
- User.sendToken(floID, amount, remark).then(txid => {
+ User.sendToken(floID, amount, "|" + remark).then(txid => {
console.warn(`Sent ${amount} to ${floID}`, txid);
alert(`Sent ${amount} to ${floID}. It may take a few mins to reflect in their wallet`);
}).catch(error => console.error(error));
@@ -118,7 +118,7 @@ userUI.payRequest = function(reqID) {
let confirmation = confirm(`Do you want to SEND ${request.message.amount} to ${request.senderID}?`);
if (!confirmation)
return alert("Cancelled");
- User.sendToken(request.senderID, request.message.amount, request.message.remark).then(txid => {
+ User.sendToken(request.senderID, request.message.amount, "|" + request.message.remark).then(txid => {
console.warn(`Sent ${request.message.amount} to ${request.senderID}`, txid);
alert(`Sent ${request.message.amount} to ${request.senderID}. It may take a few mins to reflect in their wallet`);
User.decideRequest(request, 'PAID: ' + txid)
@@ -215,4 +215,30 @@ function completeTokenToCashRequest(request) {
console.info('Rejected token-to-cash request:', request.vectorClock);
}).catch(error => console.error(error))
})
+}
+
+function renderAllTokenTransactions() {
+ let table = document.getElementById('token-transactions').getElementsByTagName('tbody')[0];
+ tokenAPI.getAllTxs(myFloID).then(result => {
+ for (let txid in result.transactions) {
+ let row = table.insertRow();
+ renderTransactionCard(row, txid, tokenAPI.util.parseTxData(result.transactions[txid]));
+ }
+ }).catch(error => console.error(error))
+}
+
+function renderTransactionCard(row, txid, tx) {
+ row.setAttribute('title', txid);
+ row.insertCell().textContent = tx.time;
+ if (tx.sender === myFloID) {
+ row.insertCell().textContent = 'Sent';
+ row.insertCell().textContent = tx.receiver || 'Myself';
+ } else if (tx.receiver === myFloID) {
+ row.insertCell().textContent = 'Recieved';
+ row.insertCell().textContent = tx.sender;
+ } else { //This should not happen unless API returns transaction that doesnot involve myFloID
+ row.insertCell().textContent = tx.sender;
+ row.insertCell().textContent = tx.receiver;
+ }
+ row.insertCell().textContent = tx.tokenAmount;
}
\ No newline at end of file
diff --git a/new.html b/new.html
index 0f07444..f5aa4df 100644
--- a/new.html
+++ b/new.html
@@ -67,6 +67,7 @@
document.getElementById('user').hidden = false;
}).catch(error => console.error(error))
}
+ renderAllTokenTransactions();
}).catch(error => console.error(error))
}
@@ -88,7 +89,7 @@
-
-
-
- | Date-Time |
- Cashier |
- Mode |
- Status |
-
-
-
-
+
-
-
-
- | Date-Time |
- Requestor |
- Amount |
- Remark |
- Status |
-
-
-
-
+
@@ -130,20 +137,38 @@
-
+
+
+
+
+
-
-
+
+