@poap-xyz/poaps
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -5,4 +5,6 @@ export declare function filterUndefinedProperties<T extends Record<string, any>>(obj: T): Partial<T>; | ||
export declare function creatEqFilter(key: string, value?: string | number): Record<string, any>; | ||
export declare function creatAddressFilter(key: string, value?: string): Record<string, any>; | ||
export declare function creatNeqFilter(key: string, value?: string | number): Record<string, any>; | ||
export declare function filterZeroAddress(filter: boolean): Record<string, any>; | ||
export declare function creatAddressFilter(key: string, filter: boolean, value?: string): Record<string, any>; | ||
export declare function createInFilter(key: string, values?: Array<string | number>): Record<string, any>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): Record<string, any>; |
@@ -18,2 +18,3 @@ import { Order, Chain } from '@poap-xyz/utils'; | ||
sort_dir?: Order; | ||
filter_by_zero_address?: boolean; | ||
} |
@@ -5,4 +5,6 @@ export declare function filterUndefinedProperties<T extends Record<string, any>>(obj: T): Partial<T>; | ||
export declare function creatEqFilter(key: string, value?: string | number): Record<string, any>; | ||
export declare function creatAddressFilter(key: string, value?: string): Record<string, any>; | ||
export declare function creatNeqFilter(key: string, value?: string | number): Record<string, any>; | ||
export declare function filterZeroAddress(filter: boolean): Record<string, any>; | ||
export declare function creatAddressFilter(key: string, filter: boolean, value?: string): Record<string, any>; | ||
export declare function createInFilter(key: string, values?: Array<string | number>): Record<string, any>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): Record<string, any>; |
@@ -18,2 +18,3 @@ import { Order, Chain } from '@poap-xyz/utils'; | ||
sort_dir?: Order; | ||
filter_by_zero_address?: boolean; | ||
} |
@@ -63,5 +63,16 @@ (function (global, factory) { | ||
} | ||
function creatAddressFilter(key, value) { | ||
return value ? { [key]: { _eq: value.toLocaleLowerCase() } } : {}; | ||
function filterZeroAddress(filter) { | ||
return filter ? { _neq: '0x0000000000000000000000000000000000000000' } : {}; | ||
} | ||
function creatAddressFilter(key, filter, value) { | ||
const addressFilter = { | ||
[key]: { | ||
...filterZeroAddress(filter), | ||
}, | ||
}; | ||
if (value) { | ||
addressFilter[key]._eq = value.toLocaleLowerCase(); | ||
} | ||
return filter || value ? addressFilter : {}; | ||
} | ||
function createInFilter(key, values) { | ||
@@ -86,3 +97,3 @@ return values && values.length ? { [key]: { _in: values } } : {}; | ||
async fetch(input) { | ||
const { limit, offset, chain, collector_address, minted_date_from, minted_date_to, ids, drop_id, sort_field, sort_dir, } = input; | ||
const { limit, offset, chain, collector_address, minted_date_from, minted_date_to, ids, drop_id, sort_field, sort_dir, filter_by_zero_address = true, } = input; | ||
const variables = { | ||
@@ -93,3 +104,3 @@ limit, | ||
where: { | ||
...creatAddressFilter('collector_address', collector_address), | ||
...creatAddressFilter('collector_address', filter_by_zero_address, collector_address), | ||
...creatEqFilter('chain', chain), | ||
@@ -96,0 +107,0 @@ ...creatEqFilter('drop_id', drop_id), |
@@ -5,4 +5,6 @@ export declare function filterUndefinedProperties<T extends Record<string, any>>(obj: T): Partial<T>; | ||
export declare function creatEqFilter(key: string, value?: string | number): Record<string, any>; | ||
export declare function creatAddressFilter(key: string, value?: string): Record<string, any>; | ||
export declare function creatNeqFilter(key: string, value?: string | number): Record<string, any>; | ||
export declare function filterZeroAddress(filter: boolean): Record<string, any>; | ||
export declare function creatAddressFilter(key: string, filter: boolean, value?: string): Record<string, any>; | ||
export declare function createInFilter(key: string, values?: Array<string | number>): Record<string, any>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): Record<string, any>; |
@@ -18,2 +18,3 @@ import { Order, Chain } from '@poap-xyz/utils'; | ||
sort_dir?: Order; | ||
filter_by_zero_address?: boolean; | ||
} |
{ | ||
"name": "@poap-xyz/poaps", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Poaps module for the poap.js library", | ||
@@ -32,5 +32,5 @@ "main": "dist/cjs/index.cjs", | ||
"peerDependencies": { | ||
"@poap-xyz/providers": "*", | ||
"@poap-xyz/utils": "*" | ||
"@poap-xyz/providers": "0.0.26", | ||
"@poap-xyz/utils": "0.0.26" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57862
647