@pear-protocol/exchanges-sdk 0.0.8 → 0.0.10

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.
@@ -33,7 +33,7 @@ class BinanceOrchestrator extends BaseOrchestrator {
33
33
  if (gen !== this.startGeneration) return;
34
34
  this.handleAccountStatus(snapshot);
35
35
  this.handlePositionRisk(positionRisk, false);
36
- const listenKey = await createListenKey(this.creds.api_key, this.demo);
36
+ const listenKey = await createListenKey(this.creds.read.api_key, this.demo);
37
37
  this.ws = new BinanceWs(
38
38
  {
39
39
  onUserDataEvent: (event) => this.handleUserDataEvent(event),
@@ -50,7 +50,7 @@ class BinanceOrchestrator extends BaseOrchestrator {
50
50
  await this.ws.connectUserDataStream(listenKey);
51
51
  this.listenKeyTimer = setInterval(() => {
52
52
  if (this.creds) {
53
- keepAliveListenKey(this.creds.api_key, this.demo).catch(
53
+ keepAliveListenKey(this.creds.read.api_key, this.demo).catch(
54
54
  (err) => this.onError(err instanceof Error ? err : new Error(String(err)))
55
55
  );
56
56
  }
@@ -6,9 +6,9 @@ async function signedGet(creds, path, params, demo) {
6
6
  const timestamp = Date.now().toString();
7
7
  const allParams = { ...params, timestamp, recvWindow: "5000" };
8
8
  const queryString = new URLSearchParams(allParams).toString();
9
- const signature = await hmacSha256Hex(creds.api_secret, queryString);
9
+ const signature = await hmacSha256Hex(creds.read.api_secret, queryString);
10
10
  const response = await fetch(`${baseUrl}${path}?${queryString}&signature=${signature}`, {
11
- headers: { "X-MBX-APIKEY": creds.api_key }
11
+ headers: { "X-MBX-APIKEY": creds.read.api_key }
12
12
  });
13
13
  if (!response.ok) {
14
14
  const body = await response.json().catch(() => null);
@@ -22,10 +22,10 @@ async function signedPost(creds, path, params, demo) {
22
22
  const timestamp = Date.now().toString();
23
23
  const allParams = { ...params, timestamp, recvWindow: "5000" };
24
24
  const queryString = new URLSearchParams(allParams).toString();
25
- const signature = await hmacSha256Hex(creds.api_secret, queryString);
25
+ const signature = await hmacSha256Hex(creds.read.api_secret, queryString);
26
26
  const response = await fetch(`${baseUrl}${path}?${queryString}&signature=${signature}`, {
27
27
  method: "POST",
28
- headers: { "X-MBX-APIKEY": creds.api_key }
28
+ headers: { "X-MBX-APIKEY": creds.read.api_key }
29
29
  });
30
30
  if (!response.ok) {
31
31
  const body = await response.json().catch(() => null);
@@ -59,9 +59,9 @@ class BinanceWs {
59
59
  async sendSignedRequest(id, method, params = {}) {
60
60
  if (!this.creds) return;
61
61
  const timestamp = Date.now();
62
- const allParams = { ...params, apiKey: this.creds.api_key, timestamp };
62
+ const allParams = { ...params, apiKey: this.creds.read.api_key, timestamp };
63
63
  const queryString = Object.keys(allParams).sort().map((k) => `${k}=${allParams[k]}`).join("&");
64
- const signature = await hmacSha256Hex(this.creds.api_secret, queryString);
64
+ const signature = await hmacSha256Hex(this.creds.read.api_secret, queryString);
65
65
  sendWs(this.wsApiWs, { id, method, params: { ...allParams, signature } });
66
66
  }
67
67
  close() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/exchanges-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Pear Protocol Exchanges SDK",
5
5
  "private": false,
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@nktkas/hyperliquid": "0.30.2",
29
- "@pear-protocol/core-sdk": "0.0.9",
30
- "@pear-protocol/types": "0.0.8",
29
+ "@pear-protocol/core-sdk": "0.0.11",
30
+ "@pear-protocol/types": "0.0.10",
31
31
  "viem": "^2.43.5"
32
32
  },
33
33
  "devDependencies": {