@pear-protocol/hyperliquid-sdk 0.0.2 → 0.0.4

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.ts CHANGED
@@ -444,7 +444,9 @@ declare class PearHyperliquidClient {
444
444
  */
445
445
  declare class PearMigrationSDK {
446
446
  private client;
447
- private isSyncRunning;
447
+ private isTradeHistorySyncRunning;
448
+ private isOpenPositionsSyncRunning;
449
+ private isOpenOrdersSyncRunning;
448
450
  constructor(client: PearHyperliquidClient);
449
451
  /**
450
452
  * Sync trade history data - can only run one at a time
@@ -462,9 +464,21 @@ declare class PearMigrationSDK {
462
464
  */
463
465
  syncOpenOrders(payload: SyncOpenOrderDto): Promise<ApiResponse<SyncOpenOrderResponseDto> | null>;
464
466
  /**
465
- * Check if sync is currently running
467
+ * Check if any sync is currently running
466
468
  */
467
469
  isSyncInProgress(): boolean;
470
+ /**
471
+ * Check if trade history sync is currently running
472
+ */
473
+ isTradeHistorySyncInProgress(): boolean;
474
+ /**
475
+ * Check if open positions sync is currently running
476
+ */
477
+ isOpenPositionsSyncInProgress(): boolean;
478
+ /**
479
+ * Check if open orders sync is currently running
480
+ */
481
+ isOpenOrdersSyncInProgress(): boolean;
468
482
  /**
469
483
  * Get the underlying client instance
470
484
  */
package/dist/index.esm.js CHANGED
@@ -94,7 +94,9 @@ class PearHyperliquidClient {
94
94
  */
95
95
  class PearMigrationSDK {
96
96
  constructor(client) {
97
- this.isSyncRunning = false;
97
+ this.isTradeHistorySyncRunning = false;
98
+ this.isOpenPositionsSyncRunning = false;
99
+ this.isOpenOrdersSyncRunning = false;
98
100
  this.client = client;
99
101
  }
100
102
  /**
@@ -103,16 +105,16 @@ class PearMigrationSDK {
103
105
  */
104
106
  async syncTradeHistory(payload) {
105
107
  // If sync is already running, return immediately
106
- if (this.isSyncRunning) {
108
+ if (this.isTradeHistorySyncRunning) {
107
109
  return null;
108
110
  }
109
111
  try {
110
- this.isSyncRunning = true;
112
+ this.isTradeHistorySyncRunning = true;
111
113
  const response = await this.client.syncTradeHistory(payload);
112
114
  return response;
113
115
  }
114
116
  finally {
115
- this.isSyncRunning = false;
117
+ this.isTradeHistorySyncRunning = false;
116
118
  }
117
119
  }
118
120
  /**
@@ -121,16 +123,16 @@ class PearMigrationSDK {
121
123
  */
122
124
  async syncOpenPositions(payload) {
123
125
  // If sync is already running, return immediately
124
- if (this.isSyncRunning) {
126
+ if (this.isOpenPositionsSyncRunning) {
125
127
  return null;
126
128
  }
127
129
  try {
128
- this.isSyncRunning = true;
130
+ this.isOpenPositionsSyncRunning = true;
129
131
  const response = await this.client.syncOpenPositions(payload);
130
132
  return response;
131
133
  }
132
134
  finally {
133
- this.isSyncRunning = false;
135
+ this.isOpenPositionsSyncRunning = false;
134
136
  }
135
137
  }
136
138
  /**
@@ -139,23 +141,41 @@ class PearMigrationSDK {
139
141
  */
140
142
  async syncOpenOrders(payload) {
141
143
  // If sync is already running, return immediately
142
- if (this.isSyncRunning) {
144
+ if (this.isOpenOrdersSyncRunning) {
143
145
  return null;
144
146
  }
145
147
  try {
146
- this.isSyncRunning = true;
148
+ this.isOpenOrdersSyncRunning = true;
147
149
  const response = await this.client.syncOpenOrders(payload);
148
150
  return response;
149
151
  }
150
152
  finally {
151
- this.isSyncRunning = false;
153
+ this.isOpenOrdersSyncRunning = false;
152
154
  }
153
155
  }
154
156
  /**
155
- * Check if sync is currently running
157
+ * Check if any sync is currently running
156
158
  */
157
159
  isSyncInProgress() {
158
- return this.isSyncRunning;
160
+ return this.isTradeHistorySyncRunning || this.isOpenPositionsSyncRunning || this.isOpenOrdersSyncRunning;
161
+ }
162
+ /**
163
+ * Check if trade history sync is currently running
164
+ */
165
+ isTradeHistorySyncInProgress() {
166
+ return this.isTradeHistorySyncRunning;
167
+ }
168
+ /**
169
+ * Check if open positions sync is currently running
170
+ */
171
+ isOpenPositionsSyncInProgress() {
172
+ return this.isOpenPositionsSyncRunning;
173
+ }
174
+ /**
175
+ * Check if open orders sync is currently running
176
+ */
177
+ isOpenOrdersSyncInProgress() {
178
+ return this.isOpenOrdersSyncRunning;
159
179
  }
160
180
  /**
161
181
  * Get the underlying client instance