Skip to content

Commit

Permalink
Move address constants
Browse files Browse the repository at this point in the history
  • Loading branch information
jm42 committed Apr 20, 2024
1 parent c510e46 commit d845d6c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/utils/src/constants/address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
export const DEAD_ADDRESS = '0x000000000000000000000000000000000000dead';
1 change: 1 addition & 0 deletions packages/utils/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './address';
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './types';
export * from './constants';
export * from './functions';
export * from './queries';
export * from './format';
Expand Down
10 changes: 4 additions & 6 deletions packages/utils/src/queries/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
NinFilter,
Value,
} from '../types/filter';
import { ZERO_ADDRESS, DEAD_ADDRESS } from '../constants';

export function createLikeFilter(
key: string,
Expand Down Expand Up @@ -63,20 +64,17 @@ export function createNotNullAddressFilter(
): FieldFilter<NeqFilter<string>> | FieldFilter<NinFilter<string>> {
if (filterZeroAddress && filterDeadAddress) {
return createField<NinFilter<string>>(key, {
_nin: [
'0x0000000000000000000000000000000000000000',
'0x000000000000000000000000000000000000dead',
],
_nin: [ZERO_ADDRESS, DEAD_ADDRESS],
});
}
if (filterZeroAddress) {
return createField<NeqFilter<string>>(key, {
_neq: '0x0000000000000000000000000000000000000000',
_neq: ZERO_ADDRESS,
});
}
if (filterDeadAddress) {
return createField<NeqFilter<string>>(key, {
_neq: '0x000000000000000000000000000000000000dead',
_neq: DEAD_ADDRESS,
});
}
return {};
Expand Down

0 comments on commit d845d6c

Please sign in to comment.