@xoxno/sdk-js 0.1.354 → 0.1.355

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
- import type { NftDoc } from '@xoxno/types';
1
+ import type { GetSingleNftOfferResponseDto, NftDoc } from '@xoxno/types';
2
+ import type { ArgsQueryTop } from '../types';
2
3
  import type { ActivityChain } from '../types/nft';
3
- import type { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
4
- import type { UserOffers } from '../types/user';
5
4
  /**
6
5
  * NFTModule provides a set of methods to interact with single NFTs.
7
6
  * It includes methods for getting single NFT information, and searching NFTs by collection and nonce.
@@ -41,7 +40,7 @@ export declare class NFTModule {
41
40
  * If it is valid, the function fetches the NFT data using the API.
42
41
  * Finally, it returns a promise that resolves to the fetched NFT data.
43
42
  */
44
- getNFTsOffers: (identifier: string, skip?: number, top?: number) => Promise<UserOffers>;
43
+ getNFTsOffers: ({ identifier, ...args }: ArgsQueryTop) => Promise<GetSingleNftOfferResponseDto>;
45
44
  /**
46
45
  * Gets an NFT by collection and nonce.
47
46
  * @param collection The collection ticker.
@@ -73,12 +72,4 @@ export declare class NFTModule {
73
72
  * @return {Promise<NftDoc>} NFT data
74
73
  */
75
74
  getNFTByCollectionAndNonceHex: (collection: string, nonceHex: string) => Promise<NftDoc>;
76
- /**
77
- * Retrieves trading history based on the provided arguments.
78
- *
79
- * @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
80
- * @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
81
- * @throws {Error} Throws an error if the 'top' argument is greater than 100.
82
- */
83
- getTradingActivity: (args: TradincActivityArgs) => Promise<TradingActivityResponse>;
84
75
  }
@@ -1,7 +1,7 @@
1
1
  import type { IEventDoc } from './event';
2
2
  import type { ActivityChain, CollectionInfo, Media, NftData, NFTMetadata, Owner, SaleInfo } from './nft';
3
3
  import type { NftActivityType } from './trading';
4
- import type { CreatorProfile, IUserProfileSearch, OfferBody } from './user';
4
+ import type { CreatorProfile, IUserProfileSearch } from './user';
5
5
  export interface ISocials {
6
6
  twitter: string;
7
7
  instagram: string;
@@ -281,69 +281,6 @@ export declare enum AuctionTypes {
281
281
  All = "All",
282
282
  AllListed = "AllListed"
283
283
  }
284
- export interface GetNFTsArgs {
285
- /** Listed by different users */
286
- listedBy?: string[];
287
- /** Owned by different users */
288
- ownedBy?: string[];
289
- identifiers?: string[];
290
- auctionType: AuctionTypes;
291
- /** If set, will return only NFTs from the specified collections */
292
- collections?: string[];
293
- chain?: ActivityChain[];
294
- /** If set, will return only NFTs from verified collections */
295
- onlyVerified?: boolean;
296
- /** If true, will return only NFTs that are on sale */
297
- onlyOnSale?: boolean;
298
- /** If true, will return only NFTs that are active, deadline not expired */
299
- activeAuctions?: boolean;
300
- /** If true the extra details of an NFT will be appended to each NFT, such as collection size and owners name */
301
- applyNftExtraDetails?: boolean;
302
- /** If set, will return only NFTs with a price in the specified range */
303
- priceRange?: {
304
- min: number;
305
- max: number;
306
- };
307
- /** If set, will return only NFTs listed in the specified tokens */
308
- listedInToken?: string[];
309
- /** If set, will return only NFTs with a rank in the specified range */
310
- rankRange?: {
311
- min: number;
312
- max: number;
313
- };
314
- /** If set, will return only NFTs with a cantina level in the specified range */
315
- cantinaLevelRange?: {
316
- min: number;
317
- max: number;
318
- };
319
- /** If set, will return the total count of the NFTs, recommended to be set true only for the first call, then false for the next pages */
320
- includeCount?: boolean;
321
- /** If set, will apply the extra manual filters on top of the main payload */
322
- extraSearch?: string[];
323
- /** If set, will return only NFTs with a name that contains the specified string */
324
- searchName?: string;
325
- /** The number of results to return */
326
- top?: number;
327
- /** The order by to use */
328
- skip?: number;
329
- /** Document type */
330
- dataType?: string[];
331
- /** The nonces of the NFTs */
332
- nonces?: number[];
333
- /** If set, will return only NFTs that are staked */
334
- isStaked?: boolean;
335
- /** The order of the results based on a field */
336
- orderBy?: SearchOrderBy[];
337
- /** If set, will return only the specified fields */
338
- onlySelectFields?: FieldsToSelect[];
339
- /** If set, will return only NFTs listed in the specified marketplaces */
340
- listedOnlyOn?: Marketplace[];
341
- /** If set, will return only NFTs with the specified attributes */
342
- attributes?: MetadataAttribute[];
343
- /** If set, will return only the selected fields */
344
- strictSelect?: boolean;
345
- name?: string;
346
- }
347
284
  export interface GETDropsArgs {
348
285
  name?: string;
349
286
  /** If set, will return only NFTs from the specified collections */
@@ -380,26 +317,6 @@ export interface SuggestNFTsArgs {
380
317
  orderBy?: SuggestOrderBy[];
381
318
  chain?: ActivityChain[];
382
319
  }
383
- export interface SearchNFTsResponse {
384
- /** The total count of the results for the specific query */
385
- count?: number;
386
- /** The results for the current page */
387
- resources: NftData[];
388
- /** The payload to use to get the next page */
389
- getNextPagePayload: GetNFTsArgs;
390
- /** If there are more results to fetch */
391
- hasMoreResults: boolean;
392
- }
393
- export interface GetDropsResponse {
394
- /** The total count of the results for the specific query */
395
- count?: number;
396
- /** The results for the current page */
397
- resources: GetCollectionMintInfo[];
398
- /** The payload to use to get the next page */
399
- getNextPagePayload: GETDropsArgs;
400
- /** If there are more results to fetch */
401
- hasMoreResults: boolean;
402
- }
403
320
  export interface OfferFilters {
404
321
  isActive?: boolean[];
405
322
  identifier?: string[];
@@ -422,11 +339,6 @@ export interface GetOffersArgs {
422
339
  includeCount?: boolean;
423
340
  filters?: OfferFilters;
424
341
  }
425
- export interface GetOffersResponse {
426
- count?: number;
427
- resources: OfferBody[];
428
- hasMoreResults: boolean;
429
- }
430
342
  export type ActivityData = {
431
343
  collection: string;
432
344
  identifier: string;
@@ -501,17 +413,10 @@ export interface CollectionsNFTsResponse {
501
413
  /** The results for the current page */
502
414
  results: ICollectionProfile[];
503
415
  /** If the results are empty */
504
- empty: boolean;
505
416
  /** The payload to use to get the next page */
506
- getNextPagePayload: GetCollectionsArgs;
507
417
  /** If there are more results to fetch */
508
418
  hasMoreResults: boolean;
509
419
  }
510
- export interface SuggestResults {
511
- count: number;
512
- hasMoreResults: boolean;
513
- resources: ResultsBody;
514
- }
515
420
  export interface ResultsBody {
516
421
  collections: (ICollectionProfile & {
517
422
  floorPrice: number;
@@ -641,12 +546,6 @@ export type HoldedDetails = {
641
546
  export interface AvgHolder extends HoldedDetails {
642
547
  avgPerHodler: number;
643
548
  }
644
- export type GlobalOffersResult = {
645
- resources: GlobalOffers[];
646
- hasMoreResults: boolean;
647
- lastSkip: number;
648
- getNextPagePayload?: GetGlobalOffersArgs;
649
- };
650
549
  export type GlobalOffers = {
651
550
  offerId: number;
652
551
  collection: string;
@@ -716,11 +615,6 @@ export type StagePrice = {
716
615
  usdValue: number;
717
616
  decimals: number;
718
617
  };
719
- export type CollectionStatsResults = {
720
- resources: CollectionStatsDoc[];
721
- hasMoreResults: boolean;
722
- getNextPagePayload?: GetCollectionStatsArgs;
723
- };
724
618
  export type GetCollectionStatsArgs = {
725
619
  filters?: {
726
620
  chain?: ActivityChain[];
@@ -9,3 +9,15 @@ export * from './event';
9
9
  export type PublicOnly<T> = {
10
10
  [K in keyof T as T[K] extends Function ? never : K]: T[K];
11
11
  };
12
+ export interface ArgsQueryTop {
13
+ identifier: string;
14
+ skip: number;
15
+ top: number;
16
+ }
17
+ export interface ArgsUserOffers extends ArgsQueryTop {
18
+ type: OfferType;
19
+ }
20
+ export declare enum OfferType {
21
+ Received = "received",
22
+ Placed = "placed"
23
+ }
@@ -1,4 +1,4 @@
1
- import type { Marketplace, MetadataAttribute, RangeFilter, TradingActivity } from './collection';
1
+ import type { Marketplace, MetadataAttribute, RangeFilter } from './collection';
2
2
  import type { ActivityChain } from './nft';
3
3
  export declare enum NftActivityType {
4
4
  NFT_CREATE = "nftCreate",
@@ -109,10 +109,3 @@ export declare enum SelectFieldsTradingActivity {
109
109
  'marketplace' = 8,
110
110
  'payment_token' = 9
111
111
  }
112
- export interface TradingActivityResponse {
113
- hasMoreResults: boolean;
114
- /** The total count of the results for the specific query */
115
- count?: number;
116
- resources: TradingActivity[];
117
- empty: boolean;
118
- }
@@ -86,21 +86,6 @@ export interface UserInventory {
86
86
  value: number;
87
87
  chain?: ActivityChain;
88
88
  }
89
- export interface UserOffers {
90
- hasMoreResults: boolean;
91
- count: number;
92
- resources: OfferBody[];
93
- }
94
- export interface ArgsUserOffers {
95
- address: string;
96
- type: OfferType;
97
- skip: number;
98
- top: number;
99
- }
100
- export declare enum OfferType {
101
- Received = "received",
102
- Placed = "placed"
103
- }
104
89
  export interface OfferBody {
105
90
  dataType: string;
106
91
  identifier: string;
@@ -124,12 +109,6 @@ export interface OfferBody {
124
109
  floorPrice: number;
125
110
  chain?: ActivityChain;
126
111
  }
127
- export type Nfts = {
128
- count: number;
129
- resultsCount: number;
130
- results: NftData[];
131
- empty: boolean;
132
- };
133
112
  export declare enum Type {
134
113
  NonFungibleESDT = "NonFungibleESDT"
135
114
  }
@@ -1,6 +1,6 @@
1
- import type { NftDocFilter } from '@xoxno/types';
2
- import type { CollectionCreatorInfo, CreatorInfo, EventCreatorInfo, PublicOnly, SearchNFTsResponse, StakingStatus, StakingSummaryPools, StakingSummaryPoolsSlim, StatusResponse, SuggestNFTsArgs, SuggestResults, TradincActivityArgs, TradingActivityResponse } from '../types';
3
- import type { ArgsUserOffers, BulkAccount, CreatorProfile, IApiShareholder, IOwnerInfo, IUserProfile, StakingCreatorInfo, UserAnalyticSummary, UserInventory, UserNetworkAccount, UserOffers, UserPoolStakingInfo, UserStats, UserTokenInventory, UserXOXNODrop } from '../types/user';
1
+ import type { FilterQueryDto, GetUserOffersResponseDto, GlobalSearchResponseDto, NftCosmosResponse, NftDocFilter } from '@xoxno/types';
2
+ import type { ArgsQueryTop, ArgsUserOffers, CollectionCreatorInfo, CreatorInfo, EventCreatorInfo, PublicOnly, StakingStatus, StakingSummaryPools, StakingSummaryPoolsSlim, StatusResponse } from '../types';
3
+ import type { BulkAccount, CreatorProfile, IApiShareholder, IOwnerInfo, IUserProfile, StakingCreatorInfo, UserAnalyticSummary, UserInventory, UserNetworkAccount, UserPoolStakingInfo, UserStats, UserTokenInventory, UserXOXNODrop } from '../types/user';
4
4
  export declare class UserModule {
5
5
  private api;
6
6
  private collection;
@@ -45,14 +45,14 @@ export declare class UserModule {
45
45
  * @param address - The user's address
46
46
  * @returns {UserInventory} - A list of token ids and the price
47
47
  */
48
- getUserNFTs: (args: PublicOnly<NftDocFilter>) => Promise<import("@xoxno/types").NftCosmosResponse>;
48
+ getUserNFTs: (args: PublicOnly<NftDocFilter>) => Promise<NftCosmosResponse>;
49
49
  /**
50
50
  * @name getUserOffers
51
51
  * @description Fetches all offers sent or received associated with a user address
52
- * @param {String} address - The user's wallet address
52
+ * @param {ArgsUserOffers} address - The user's wallet address
53
53
  * @returns {UserOffers} - The user's listings
54
54
  */
55
- getUserOffers: (args: ArgsUserOffers) => Promise<UserOffers>;
55
+ getUserOffers: ({ identifier: address, ...args }: ArgsUserOffers) => Promise<GetUserOffersResponseDto>;
56
56
  /**
57
57
  * @public
58
58
  * @async
@@ -67,15 +67,7 @@ export declare class UserModule {
67
67
  *
68
68
  * Finally, it returns a promise that resolves to the fetched users results.
69
69
  */
70
- suggestUsers: (args: SuggestNFTsArgs) => Promise<SuggestResults>;
71
- /**
72
- * Retrieves trading history based on the provided arguments.
73
- *
74
- * @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
75
- * @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
76
- * @throws {Error} Throws an error if the 'top' argument is greater than 100.
77
- */
78
- getTradingActivity: (args: TradincActivityArgs) => Promise<TradingActivityResponse>;
70
+ suggestUsers: (args: PublicOnly<FilterQueryDto>) => Promise<GlobalSearchResponseDto>;
79
71
  /** Gets user's creator profile
80
72
  * @param {String} address - User's address
81
73
  * @returns {CreatorProfile} User's creator profile struct
@@ -145,7 +137,7 @@ export declare class UserModule {
145
137
  * @returns {NftDoc[]} Array of NFTs
146
138
  * @throws {Error} Throws an error if the address is invalid
147
139
  * */
148
- getUserFavoriteNFTs: (address: string, top: number, skip: number) => Promise<SearchNFTsResponse>;
140
+ getUserFavoriteNFTs: ({ identifier: address, ...args }: ArgsQueryTop) => Promise<NftCosmosResponse>;
149
141
  /** Gets user's favorite collection tickers
150
142
  * @param {String} address - User's address
151
143
  * @returns {String[]} Array of tickers
@@ -1,6 +1,12 @@
1
1
  export declare class CollectionNotFoundError extends Error {
2
2
  constructor(item: string);
3
3
  }
4
+ export declare class AddressNotFoundError extends Error {
5
+ constructor(item: string);
6
+ }
7
+ export declare class NFTNotFoundError extends Error {
8
+ constructor(item: string);
9
+ }
4
10
  export declare class PaginatedTopError extends Error {
5
11
  constructor(top: number);
6
12
  }
@@ -1,4 +1,7 @@
1
- import type { CosmosDbGenericFilter } from '@xoxno/types';
2
1
  export declare function collectionGuard<T>(collection: string, callback: Promise<T>): Promise<T>;
2
+ export declare function addressGuard<T>(address: string, callback: Promise<T>): Promise<T>;
3
+ export declare function nftGuard<T>(identifier: string, callback: Promise<T>): Promise<T>;
3
4
  export declare function collectionGuardOnly(collection: string): Promise<void>;
4
- export declare function paginatedGuard<T, R>(filter: CosmosDbGenericFilter<T>, callback: (filter: string) => Promise<R>): Promise<R>;
5
+ export declare function paginatedGuard<T extends {
6
+ top?: number;
7
+ }, R>(filter: T, callback: (filter: string) => Promise<R>): Promise<R>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "0.1.354",
3
+ "version": "0.1.355",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {
@@ -98,7 +98,7 @@
98
98
  "dependencies": {
99
99
  "@multiversx/sdk-core": "^13.17.2",
100
100
  "@multiversx/sdk-network-providers": "^2.9.3",
101
- "@xoxno/types": "^1.0.9",
101
+ "@xoxno/types": "^1.0.11",
102
102
  "axios": "^1.7.9",
103
103
  "protobufjs": "^7.4.0",
104
104
  "webpack-bundle-analyzer": "^4.10.2"
@@ -1,10 +0,0 @@
1
- import type { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
2
- import type { XOXNOClient } from './api';
3
- /**
4
- * Fetches the trading activity of the given collections
5
- * @param args - The trading activity arguments
6
- * @param api - The API client
7
- * @returns - The trading activity response
8
- * @throws - If the top is greater than 100
9
- */
10
- export declare const getActivity: (args: TradincActivityArgs, api: XOXNOClient) => Promise<TradingActivityResponse>;