diff --git a/instances/widgets.treasury-factory.near/widget/pages/dashboard/TransactionHistory.jsx b/instances/widgets.treasury-factory.near/widget/pages/dashboard/TransactionHistory.jsx
index e7a30001..cf998608 100644
--- a/instances/widgets.treasury-factory.near/widget/pages/dashboard/TransactionHistory.jsx
+++ b/instances/widgets.treasury-factory.near/widget/pages/dashboard/TransactionHistory.jsx
@@ -36,20 +36,6 @@ const loading = (
);
-function sortByDate(items) {
- const groupedItems = items ? [...items] : [];
-
- // Sort by timestamp in descending order
- const sortedItems = groupedItems.sort((a, b) => {
- const timestampA = parseInt(a.timestamp, 10);
- const timestampB = parseInt(b.timestamp, 10);
-
- return timestampB - timestampA;
- });
-
- return sortedItems;
-}
-
// use BOS open API for gateway and paid for web4
const pikespeakKey = isBosGateway()
? "${REPL_PIKESPEAK_KEY}"
@@ -66,78 +52,18 @@ function setAPIError() {
useEffect(() => {
if (!showMoreLoading) {
- const options = {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- "x-api-key": pikespeakKey,
- },
- };
- const promises = [];
setShowMoreLoading(true);
- promises.push(
- asyncFetch(
- `https://api.pikespeak.ai/account/near-transfer/${treasuryDaoID}?limit=${totalTxnsPerPage}&offset=${
- totalTxnsPerPage * (page - 1)
- }`,
- options
- )
- );
-
- promises.push(
- asyncFetch(
- `https://api.pikespeak.ai/account/ft-transfer/${treasuryDaoID}?limit=${totalTxnsPerPage}&offset=${
- totalTxnsPerPage * (page - 1)
- }`,
- options
- )
- );
-
- if (lockupContract) {
- promises.push(
- asyncFetch(
- `https://api.pikespeak.ai/account/near-transfer/${lockupContract}?limit=${totalTxnsPerPage}&offset=${
- totalTxnsPerPage * (page - 1)
- }`,
- options
- )
- );
-
- promises.push(
- asyncFetch(
- `https://api.pikespeak.ai/account/ft-transfer/${lockupContract}?limit=${totalTxnsPerPage}&offset=${
- totalTxnsPerPage * (page - 1)
- }`,
- options
- )
- );
- }
- Promise.all(promises).then((i) => {
- if (!i[0].ok || !i[1].ok) {
+ asyncFetch(
+ `${REPL_BACKEND_API}/transactions-transfer-history?treasuryDaoID=${treasuryDaoID}&lockupContract=${lockupContract}&page=${page}`
+ ).then((res) => {
+ if (!res.body.data) {
setAPIError();
- return;
- }
- if (lockupContract && (!i[2].ok || !i[3].ok)) {
- setAPIError();
- return;
- }
- const nearResp = lockupContract
- ? i[0]?.body.concat(i[2]?.body)
- : i[0]?.body;
- const ftResp = lockupContract
- ? i[1]?.body.concat(i[3]?.body)
- : i[1]?.body;
- if (Array.isArray(nearResp) && Array.isArray(ftResp)) {
- if (
- nearResp.length < totalTxnsPerPage &&
- ftResp.length < totalTxnsPerPage
- ) {
+ } else {
+ if (res.body.data.length < page * totalTxnsPerPage) {
setHideViewMore(true);
}
setError(null);
- setTransactionWithBalance((prev) => {
- return [...prev, ...sortByDate(nearResp.concat(ftResp))];
- });
+ setTransactionWithBalance(res.body.data);
setShowMoreLoading(false);
}
});
@@ -229,6 +155,11 @@ const Container = styled.div`
table {
overflow-x: auto;
}
+
+ .account-cell {
+ min-width: 180px;
+ max-width: 180px;
+ }
`;
function formatAccount(text) {
@@ -252,8 +183,8 @@ return (
Type |
- From |
- To |
+ From |
+ To |
Transaction |
Amount |
@@ -300,45 +231,33 @@ return (
-
+ |
- ),
- children: (
-
- {formatAccount(txn.sender)}
-
- ),
+ accountId: txn.sender,
+ showKYC: false,
instance,
+ displayImage: false,
+ displayName: false,
+ width: 150,
}}
/>
|
-
+ |
- ),
- children: (
-
- {formatAccount(txn.receiver)}
-
- ),
+ accountId: txn.receiver,
+ showKYC: false,
instance,
+ displayImage: false,
+ displayName: false,
+ width: 150,
}}
/>
|
-
+ |
|