mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
address relation from query (#2938)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import type { AddressParam } from './addressParams';
|
||||
import type { TokenInfo } from './token';
|
||||
|
||||
export const ADVANCED_FILTER_ADDRESS_RELATION = [ 'or', 'and' ] as const;
|
||||
export type AddressRelation = typeof ADVANCED_FILTER_ADDRESS_RELATION[number];
|
||||
|
||||
export type AdvancedFilterParams = {
|
||||
transaction_types?: Array<AdvancedFilterType>;
|
||||
methods?: Array<string>;
|
||||
@@ -12,7 +15,7 @@ export type AdvancedFilterParams = {
|
||||
from_address_hashes_to_exclude?: Array<string>;
|
||||
to_address_hashes_to_include?: Array<string>;
|
||||
to_address_hashes_to_exclude?: Array<string>;
|
||||
address_relation?: 'or' | 'and';
|
||||
address_relation?: AddressRelation;
|
||||
amount_from?: string;
|
||||
amount_to?: string;
|
||||
token_contract_address_hashes_to_include?: Array<string>;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useRouter } from 'next/router';
|
||||
import React from 'react';
|
||||
|
||||
import type { AdvancedFilterParams } from 'types/api/advancedFilter';
|
||||
import { ADVANCED_FILTER_TYPES, ADVANCED_FILTER_AGES } from 'types/api/advancedFilter';
|
||||
import { ADVANCED_FILTER_TYPES, ADVANCED_FILTER_AGES, ADVANCED_FILTER_ADDRESS_RELATION } from 'types/api/advancedFilter';
|
||||
|
||||
import useApiQuery from 'lib/api/useApiQuery';
|
||||
import { AddressHighlightProvider } from 'lib/contexts/addressHighlight';
|
||||
@@ -47,6 +47,7 @@ const AdvancedFilter = () => {
|
||||
|
||||
const [ filters, setFilters ] = React.useState<AdvancedFilterParams>(() => {
|
||||
const age = getFilterValueFromQuery(ADVANCED_FILTER_AGES, router.query.age);
|
||||
const addressRelation = getFilterValueFromQuery(ADVANCED_FILTER_ADDRESS_RELATION, router.query.address_relation);
|
||||
return {
|
||||
transaction_types: getFilterValuesFromQuery(ADVANCED_FILTER_TYPES, router.query.transaction_types),
|
||||
methods: getValuesArrayFromQuery(router.query.methods),
|
||||
@@ -56,6 +57,7 @@ const AdvancedFilter = () => {
|
||||
age,
|
||||
age_to: age ? dayjs().toISOString() : getQueryParamString(router.query.age_to),
|
||||
age_from: age ? dayjs((dayjs().valueOf() - getDurationFromAge(age))).toISOString() : getQueryParamString(router.query.age_from),
|
||||
address_relation: addressRelation,
|
||||
token_contract_address_hashes_to_exclude: getValuesArrayFromQuery(router.query.token_contract_address_hashes_to_exclude),
|
||||
token_contract_symbols_to_exclude: getValuesArrayFromQuery(router.query.token_contract_symbols_to_exclude),
|
||||
token_contract_address_hashes_to_include: getValuesArrayFromQuery(router.query.token_contract_address_hashes_to_include),
|
||||
|
||||
Reference in New Issue
Block a user