emblem-vault-sdk 1.4.0 → 1.4.2
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/bundle.js +10 -4
- package/docs/bundle.js +10 -4
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/readme.md +1 -0
- package/src/index.ts +9 -4
package/dist/bundle.js
CHANGED
|
@@ -684212,7 +684212,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
684212
684212
|
};
|
|
684213
684213
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
684214
684214
|
const utils_1 = require("./utils");
|
|
684215
|
-
const SDK_VERSION = '1.4.
|
|
684215
|
+
const SDK_VERSION = '1.4.1';
|
|
684216
684216
|
class EmblemVaultSDK {
|
|
684217
684217
|
constructor(apiKey, baseUrl) {
|
|
684218
684218
|
this.apiKey = apiKey;
|
|
@@ -684243,10 +684243,11 @@ class EmblemVaultSDK {
|
|
|
684243
684243
|
}
|
|
684244
684244
|
// ** Curated **
|
|
684245
684245
|
//
|
|
684246
|
-
fetchCuratedContracts(hideUnMintable = false) {
|
|
684246
|
+
fetchCuratedContracts(hideUnMintable = false, overrideFunc = false) {
|
|
684247
684247
|
return __awaiter(this, void 0, void 0, function* () {
|
|
684248
684248
|
let url = `${this.baseUrl}/curated`;
|
|
684249
|
-
|
|
684249
|
+
// Fetch using URL or override function
|
|
684250
|
+
let data = typeof overrideFunc === 'function' ? yield overrideFunc() : yield (0, utils_1.fetchData)(url, this.apiKey);
|
|
684250
684251
|
// Filter out collections that are not mintable
|
|
684251
684252
|
data = hideUnMintable ? data.filter((collection) => collection.mintable) : data;
|
|
684252
684253
|
// Sort the data by the name property in ascending order
|
|
@@ -684254,8 +684255,13 @@ class EmblemVaultSDK {
|
|
|
684254
684255
|
// Map over the sorted data and generate a template for each item
|
|
684255
684256
|
.map((item) => {
|
|
684256
684257
|
const template = (0, utils_1.generateTemplate)(item);
|
|
684258
|
+
Object.keys(template).forEach(key => {
|
|
684259
|
+
if (key != 'id' && key != 'created_at' && key != 'contracts' && key != 'imageHandler' && key != 'placeholderImages' && key != 'loadingImages')
|
|
684260
|
+
item[key] = template[key];
|
|
684261
|
+
});
|
|
684257
684262
|
// Return a new object that combines the properties of the item and the template
|
|
684258
|
-
return
|
|
684263
|
+
// return { ...item, ...template };
|
|
684264
|
+
return item;
|
|
684259
684265
|
});
|
|
684260
684266
|
return data;
|
|
684261
684267
|
});
|
package/docs/bundle.js
CHANGED
|
@@ -684212,7 +684212,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
684212
684212
|
};
|
|
684213
684213
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
684214
684214
|
const utils_1 = require("./utils");
|
|
684215
|
-
const SDK_VERSION = '1.4.
|
|
684215
|
+
const SDK_VERSION = '1.4.1';
|
|
684216
684216
|
class EmblemVaultSDK {
|
|
684217
684217
|
constructor(apiKey, baseUrl) {
|
|
684218
684218
|
this.apiKey = apiKey;
|
|
@@ -684243,10 +684243,11 @@ class EmblemVaultSDK {
|
|
|
684243
684243
|
}
|
|
684244
684244
|
// ** Curated **
|
|
684245
684245
|
//
|
|
684246
|
-
fetchCuratedContracts(hideUnMintable = false) {
|
|
684246
|
+
fetchCuratedContracts(hideUnMintable = false, overrideFunc = false) {
|
|
684247
684247
|
return __awaiter(this, void 0, void 0, function* () {
|
|
684248
684248
|
let url = `${this.baseUrl}/curated`;
|
|
684249
|
-
|
|
684249
|
+
// Fetch using URL or override function
|
|
684250
|
+
let data = typeof overrideFunc === 'function' ? yield overrideFunc() : yield (0, utils_1.fetchData)(url, this.apiKey);
|
|
684250
684251
|
// Filter out collections that are not mintable
|
|
684251
684252
|
data = hideUnMintable ? data.filter((collection) => collection.mintable) : data;
|
|
684252
684253
|
// Sort the data by the name property in ascending order
|
|
@@ -684254,8 +684255,13 @@ class EmblemVaultSDK {
|
|
|
684254
684255
|
// Map over the sorted data and generate a template for each item
|
|
684255
684256
|
.map((item) => {
|
|
684256
684257
|
const template = (0, utils_1.generateTemplate)(item);
|
|
684258
|
+
Object.keys(template).forEach(key => {
|
|
684259
|
+
if (key != 'id' && key != 'created_at' && key != 'contracts' && key != 'imageHandler' && key != 'placeholderImages' && key != 'loadingImages')
|
|
684260
|
+
item[key] = template[key];
|
|
684261
|
+
});
|
|
684257
684262
|
// Return a new object that combines the properties of the item and the template
|
|
684258
|
-
return
|
|
684263
|
+
// return { ...item, ...template };
|
|
684264
|
+
return item;
|
|
684259
684265
|
});
|
|
684260
684266
|
return data;
|
|
684261
684267
|
});
|
package/docs/index.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
function generateDropdown(curatedContracts) {
|
|
27
27
|
const selectElement = function () { return document.getElementById('contractSelect') }
|
|
28
28
|
let hide = document.getElementById('hideNotMintableCheckbox').checked
|
|
29
|
-
while (selectElement().firstChild) {
|
|
29
|
+
while (selectElement().firstChild) {
|
|
30
30
|
selectElement().removeChild(selectElement().firstChild);
|
|
31
31
|
}
|
|
32
32
|
const defaultOptionElement = document.createElement('option');
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -11,6 +11,7 @@ npm i emblem-vault-sdk
|
|
|
11
11
|
## Getting Started
|
|
12
12
|
```
|
|
13
13
|
const EmblemVaultSDK = require('emblem-vault-sdk');
|
|
14
|
+
// import EmblemVaultSDK from 'emblem-vault-sdk'
|
|
14
15
|
const apiKey = 'YOUR_API_KEY'; // replace with your actual API key
|
|
15
16
|
|
|
16
17
|
const sdk = new EmblemVaultSDK(apiKey);
|
package/src/index.ts
CHANGED
|
@@ -37,10 +37,10 @@ class EmblemVaultSDK {
|
|
|
37
37
|
|
|
38
38
|
// ** Curated **
|
|
39
39
|
//
|
|
40
|
-
async fetchCuratedContracts(hideUnMintable: boolean = false): Promise<CuratedCollectionsResponse> {
|
|
40
|
+
async fetchCuratedContracts(hideUnMintable: boolean = false, overrideFunc: Function | boolean = false): Promise<CuratedCollectionsResponse> {
|
|
41
41
|
let url = `${this.baseUrl}/curated`;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// Fetch using URL or override function
|
|
43
|
+
let data = typeof overrideFunc === 'function' ? await overrideFunc() : await fetchData(url, this.apiKey);
|
|
44
44
|
// Filter out collections that are not mintable
|
|
45
45
|
data = hideUnMintable? data.filter((collection: Collection) => collection.mintable): data;
|
|
46
46
|
|
|
@@ -49,8 +49,13 @@ class EmblemVaultSDK {
|
|
|
49
49
|
// Map over the sorted data and generate a template for each item
|
|
50
50
|
.map((item: any) => {
|
|
51
51
|
const template = generateTemplate(item);
|
|
52
|
+
Object.keys(template).forEach(key => {
|
|
53
|
+
if (key != 'id' && key != 'created_at' && key != 'contracts' && key != 'imageHandler' && key != 'placeholderImages' && key != 'loadingImages' )
|
|
54
|
+
item[key] = template[key];
|
|
55
|
+
});
|
|
52
56
|
// Return a new object that combines the properties of the item and the template
|
|
53
|
-
return { ...item, ...template };
|
|
57
|
+
// return { ...item, ...template };
|
|
58
|
+
return item;
|
|
54
59
|
});
|
|
55
60
|
return data
|
|
56
61
|
}
|