Skip to content

Commit

Permalink
Address filter (#34)
Browse files Browse the repository at this point in the history
* Changed versions

* Changed versions
  • Loading branch information
rlajous authored Jun 27, 2023
1 parent a5c4243 commit 7235664
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/drops/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/drops",
"version": "0.0.22",
"version": "0.0.23",
"description": "Drops module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/moments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/moments",
"version": "0.0.22",
"version": "0.0.23",
"description": "Moments module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/poaps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poaps",
"version": "0.0.22",
"version": "0.0.23",
"description": "Poaps module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
4 changes: 2 additions & 2 deletions packages/poaps/src/PoapsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { POAP } from './domain/Poap';
import { PaginatedPoapsResponse, PAGINATED_POAPS_QUERY } from './queries';
import {
createBetweenFilter,
createFilter,
creatEqFilter,
createInFilter,
creatUndefinedOrder,
creatAddressFilter,
} from './queries/utils';
import { FetchPoapsInput } from './types';
import { PaginatedResult, nextCursor } from '@poap-xyz/utils';
Expand Down Expand Up @@ -52,7 +52,7 @@ export class PoapsClient {
offset,
orderBy: creatUndefinedOrder(sort_field, sort_dir),
where: {
...createFilter('collector_address', collector_address),
...creatAddressFilter('collector_address', collector_address),
...creatEqFilter('chain', chain),
...creatEqFilter('drop_id', drop_id),
...createBetweenFilter('minted_on', minted_date_from, minted_date_to),
Expand Down
7 changes: 7 additions & 0 deletions packages/poaps/src/queries/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export function creatEqFilter(
return value ? { [key]: { _eq: value } } : {};
}

export function creatAddressFilter(
key: string,
value?: string,
): Record<string, any> {
return value ? { [key]: { _eq: value.toLocaleLowerCase() } } : {};
}

export function createInFilter(
key: string,
values?: Array<string | number>,
Expand Down
2 changes: 1 addition & 1 deletion packages/providers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/providers",
"version": "0.0.22",
"version": "0.0.23",
"description": "Providers module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/utils",
"version": "0.0.22",
"version": "0.0.23",
"description": "Utils module for the poap.js library",
"type": "module",
"main": "dist/cjs/index.cjs",
Expand Down

0 comments on commit 7235664

Please sign in to comment.