emblem-vault-sdk 1.9.8 → 1.9.9

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 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.8';
709480
+ const SDK_VERSION = '1.9.9';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -710364,13 +710364,25 @@ function generateTemplate(record) {
710364
710364
  allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods";
710365
710365
  }
710366
710366
  else if (PROJECTS_DATA.includes(recordName)) { // XCP
710367
- allowed = !!exports.NFT_DATA[assetName];
710367
+ allowed = !!exports.NFT_DATA[assetName] && exports.NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
710368
710368
  }
710369
710369
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
710370
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project && firstAsset.project == recordName;
710370
+ allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
710371
+ if (!allowed) {
710372
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
710373
+ }
710371
710374
  }
710372
710375
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
710373
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project == recordName;
710376
+ const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
710377
+ if (!allowedChain) {
710378
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
710379
+ }
710380
+ const allowedAProject = firstAsset.project == recordName;
710381
+ if (!allowedAProject) {
710382
+ message = (message ? `${message} ` : '') +
710383
+ `Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`;
710384
+ }
710385
+ allowed = allowedChain && allowedAProject;
710374
710386
  }
710375
710387
  else { // XCP
710376
710388
  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.8';
39
+ const SDK_VERSION = '1.9.9';
40
40
  class EmblemVaultSDK {
41
41
  constructor(apiKey, baseUrl) {
42
42
  this.apiKey = apiKey;
package/dist/utils.js CHANGED
@@ -312,13 +312,25 @@ function generateTemplate(record) {
312
312
  allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods";
313
313
  }
314
314
  else if (PROJECTS_DATA.includes(recordName)) { // XCP
315
- allowed = !!exports.NFT_DATA[assetName];
315
+ allowed = !!exports.NFT_DATA[assetName] && exports.NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
316
316
  }
317
317
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
318
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project && firstAsset.project == recordName;
318
+ allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
319
+ if (!allowed) {
320
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
321
+ }
319
322
  }
320
323
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
321
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project == recordName;
324
+ const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
325
+ if (!allowedChain) {
326
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
327
+ }
328
+ const allowedAProject = firstAsset.project == recordName;
329
+ if (!allowedAProject) {
330
+ message = (message ? `${message} ` : '') +
331
+ `Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`;
332
+ }
333
+ allowed = allowedChain && allowedAProject;
322
334
  }
323
335
  else { // XCP
324
336
  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.8';
709480
+ const SDK_VERSION = '1.9.9';
709481
709481
  class EmblemVaultSDK {
709482
709482
  constructor(apiKey, baseUrl) {
709483
709483
  this.apiKey = apiKey;
@@ -710364,13 +710364,25 @@ function generateTemplate(record) {
710364
710364
  allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods";
710365
710365
  }
710366
710366
  else if (PROJECTS_DATA.includes(recordName)) { // XCP
710367
- allowed = !!exports.NFT_DATA[assetName];
710367
+ allowed = !!exports.NFT_DATA[assetName] && exports.NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
710368
710368
  }
710369
710369
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
710370
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project && firstAsset.project == recordName;
710370
+ allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
710371
+ if (!allowed) {
710372
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
710373
+ }
710371
710374
  }
710372
710375
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
710373
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project == recordName;
710376
+ const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase();
710377
+ if (!allowedChain) {
710378
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`;
710379
+ }
710380
+ const allowedAProject = firstAsset.project == recordName;
710381
+ if (!allowedAProject) {
710382
+ message = (message ? `${message} ` : '') +
710383
+ `Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`;
710384
+ }
710385
+ allowed = allowedChain && allowedAProject;
710374
710386
  }
710375
710387
  else { // XCP
710376
710388
  allowed = firstAsset.project == _this.name && firstAsset.balance == 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.9.8",
3
+ "version": "1.9.9",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/utils.ts CHANGED
@@ -288,11 +288,23 @@ export function generateTemplate(record: any) {
288
288
  } else if (recordName == "Bitcoin DeGods") {
289
289
  allowed = firstAsset.coin == "ordinalsbtc" && firstAsset.balance == 1 && firstAsset.project == "DeGods"
290
290
  } else if (PROJECTS_DATA.includes(recordName)) { // XCP
291
- allowed = !!NFT_DATA[assetName];
291
+ allowed = !!NFT_DATA[assetName] && NFT_DATA[assetName]["projectName"].toLowerCase() == recordName.toLowerCase();
292
292
  } else if (_this.vaultCollectionType && _this.vaultCollectionType == "protocol") {
293
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project && firstAsset.project == recordName
293
+ allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
294
+ if(!allowed){
295
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`
296
+ }
294
297
  } else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
295
- allowed = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase() && firstAsset.project == recordName
298
+ const allowedChain = firstAsset.coin.toLowerCase() == _this.collectionChain.toLowerCase()
299
+ if(!allowedChain) {
300
+ message = `Found ${firstAsset.coin} asset, expected ${_this.collectionChain} asset.`
301
+ }
302
+ const allowedAProject = firstAsset.project == recordName
303
+ if(!allowedAProject){
304
+ message = (message ? `${message} ` : '') +
305
+ `Found asset from ${firstAsset.project} collection, expected asset from ${recordName} collection.`
306
+ }
307
+ allowed = allowedChain && allowedAProject
296
308
  } else { // XCP
297
309
  allowed = firstAsset.project == _this.name && firstAsset.balance == 1;
298
310
  }