Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept senderAddress and recipientAddress as filters in api/transactions - Closes #3652 #3696

Merged
merged 3 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/screens/monitor/transactions/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const fields = t => [{
name: 'amount',
type: 'number-range',
}, {
label: t('Address'),
label: t('Sender'),
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'),
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/components/shared/transactionsTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ const TransactionsTable = ({
offset: transactions.meta.count + transactions.meta.offset,
sort,
});

transactions.loadData(params);
};

/* istanbul ignore next */
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('Sender')}: ${value}`,
recipientAddress: value => `${t('Recipient')}: ${value}`,
};

return (
Expand Down Expand Up @@ -106,8 +107,8 @@ const defaultFilters = {
amountTo: '',
moduleAssetId: '',
height: '',
recipient: '',
address: '',
recipientAddress: '',
senderAddress: '',
};

const defaultSort = 'timestamp:desc';
Expand Down
3 changes: 2 additions & 1 deletion src/utils/api/transaction/lsk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down