@xoxno/sdk-js 0.0.1

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.
Files changed (137) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintrc.json +19 -0
  3. package/.github/workflows/npm-publish-github-packages.yml +36 -0
  4. package/.prettierrc +8 -0
  5. package/.releaserc +10 -0
  6. package/.vscode/settings.json +3 -0
  7. package/LICENSE +674 -0
  8. package/commitlint.config.js +3 -0
  9. package/coverage/clover.xml +280 -0
  10. package/coverage/coverage-final.json +12 -0
  11. package/coverage/lcov-report/base.css +224 -0
  12. package/coverage/lcov-report/block-navigation.js +87 -0
  13. package/coverage/lcov-report/collection/index.html +116 -0
  14. package/coverage/lcov-report/collection/index.ts.html +559 -0
  15. package/coverage/lcov-report/favicon.png +0 -0
  16. package/coverage/lcov-report/index.html +161 -0
  17. package/coverage/lcov-report/interactions/index.html +116 -0
  18. package/coverage/lcov-report/interactions/index.ts.html +775 -0
  19. package/coverage/lcov-report/nft/index.html +116 -0
  20. package/coverage/lcov-report/nft/index.ts.html +379 -0
  21. package/coverage/lcov-report/prettify.css +1 -0
  22. package/coverage/lcov-report/prettify.js +2 -0
  23. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  24. package/coverage/lcov-report/sorter.js +196 -0
  25. package/coverage/lcov-report/utils/SmartContractAbis.ts.html +331 -0
  26. package/coverage/lcov-report/utils/SmartContractService.ts.html +136 -0
  27. package/coverage/lcov-report/utils/api.ts.html +484 -0
  28. package/coverage/lcov-report/utils/const.ts.html +163 -0
  29. package/coverage/lcov-report/utils/getActivity.ts.html +250 -0
  30. package/coverage/lcov-report/utils/helpers.ts.html +127 -0
  31. package/coverage/lcov-report/utils/index.html +221 -0
  32. package/coverage/lcov-report/utils/regex.ts.html +106 -0
  33. package/coverage/lcov-report/utils/scCalls.ts.html +229 -0
  34. package/coverage/lcov.info +525 -0
  35. package/docs/.nojekyll +1 -0
  36. package/docs/assets/highlight.css +64 -0
  37. package/docs/assets/main.js +58 -0
  38. package/docs/assets/search.js +1 -0
  39. package/docs/assets/style.css +1279 -0
  40. package/docs/classes/collection.CollectionModule.html +232 -0
  41. package/docs/classes/interactions.SCInteraction.html +370 -0
  42. package/docs/classes/nft.NFTModule.html +208 -0
  43. package/docs/classes/utils_SmartContractAbis.SmartContractAbis.html +198 -0
  44. package/docs/classes/utils_api.APIClient.html +212 -0
  45. package/docs/classes/utils_scCalls.ContractQueryRunner.html +129 -0
  46. package/docs/enums/types_collection.FieldsToSelect.html +186 -0
  47. package/docs/enums/types_collection.Marketplace.html +102 -0
  48. package/docs/enums/types_collection.SearchOrderBy.html +130 -0
  49. package/docs/enums/types_trading.OrderByTradingActivity.html +102 -0
  50. package/docs/enums/types_trading.SelectFieldsTradingActivity.html +144 -0
  51. package/docs/enums/utils_api.Chain.html +88 -0
  52. package/docs/functions/utils_SmartContractService.getSmartContract.html +77 -0
  53. package/docs/functions/utils_getActivity.getActivity.html +89 -0
  54. package/docs/functions/utils_helpers.getIdentifierFromColAndNonce.html +76 -0
  55. package/docs/functions/utils_helpers.nonceToHex.html +74 -0
  56. package/docs/functions/utils_regex.isValidCollectionTicker.html +74 -0
  57. package/docs/functions/utils_regex.isValidNftIdentifier.html +74 -0
  58. package/docs/index.html +55 -0
  59. package/docs/interfaces/types_collection.AttributeData.html +99 -0
  60. package/docs/interfaces/types_collection.Filter.html +157 -0
  61. package/docs/interfaces/types_collection.GlobalOffer.html +176 -0
  62. package/docs/interfaces/types_collection.ICollectionAttributes.html +85 -0
  63. package/docs/interfaces/types_collection.ICollectionProfile.html +263 -0
  64. package/docs/interfaces/types_collection.IMintInfo.html +155 -0
  65. package/docs/interfaces/types_collection.ISocials.html +127 -0
  66. package/docs/interfaces/types_collection.MetadataAttribute.html +92 -0
  67. package/docs/interfaces/types_collection.SearchNFTs.html +127 -0
  68. package/docs/interfaces/types_collection.SearchNFTsArgs.html +225 -0
  69. package/docs/interfaces/types_collection.SearchNFTsResponse.html +132 -0
  70. package/docs/interfaces/types_collection.TradingActivity.html +232 -0
  71. package/docs/interfaces/types_collection.TraitValues.html +85 -0
  72. package/docs/interfaces/types_nft.GameData.html +92 -0
  73. package/docs/interfaces/types_nft.NFTAttribute.html +127 -0
  74. package/docs/interfaces/types_nft.NFTMetadata.html +104 -0
  75. package/docs/interfaces/types_nft.NftData.html +253 -0
  76. package/docs/interfaces/types_nft.NftValue.html +106 -0
  77. package/docs/interfaces/types_nft.OffersInfo.html +169 -0
  78. package/docs/interfaces/types_nft.OriginalMedia.html +92 -0
  79. package/docs/interfaces/types_nft.SaleInfoNft.html +211 -0
  80. package/docs/interfaces/types_trading.TradincActivityArgs.html +225 -0
  81. package/docs/interfaces/types_trading.TradingActivityQueryFilter.html +151 -0
  82. package/docs/interfaces/types_trading.TradingActivityResponse.html +106 -0
  83. package/docs/modules/collection.html +71 -0
  84. package/docs/modules/interactions.html +71 -0
  85. package/docs/modules/nft.html +71 -0
  86. package/docs/modules/types.html +189 -0
  87. package/docs/modules/types_collection.html +104 -0
  88. package/docs/modules/types_interactions.html +69 -0
  89. package/docs/modules/types_nft.html +85 -0
  90. package/docs/modules/types_trading.html +82 -0
  91. package/docs/modules/utils_SmartContractAbis.html +71 -0
  92. package/docs/modules/utils_SmartContractService.html +71 -0
  93. package/docs/modules/utils_api.html +76 -0
  94. package/docs/modules/utils_const.html +95 -0
  95. package/docs/modules/utils_getActivity.html +71 -0
  96. package/docs/modules/utils_helpers.html +73 -0
  97. package/docs/modules/utils_regex.html +73 -0
  98. package/docs/modules/utils_scCalls.html +71 -0
  99. package/docs/modules.html +76 -0
  100. package/docs/types/types_interactions.Offer.html +89 -0
  101. package/docs/variables/utils_const.API_URL.html +76 -0
  102. package/docs/variables/utils_const.API_URL_DEV.html +76 -0
  103. package/docs/variables/utils_const.DR_SC.html +76 -0
  104. package/docs/variables/utils_const.FM_SC.html +76 -0
  105. package/docs/variables/utils_const.KG_SC.html +76 -0
  106. package/docs/variables/utils_const.Manager_SC.html +76 -0
  107. package/docs/variables/utils_const.Manager_SC_DEV.html +76 -0
  108. package/docs/variables/utils_const.P2P_SC.html +76 -0
  109. package/docs/variables/utils_const.P2P_SC_DEV.html +76 -0
  110. package/docs/variables/utils_const.Staking_SC.html +76 -0
  111. package/docs/variables/utils_const.Staking_SC_DEV.html +76 -0
  112. package/docs/variables/utils_const.XOXNO_SC.html +76 -0
  113. package/docs/variables/utils_const.XOXNO_SC_DEV.html +76 -0
  114. package/jest.config.js +7 -0
  115. package/package.json +74 -0
  116. package/src/collection/__tests__/collection.test.ts +100 -0
  117. package/src/collection/index.ts +158 -0
  118. package/src/index.ts +20 -0
  119. package/src/interactions/__tests__/market.test.ts +92 -0
  120. package/src/interactions/index.ts +228 -0
  121. package/src/nft/__tests__/nft.test.ts +84 -0
  122. package/src/nft/index.ts +98 -0
  123. package/src/types/collection.d.ts +267 -0
  124. package/src/types/index.ts +3 -0
  125. package/src/types/interactions.d.ts +16 -0
  126. package/src/types/nft.d.ts +100 -0
  127. package/src/types/trading.d.ts +95 -0
  128. package/src/utils/SmartContractAbis.ts +82 -0
  129. package/src/utils/SmartContractService.ts +17 -0
  130. package/src/utils/api.ts +133 -0
  131. package/src/utils/const.ts +26 -0
  132. package/src/utils/getActivity.ts +55 -0
  133. package/src/utils/helpers.ts +14 -0
  134. package/src/utils/regex.ts +7 -0
  135. package/src/utils/scCalls.ts +48 -0
  136. package/tsconfig.json +13 -0
  137. package/webpack.config.js +28 -0
