emblem-vault-sdk 1.4.7 → 1.5.0
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 +11 -2
- package/dist/index.js +3 -1
- package/dist/utils.js +8 -1
- package/docs/bundle.js +11 -2
- package/package.json +1 -1
- package/src/index.ts +7 -5
- package/src/utils.ts +6 -1
- package/types/index.d.ts +1 -1
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.
|
|
684215
|
+
const SDK_VERSION = '1.5.0';
|
|
684216
684216
|
class EmblemVaultSDK {
|
|
684217
684217
|
constructor(apiKey, baseUrl) {
|
|
684218
684218
|
this.apiKey = apiKey;
|
|
@@ -684309,10 +684309,12 @@ class EmblemVaultSDK {
|
|
|
684309
684309
|
}
|
|
684310
684310
|
else {
|
|
684311
684311
|
console.error('MetaMask is not installed!');
|
|
684312
|
+
return undefined;
|
|
684312
684313
|
}
|
|
684313
684314
|
}
|
|
684314
684315
|
catch (error) {
|
|
684315
684316
|
console.error('Error loading Web3 or connecting to MetaMask', error);
|
|
684317
|
+
return undefined;
|
|
684316
684318
|
}
|
|
684317
684319
|
});
|
|
684318
684320
|
}
|
|
@@ -684571,6 +684573,9 @@ function generateTemplate(record) {
|
|
|
684571
684573
|
else if (recordName == "Namecoin") {
|
|
684572
684574
|
allowed = data && record.nativeAssets.includes(data[0].coin) ? true : false;
|
|
684573
684575
|
}
|
|
684576
|
+
else if (recordName == "Embels") {
|
|
684577
|
+
allowed = true;
|
|
684578
|
+
}
|
|
684574
684579
|
else { // XCP
|
|
684575
684580
|
allowed = data[0].project == _this.name && data[0].balance == 1;
|
|
684576
684581
|
}
|
|
@@ -684611,6 +684616,9 @@ function generateTemplate(record) {
|
|
|
684611
684616
|
else if (recordName == "Namecoin") {
|
|
684612
684617
|
allowedName = asset ? true : false;
|
|
684613
684618
|
}
|
|
684619
|
+
else if (recordName == "Embels") {
|
|
684620
|
+
allowedName = true;
|
|
684621
|
+
}
|
|
684614
684622
|
else { // XCP
|
|
684615
684623
|
let curatedItemFound = exports.NFT_DATA[asset];
|
|
684616
684624
|
allowedName = asset && curatedItemFound ? true : false;
|
|
@@ -684740,7 +684748,8 @@ function generateTemplate(record) {
|
|
|
684740
684748
|
balanceDescription = '1';
|
|
684741
684749
|
}
|
|
684742
684750
|
}
|
|
684743
|
-
|
|
684751
|
+
let descriptionContents = balanceDescription ? `This vault contains ${balanceDescription} ${nameAndImage.assetName} ${nameAndImage.explorer}.` : '';
|
|
684752
|
+
nameAndImage.description = nameAndImage.description + `${descriptionContents}\n\n${_this.description}`;
|
|
684744
684753
|
}
|
|
684745
684754
|
let viewOnEmblemFinanceLink = '';
|
|
684746
684755
|
if (_this.collectionType === "ERC1155") {
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
const utils_1 = require("./utils");
|
|
36
|
-
const SDK_VERSION = '1.
|
|
36
|
+
const SDK_VERSION = '1.5.0';
|
|
37
37
|
class EmblemVaultSDK {
|
|
38
38
|
constructor(apiKey, baseUrl) {
|
|
39
39
|
this.apiKey = apiKey;
|
|
@@ -130,10 +130,12 @@ class EmblemVaultSDK {
|
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
132
132
|
console.error('MetaMask is not installed!');
|
|
133
|
+
return undefined;
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
catch (error) {
|
|
136
137
|
console.error('Error loading Web3 or connecting to MetaMask', error);
|
|
138
|
+
return undefined;
|
|
137
139
|
}
|
|
138
140
|
});
|
|
139
141
|
}
|
package/dist/utils.js
CHANGED
|
@@ -246,6 +246,9 @@ function generateTemplate(record) {
|
|
|
246
246
|
else if (recordName == "Namecoin") {
|
|
247
247
|
allowed = data && record.nativeAssets.includes(data[0].coin) ? true : false;
|
|
248
248
|
}
|
|
249
|
+
else if (recordName == "Embels") {
|
|
250
|
+
allowed = true;
|
|
251
|
+
}
|
|
249
252
|
else { // XCP
|
|
250
253
|
allowed = data[0].project == _this.name && data[0].balance == 1;
|
|
251
254
|
}
|
|
@@ -286,6 +289,9 @@ function generateTemplate(record) {
|
|
|
286
289
|
else if (recordName == "Namecoin") {
|
|
287
290
|
allowedName = asset ? true : false;
|
|
288
291
|
}
|
|
292
|
+
else if (recordName == "Embels") {
|
|
293
|
+
allowedName = true;
|
|
294
|
+
}
|
|
289
295
|
else { // XCP
|
|
290
296
|
let curatedItemFound = exports.NFT_DATA[asset];
|
|
291
297
|
allowedName = asset && curatedItemFound ? true : false;
|
|
@@ -415,7 +421,8 @@ function generateTemplate(record) {
|
|
|
415
421
|
balanceDescription = '1';
|
|
416
422
|
}
|
|
417
423
|
}
|
|
418
|
-
|
|
424
|
+
let descriptionContents = balanceDescription ? `This vault contains ${balanceDescription} ${nameAndImage.assetName} ${nameAndImage.explorer}.` : '';
|
|
425
|
+
nameAndImage.description = nameAndImage.description + `${descriptionContents}\n\n${_this.description}`;
|
|
419
426
|
}
|
|
420
427
|
let viewOnEmblemFinanceLink = '';
|
|
421
428
|
if (_this.collectionType === "ERC1155") {
|
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.
|
|
684215
|
+
const SDK_VERSION = '1.5.0';
|
|
684216
684216
|
class EmblemVaultSDK {
|
|
684217
684217
|
constructor(apiKey, baseUrl) {
|
|
684218
684218
|
this.apiKey = apiKey;
|
|
@@ -684309,10 +684309,12 @@ class EmblemVaultSDK {
|
|
|
684309
684309
|
}
|
|
684310
684310
|
else {
|
|
684311
684311
|
console.error('MetaMask is not installed!');
|
|
684312
|
+
return undefined;
|
|
684312
684313
|
}
|
|
684313
684314
|
}
|
|
684314
684315
|
catch (error) {
|
|
684315
684316
|
console.error('Error loading Web3 or connecting to MetaMask', error);
|
|
684317
|
+
return undefined;
|
|
684316
684318
|
}
|
|
684317
684319
|
});
|
|
684318
684320
|
}
|
|
@@ -684571,6 +684573,9 @@ function generateTemplate(record) {
|
|
|
684571
684573
|
else if (recordName == "Namecoin") {
|
|
684572
684574
|
allowed = data && record.nativeAssets.includes(data[0].coin) ? true : false;
|
|
684573
684575
|
}
|
|
684576
|
+
else if (recordName == "Embels") {
|
|
684577
|
+
allowed = true;
|
|
684578
|
+
}
|
|
684574
684579
|
else { // XCP
|
|
684575
684580
|
allowed = data[0].project == _this.name && data[0].balance == 1;
|
|
684576
684581
|
}
|
|
@@ -684611,6 +684616,9 @@ function generateTemplate(record) {
|
|
|
684611
684616
|
else if (recordName == "Namecoin") {
|
|
684612
684617
|
allowedName = asset ? true : false;
|
|
684613
684618
|
}
|
|
684619
|
+
else if (recordName == "Embels") {
|
|
684620
|
+
allowedName = true;
|
|
684621
|
+
}
|
|
684614
684622
|
else { // XCP
|
|
684615
684623
|
let curatedItemFound = exports.NFT_DATA[asset];
|
|
684616
684624
|
allowedName = asset && curatedItemFound ? true : false;
|
|
@@ -684740,7 +684748,8 @@ function generateTemplate(record) {
|
|
|
684740
684748
|
balanceDescription = '1';
|
|
684741
684749
|
}
|
|
684742
684750
|
}
|
|
684743
|
-
|
|
684751
|
+
let descriptionContents = balanceDescription ? `This vault contains ${balanceDescription} ${nameAndImage.assetName} ${nameAndImage.explorer}.` : '';
|
|
684752
|
+
nameAndImage.description = nameAndImage.description + `${descriptionContents}\n\n${_this.description}`;
|
|
684744
684753
|
}
|
|
684745
684754
|
let viewOnEmblemFinanceLink = '';
|
|
684746
684755
|
if (_this.collectionType === "ERC1155") {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -85,26 +85,28 @@ class EmblemVaultSDK {
|
|
|
85
85
|
// ** Web3 **
|
|
86
86
|
//
|
|
87
87
|
// Function to load web3 dynamically and attach it to the window object
|
|
88
|
-
async loadWeb3() {
|
|
88
|
+
async loadWeb3(): Promise<any | undefined> {
|
|
89
89
|
try {
|
|
90
90
|
// Dynamically import the Web3 module
|
|
91
91
|
const { default: Web3 } = await import('web3');
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
// Check if MetaMask (window.ethereum) is available
|
|
94
94
|
if (window.ethereum) {
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
// Initialize Web3 with MetaMask's provider
|
|
97
97
|
const web3 = new Web3(window.ethereum);
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
// Attach Web3 to the window object
|
|
100
100
|
window.web3 = web3;
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
return web3;
|
|
103
103
|
} else {
|
|
104
104
|
console.error('MetaMask is not installed!');
|
|
105
|
+
return undefined;
|
|
105
106
|
}
|
|
106
107
|
} catch (error) {
|
|
107
108
|
console.error('Error loading Web3 or connecting to MetaMask', error);
|
|
109
|
+
return undefined;
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
|
package/src/utils.ts
CHANGED
|
@@ -219,6 +219,8 @@ export function generateTemplate(record: any) {
|
|
|
219
219
|
allowed = data[0].name == "Bel" && data[0].balance > 0 && Number.isInteger(data[0].balance)
|
|
220
220
|
} else if (recordName == "Namecoin") {
|
|
221
221
|
allowed = data && record.nativeAssets.includes(data[0].coin) ? true: false
|
|
222
|
+
} else if (recordName == "Embels"){
|
|
223
|
+
allowed = true
|
|
222
224
|
} else { // XCP
|
|
223
225
|
allowed = data[0].project == _this.name && data[0].balance == 1;
|
|
224
226
|
}
|
|
@@ -250,6 +252,8 @@ export function generateTemplate(record: any) {
|
|
|
250
252
|
allowedName = asset == "Bel" ? true : false
|
|
251
253
|
} else if (recordName == "Namecoin") {
|
|
252
254
|
allowedName = asset? true: false
|
|
255
|
+
} else if (recordName == "Embels"){
|
|
256
|
+
allowedName = true
|
|
253
257
|
} else { // XCP
|
|
254
258
|
let curatedItemFound = NFT_DATA[asset];
|
|
255
259
|
allowedName = asset && curatedItemFound ? true : false;
|
|
@@ -382,7 +386,8 @@ export function generateTemplate(record: any) {
|
|
|
382
386
|
balanceDescription = '1';
|
|
383
387
|
}
|
|
384
388
|
}
|
|
385
|
-
|
|
389
|
+
let descriptionContents = balanceDescription ? `This vault contains ${balanceDescription} ${nameAndImage.assetName} ${nameAndImage.explorer}.`: ''
|
|
390
|
+
nameAndImage.description = nameAndImage.description + `${descriptionContents}\n\n${_this.description}`;
|
|
386
391
|
}
|
|
387
392
|
|
|
388
393
|
let viewOnEmblemFinanceLink = '';
|
package/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare class EmblemVaultSDK {
|
|
|
10
10
|
createCuratedVault(template: any): Promise<Vault>;
|
|
11
11
|
fetchMetadata(tokenId: string): Promise<MetaData>;
|
|
12
12
|
fetchVaultsOfType(vaultType: string, address: string): Promise<any>;
|
|
13
|
-
loadWeb3(): Promise<
|
|
13
|
+
loadWeb3(): Promise<any | undefined>;
|
|
14
14
|
}
|
|
15
15
|
declare global {
|
|
16
16
|
interface Window {
|