emblem-vault-sdk 1.10.1 → 1.10.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.10.1';
711424
+ const SDK_VERSION = '1.10.3';
711425
711425
  class EmblemVaultSDK {
711426
711426
  constructor(apiKey, baseUrl) {
711427
711427
  this.apiKey = apiKey;
@@ -711532,7 +711532,7 @@ class EmblemVaultSDK {
711532
711532
  if (callback) {
711533
711533
  callback('refreshing Balance');
711534
711534
  }
711535
- let url = `${this.v1Url}/vault/balance/${tokenId}?live=true`;
711535
+ let url = `${this.v3Url}/vault/balance/${tokenId}?live=true`;
711536
711536
  let balance = yield (0, utils_1.fetchData)(url, this.apiKey);
711537
711537
  if (callback) {
711538
711538
  callback('received Balance', balance.balances);
@@ -712630,8 +712630,11 @@ function checkContentType(url) {
712630
712630
  let returnVal = { valid: false };
712631
712631
  // Function to make fetch requests
712632
712632
  function fetchUrl(method) {
712633
- return fetch(url, { method: method })
712633
+ const controller = new AbortController();
712634
+ const timeoutId = setTimeout(() => controller.abort(), 3000); // 3 seconds timeout (probably need to make this timeout only for HEAD)
712635
+ return fetch(url, { method: method, signal: controller.signal })
712634
712636
  .then(response => {
712637
+ clearTimeout(timeoutId);
712635
712638
  if (!response.ok) {
712636
712639
  returnVal.valid = false;
712637
712640
  return resolve(returnVal);
@@ -712659,6 +712662,7 @@ function checkContentType(url) {
712659
712662
  }
712660
712663
  })
712661
712664
  .catch(error => {
712665
+ clearTimeout(timeoutId);
712662
712666
  console.error('Error while fetching URL:', error);
712663
712667
  return resolve(returnVal);
712664
712668
  });
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.10.1';
38
+ const SDK_VERSION = '1.10.3';
39
39
  class EmblemVaultSDK {
40
40
  constructor(apiKey, baseUrl) {
41
41
  this.apiKey = apiKey;
@@ -146,7 +146,7 @@ class EmblemVaultSDK {
146
146
  if (callback) {
147
147
  callback('refreshing Balance');
148
148
  }
149
- let url = `${this.v1Url}/vault/balance/${tokenId}?live=true`;
149
+ let url = `${this.v3Url}/vault/balance/${tokenId}?live=true`;
150
150
  let balance = yield (0, utils_1.fetchData)(url, this.apiKey);
151
151
  if (callback) {
152
152
  callback('received Balance', balance.balances);
package/dist/utils.js CHANGED
@@ -601,8 +601,11 @@ function checkContentType(url) {
601
601
  let returnVal = { valid: false };
602
602
  // Function to make fetch requests
603
603
  function fetchUrl(method) {
604
- return fetch(url, { method: method })
604
+ const controller = new AbortController();
605
+ const timeoutId = setTimeout(() => controller.abort(), 3000); // 3 seconds timeout (probably need to make this timeout only for HEAD)
606
+ return fetch(url, { method: method, signal: controller.signal })
605
607
  .then(response => {
608
+ clearTimeout(timeoutId);
606
609
  if (!response.ok) {
607
610
  returnVal.valid = false;
608
611
  return resolve(returnVal);
@@ -630,6 +633,7 @@ function checkContentType(url) {
630
633
  }
631
634
  })
632
635
  .catch(error => {
636
+ clearTimeout(timeoutId);
633
637
  console.error('Error while fetching URL:', error);
634
638
  return resolve(returnVal);
635
639
  });
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.10.1';
711424
+ const SDK_VERSION = '1.10.3';
711425
711425
  class EmblemVaultSDK {
711426
711426
  constructor(apiKey, baseUrl) {
711427
711427
  this.apiKey = apiKey;
@@ -711532,7 +711532,7 @@ class EmblemVaultSDK {
711532
711532
  if (callback) {
711533
711533
  callback('refreshing Balance');
711534
711534
  }
711535
- let url = `${this.v1Url}/vault/balance/${tokenId}?live=true`;
711535
+ let url = `${this.v3Url}/vault/balance/${tokenId}?live=true`;
711536
711536
  let balance = yield (0, utils_1.fetchData)(url, this.apiKey);
711537
711537
  if (callback) {
711538
711538
  callback('received Balance', balance.balances);
@@ -712630,8 +712630,11 @@ function checkContentType(url) {
712630
712630
  let returnVal = { valid: false };
712631
712631
  // Function to make fetch requests
712632
712632
  function fetchUrl(method) {
712633
- return fetch(url, { method: method })
712633
+ const controller = new AbortController();
712634
+ const timeoutId = setTimeout(() => controller.abort(), 3000); // 3 seconds timeout (probably need to make this timeout only for HEAD)
712635
+ return fetch(url, { method: method, signal: controller.signal })
712634
712636
  .then(response => {
712637
+ clearTimeout(timeoutId);
712635
712638
  if (!response.ok) {
712636
712639
  returnVal.valid = false;
712637
712640
  return resolve(returnVal);
@@ -712659,6 +712662,7 @@ function checkContentType(url) {
712659
712662
  }
712660
712663
  })
712661
712664
  .catch(error => {
712665
+ clearTimeout(timeoutId);
712662
712666
  console.error('Error while fetching URL:', error);
712663
712667
  return resolve(returnVal);
712664
712668
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -112,7 +112,7 @@ class EmblemVaultSDK {
112
112
  async refreshBalance(tokenId: string, callback: any = null): Promise<MetaData> {
113
113
  genericGuard(tokenId, "string", "tokenId");
114
114
  if (callback) { callback('refreshing Balance')}
115
- let url = `${this.v1Url}/vault/balance/${tokenId}?live=true`;
115
+ let url = `${this.v3Url}/vault/balance/${tokenId}?live=true`;
116
116
  let balance = await fetchData(url, this.apiKey);
117
117
  if (callback) { callback('received Balance', balance.balances)}
118
118
  return balance?.balances || [];
package/src/utils.ts CHANGED
@@ -574,8 +574,12 @@ export function checkContentType(url: string) {
574
574
 
575
575
  // Function to make fetch requests
576
576
  function fetchUrl(method: string): any {
577
- return fetch(url, { method: method })
577
+ const controller = new AbortController();
578
+ const timeoutId = setTimeout(() => controller.abort(), 3000); // 3 seconds timeout (probably need to make this timeout only for HEAD)
579
+
580
+ return fetch(url, { method: method, signal: controller.signal })
578
581
  .then(response => {
582
+ clearTimeout(timeoutId);
579
583
  if (!response.ok) {
580
584
  returnVal.valid = false;
581
585
  return resolve(returnVal);
@@ -600,6 +604,7 @@ export function checkContentType(url: string) {
600
604
  }
601
605
  })
602
606
  .catch(error => {
607
+ clearTimeout(timeoutId);
603
608
  console.error('Error while fetching URL:', error);
604
609
  return resolve(returnVal);
605
610
  });