@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.d.mts CHANGED
@@ -19711,6 +19711,7 @@ declare namespace admin {
19711
19711
  export { admin_grantRole as grantRole, admin_prepareGrantRole as prepareGrantRole, admin_prepareRevokeRole as prepareRevokeRole, admin_revokeRole as revokeRole };
19712
19712
  }
19713
19713
 
19714
+ declare function getHedgerBaseUrl(chainId: number): string;
19714
19715
  /**
19715
19716
  * Creates a SIWE (Sign-In with Ethereum) message for instant trading auth.
19716
19717
  * Follows EIP-4361 format. Token is valid for 30 days.
@@ -19743,13 +19744,14 @@ declare function getOpenInstantCloses(chainId: number, account: Address, accessT
19743
19744
 
19744
19745
  declare const instant_cancelInstantClose: typeof cancelInstantClose;
19745
19746
  declare const instant_createSiweMessage: typeof createSiweMessage;
19747
+ declare const instant_getHedgerBaseUrl: typeof getHedgerBaseUrl;
19746
19748
  declare const instant_getNonce: typeof getNonce;
19747
19749
  declare const instant_getOpenInstantCloses: typeof getOpenInstantCloses;
19748
19750
  declare const instant_instantClose: typeof instantClose;
19749
19751
  declare const instant_instantOpen: typeof instantOpen;
19750
19752
  declare const instant_login: typeof login;
19751
19753
  declare namespace instant {
19752
- export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
19754
+ export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getHedgerBaseUrl as getHedgerBaseUrl, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
19753
19755
  }
19754
19756
 
19755
19757
  /**
package/dist/index.d.ts CHANGED
@@ -19711,6 +19711,7 @@ declare namespace admin {
19711
19711
  export { admin_grantRole as grantRole, admin_prepareGrantRole as prepareGrantRole, admin_prepareRevokeRole as prepareRevokeRole, admin_revokeRole as revokeRole };
19712
19712
  }
19713
19713
 
19714
+ declare function getHedgerBaseUrl(chainId: number): string;
19714
19715
  /**
19715
19716
  * Creates a SIWE (Sign-In with Ethereum) message for instant trading auth.
19716
19717
  * Follows EIP-4361 format. Token is valid for 30 days.
@@ -19743,13 +19744,14 @@ declare function getOpenInstantCloses(chainId: number, account: Address, accessT
19743
19744
 
19744
19745
  declare const instant_cancelInstantClose: typeof cancelInstantClose;
19745
19746
  declare const instant_createSiweMessage: typeof createSiweMessage;
19747
+ declare const instant_getHedgerBaseUrl: typeof getHedgerBaseUrl;
19746
19748
  declare const instant_getNonce: typeof getNonce;
19747
19749
  declare const instant_getOpenInstantCloses: typeof getOpenInstantCloses;
19748
19750
  declare const instant_instantClose: typeof instantClose;
19749
19751
  declare const instant_instantOpen: typeof instantOpen;
19750
19752
  declare const instant_login: typeof login;
19751
19753
  declare namespace instant {
19752
- export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
19754
+ export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getHedgerBaseUrl as getHedgerBaseUrl, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
19753
19755
  }
19754
19756
 
19755
19757
  /**
package/dist/index.js CHANGED
@@ -23271,8 +23271,8 @@ var MUON_BASE_URLS = [
23271
23271
  var MUON_APP_NAME = "symmio";
23272
23272
  var MUON_REQUEST_TIMEOUT = 15e3;
23273
23273
  var HEDGER_BASE_URLS = {
23274
- [42161 /* ARBITRUM */]: "https://www.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4",
23275
- [8453 /* BASE */]: "https://www.perps-streaming.com/v1/8453a/0x6273242a7E88b3De90822b31648C212215caaFE4"
23274
+ [42161 /* ARBITRUM */]: "https://www.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/",
23275
+ [8453 /* BASE */]: "https://www.perps-streaming.com/v1/8453a/0xE43166cE17d3511B09438a359dAa53513225101D/"
23276
23276
  };
23277
23277
  var SymmioSDKError = class extends Error {
23278
23278
  constructor(message, code) {
@@ -24398,6 +24398,7 @@ var instant_exports = {};
24398
24398
  __export(instant_exports, {
24399
24399
  cancelInstantClose: () => cancelInstantClose,
24400
24400
  createSiweMessage: () => createSiweMessage,
24401
+ getHedgerBaseUrl: () => getHedgerBaseUrl,
24401
24402
  getNonce: () => getNonce,
24402
24403
  getOpenInstantCloses: () => getOpenInstantCloses,
24403
24404
  instantClose: () => instantClose,
@@ -24458,10 +24459,24 @@ async function login(chainId, params) {
24458
24459
  body: JSON.stringify(body)
24459
24460
  });
24460
24461
  if (!response.ok) {
24461
- const errorData = await response.json().catch(() => null);
24462
- throw new Error(
24463
- errorData?.error_message ?? `Login failed: ${response.statusText}`
24464
- );
24462
+ let errorMessage = "";
24463
+ if (typeof response.text === "function") {
24464
+ const rawBody = await response.text().catch(() => "");
24465
+ if (rawBody) {
24466
+ try {
24467
+ const parsed = JSON.parse(rawBody);
24468
+ errorMessage = parsed.error_message ?? parsed.message ?? parsed.detail ?? rawBody;
24469
+ } catch {
24470
+ errorMessage = rawBody;
24471
+ }
24472
+ }
24473
+ }
24474
+ if (!errorMessage && typeof response.json === "function") {
24475
+ const errorData = await response.json().catch(() => null);
24476
+ errorMessage = errorData?.error_message ?? errorData?.message ?? errorData?.detail ?? "";
24477
+ }
24478
+ const reason = errorMessage || response.statusText;
24479
+ throw new Error(reason ? `Login failed: ${reason}` : "Login failed");
24465
24480
  }
24466
24481
  const data = await response.json();
24467
24482
  if (!data.access_token) {