From e06ba11ca6200799486eaa5b5c896d21de79399e Mon Sep 17 00:00:00 2001 From: UsamaHameed Date: Fri, 16 Jul 2021 13:07:57 +0200 Subject: [PATCH 1/3] accept senderAddress and recipientAddress as filters in api/transactions --- src/utils/api/transaction/lsk.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/api/transaction/lsk.js b/src/utils/api/transaction/lsk.js index 042475ce87..f4ec7ed98f 100644 --- a/src/utils/api/transaction/lsk.js +++ b/src/utils/api/transaction/lsk.js @@ -52,7 +52,8 @@ export const getTransaction = ({ }); const filters = { - address: { key: 'address', test: address => !validateAddress(tokenMap.LSK.key, address) }, + senderAddress: { key: 'senderAddress', test: address => !validateAddress(tokenMap.LSK.key, address) }, + recipientAddress: { key: 'recipientAddress', test: address => !validateAddress(tokenMap.LSK.key, address) }, timestamp: { key: 'timestamp', test: str => /^(\d+)?:(\d+)?$/.test(str) }, amount: { key: 'amount', test: str => /^(\d+)?:(\d+)?$/.test(str) }, limit: { key: 'limit', test: num => parseInt(num, 10) > 0 }, From d392c44995820200ce5b8654899ebe1cdf250df4 Mon Sep 17 00:00:00 2001 From: UsamaHameed Date: Fri, 16 Jul 2021 13:08:48 +0200 Subject: [PATCH 2/3] properly add senderAddress and recipientAddress as filters for transactions api calls --- .../screens/monitor/transactions/transactions.js | 8 ++++---- src/components/shared/transactionsTable/index.js | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/screens/monitor/transactions/transactions.js b/src/components/screens/monitor/transactions/transactions.js index 216875c7c4..7d3764b159 100644 --- a/src/components/screens/monitor/transactions/transactions.js +++ b/src/components/screens/monitor/transactions/transactions.js @@ -14,12 +14,12 @@ const fields = t => [{ }, { label: t('Address'), placeholder: t('Address or public key'), - name: 'address', + name: 'senderAddress', type: 'address', }, { label: t('Recipient'), placeholder: t('Address or public key'), - name: 'recipient', + name: 'recipientAddress', type: 'address', }, { label: t('Type'), @@ -41,8 +41,8 @@ const Transactions = ({ t, transactions }) => { amountTo: '', moduleAssetId: '', height: '', - recipient: '', - address: '', + recipientAddress: '', + senderAddress: '', }; const canLoadMore = transactions.meta ? transactions.data.length < transactions.meta.total diff --git a/src/components/shared/transactionsTable/index.js b/src/components/shared/transactionsTable/index.js index 129565d56d..4536256e07 100644 --- a/src/components/shared/transactionsTable/index.js +++ b/src/components/shared/transactionsTable/index.js @@ -40,6 +40,7 @@ const TransactionsTable = ({ offset: transactions.meta.count + transactions.meta.offset, sort, }); + transactions.loadData(params); }; @@ -47,8 +48,8 @@ const TransactionsTable = ({ const formatters = { height: value => `${t('Height')}: ${value}`, moduleAssetId: value => `${t('Type')}: ${getModuleAssetTitle()[value]}`, - address: value => `${t('Address')}: ${value}`, - recipient: value => `${t('Recipient')}: ${value}`, + senderAddress: value => `${t('Address')}: ${value}`, + recipientAddress: value => `${t('Recipient')}: ${value}`, }; return ( From 9a8ff58187ef6bc16213f1246384423b4906b8b5 Mon Sep 17 00:00:00 2001 From: UsamaHameed Date: Fri, 16 Jul 2021 15:39:12 +0200 Subject: [PATCH 3/3] fix filter resetting --- src/components/screens/monitor/transactions/transactions.js | 2 +- src/components/shared/transactionsTable/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/screens/monitor/transactions/transactions.js b/src/components/screens/monitor/transactions/transactions.js index 7d3764b159..fd1c347b3f 100644 --- a/src/components/screens/monitor/transactions/transactions.js +++ b/src/components/screens/monitor/transactions/transactions.js @@ -12,7 +12,7 @@ const fields = t => [{ name: 'amount', type: 'number-range', }, { - label: t('Address'), + label: t('Sender'), placeholder: t('Address or public key'), name: 'senderAddress', type: 'address', diff --git a/src/components/shared/transactionsTable/index.js b/src/components/shared/transactionsTable/index.js index 4536256e07..a20137d6a8 100644 --- a/src/components/shared/transactionsTable/index.js +++ b/src/components/shared/transactionsTable/index.js @@ -48,7 +48,7 @@ const TransactionsTable = ({ const formatters = { height: value => `${t('Height')}: ${value}`, moduleAssetId: value => `${t('Type')}: ${getModuleAssetTitle()[value]}`, - senderAddress: value => `${t('Address')}: ${value}`, + senderAddress: value => `${t('Sender')}: ${value}`, recipientAddress: value => `${t('Recipient')}: ${value}`, }; @@ -107,8 +107,8 @@ const defaultFilters = { amountTo: '', moduleAssetId: '', height: '', - recipient: '', - address: '', + recipientAddress: '', + senderAddress: '', }; const defaultSort = 'timestamp:desc';