emblem-vault-sdk 2.3.7 → 2.4.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 CHANGED
@@ -711465,7 +711465,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
711465
711465
  const bignumber_1 = require("@ethersproject/bignumber");
711466
711466
  const utils_1 = require("./utils");
711467
711467
  const derive_1 = require("./derive");
711468
- const SDK_VERSION = '2.3.7';
711468
+ const SDK_VERSION = '2.4.0';
711469
711469
  class EmblemVaultSDK {
711470
711470
  constructor(apiKey, baseUrl, v3Url, sigUrl) {
711471
711471
  this.apiKey = apiKey;
@@ -712508,7 +712508,16 @@ function generateTemplate(record) {
712508
712508
  let possibleBalances = [5000, 50000, 500000];
712509
712509
  let covalAssets = data.filter((item) => item.name == "Circuits of Value");
712510
712510
  let covalTotalBalance = covalAssets.reduce((acc, item) => acc + item.balance, 0);
712511
- allowed = possibleBalances.includes(covalTotalBalance) || false;
712511
+ const normalizedBalance = possibleBalances.reduce((closest, target) => {
712512
+ // If balance is less than current target, return the previous closest
712513
+ if (covalTotalBalance < target) {
712514
+ return closest;
712515
+ }
712516
+ // If we're at or above this target, it becomes our new closest
712517
+ return target;
712518
+ }, 0);
712519
+ allowed = normalizedBalance > 0;
712520
+ // allowed = possibleBalances.includes(covalTotalBalance) || false
712512
712521
  message = !allowed ? `Load vault with 5000, 50000, or 500000 Circuits of Value` : message;
712513
712522
  }
712514
712523
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
45
  const bignumber_1 = require("@ethersproject/bignumber");
46
46
  const utils_1 = require("./utils");
47
47
  const derive_1 = require("./derive");
48
- const SDK_VERSION = '2.3.7';
48
+ const SDK_VERSION = '2.4.0';
49
49
  class EmblemVaultSDK {
50
50
  constructor(apiKey, baseUrl, v3Url, sigUrl) {
51
51
  this.apiKey = apiKey;
package/dist/utils.js CHANGED
@@ -414,7 +414,16 @@ function generateTemplate(record) {
414
414
  let possibleBalances = [5000, 50000, 500000];
415
415
  let covalAssets = data.filter((item) => item.name == "Circuits of Value");
416
416
  let covalTotalBalance = covalAssets.reduce((acc, item) => acc + item.balance, 0);
417
- allowed = possibleBalances.includes(covalTotalBalance) || false;
417
+ const normalizedBalance = possibleBalances.reduce((closest, target) => {
418
+ // If balance is less than current target, return the previous closest
419
+ if (covalTotalBalance < target) {
420
+ return closest;
421
+ }
422
+ // If we're at or above this target, it becomes our new closest
423
+ return target;
424
+ }, 0);
425
+ allowed = normalizedBalance > 0;
426
+ // allowed = possibleBalances.includes(covalTotalBalance) || false
418
427
  message = !allowed ? `Load vault with 5000, 50000, or 500000 Circuits of Value` : message;
419
428
  }
420
429
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
package/docs/bundle.js CHANGED
@@ -711465,7 +711465,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
711465
711465
  const bignumber_1 = require("@ethersproject/bignumber");
711466
711466
  const utils_1 = require("./utils");
711467
711467
  const derive_1 = require("./derive");
711468
- const SDK_VERSION = '2.3.7';
711468
+ const SDK_VERSION = '2.4.0';
711469
711469
  class EmblemVaultSDK {
711470
711470
  constructor(apiKey, baseUrl, v3Url, sigUrl) {
711471
711471
  this.apiKey = apiKey;
@@ -712508,7 +712508,16 @@ function generateTemplate(record) {
712508
712508
  let possibleBalances = [5000, 50000, 500000];
712509
712509
  let covalAssets = data.filter((item) => item.name == "Circuits of Value");
712510
712510
  let covalTotalBalance = covalAssets.reduce((acc, item) => acc + item.balance, 0);
712511
- allowed = possibleBalances.includes(covalTotalBalance) || false;
712511
+ const normalizedBalance = possibleBalances.reduce((closest, target) => {
712512
+ // If balance is less than current target, return the previous closest
712513
+ if (covalTotalBalance < target) {
712514
+ return closest;
712515
+ }
712516
+ // If we're at or above this target, it becomes our new closest
712517
+ return target;
712518
+ }, 0);
712519
+ allowed = normalizedBalance > 0;
712520
+ // allowed = possibleBalances.includes(covalTotalBalance) || false
712512
712521
  message = !allowed ? `Load vault with 5000, 50000, or 500000 Circuits of Value` : message;
712513
712522
  }
712514
712523
  else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "2.3.7",
3
+ "version": "2.4.0",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/utils.ts CHANGED
@@ -368,7 +368,16 @@ export function generateTemplate(record: any) {
368
368
  let possibleBalances = [5000, 50000, 500000]
369
369
  let covalAssets = data.filter((item: { name: string; }) => item.name == "Circuits of Value")
370
370
  let covalTotalBalance = covalAssets.reduce((acc: number, item: { balance: number; }) => acc + item.balance, 0)
371
- allowed = possibleBalances.includes(covalTotalBalance) || false
371
+ const normalizedBalance = possibleBalances.reduce((closest, target) => {
372
+ // If balance is less than current target, return the previous closest
373
+ if (covalTotalBalance < target) {
374
+ return closest
375
+ }
376
+ // If we're at or above this target, it becomes our new closest
377
+ return target
378
+ }, 0)
379
+ allowed = normalizedBalance > 0
380
+ // allowed = possibleBalances.includes(covalTotalBalance) || false
372
381
  message = !allowed ? `Load vault with 5000, 50000, or 500000 Circuits of Value` : message
373
382
  } else if (_this.vaultCollectionType && _this.vaultCollectionType == "collection") {
374
383
  if (recordName == "Bitcoin Punks") {