@pear-protocol/symmio-client 0.2.38 → 0.2.40

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
@@ -23269,8 +23269,8 @@ var MUON_BASE_URLS = [
23269
23269
  var MUON_APP_NAME = "symmio";
23270
23270
  var MUON_REQUEST_TIMEOUT = 15e3;
23271
23271
  var HEDGER_BASE_URLS = {
23272
- [42161 /* ARBITRUM */]: "https://www.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4",
23273
- [8453 /* BASE */]: "https://www.perps-streaming.com/v1/8453a/0x6273242a7E88b3De90822b31648C212215caaFE4"
23272
+ [42161 /* ARBITRUM */]: "https://www.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/",
23273
+ [8453 /* BASE */]: "https://www.perps-streaming.com/v1/8453a/0xE43166cE17d3511B09438a359dAa53513225101D/"
23274
23274
  };
23275
23275
  var SymmioSDKError = class extends Error {
23276
23276
  constructor(message, code) {
@@ -24396,6 +24396,7 @@ var instant_exports = {};
24396
24396
  __export(instant_exports, {
24397
24397
  cancelInstantClose: () => cancelInstantClose,
24398
24398
  createSiweMessage: () => createSiweMessage,
24399
+ getHedgerBaseUrl: () => getHedgerBaseUrl,
24399
24400
  getNonce: () => getNonce,
24400
24401
  getOpenInstantCloses: () => getOpenInstantCloses,
24401
24402
  instantClose: () => instantClose,
@@ -24456,10 +24457,24 @@ async function login(chainId, params) {
24456
24457
  body: JSON.stringify(body)
24457
24458
  });
24458
24459
  if (!response.ok) {
24459
- const errorData = await response.json().catch(() => null);
24460
- throw new Error(
24461
- errorData?.error_message ?? `Login failed: ${response.statusText}`
24462
- );
24460
+ let errorMessage = "";
24461
+ if (typeof response.text === "function") {
24462
+ const rawBody = await response.text().catch(() => "");
24463
+ if (rawBody) {
24464
+ try {
24465
+ const parsed = JSON.parse(rawBody);
24466
+ errorMessage = parsed.error_message ?? parsed.message ?? parsed.detail ?? rawBody;
24467
+ } catch {
24468
+ errorMessage = rawBody;
24469
+ }
24470
+ }
24471
+ }
24472
+ if (!errorMessage && typeof response.json === "function") {
24473
+ const errorData = await response.json().catch(() => null);
24474
+ errorMessage = errorData?.error_message ?? errorData?.message ?? errorData?.detail ?? "";
24475
+ }
24476
+ const reason = errorMessage || response.statusText;
24477
+ throw new Error(reason ? `Login failed: ${reason}` : "Login failed");
24463
24478
  }
24464
24479
  const data = await response.json();
24465
24480
  if (!data.access_token) {