@xoxno/sdk-js 0.1.3-alpha → 0.1.4-alpha
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.
- package/dist/nft/index.d.ts +16 -0
- package/dist/nft/index.js +21 -0
- package/dist/nft/index.js.map +1 -1
- package/package.json +1 -1
package/dist/nft/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NftData } from '../types/nft';
|
|
2
2
|
import { TradingActivityResponse, TradincActivityArgs } from '../types/trading';
|
|
3
|
+
import { UserOffers } from '../types/user';
|
|
3
4
|
/**
|
|
4
5
|
* NFTModule provides a set of methods to interact with single NFTs.
|
|
5
6
|
* It includes methods for getting single NFT information, and searching NFTs by collection and nonce.
|
|
@@ -25,6 +26,21 @@ export default class NFTModule {
|
|
|
25
26
|
* Finally, it returns a promise that resolves to the fetched NFT data.
|
|
26
27
|
*/
|
|
27
28
|
getNFTByIdentifier: (identifier: string) => Promise<NftData>;
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
* @async
|
|
32
|
+
* @function getNFTByIdentifier
|
|
33
|
+
* @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
|
+
*
|
|
36
|
+
* This function fetches data for a given NFT by its identifier. It takes the following parameter:
|
|
37
|
+
* - identifier (string): The identifier of the NFT to fetch data for.
|
|
38
|
+
*
|
|
39
|
+
* The function first validates the input identifier and checks if it is a valid NFT identifier.
|
|
40
|
+
* If it is valid, the function fetches the NFT data using the API.
|
|
41
|
+
* Finally, it returns a promise that resolves to the fetched NFT data.
|
|
42
|
+
*/
|
|
43
|
+
getNFTsOffers: (identifier: string) => Promise<UserOffers>;
|
|
28
44
|
/**
|
|
29
45
|
* Gets an NFT by collection and nonce.
|
|
30
46
|
* @param collection The collection ticker.
|
package/dist/nft/index.js
CHANGED
|
@@ -46,6 +46,27 @@ class NFTModule {
|
|
|
46
46
|
const response = yield this.api.fetchWithTimeout(`/getSingleNft/${identifier}`);
|
|
47
47
|
return response;
|
|
48
48
|
});
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
* @async
|
|
52
|
+
* @function getNFTByIdentifier
|
|
53
|
+
* @param {string} identifier - The identifier of the NFT to fetch data for.
|
|
54
|
+
* @returns {Promise<NftData>} A promise that resolves to the fetched NFT data.
|
|
55
|
+
*
|
|
56
|
+
* This function fetches data for a given NFT by its identifier. It takes the following parameter:
|
|
57
|
+
* - identifier (string): The identifier of the NFT to fetch data for.
|
|
58
|
+
*
|
|
59
|
+
* The function first validates the input identifier and checks if it is a valid NFT identifier.
|
|
60
|
+
* If it is valid, the function fetches the NFT data using the API.
|
|
61
|
+
* Finally, it returns a promise that resolves to the fetched NFT data.
|
|
62
|
+
*/
|
|
63
|
+
this.getNFTsOffers = (identifier) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (!(0, regex_1.isValidNftIdentifier)(identifier)) {
|
|
65
|
+
throw new Error('Invalid identifier: ' + identifier);
|
|
66
|
+
}
|
|
67
|
+
const response = yield this.api.fetchWithTimeout(`/getSingleNft/${identifier}/offers`);
|
|
68
|
+
return response;
|
|
69
|
+
});
|
|
49
70
|
/**
|
|
50
71
|
* Gets an NFT by collection and nonce.
|
|
51
72
|
* @param collection The collection ticker.
|
package/dist/nft/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nft/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nft/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,uDAAuC;AACvC,sDAAmD;AACnD,8CAAgE;AAChE,0CAA+E;AAE/E;;;;;;GAMG;AAEH,MAAqB,SAAS;IAE5B;QAIA;;;;;;;;;;;;;WAaG;QACI,uBAAkB,GAAG,CAAO,UAAk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