emblem-vault-sdk 1.9.8 → 1.9.10
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 +21 -6
- package/dist/index.js +1 -1
- package/dist/utils.js +20 -5
- package/docs/bundle.js +21 -6
- package/package.json +1 -1
- package/src/utils.ts +20 -6
package/dist/bundle.js
CHANGED
|
@@ -709477,7 +709477,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
|
|
|
709477
709477
|
const utils_1 = require("./utils");
|
|
709478
709478
|
const sats_connect_1 = require("sats-connect");
|
|
709479
709479
|
const derive_1 = require("./derive");
|
|
709480
|
-
const SDK_VERSION = '1.9.
|
|
709480
|
+
const SDK_VERSION = '1.9.10';
|
|
709481
709481
|
class EmblemVaultSDK {
|
|
709482
709482
|
constructor(apiKey, baseUrl) {
|
|
709483
709483
|
this.apiKey = apiKey;
|
|
@@ -710299,14 +710299,17 @@ function generateTemplate(record) {
|
|
|
710299
710299
|
*/
|
|
710300
710300
|
allowed: (data, _this, msgCallback = null) => {
|
|
710301
710301
|
var _a;
|
|
710302
|
-
if (!data || data.length == 0) {
|
|
710302
|
+
if ((!data || data.length == 0) && recordName != "Embels") {
|
|
710303
710303
|
return false;
|
|
710304
710304
|
}
|
|
710305
710305
|
let allowed = false;
|
|
710306
710306
|
let firstAsset = data[0];
|
|
710307
710307
|
let assetName = firstAsset.name ? firstAsset.name : "";
|
|
710308
710308
|
let message = null;
|
|
710309
|
-
if (recordName == "
|
|
710309
|
+
if (recordName == "Embels") {
|
|
710310
|
+
allowed = true;
|
|
710311
|
+
}
|
|
710312
|
+
else if (recordName == "Cursed Ordinal") {
|
|
710310
710313
|
if (data && data.length > 0) {
|
|
710311
710314
|
let allowedCoin = firstAsset.content_type != "application/json" && firstAsset.coin == "cursedordinalsbtc";
|
|
710312
710315
|
let pieces = assetName.split(' ');
|
|
@@ -710364,13 +710367,25 @@ function generateTemplate(record) {
|
|
|
710364
710367
|
allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods";
|
|
710365
710368
|
}
|
|
710366
710369
|
else if (PROJECTS_DATA.includes(recordName)) { // XCP
|
|
710367
|
-
allowed = !!exports.NFT_DATA[assetName];
|
|
710370
|
+
allowed = !!exports.NFT_DATA[assetName] && exports.NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
|
|
710368
710371
|
}
|
|
710369
710372
|
else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
|
|
710370
|
-
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
|
|
710373
|
+
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
|
|
710374
|
+
if (!allowed) {
|
|
710375
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
|
|
710376
|
+
}
|
|
710371
710377
|
}
|
|
710372
710378
|
else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
|
|
710373
|
-
|
|
710379
|
+
const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
|
|
710380
|
+
if (!allowedChain) {
|
|
710381
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
|
|
710382
|
+
}
|
|
710383
|
+
const allowedAProject = firstAsset.project == recordName;
|
|
710384
|
+
if (!allowedAProject) {
|
|
710385
|
+
message = (message ? `${message} ` : '') +
|
|
710386
|
+
`Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`;
|
|
710387
|
+
}
|
|
710388
|
+
allowed = allowedChain && allowedAProject;
|
|
710374
710389
|
}
|
|
710375
710390
|
else { // XCP
|
|
710376
710391
|
allowed = firstAsset.project == _this.name && firstAsset.balance == 1;
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
|
|
|
36
36
|
const utils_1 = require("./utils");
|
|
37
37
|
const sats_connect_1 = require("sats-connect");
|
|
38
38
|
const derive_1 = require("./derive");
|
|
39
|
-
const SDK_VERSION = '1.9.
|
|
39
|
+
const SDK_VERSION = '1.9.10';
|
|
40
40
|
class EmblemVaultSDK {
|
|
41
41
|
constructor(apiKey, baseUrl) {
|
|
42
42
|
this.apiKey = apiKey;
|
package/dist/utils.js
CHANGED
|
@@ -247,14 +247,17 @@ function generateTemplate(record) {
|
|
|
247
247
|
*/
|
|
248
248
|
allowed: (data, _this, msgCallback = null) => {
|
|
249
249
|
var _a;
|
|
250
|
-
if (!data || data.length == 0) {
|
|
250
|
+
if ((!data || data.length == 0) && recordName != "Embels") {
|
|
251
251
|
return false;
|
|
252
252
|
}
|
|
253
253
|
let allowed = false;
|
|
254
254
|
let firstAsset = data[0];
|
|
255
255
|
let assetName = firstAsset.name ? firstAsset.name : "";
|
|
256
256
|
let message = null;
|
|
257
|
-
if (recordName == "
|
|
257
|
+
if (recordName == "Embels") {
|
|
258
|
+
allowed = true;
|
|
259
|
+
}
|
|
260
|
+
else if (recordName == "Cursed Ordinal") {
|
|
258
261
|
if (data && data.length > 0) {
|
|
259
262
|
let allowedCoin = firstAsset.content_type != "application/json" && firstAsset.coin == "cursedordinalsbtc";
|
|
260
263
|
let pieces = assetName.split(' ');
|
|
@@ -312,13 +315,25 @@ function generateTemplate(record) {
|
|
|
312
315
|
allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods";
|
|
313
316
|
}
|
|
314
317
|
else if (PROJECTS_DATA.includes(recordName)) { // XCP
|
|
315
|
-
allowed = !!exports.NFT_DATA[assetName];
|
|
318
|
+
allowed = !!exports.NFT_DATA[assetName] && exports.NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
|
|
316
319
|
}
|
|
317
320
|
else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
|
|
318
|
-
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
|
|
321
|
+
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
|
|
322
|
+
if (!allowed) {
|
|
323
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
|
|
324
|
+
}
|
|
319
325
|
}
|
|
320
326
|
else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
|
|
321
|
-
|
|
327
|
+
const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
|
|
328
|
+
if (!allowedChain) {
|
|
329
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
|
|
330
|
+
}
|
|
331
|
+
const allowedAProject = firstAsset.project == recordName;
|
|
332
|
+
if (!allowedAProject) {
|
|
333
|
+
message = (message ? `${message} ` : '') +
|
|
334
|
+
`Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`;
|
|
335
|
+
}
|
|
336
|
+
allowed = allowedChain && allowedAProject;
|
|
322
337
|
}
|
|
323
338
|
else { // XCP
|
|
324
339
|
allowed = firstAsset.project == _this.name && firstAsset.balance == 1;
|
package/docs/bundle.js
CHANGED
|
@@ -709477,7 +709477,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
|
|
|
709477
709477
|
const utils_1 = require("./utils");
|
|
709478
709478
|
const sats_connect_1 = require("sats-connect");
|
|
709479
709479
|
const derive_1 = require("./derive");
|
|
709480
|
-
const SDK_VERSION = '1.9.
|
|
709480
|
+
const SDK_VERSION = '1.9.10';
|
|
709481
709481
|
class EmblemVaultSDK {
|
|
709482
709482
|
constructor(apiKey, baseUrl) {
|
|
709483
709483
|
this.apiKey = apiKey;
|
|
@@ -710299,14 +710299,17 @@ function generateTemplate(record) {
|
|
|
710299
710299
|
*/
|
|
710300
710300
|
allowed: (data, _this, msgCallback = null) => {
|
|
710301
710301
|
var _a;
|
|
710302
|
-
if (!data || data.length == 0) {
|
|
710302
|
+
if ((!data || data.length == 0) && recordName != "Embels") {
|
|
710303
710303
|
return false;
|
|
710304
710304
|
}
|
|
710305
710305
|
let allowed = false;
|
|
710306
710306
|
let firstAsset = data[0];
|
|
710307
710307
|
let assetName = firstAsset.name ? firstAsset.name : "";
|
|
710308
710308
|
let message = null;
|
|
710309
|
-
if (recordName == "
|
|
710309
|
+
if (recordName == "Embels") {
|
|
710310
|
+
allowed = true;
|
|
710311
|
+
}
|
|
710312
|
+
else if (recordName == "Cursed Ordinal") {
|
|
710310
710313
|
if (data && data.length > 0) {
|
|
710311
710314
|
let allowedCoin = firstAsset.content_type != "application/json" && firstAsset.coin == "cursedordinalsbtc";
|
|
710312
710315
|
let pieces = assetName.split(' ');
|
|
@@ -710364,13 +710367,25 @@ function generateTemplate(record) {
|
|
|
710364
710367
|
allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods";
|
|
710365
710368
|
}
|
|
710366
710369
|
else if (PROJECTS_DATA.includes(recordName)) { // XCP
|
|
710367
|
-
allowed = !!exports.NFT_DATA[assetName];
|
|
710370
|
+
allowed = !!exports.NFT_DATA[assetName] && exports.NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
|
|
710368
710371
|
}
|
|
710369
710372
|
else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
|
|
710370
|
-
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
|
|
710373
|
+
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
|
|
710374
|
+
if (!allowed) {
|
|
710375
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
|
|
710376
|
+
}
|
|
710371
710377
|
}
|
|
710372
710378
|
else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
|
|
710373
|
-
|
|
710379
|
+
const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
|
|
710380
|
+
if (!allowedChain) {
|
|
710381
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
|
|
710382
|
+
}
|
|
710383
|
+
const allowedAProject = firstAsset.project == recordName;
|
|
710384
|
+
if (!allowedAProject) {
|
|
710385
|
+
message = (message ? `${message} ` : '') +
|
|
710386
|
+
`Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`;
|
|
710387
|
+
}
|
|
710388
|
+
allowed = allowedChain && allowedAProject;
|
|
710374
710389
|
}
|
|
710375
710390
|
else { // XCP
|
|
710376
710391
|
allowed = firstAsset.project == _this.name && firstAsset.balance == 1;
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -232,7 +232,7 @@ export function generateTemplate(record: any) {
|
|
|
232
232
|
* @param {function} - msgCallback should be a function that takes a string message
|
|
233
233
|
*/
|
|
234
234
|
allowed: (data: any[], _this: any, msgCallback: any = null) => {
|
|
235
|
-
if (!data || data.length == 0) {
|
|
235
|
+
if ((!data || data.length == 0)&& recordName != "Embels") {
|
|
236
236
|
return false
|
|
237
237
|
}
|
|
238
238
|
|
|
@@ -240,8 +240,10 @@ export function generateTemplate(record: any) {
|
|
|
240
240
|
let firstAsset = data[0]
|
|
241
241
|
let assetName = firstAsset.name ? firstAsset.name : ""
|
|
242
242
|
let message = null
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
if (recordName == "Embels"){
|
|
244
|
+
allowed = true
|
|
245
|
+
}
|
|
246
|
+
else if (recordName == "Cursed Ordinal") {
|
|
245
247
|
if (data && data.length > 0) {
|
|
246
248
|
let allowedCoin = firstAsset.content_type != "application/json" && firstAsset.coin == "cursedordinalsbtc"
|
|
247
249
|
let pieces = assetName.split(' ')
|
|
@@ -288,11 +290,23 @@ export function generateTemplate(record: any) {
|
|
|
288
290
|
} else if (recordName == "Bitcoin DeGods") {
|
|
289
291
|
allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods"
|
|
290
292
|
} else if (PROJECTS_DATA.includes(recordName)) { // XCP
|
|
291
|
-
allowed = !!NFT_DATA[assetName];
|
|
293
|
+
allowed = !!NFT_DATA[assetName] && NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
|
|
292
294
|
} else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
|
|
293
|
-
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
|
|
295
|
+
allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
|
|
296
|
+
if(!allowed){
|
|
297
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`
|
|
298
|
+
}
|
|
294
299
|
} else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
|
|
295
|
-
|
|
300
|
+
const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
|
|
301
|
+
if(!allowedChain) {
|
|
302
|
+
message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`
|
|
303
|
+
}
|
|
304
|
+
const allowedAProject = firstAsset.project == recordName
|
|
305
|
+
if(!allowedAProject){
|
|
306
|
+
message = (message ? `${message} ` : '') +
|
|
307
|
+
`Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`
|
|
308
|
+
}
|
|
309
|
+
allowed = allowedChain && allowedAProject
|
|
296
310
|
} else { // XCP
|
|
297
311
|
allowed = firstAsset.project == _this.name && firstAsset.balance == 1;
|
|
298
312
|
}
|