@pear-protocol/symmio-client 0.3.15 → 0.3.17

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.mjs CHANGED
@@ -23280,6 +23280,7 @@ var SymmioSDKError = class extends Error {
23280
23280
  this.code = code;
23281
23281
  this.name = "SymmioSDKError";
23282
23282
  }
23283
+ code;
23283
23284
  };
23284
23285
  function validateAddress(address, name) {
23285
23286
  if (!isAddress(address)) {
@@ -24739,15 +24740,24 @@ function readTimestamp(source) {
24739
24740
  const parsed = Number(timestamp);
24740
24741
  return Number.isFinite(parsed) ? parsed : void 0;
24741
24742
  }
24743
+ function hasAccountDataShape(value) {
24744
+ return isRecord(value) && ("equity" in value || "maintenanceMargin" in value || "availableForOrder" in value || "totalLocked" in value);
24745
+ }
24742
24746
  function getSymmAccountData(response) {
24743
24747
  if (!isRecord(response)) {
24744
24748
  return void 0;
24745
24749
  }
24746
24750
  const data = response.data;
24747
24751
  if (isRecord(data)) {
24748
- return data;
24752
+ if (hasAccountDataShape(data.accountData)) {
24753
+ return data.accountData;
24754
+ }
24755
+ if (hasAccountDataShape(data)) {
24756
+ return data;
24757
+ }
24758
+ return void 0;
24749
24759
  }
24750
- if ("equity" in response || "maintenanceMargin" in response || "availableForOrder" in response || "totalLocked" in response) {
24760
+ if (hasAccountDataShape(response)) {
24751
24761
  return response;
24752
24762
  }
24753
24763
  return void 0;