@@ -0,0 +1,84 @@
1
+ import { NFTModule } from '../index';
2
+ import { APIClient } from '../../utils/api';
3
+ import { OrderByTradingActivity } from '../../types';
4
+
5
+ describe('NFTModule', () => {
6
+ let nftModule: NFTModule;
7
+ const inputIdentifier = 'BANANA-e955fd-01';
8
+ const collection = 'BANANA-e955fd';
9
+ const nonce = 1;
10
+ const nonceHex = '01';
11
+ beforeAll(() => {
12
+ APIClient.init();
13
+ nftModule = new NFTModule();
14
+ });
15
+
16
+ it('should return NFT data when given a valid identifier', async () => {
17
+ const nftData = await nftModule.getNFTByIdentifier(inputIdentifier);
18
+ expect(nftData).toBeDefined();
19
+ expect(nftData.identifier).toEqual(inputIdentifier);
20
+ });
21
+
22
+ it('should return NFT data when given a valid collection and nonce', async () => {
23
+ const nftData = await nftModule.getNFTByCollectionAndNonce(
24
+ collection,
25
+ nonce
26
+ );
27
+ expect(nftData).toBeDefined();
28
+ expect(nftData.identifier).toEqual(inputIdentifier);
29
+ });
30
+
31
+ it('should return NFT data when given a valid collection and nonce as hex', async () => {
32
+ const nftData = await nftModule.getNFTByCollectionAndNonceHex(
33
+ collection,
34
+ nonceHex
35
+ );
36
+ expect(nftData).toBeDefined();
37
+ expect(nftData.identifier).toEqual(inputIdentifier);
38
+ });
39
+
40
+ it('should return empty NFT trading activity', async () => {
41
+ const nftTradingActivity = await nftModule.getTradingActivity({
42
+ identifiers: [inputIdentifier],
43
+ });
44
+ expect(nftTradingActivity).toBeDefined();
45
+ expect(nftTradingActivity.empty).toEqual(true);
46
+ });
47
+
48
+ it('should return NFT trading activity', async () => {
49
+ const nftTradingActivity = await nftModule.getTradingActivity({
50
+ identifiers: ['BANANA-e955fd-05d9'],
51
+ orderBy: [OrderByTradingActivity.OldestPlaced],
52
+ top: 1,
53
+ });
54
+ expect(nftTradingActivity).toBeDefined();
55
+ expect(nftTradingActivity.empty).toEqual(false);
56
+ expect(nftTradingActivity.resources.length).toEqual(1);
57
+ expect(nftTradingActivity.resources[0]).toMatchObject({
58
+ txHash:
59
+ 'f2cc0f9abbe6e18855cec144cecee5a6e7e0fdf2249a7e2b487935c4630aec3d',
60
+ collection: 'BANANA-e955fd',
61
+ identifier: 'BANANA-e955fd-05d9',
62
+ timestamp: 1642523586,
63
+ action: 'buy',
64
+ price: 0.1,
65
+ paymentToken: 'EGLD',
66
+ buyer: 'erd1ecae8gpcsf5fk9na69my54c4t3dw27pdgk009huaj0ekjcp02u4qtw9e9d',
67
+ seller: 'erd1kkp6kcs5qpmfmcs4vj4v07kq750anpdz579mh2962r2suum2hfjsfrdaav',
68
+ usdPrice: 17.24,
69
+ egldValue: 0.1,
70
+ name: 'Banana #1497',
71
+ url: 'https://media.elrond.com/nfts/asset/QmZzdYmNtQw5F8WGY4eFmyqcFcziPa73DMSypMJWTxRdqa/1337.png',
72
+ avifUrl:
73
+ 'https://trustmarket.blob.core.windows.net/nftmedia/BANANA-e955fd/BANANA-e955fd-05d9.avif',
74
+ webpUrl:
75
+ 'https://trustmarket.blob.core.windows.net/nftmedia/BANANA-e955fd/BANANA-e955fd-05d9.webp',
76
+ rank: 480,
77
+ marketplace: 'XO',
78
+ id: '4505a7ae-eab9-4591-9f81-81671e63a9a3',
79
+ _ts: 1677342781,
80
+ sellerUsername: '@denysvicol',
81
+ buyerUsername: '@stefanmorar',
82
+ });
83
+ });
84
+ });
@@ -0,0 +1,98 @@
1
+ import { NftData } from '../types/nft';
2
+ import { TradingActivityResponse, TradincActivityArgs } from '../types/trading';
3
+ import { APIClient } from '../utils/api';
4
+ import { getActivity } from '../utils/getActivity';
5
+ import { getIdentifierFromColAndNonce } from '../utils/helpers';
6
+ import { isValidCollectionTicker, isValidNftIdentifier } from '../utils/regex';
7
+
8
+ /**
9
+ * NFTModule provides a set of methods to interact with single NFTs.
10
+ * It includes methods for getting single NFT information, and searching NFTs by collection and nonce.
11
+ *
12
+ * @example
13
+ * const xoxno = new XOXNO({ apiURL: 'https://api.xoxno.com', apiKey: 'your-api-key' });
14
+ * const nftModule = xoxno.nft;
15
+ */
16
+
17
+ export class NFTModule {
18
+ private api: APIClient;
19
+ constructor() {
20
+ this.api = APIClient.getClient();
21
+ }
22
+
23
+ /**
24
+ * Get the NFT data for the specified identifier.
25
+ * @param identifier The NFT identifier. Must be a valid NFT identifier.
26
+ * @returns {Promise<NftData>} The NFT data.
27
+ */
28
+ public getNFTByIdentifier = async (identifier: string): Promise<NftData> => {
29
+ if (!isValidNftIdentifier(identifier)) {
30
+ throw new Error('Invalid identifier: ' + identifier);
31
+ }
32
+ const response = await this.api.fetchWithTimeout<NftData>(
33
+ `/nfts/${identifier}`
34
+ );
35
+ return response;
36
+ };
37
+
38
+ /**
39
+ * Gets an NFT by collection and nonce.
40
+ * @param collection The collection ticker.
41
+ * @param nonce The nonce of the NFT.
42
+ * @returns {Promise<NftData>} The NFT data.
43
+ * @throws Throws an error when the collection ticker is invalid.
44
+ */
45
+ public getNFTByCollectionAndNonce = async (
46
+ collection: string,
47
+ nonce: number
48
+ ): Promise<NftData> => {
49
+ if (!isValidCollectionTicker(collection)) {
50
+ throw new Error('Invalid collection ticker: ' + collection);
51
+ }
52
+
53
+ const response = await this.api.fetchWithTimeout<NftData>(
54
+ `/nfts/${getIdentifierFromColAndNonce(collection, nonce)}`
55
+ );
56
+ return response;
57
+ };
58
+
59
+ /**
60
+ * Get NFT by collection and nonce hex
61
+ *
62
+ * @param collection - collection ticker
63
+ * @param nonceHex - nonce hex
64
+ * @return {Promise<NftData>} NFT data
65
+ */
66
+
67
+ public getNFTByCollectionAndNonceHex = async (
68
+ collection: string,
69
+ nonceHex: string
70
+ ): Promise<NftData> => {
71
+ // check that collection is valid
72
+ if (!isValidCollectionTicker(collection)) {
73
+ throw new Error('Invalid collection ticker: ' + collection);
74
+ }
75
+ // make sure nonceHex is even
76
+ if (nonceHex.length % 2 !== 0) {
77
+ nonceHex = '0' + nonceHex;
78
+ }
79
+ // fetch the NFT data
80
+ const response = await this.api.fetchWithTimeout<NftData>(
81
+ `/nfts/${[collection, nonceHex].join('-')}`
82
+ );
83
+ return response;
84
+ };
85
+
86
+ /**
87
+ * Retrieves trading history based on the provided arguments.
88
+ *
89
+ * @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
90
+ * @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
91
+ * @throws {Error} Throws an error if the 'top' argument is greater than 35.
92
+ */
93
+ public getTradingActivity = async (
94
+ args: TradincActivityArgs
95
+ ): Promise<TradingActivityResponse> => {
96
+ return await getActivity(args, this.api);
97
+ };
98
+ }
@@ -0,0 +1,267 @@
1
+ import { NftData } from './nft';
2
+
3
+ export interface ISocials {
4
+ twitter: string;
5
+ instagram: string;
6
+ website: string;
7
+ telegram: string;
8
+ discord: string;
9
+ facebook: string;
10
+ youtube: string;
11
+ }
12
+
13
+ export interface IMintInfo {
14
+ contractAddress: string;
15
+ totalNftMinted: number;
16
+ collectionTag: string;
17
+ cid: string;
18
+ mediaType: string;
19
+ collectionSize: number;
20
+ nftTransferLimited: string;
21
+ allowsPublicBurn: string;
22
+ kycRequired: string;
23
+ allowsRefund: string;
24
+ hasReveal: string;
25
+ }
26
+
27
+ export interface ICollectionProfile {
28
+ dataType: 'collectionProfile';
29
+ collection: string;
30
+ name: string;
31
+ description: string;
32
+ isVisible: boolean;
33
+ isVerified: boolean;
34
+ profile: string;
35
+ banner: string;
36
+ statistics: {
37
+ tradeData: {
38
+ dayEgldVolume: number;
39
+ weekEgldVolume: number;
40
+ totalEgldVolume: number;
41
+ averageEgldPrice: number;
42
+ athEgldPrice: number;
43
+ athTxHash: string;
44
+ totalTrades: number;
45
+ };
46
+ mintData: {
47
+ totalMintEgldVolume: number;
48
+ weekMintEgldVolume: number;
49
+ dayMintEgldVolume: number;
50
+ };
51
+ other: {
52
+ nftCount: number;
53
+ followCount: number;
54
+ holdersCount?: number;
55
+ };
56
+ };
57
+ owner: string;
58
+ creator: string;
59
+ isMintable: boolean;
60
+ mintInfo: IMintInfo;
61
+ mintStages: {
62
+ name: string;
63
+ collectionTag: string;
64
+ mintEnabled: boolean;
65
+ isWhitelist: boolean;
66
+ startTime: number;
67
+ endTime: number;
68
+ mintLimit: number;
69
+ mintCount: number;
70
+ prices: {
71
+ tokenIdentifier: string;
72
+ tokenNonce: string;
73
+ amount: string;
74
+ }[];
75
+ walletLimit: number;
76
+ }[];
77
+ hasStaking: boolean;
78
+ id: string;
79
+ socials: ISocials;
80
+ type: string;
81
+ lastVerifiedTimestamp: number;
82
+ lastVerifiedBy: string;
83
+ _ts: number;
84
+ }
85
+
86
+ export interface AttributeData {
87
+ attributeOccurrence: number;
88
+ FloorPrice: number;
89
+ OnSale: number;
90
+ }
91
+
92
+ export interface MetadataAttribute {
93
+ trait_type: string;
94
+ value: string;
95
+ }
96
+
97
+ export interface TraitValues {
98
+ [traitValue: string]: AttributeData;
99
+ }
100
+
101
+ export interface ICollectionAttributes {
102
+ [traitType: string]: TraitValues;
103
+ }
104
+ export enum Marketplace {
105
+ XO = 'XO',
106
+ FM = 'FM',
107
+ DR = 'DR',
108
+ KG = 'KG',
109
+ }
110
+
111
+ export interface GlobalOffer {
112
+ attributes: MetadataAttribute[];
113
+ collection: string;
114
+ isActive: boolean;
115
+ marketplace: string;
116
+ offer_id: number;
117
+ owner: string;
118
+ ownerProfile?: string;
119
+ ownerUsername?: string;
120
+ payment_nonce: number;
121
+ payment_token: string;
122
+ price: string;
123
+ quantity: number;
124
+ short_price: number;
125
+ timestamp: number;
126
+ }
127
+
128
+ export const enum FieldsToSelect {
129
+ Rank = 'metadata/rarity/rank',
130
+ Attributes = 'metadata/attributes',
131
+ Description = 'metadata/description',
132
+ Name = 'name',
133
+ OnSale = 'onSale',
134
+ SaleInfo = 'saleInfoNft',
135
+ Royalties = 'royalties',
136
+ Identifier = 'identifier',
137
+ Collection = 'collection',
138
+ OriginalURL = 'url',
139
+ Nonce = 'nonce',
140
+ ContentType = 'originalMedia/contentType',
141
+ WasProcessed = 'wasProcessed',
142
+ AvifURL = 'avifUrl',
143
+ WebpURL = 'webpUrl',
144
+ Type = 'type',
145
+ }
146
+
147
+ export const enum SearchOrderBy {
148
+ PriceHighToLow = 'saleInfoNft/min_bid_short desc',
149
+ PriceLowToHigh = 'saleInfoNft/min_bid_short asc',
150
+ RarityHighToLow = 'metadata/rarity/rank desc',
151
+ RarityLowToHigh = 'metadata/rarity/rank asc',
152
+ NonceHighToLow = 'nonce desc',
153
+ NonceLowToHigh = 'nonce asc',
154
+ RecentListed = 'saleInfoNft/timestamp desc',
155
+ OldestListed = 'saleInfoNft/timestamp asc',
156
+ }
157
+
158
+ export interface Filter {
159
+ marketplace?: Marketplace[];
160
+ onSale?: boolean;
161
+ auctionTypes?: string[];
162
+ tokens?: string[];
163
+ attributes?: MetadataAttribute[];
164
+ range?: {
165
+ min: number;
166
+ max: number;
167
+ type: string;
168
+ };
169
+ rankRange?: {
170
+ min?: number;
171
+ max?: number;
172
+ };
173
+ levelRange?: {
174
+ min?: number;
175
+ max?: number;
176
+ };
177
+ }
178
+
179
+ export interface SearchNFTs {
180
+ filters: Filter;
181
+ name?: string;
182
+ orderBy?: SearchOrderBy[];
183
+ collection: string;
184
+ top: number;
185
+ skip: number;
186
+ select?: FieldsToSelect[];
187
+ }
188
+
189
+ export interface SearchNFTsArgs {
190
+ /** The collection to search in */
191
+ collection: string;
192
+ /** If true, will return only NFTs that are on sale */
193
+ onlyOnSale?: boolean;
194
+ /** If true, will return only NFTs that are on auction */
195
+ onlyAuctions?: boolean;
196
+ /** If set, will return only NFTs with a price in the specified range */
197
+ priceRange?: {
198
+ min: number;
199
+ max: number;
200
+ };
201
+ /** If set, will return only NFTs listed in the specified tokens */
202
+ listedInToken?: string[];
203
+ /** If set, will return only NFTs with a rank in the specified range */
204
+ rankRange?: {
205
+ min: number;
206
+ max: number;
207
+ };
208
+ /** If set, will return only NFTs with a cantina level in the specified range */
209
+ cantinaLevelRange?: {
210
+ min: number;
211
+ max: number;
212
+ };
213
+ /** If set, will return only NFTs with a name that contains the specified string */
214
+ searchName?: string;
215
+ /** The number of results to return */
216
+ top?: number;
217
+ /** The order by to use */
218
+ skip?: number;
219
+ /** The order of the results based on a field */
220
+ orderBy?: SearchOrderBy[];
221
+ /** If set, will return only the specified fields */
222
+ onlySelectFields?: FieldsToSelect[];
223
+ /** If set, will return only NFTs listed in the specified marketplaces */
224
+ listedOnlyOn?: Marketplace[];
225
+ /** If set, will return only NFTs with the specified attributes */
226
+ attributes?: MetadataAttribute[];
227
+ }
228
+
229
+ export interface SearchNFTsResponse {
230
+ /** The total count of the results for the specific query */
231
+ count: number;
232
+ /** The results count for the current page */
233
+ resultsCount: number;
234
+ /** The results for the current page */
235
+ results: NftData[];
236
+ /** If the results are empty */
237
+ empty: boolean;
238
+ /** The payload to use to get the next page */
239
+ getNextPagePayload: SearchNFTsArgs;
240
+ /** If there are more results to fetch */
241
+ hasMoreResults: boolean;
242
+ }
243
+
244
+ export interface TradingActivity {
245
+ action: string;
246
+ attributes: MetadataAttribute[];
247
+ avifUrl: string;
248
+ buyer: string;
249
+ buyerUsername: string;
250
+ collection: string;
251
+ egldValue: number;
252
+ id: string;
253
+ identifier: string;
254
+ marketplace: Marketplace;
255
+ name: string;
256
+ paymentToken: string;
257
+ price: number;
258
+ rank: number;
259
+ seller: string;
260
+ sellerUsername: string;
261
+ timestamp: number;
262
+ txHash: string;
263
+ url: string;
264
+ usdPrice: number;
265
+ webpUrl: string;
266
+ _ts: number;
267
+ }
@@ -0,0 +1,3 @@
1
+ export * from './collection';
2
+ export * from './nft';
3
+ export * from './trading';
@@ -0,0 +1,16 @@
1
+ type Offer = {
2
+ offer_id: number;
3
+ collection: string;
4
+ quantity: number;
5
+ payment_token: string;
6
+ payment_nonce: number;
7
+ price: number;
8
+ timestamp: number;
9
+ owner: string;
10
+ attributes: Array<{
11
+ trait_type: string;
12
+ value: string;
13
+ }>;
14
+ new_version: boolean;
15
+ price_long: string;
16
+ };
@@ -0,0 +1,100 @@
1
+ export interface NFTAttribute {
2
+ trait_type: string;
3
+ value: string;
4
+ occurance: number;
5
+ rarity: number;
6
+ frequency: number;
7
+ OnSale?: number;
8
+ FloorPrice?: number;
9
+ }
10
+
11
+ export interface NFTMetadata {
12
+ description?: string;
13
+ attributes: NFTAttribute[];
14
+ rarity: {
15
+ rank: number;
16
+ };
17
+ }
18
+
19
+ export interface OriginalMedia {
20
+ contentType: string;
21
+ contentLength: number;
22
+ }
23
+
24
+ export interface SaleInfoNft {
25
+ auction_id: number;
26
+ seller: string;
27
+ current_winner: string;
28
+ min_bid: string;
29
+ max_bid: string;
30
+ current_bid: string;
31
+ start_time: number;
32
+ deadline: number;
33
+ accepted_payment_token: string;
34
+ accepted_payment_token_nonce: number;
35
+ auction_type: string;
36
+ timestamp: number;
37
+ min_bid_short: number;
38
+ max_bid_short: number;
39
+ current_bid_short: number;
40
+ quantity: null | number;
41
+ marketplace: string;
42
+ usd: string;
43
+ usd_max_bid: string;
44
+ }
45
+
46
+ export interface NftValue {
47
+ floorValue: number;
48
+ avgValue: number;
49
+ maxValue: number;
50
+ collectionFp: number;
51
+ }
52
+
53
+ export interface GameData {
54
+ name: string;
55
+ value: number;
56
+ }
57
+
58
+ export interface OffersInfo {
59
+ EgldValue: number;
60
+ UsdValue: number;
61
+ deadline: number;
62
+ isActive: boolean;
63
+ offer_id: number;
64
+ owner: string;
65
+ ownerUsername: string;
66
+ payment_nonce: number;
67
+ payment_token: string;
68
+ price: string;
69
+ price_short: number;
70
+ quantity: number;
71
+ timestamp: number;
72
+ }
73
+
74
+ export interface NftData {
75
+ identifier: string;
76
+ collection: string;
77
+ attributes?: string;
78
+ nonce: number;
79
+ type: string;
80
+ name: string;
81
+ creator?: string;
82
+ royalties: number;
83
+ url: string;
84
+ avifUrl: string;
85
+ webpUrl: string;
86
+ wasProcessed: boolean;
87
+ onSale: boolean;
88
+ hasOffers?: boolean;
89
+ metadata: Metadata;
90
+ originalMedia: OriginalMedia;
91
+ saleInfoNft: SaleInfoNft;
92
+ offersInfo: OffersInfo[];
93
+ gameData: GameData[]; // Only for Cantina Rolaye
94
+ owner?: string;
95
+ ownerCount?: number; // Only for SFTs with over 1 owner
96
+ ownerUsername?: string;
97
+ isVerified: boolean;
98
+ isVisible: boolean;
99
+ nftValue?: NftValue;
100
+ }
@@ -0,0 +1,95 @@
1
+ import { Marketplace, MetadataAttribute } from './collection';
2
+
3
+ export interface TradingActivityQueryFilter {
4
+ filters: {
5
+ collection?: string[];
6
+ identifier?: string[];
7
+ address?: string[];
8
+ tokens?: string[];
9
+ marketplace?: Marketplace[];
10
+ action?: string[];
11
+ range?: {
12
+ min: number;
13
+ max: number;
14
+ };
15
+ rankRange?: {
16
+ min: number;
17
+ max: number;
18
+ };
19
+ timestampRange?: {
20
+ min: number;
21
+ max: number;
22
+ };
23
+ attributes?: MetadataAttribute[];
24
+ };
25
+ top: number;
26
+ skip: number;
27
+ select?: SelectFieldsTradingActivity[];
28
+ orderBy?: OrderByTradingActivity[];
29
+ }
30
+ export interface TradincActivityArgs {
31
+ /** The collections to fetch the trading activity from */
32
+ collections?: string[];
33
+ /** The identifier of the NFTs to fetch the trading activity from */
34
+ identifiers?: string[];
35
+ /** The owners of the NFTs to fetch the trading activity from */
36
+ owners?: string[];
37
+ /** The marketplaces to fetch the trading activity from */
38
+ marketplaces?: Marketplace[];
39
+ /** The tokens to fetch the trading activity from */
40
+ placedInToken?: string[];
41
+ /** The price range to fetch the trading activity from */
42
+ priceRange?: {
43
+ min: number;
44
+ max: number;
45
+ };
46
+ /** The rank range to fetch the trading activity from */
47
+ rankRange?: {
48
+ min: number;
49
+ max: number;
50
+ };
51
+ /** The timestamp range to fetch the trading activity from */
52
+ timestampRange?: {
53
+ min: number;
54
+ max: number;
55
+ };
56
+ /** The number of results to return */
57
+ top?: number;
58
+ /** The number of results to skip */
59
+ skip?: number;
60
+ /** The actions to fetch the trading activity from */
61
+ actions?: string[];
62
+ /** The fields to select from the trading activity */
63
+ select?: SelectFieldsTradingActivity[];
64
+ /** The fields to order the trading activity by */
65
+ orderBy?: OrderByTradingActivity[];
66
+ /** The attributes to fetch the trading activity from */
67
+ attributes?: MetadataAttribute[];
68
+ }
69
+
70
+ export const enum OrderByTradingActivity {
71
+ PriceHighToLow = 'short_price desc',
72
+ PriceLowToHigh = 'short_price asc',
73
+ RecentPlaced = 'timestamp desc',
74
+ OldestPlaced = 'timestamp asc',
75
+ }
76
+
77
+ export const enum SelectFieldsTradingActivity {
78
+ 'attributes',
79
+ 'collection',
80
+ 'offer_id',
81
+ 'owner',
82
+ 'short_price',
83
+ 'price',
84
+ 'id',
85
+ 'dataType',
86
+ 'marketplace',
87
+ 'payment_token',
88
+ }
89
+
90
+ export interface TradingActivityResponse {
91
+ hasMoreResults: boolean;
92
+ resources: TradingActivity[];
93
+ getNextPagePayload: TradincActivityArgs;
94
+ empty: boolean;
95
+ }