-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c2d06f
commit cced044
Showing
4 changed files
with
50 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type React from 'react'; | ||
|
||
import type { AddressFromToFilter } from 'types/api/address'; | ||
import type { TransactionsSortingField, TransactionsSortingValue, TransactionsSorting } from 'types/api/transaction'; | ||
|
||
import { TX } from 'stubs/tx'; | ||
import { generateListStub } from 'stubs/utils'; | ||
import useQueryWithPages from 'ui/shared/pagination/useQueryWithPages'; | ||
import getSortParamsFromValue from 'ui/shared/sort/getSortParamsFromValue'; | ||
|
||
type Props = { | ||
hash: string; | ||
sort?: TransactionsSortingValue; | ||
filter?: AddressFromToFilter; | ||
scrollRef?: React.RefObject<HTMLDivElement>; | ||
enabled: boolean; | ||
} | ||
|
||
export default function useAddressTxsQuery({ hash, filter, sort, scrollRef, enabled }: Props) { | ||
|
||
return useQueryWithPages({ | ||
resourceName: 'address_txs', | ||
pathParams: { hash }, | ||
filters: { filter }, | ||
sorting: getSortParamsFromValue<TransactionsSortingValue, TransactionsSortingField, TransactionsSorting['order']>(sort), | ||
scrollRef, | ||
options: { | ||
enabled, | ||
refetchOnMount: false, | ||
placeholderData: generateListStub<'address_txs'>(TX, 50, { next_page_params: { | ||
block_number: 9005713, | ||
index: 5, | ||
items_count: 50, | ||
} }), | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters