@xoxno/sdk-js 0.1.353 → 0.1.354

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,4 +1,5 @@
1
- import type { ActivityChain, NftData } from '../types/nft';
1
+ import type { NftDoc } from '@xoxno/types';
2
+ import type { ActivityChain } from '../types/nft';
2
3
  import type { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
3
4
  import type { UserOffers } from '../types/user';
4
5
  /**
@@ -16,7 +17,7 @@ export declare class NFTModule {
16
17
  * @async
17
18
  * @function getNFTByIdentifier
18
19
  * @param {string} identifier - The identifier of the NFT to fetch data for.
19
- * @returns {Promise<NftData>} A promise that resolves to the fetched NFT data.
20
+ * @returns {Promise<NftDoc>} A promise that resolves to the fetched NFT data.
20
21
  *
21
22
  * This function fetches data for a given NFT by its identifier. It takes the following parameter:
22
23
  * - identifier (string): The identifier of the NFT to fetch data for.
@@ -25,13 +26,13 @@ export declare class NFTModule {
25
26
  * If it is valid, the function fetches the NFT data using the API.
26
27
  * Finally, it returns a promise that resolves to the fetched NFT data.
27
28
  */
28
- getNFTByIdentifier: (identifier: string, extra?: RequestInit) => Promise<NftData>;
29
+ getNFTByIdentifier: (identifier: string, extra?: RequestInit) => Promise<NftDoc>;
29
30
  /**
30
31
  * @public
31
32
  * @async
32
33
  * @function getNFTByIdentifier
33
34
  * @param {string} identifier - The identifier of the NFT to fetch data for.
34
- * @returns {Promise<NftData>} A promise that resolves to the fetched NFT data.
35
+ * @returns {Promise<NftDoc>} A promise that resolves to the fetched NFT data.
35
36
  *
36
37
  * This function fetches data for a given NFT by its identifier. It takes the following parameter:
37
38
  * - identifier (string): The identifier of the NFT to fetch data for.
@@ -45,25 +46,33 @@ export declare class NFTModule {
45
46
  * Gets an NFT by collection and nonce.
46
47
  * @param collection The collection ticker.
47
48
  * @param nonce The nonce of the NFT.
48
- * @returns {Promise<NftData>} The NFT data.
49
+ * @returns {Promise<NftDoc>} The NFT data.
49
50
  * @throws Throws an error when the collection ticker is invalid.
50
51
  */
51
- getNFTByCollectionAndNonce: (collection: string, nonce: number) => Promise<NftData>;
52
+ getNFTByCollectionAndNonce: (collection: string, nonce: number) => Promise<NftDoc>;
53
+ /**
54
+ * @public
55
+ * @async
56
+ * @function getDailyTrending
57
+ * @returns {Promise<NftDoc[]>} A promise that resolves to the array of trending NFTs.
58
+ * This function fetches the top NFTs that are trending today based on their floor and volumes
59
+ */
60
+ getDailyTrending: () => Promise<NftDoc[]>;
52
61
  /**
53
62
  * @public
54
63
  * @async
55
64
  * @function getPinnedNFTs
56
- * @returns {Promise<NftData[]>} A promise that resolves to the fetched pinned collections.
65
+ * @returns {Promise<NftDoc[]>} A promise that resolves to the fetched pinned collections.
57
66
  */
58
- getPinnedNFTs: (chain?: ActivityChain) => Promise<NftData[]>;
67
+ getPinnedNFTs: (chain?: ActivityChain) => Promise<NftDoc[]>;
59
68
  /**
60
69
  * Get NFT by collection and nonce hex
61
70
  *
62
71
  * @param collection - collection ticker
63
72
  * @param nonceHex - nonce hex
64
- * @return {Promise<NftData>} NFT data
73
+ * @return {Promise<NftDoc>} NFT data
65
74
  */
66
- getNFTByCollectionAndNonceHex: (collection: string, nonceHex: string) => Promise<NftData>;
75
+ getNFTByCollectionAndNonceHex: (collection: string, nonceHex: string) => Promise<NftDoc>;
67
76
  /**
68
77
  * Retrieves trading history based on the provided arguments.
69
78
  *
@@ -6,3 +6,6 @@ export * from './staking';
6
6
  export * from './user';
7
7
  export * from './common';
8
8
  export * from './event';
9
+ export type PublicOnly<T> = {
10
+ [K in keyof T as T[K] extends Function ? never : K]: T[K];
11
+ };
@@ -114,6 +114,5 @@ export interface TradingActivityResponse {
114
114
  /** The total count of the results for the specific query */
115
115
  count?: number;
116
116
  resources: TradingActivity[];
117
- getNextPagePayload: TradincActivityArgs;
118
117
  empty: boolean;
119
118
  }
