@gvnrdao/dh-sdk 0.0.287 → 0.0.289

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/index.js CHANGED
@@ -34758,11 +34758,11 @@ __export(network_configs_exports, {
34758
34758
  isNetworkSupported: () => isNetworkSupported
34759
34759
  });
34760
34760
  function logNetworkConfig(level, message, ...args) {
34761
- if (!isNode2 || isBrowser)
34762
- return;
34763
- if (level === "log" && !process.env["DH_DEBUG"])
34764
- return;
34765
- console[level](message, ...args);
34761
+ if (isNode2 && !isBrowser) {
34762
+ if (level === "log" && process.env["DH_DEBUG"] !== "1")
34763
+ return;
34764
+ console[level](message, ...args);
34765
+ }
34766
34766
  }
34767
34767
  function readInitBackedEnv(name) {
34768
34768
  if (isNode2 && !isBrowser && typeof process !== "undefined" && process.env && typeof process.env[name] === "string") {
@@ -37330,7 +37330,10 @@ var require_es2015 = __commonJS({
37330
37330
  if (isCallable(method)) {
37331
37331
  result = method.call(O);
37332
37332
  if (isPrimitive2(result)) {
37333
- return result;
37333
+ return (
37334
+ /** @type {primitiveES6} */
37335
+ result
37336
+ );
37334
37337
  }
37335
37338
  }
37336
37339
  }
@@ -37339,7 +37342,10 @@ var require_es2015 = __commonJS({
37339
37342
  var GetMethod = require_GetMethod();
37340
37343
  module2.exports = function ToPrimitive(input) {
37341
37344
  if (isPrimitive2(input)) {
37342
- return input;
37345
+ return (
37346
+ /** @type {primitiveES6} */
37347
+ input
37348
+ );
37343
37349
  }
37344
37350
  var hint = "default";
37345
37351
  if (arguments.length > 1) {
@@ -37364,7 +37370,10 @@ var require_es2015 = __commonJS({
37364
37370
  if (typeof exoticToPrim !== "undefined") {
37365
37371
  var result = exoticToPrim.call(input, hint);
37366
37372
  if (isPrimitive2(result)) {
37367
- return result;
37373
+ return (
37374
+ /** @type {primitiveES6} */
37375
+ result
37376
+ );
37368
37377
  }
37369
37378
  throw new $TypeError("unable to convert exotic object to primitive");
37370
37379
  }
@@ -123907,12 +123916,13 @@ Error data: ${errorData || "none"}`
123907
123916
  const response = await fetch(url, {
123908
123917
  headers: await this.getAuthHeader()
123909
123918
  });
123910
- if (!response.ok) {
123911
- throw new Error(`Address balance request failed: ${response.status} ${response.statusText}`);
123919
+ const json = await response.json().catch(() => null);
123920
+ if (!response.ok || !json?.success) {
123921
+ const serverError = json?.error?.trim();
123922
+ throw new Error(
123923
+ serverError ? `Address balance request failed: ${serverError}` : `Address balance request failed: ${response.status} ${response.statusText}`.trimEnd()
123924
+ );
123912
123925
  }
123913
- const json = await response.json();
123914
- if (!json.success)
123915
- throw new Error(json.error ?? "Address balance request failed");
123916
123926
  return success(json.data);
123917
123927
  } catch (error2) {
123918
123928
  return failure(new SDKError({
package/dist/index.mjs CHANGED
@@ -34764,11 +34764,11 @@ __export(network_configs_exports, {
34764
34764
  isNetworkSupported: () => isNetworkSupported
34765
34765
  });
34766
34766
  function logNetworkConfig(level, message, ...args) {
34767
- if (!isNode2 || isBrowser)
34768
- return;
34769
- if (level === "log" && !process.env["DH_DEBUG"])
34770
- return;
34771
- console[level](message, ...args);
34767
+ if (isNode2 && !isBrowser) {
34768
+ if (level === "log" && process.env["DH_DEBUG"] !== "1")
34769
+ return;
34770
+ console[level](message, ...args);
34771
+ }
34772
34772
  }
34773
34773
  function readInitBackedEnv(name) {
34774
34774
  if (isNode2 && !isBrowser && typeof process !== "undefined" && process.env && typeof process.env[name] === "string") {
@@ -37336,7 +37336,10 @@ var require_es2015 = __commonJS({
37336
37336
  if (isCallable(method)) {
37337
37337
  result = method.call(O);
37338
37338
  if (isPrimitive2(result)) {
37339
- return result;
37339
+ return (
37340
+ /** @type {primitiveES6} */
37341
+ result
37342
+ );
37340
37343
  }
37341
37344
  }
37342
37345
  }
@@ -37345,7 +37348,10 @@ var require_es2015 = __commonJS({
37345
37348
  var GetMethod = require_GetMethod();
37346
37349
  module2.exports = function ToPrimitive(input) {
37347
37350
  if (isPrimitive2(input)) {
37348
- return input;
37351
+ return (
37352
+ /** @type {primitiveES6} */
37353
+ input
37354
+ );
37349
37355
  }
37350
37356
  var hint = "default";
37351
37357
  if (arguments.length > 1) {
@@ -37370,7 +37376,10 @@ var require_es2015 = __commonJS({
37370
37376
  if (typeof exoticToPrim !== "undefined") {
37371
37377
  var result = exoticToPrim.call(input, hint);
37372
37378
  if (isPrimitive2(result)) {
37373
- return result;
37379
+ return (
37380
+ /** @type {primitiveES6} */
37381
+ result
37382
+ );
37374
37383
  }
37375
37384
  throw new $TypeError("unable to convert exotic object to primitive");
37376
37385
  }
@@ -123829,12 +123838,13 @@ Error data: ${errorData || "none"}`
123829
123838
  const response = await fetch(url, {
123830
123839
  headers: await this.getAuthHeader()
123831
123840
  });
123832
- if (!response.ok) {
123833
- throw new Error(`Address balance request failed: ${response.status} ${response.statusText}`);
123841
+ const json = await response.json().catch(() => null);
123842
+ if (!response.ok || !json?.success) {
123843
+ const serverError = json?.error?.trim();
123844
+ throw new Error(
123845
+ serverError ? `Address balance request failed: ${serverError}` : `Address balance request failed: ${response.status} ${response.statusText}`.trimEnd()
123846
+ );
123834
123847
  }
123835
- const json = await response.json();
123836
- if (!json.success)
123837
- throw new Error(json.error ?? "Address balance request failed");
123838
123848
  return success(json.data);
123839
123849
  } catch (error2) {
123840
123850
  return failure(new SDKError({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-sdk",
3
- "version": "0.0.287",
3
+ "version": "0.0.289",
4
4
  "description": "TypeScript SDK for Diamond Hands Protocol - Bitcoin-backed lending with LIT Protocol PKPs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",