From d845d6c647efc8ce3917cfa34eba46682372efdb Mon Sep 17 00:00:00 2001 From: Juan M Date: Sat, 20 Apr 2024 04:27:48 -0300 Subject: [PATCH] Move address constants --- packages/utils/src/constants/address.ts | 2 ++ packages/utils/src/constants/index.ts | 1 + packages/utils/src/index.ts | 1 + packages/utils/src/queries/filter.ts | 10 ++++------ 4 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 packages/utils/src/constants/address.ts create mode 100644 packages/utils/src/constants/index.ts diff --git a/packages/utils/src/constants/address.ts b/packages/utils/src/constants/address.ts new file mode 100644 index 00000000..beb1658d --- /dev/null +++ b/packages/utils/src/constants/address.ts @@ -0,0 +1,2 @@ +export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; +export const DEAD_ADDRESS = '0x000000000000000000000000000000000000dead'; diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts new file mode 100644 index 00000000..cef16803 --- /dev/null +++ b/packages/utils/src/constants/index.ts @@ -0,0 +1 @@ +export * from './address'; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index c864bc3d..3198a64b 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,4 +1,5 @@ export * from './types'; +export * from './constants'; export * from './functions'; export * from './queries'; export * from './format'; diff --git a/packages/utils/src/queries/filter.ts b/packages/utils/src/queries/filter.ts index 01b50b4c..8bee051d 100644 --- a/packages/utils/src/queries/filter.ts +++ b/packages/utils/src/queries/filter.ts @@ -12,6 +12,7 @@ import { NinFilter, Value, } from '../types/filter'; +import { ZERO_ADDRESS, DEAD_ADDRESS } from '../constants'; export function createLikeFilter( key: string, @@ -63,20 +64,17 @@ export function createNotNullAddressFilter( ): FieldFilter> | FieldFilter> { if (filterZeroAddress && filterDeadAddress) { return createField>(key, { - _nin: [ - '0x0000000000000000000000000000000000000000', - '0x000000000000000000000000000000000000dead', - ], + _nin: [ZERO_ADDRESS, DEAD_ADDRESS], }); } if (filterZeroAddress) { return createField>(key, { - _neq: '0x0000000000000000000000000000000000000000', + _neq: ZERO_ADDRESS, }); } if (filterDeadAddress) { return createField>(key, { - _neq: '0x000000000000000000000000000000000000dead', + _neq: DEAD_ADDRESS, }); } return {};