@@ -1,4 +1,5 @@
1
- import type { CollectionCreatorInfo, CreatorInfo, EventCreatorInfo, GetNFTsArgs, SearchNFTsResponse, StakingStatus, StakingSummaryPools, StakingSummaryPoolsSlim, StatusResponse, SuggestNFTsArgs, SuggestResults, TradincActivityArgs, TradingActivityResponse } from '../types';
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';
2
3
  import type { ArgsUserOffers, BulkAccount, CreatorProfile, IApiShareholder, IOwnerInfo, IUserProfile, StakingCreatorInfo, UserAnalyticSummary, UserInventory, UserNetworkAccount, UserOffers, UserPoolStakingInfo, UserStats, UserTokenInventory, UserXOXNODrop } from '../types/user';
3
4
  export declare class UserModule {
4
5
  private api;
@@ -44,7 +45,7 @@ export declare class UserModule {
44
45
  * @param address - The user's address
45
46
  * @returns {UserInventory} - A list of token ids and the price
46
47
  */
47
- getUserNFTs: (args: GetNFTsArgs) => Promise<SearchNFTsResponse>;
48
+ getUserNFTs: (args: PublicOnly<NftDocFilter>) => Promise<import("@xoxno/types").NftCosmosResponse>;
48
49
  /**
49
50
  * @name getUserOffers
50
51
  * @description Fetches all offers sent or received associated with a user address
@@ -141,7 +142,7 @@ export declare class UserModule {
141
142
  * @param {String} address - User's address
142
143
  * @param {number} top - Top
143
144
  * @param {number} skip - Skip
144
- * @returns {NftData[]} Array of NFTs
145
+ * @returns {NftDoc[]} Array of NFTs
145
146
  * @throws {Error} Throws an error if the address is invalid
146
147
  * */
147
148
  getUserFavoriteNFTs: (address: string, top: number, skip: number) => Promise<SearchNFTsResponse>;
@@ -26,5 +26,7 @@ export declare class XOXNOClient {
26
26
  chain?: Chain;
27
27
  }>): XOXNOClient;
28
28
  static getInstance(): XOXNOClient;
29
- fetchWithTimeout: <T>(path: string, options?: Record<string, any>) => Promise<T>;
29
+ fetchWithTimeout: <T>(path: string, options?: RequestInit & {
30
+ params?: Record<string, any>;
31
+ }) => Promise<T>;
30
32
  }
@@ -0,0 +1,6 @@
1
+ export declare class CollectionNotFoundError extends Error {
2
+ constructor(item: string);
3
+ }
4
+ export declare class PaginatedTopError extends Error {
5
+ constructor(top: number);
6
+ }
@@ -1,5 +1,5 @@
1
- import type { XOXNOClient } from '..';
2
1
  import type { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
2
+ import type { XOXNOClient } from './api';
3
3
  /**
4
4
  * Fetches the trading activity of the given collections
5
5
  * @param args - The trading activity arguments
@@ -0,0 +1,4 @@
1
+ import type { CosmosDbGenericFilter } from '@xoxno/types';
2
+ export declare function collectionGuard<T>(collection: string, callback: Promise<T>): Promise<T>;
3
+ 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>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "0.1.353",
3
+ "version": "0.1.354",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {
@@ -98,6 +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
102
  "axios": "^1.7.9",
102
103
  "protobufjs": "^7.4.0",
103
104
  "webpack-bundle-analyzer": "^4.10.2"