Skip to content

Commit

Permalink
continue
Browse files Browse the repository at this point in the history
  • Loading branch information
borispoehland committed Aug 12, 2024
1 parent ce8e663 commit 8c5800d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/collection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import type {
GetDropsResponse,
GetGlobalOffersArgs,
GetNFTsArgs,
GetOffersArgs,
GetOffersResponse,
GlobalOffersResult,
ICollectionAttributes,
ICollectionProfile,
Expand Down Expand Up @@ -417,6 +419,23 @@ export class CollectionModule {
return await getActivity(args, this.api)
}

public getOffers = async (
args: GetOffersArgs
): Promise<GetOffersResponse> => {
return await this.api.fetchWithTimeout<GetOffersResponse>(
'/nft/offer/query',
{
params: {
filter: JSON.stringify(args),
},
next: {
tags: ['/nft/offer/query'],
/* revalidate: 500, */
},
}
)
}

/**
* Fetch collections profiles based on the provided arguments.
* @param {GetCollectionsArgs} args - The GetCollectionsArgs object containing the search parameters.
Expand Down
32 changes: 31 additions & 1 deletion src/types/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
SaleInfo,
} from './nft'
import type { NftActivityType } from './trading'
import type { IUserProfileSearch } from './user'
import type { IUserProfileSearch, OfferBody } from './user'

export interface ISocials {
twitter: string
Expand Down Expand Up @@ -423,6 +423,36 @@ export interface GetDropsResponse {
hasMoreResults: boolean
}

export interface OfferFilters {
isActive?: boolean[]
identifier?: string[]
collection?: string[]
owner?: string[]
nftOwner?: string[]
marketplace?: Marketplace[]
range?: {
min: number
max: number
field: string
}[]
}

export interface GetOffersArgs {
select?: string[]
strictSelect?: boolean
orderBy?: string[]
top?: number
skip?: number
includeCount?: boolean
filters?: OfferFilters
}

export interface GetOffersResponse {
count?: number
resources: OfferBody[]
hasMoreResults: boolean
}

export type ActivityData = {
collection: string
identifier: string
Expand Down

0 comments on commit 8c5800d

Please sign in to comment.