emblem-vault-sdk 1.12.1 → 1.12.3

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
@@ -711421,7 +711421,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
711421
711421
  const bignumber_1 = require("@ethersproject/bignumber");
711422
711422
  const utils_1 = require("./utils");
711423
711423
  const derive_1 = require("./derive");
711424
- const SDK_VERSION = '1.12.1';
711424
+ const SDK_VERSION = '1.12.3';
711425
711425
  class EmblemVaultSDK {
711426
711426
  constructor(apiKey, baseUrl) {
711427
711427
  this.apiKey = apiKey;
@@ -712291,7 +712291,6 @@ function generateTemplate(record) {
712291
712291
  * @param {function} - msgCallback should be a function that takes a string message
712292
712292
  */
712293
712293
  allowed: (data, _this, msgCallback = null) => {
712294
- var _a;
712295
712294
  if (recordName == "Embels") {
712296
712295
  return true;
712297
712296
  }
@@ -712326,17 +712325,16 @@ function generateTemplate(record) {
712326
712325
  if (!allowed) {
712327
712326
  message = `Load vault with exactly ${balanceQty} ${recordName}`;
712328
712327
  }
712329
- }
712330
- else if (recordName == "Counterparty") {
712331
- let facts = [
712332
- {
712333
- eval: record.nativeAssets.includes((_a = data[0]) === null || _a === void 0 ? void 0 : _a.coin),
712334
- msg: `Vaults should only contain assets native to ${recordName}`
712335
- },
712336
- { eval: data.length == 1, msg: `Vaults should only contain a single item` },
712337
- // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
712338
- ];
712339
- allowed = (0, exports.evaluateFacts)(allowed, facts, msgCallback);
712328
+ // } else if (recordName == "Counterparty") {
712329
+ // let facts = [
712330
+ // {
712331
+ // eval: record.nativeAssets.includes(data[0]?.coin),
712332
+ // msg: `Vaults should only contain assets native to ${recordName}`
712333
+ // },
712334
+ // {eval: data.length == 1, msg: `Vaults should only contain a single item`},
712335
+ // // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
712336
+ // ]
712337
+ // allowed = evaluateFacts(allowed, facts, msgCallback)
712340
712338
  }
712341
712339
  else if (recordName == "Stamps") {
712342
712340
  let allowedName = assetName.toLowerCase().includes("stamp");
@@ -712417,8 +712415,7 @@ function generateTemplate(record) {
712417
712415
  let allowedJump = false;
712418
712416
  if (hasAnyBalance && recordName != "Rinkeby") {
712419
712417
  let filteredBalances = _this.filterNativeBalances(ownership_balances, _this);
712420
- // single
712421
- if (filteredBalances.length == 1) {
712418
+ if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
712422
712419
  allowedJump = _this.allowed(filteredBalances, _this);
712423
712420
  }
712424
712421
  else {
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
35
35
  const bignumber_1 = require("@ethersproject/bignumber");
36
36
  const utils_1 = require("./utils");
37
37
  const derive_1 = require("./derive");
38
- const SDK_VERSION = '1.12.1';
38
+ const SDK_VERSION = '1.12.3';
39
39
  class EmblemVaultSDK {
40
40
  constructor(apiKey, baseUrl) {
41
41
  this.apiKey = apiKey;
package/dist/utils.js CHANGED
@@ -262,7 +262,6 @@ function generateTemplate(record) {
262
262
  * @param {function} - msgCallback should be a function that takes a string message
263
263
  */
264
264
  allowed: (data, _this, msgCallback = null) => {
265
- var _a;
266
265
  if (recordName == "Embels") {
267
266
  return true;
268
267
  }
@@ -297,17 +296,16 @@ function generateTemplate(record) {
297
296
  if (!allowed) {
298
297
  message = `Load vault with exactly ${balanceQty} ${recordName}`;
299
298
  }
300
- }
301
- else if (recordName == "Counterparty") {
302
- let facts = [
303
- {
304
- eval: record.nativeAssets.includes((_a = data[0]) === null || _a === void 0 ? void 0 : _a.coin),
305
- msg: `Vaults should only contain assets native to ${recordName}`
306
- },
307
- { eval: data.length == 1, msg: `Vaults should only contain a single item` },
308
- // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
309
- ];
310
- allowed = (0, exports.evaluateFacts)(allowed, facts, msgCallback);
299
+ // } else if (recordName == "Counterparty") {
300
+ // let facts = [
301
+ // {
302
+ // eval: record.nativeAssets.includes(data[0]?.coin),
303
+ // msg: `Vaults should only contain assets native to ${recordName}`
304
+ // },
305
+ // {eval: data.length == 1, msg: `Vaults should only contain a single item`},
306
+ // // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
307
+ // ]
308
+ // allowed = evaluateFacts(allowed, facts, msgCallback)
311
309
  }
312
310
  else if (recordName == "Stamps") {
313
311
  let allowedName = assetName.toLowerCase().includes("stamp");
@@ -388,8 +386,7 @@ function generateTemplate(record) {
388
386
  let allowedJump = false;
389
387
  if (hasAnyBalance && recordName != "Rinkeby") {
390
388
  let filteredBalances = _this.filterNativeBalances(ownership_balances, _this);
391
- // single
392
- if (filteredBalances.length == 1) {
389
+ if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
393
390
  allowedJump = _this.allowed(filteredBalances, _this);
394
391
  }
395
392
  else {
package/docs/bundle.js CHANGED
@@ -711421,7 +711421,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
711421
711421
  const bignumber_1 = require("@ethersproject/bignumber");
711422
711422
  const utils_1 = require("./utils");
711423
711423
  const derive_1 = require("./derive");
711424
- const SDK_VERSION = '1.12.1';
711424
+ const SDK_VERSION = '1.12.3';
711425
711425
  class EmblemVaultSDK {
711426
711426
  constructor(apiKey, baseUrl) {
711427
711427
  this.apiKey = apiKey;
@@ -712291,7 +712291,6 @@ function generateTemplate(record) {
712291
712291
  * @param {function} - msgCallback should be a function that takes a string message
712292
712292
  */
712293
712293
  allowed: (data, _this, msgCallback = null) => {
712294
- var _a;
712295
712294
  if (recordName == "Embels") {
712296
712295
  return true;
712297
712296
  }
@@ -712326,17 +712325,16 @@ function generateTemplate(record) {
712326
712325
  if (!allowed) {
712327
712326
  message = `Load vault with exactly ${balanceQty} ${recordName}`;
712328
712327
  }
712329
- }
712330
- else if (recordName == "Counterparty") {
712331
- let facts = [
712332
- {
712333
- eval: record.nativeAssets.includes((_a = data[0]) === null || _a === void 0 ? void 0 : _a.coin),
712334
- msg: `Vaults should only contain assets native to ${recordName}`
712335
- },
712336
- { eval: data.length == 1, msg: `Vaults should only contain a single item` },
712337
- // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
712338
- ];
712339
- allowed = (0, exports.evaluateFacts)(allowed, facts, msgCallback);
712328
+ // } else if (recordName == "Counterparty") {
712329
+ // let facts = [
712330
+ // {
712331
+ // eval: record.nativeAssets.includes(data[0]?.coin),
712332
+ // msg: `Vaults should only contain assets native to ${recordName}`
712333
+ // },
712334
+ // {eval: data.length == 1, msg: `Vaults should only contain a single item`},
712335
+ // // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
712336
+ // ]
712337
+ // allowed = evaluateFacts(allowed, facts, msgCallback)
712340
712338
  }
712341
712339
  else if (recordName == "Stamps") {
712342
712340
  let allowedName = assetName.toLowerCase().includes("stamp");
@@ -712417,8 +712415,7 @@ function generateTemplate(record) {
712417
712415
  let allowedJump = false;
712418
712416
  if (hasAnyBalance && recordName != "Rinkeby") {
712419
712417
  let filteredBalances = _this.filterNativeBalances(ownership_balances, _this);
712420
- // single
712421
- if (filteredBalances.length == 1) {
712418
+ if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
712422
712419
  allowedJump = _this.allowed(filteredBalances, _this);
712423
712420
  }
712424
712421
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.12.1",
3
+ "version": "1.12.3",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/utils.ts CHANGED
@@ -270,16 +270,16 @@ export function generateTemplate(record: any) {
270
270
  if (!allowed) {
271
271
  message = `Load vault with exactly ${balanceQty} ${recordName}`
272
272
  }
273
- } else if (recordName == "Counterparty") {
274
- let facts = [
275
- {
276
- eval: record.nativeAssets.includes(data[0]?.coin),
277
- msg: `Vaults should only contain assets native to ${recordName}`
278
- },
279
- {eval: data.length == 1, msg: `Vaults should only contain a single item`},
280
- // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
281
- ]
282
- allowed = evaluateFacts(allowed, facts, msgCallback)
273
+ // } else if (recordName == "Counterparty") {
274
+ // let facts = [
275
+ // {
276
+ // eval: record.nativeAssets.includes(data[0]?.coin),
277
+ // msg: `Vaults should only contain assets native to ${recordName}`
278
+ // },
279
+ // {eval: data.length == 1, msg: `Vaults should only contain a single item`},
280
+ // // { eval: data[0].projectName && data[0].projectName == recordName, msg: `Vaults should only contain a single item` }
281
+ // ]
282
+ // allowed = evaluateFacts(allowed, facts, msgCallback)
283
283
  } else if (recordName == "Stamps") {
284
284
  let allowedName = assetName.toLowerCase().includes("stamp")
285
285
  allowed = allowedName &&
@@ -350,8 +350,7 @@ export function generateTemplate(record: any) {
350
350
  let allowedJump = false
351
351
  if (hasAnyBalance && recordName != "Rinkeby") {
352
352
  let filteredBalances = _this.filterNativeBalances(ownership_balances, _this)
353
- // single
354
- if (filteredBalances.length == 1) {
353
+ if ((_this.vaultCollectionType == "protocol" && filteredBalances.length >= 1 && filteredBalances.every((balance: { coin: string; }) => balance.coin.toLowerCase() == _this.collectionChain.toLowerCase())) || filteredBalances.length == 1) {
355
354
  allowedJump = _this.allowed(filteredBalances, _this)
356
355
  } else {
357
356
  allowedJump = false