@pear-protocol/core-sdk 2.6.0 → 2.8.0

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.
@@ -34,8 +34,8 @@ declare class Core {
34
34
  }[];
35
35
  nextCursor?: string | undefined;
36
36
  }>;
37
- /** Read the latest 20 open positions and active automation records per section without account authentication. */
38
- public: (tradeAccountId: string, headers?: ClientHeaders) => Promise<{
37
+ /** Read public positions; opt into viewer copy state with authentication and an owned account header. */
38
+ public: (tradeAccountId: string, headers?: ClientHeaders, query?: HttpTypes.PublicTraderQueryInput) => Promise<{
39
39
  connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter" | "lighter_rhc";
40
40
  copyingEnabled: boolean;
41
41
  followers: {
@@ -71,6 +71,9 @@ declare class Core {
71
71
  entryVwap?: string | undefined;
72
72
  };
73
73
  }[];
74
+ copySubscriptionId?: string | undefined;
75
+ copyStatus?: "COPIED" | "PARTIAL" | "PENDING" | "NOT_COPIED" | "UNKNOWN" | undefined;
76
+ copyReason?: string | undefined;
74
77
  }[];
75
78
  triggers: ({
76
79
  type: "MARKET";
@@ -6011,6 +6014,8 @@ declare class Core {
6011
6014
  createdAt: string;
6012
6015
  updatedAt: string;
6013
6016
  closedReason?: "NETTED" | "USER" | "LIQUIDATED" | null | undefined;
6017
+ copySubscriptionId?: string | undefined;
6018
+ isCopying?: boolean | undefined;
6014
6019
  closedAt?: string | null | undefined;
6015
6020
  }[];
6016
6021
  nextCursor?: string | undefined;
@@ -6074,6 +6079,8 @@ declare class Core {
6074
6079
  exitVwap?: string | undefined;
6075
6080
  }[];
6076
6081
  closedReason?: "NETTED" | "USER" | "LIQUIDATED" | undefined;
6082
+ copySubscriptionId?: string | undefined;
6083
+ isCopying?: false | undefined;
6077
6084
  steps?: {
6078
6085
  at: string;
6079
6086
  grossPnl: `-${string}` | `+${string}`;
@@ -6126,6 +6133,8 @@ declare class Core {
6126
6133
  updatedAt: string;
6127
6134
  origin: "PARTIAL" | "PEAR" | "EXTERNAL";
6128
6135
  realizedGrossPnl: `-${string}` | `+${string}`;
6136
+ volume: string;
6137
+ grossUpnl: `-${string}` | `+${string}`;
6129
6138
  netCashflow: `-${string}` | `+${string}`;
6130
6139
  totalFees: `-${string}` | `+${string}`;
6131
6140
  tradeFees: `-${string}` | `+${string}`;
@@ -6154,6 +6163,8 @@ declare class Core {
6154
6163
  pearFees: `-${string}` | `+${string}`;
6155
6164
  funding: `-${string}` | `+${string}`;
6156
6165
  }[];
6166
+ copySubscriptionId?: string | undefined;
6167
+ isCopying?: boolean | undefined;
6157
6168
  steps?: {
6158
6169
  at: string;
6159
6170
  grossPnl: `-${string}` | `+${string}`;
@@ -10191,6 +10202,13 @@ declare class Core {
10191
10202
  };
10192
10203
  createdAt: string;
10193
10204
  status: "ACTIVE";
10205
+ volume: string;
10206
+ grossRealizedPnl: `-${string}` | `+${string}`;
10207
+ grossUpnl: `-${string}` | `+${string}`;
10208
+ fundingPayment: `-${string}` | `+${string}`;
10209
+ tradeFee: `-${string}` | `+${string}`;
10210
+ pearFee: `-${string}` | `+${string}`;
10211
+ totalNetPnl: `-${string}` | `+${string}`;
10194
10212
  endedAt?: string | undefined;
10195
10213
  };
10196
10214
  }>;
@@ -10224,20 +10242,39 @@ declare class Core {
10224
10242
  xAvatarUrl?: string | undefined;
10225
10243
  }[];
10226
10244
  }>;
10227
- /** Read subscription history; use copy.state for the current relationship of one account. */
10228
- listSubscriptions: (headers?: ClientHeaders) => Promise<{
10229
- subscriptions: {
10245
+ /** Read subscription history, optionally by status; use copy.state for one account's current relationship. */
10246
+ listSubscriptions: (headers?: ClientHeaders, query?: HttpTypes.CopySubscriptionListQueryInput) => Promise<{
10247
+ subscriptions: ({
10230
10248
  id: string;
10231
10249
  leaderTradeAccountId: string;
10232
10250
  followerTradeAccountId: string;
10233
10251
  connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter" | "lighter_rhc";
10234
- status: "ACTIVE" | "ENDED";
10235
10252
  sizing: {
10236
10253
  mode: "LEADER_EQUITY_FRACTION";
10237
10254
  };
10238
10255
  createdAt: string;
10256
+ status: "ACTIVE";
10257
+ volume: string;
10258
+ grossRealizedPnl: `-${string}` | `+${string}`;
10259
+ grossUpnl: `-${string}` | `+${string}`;
10260
+ fundingPayment: `-${string}` | `+${string}`;
10261
+ tradeFee: `-${string}` | `+${string}`;
10262
+ pearFee: `-${string}` | `+${string}`;
10263
+ totalNetPnl: `-${string}` | `+${string}`;
10239
10264
  endedAt?: string | undefined;
10240
- }[];
10265
+ } | {
10266
+ id: string;
10267
+ leaderTradeAccountId: string;
10268
+ followerTradeAccountId: string;
10269
+ connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter" | "lighter_rhc";
10270
+ sizing: {
10271
+ mode: "LEADER_EQUITY_FRACTION";
10272
+ };
10273
+ createdAt: string;
10274
+ status: "ENDED";
10275
+ volume: string;
10276
+ endedAt?: string | undefined;
10277
+ })[];
10241
10278
  }>;
10242
10279
  /** Start copying into the account selected by x-trade-account-id, syncing existing positions by default. */
10243
10280
  subscribe: (body: HttpTypes.CreateCopySubscriptionInput, headers?: ClientHeaders) => Promise<{
@@ -10316,7 +10353,7 @@ declare class Core {
10316
10353
  origin: "AUTO_REBALANCE";
10317
10354
  configId: string;
10318
10355
  } | undefined;
10319
- outcome?: "FAILED" | "PARTIAL" | "COPIED" | "SKIPPED" | undefined;
10356
+ outcome?: "FAILED" | "COPIED" | "PARTIAL" | "SKIPPED" | undefined;
10320
10357
  skipReason?: "SUBSCRIPTION_NOT_ACTIVE" | "POSITION_EXCLUDED" | "INCLUDED_IN_JOIN" | "VENUE_MISMATCH" | "BELOW_VENUE_MINIMUM" | "PAIR_ALREADY_ENTERED" | "ENTRY_EXPIRED" | "FOLLOWER_LEG_ABSENT" | "LEADER_LEG_REOPENED" | "NO_FOLLOWER_DELTA" | "LEADER_EQUITY_UNREADABLE" | "FOLLOWER_EQUITY_UNREADABLE" | "PRICE_UNAVAILABLE" | "LEVERAGE_NOT_APPLIED" | undefined;
10321
10358
  failureReason?: string | undefined;
10322
10359
  leaderEquityFraction?: string | undefined;
@@ -31,11 +31,12 @@ class Core {
31
31
  headers
32
32
  });
33
33
  }, "closedPositions"),
34
- /** Read the latest 20 open positions and active automation records per section without account authentication. */
35
- public: /* @__PURE__ */ __name(async (tradeAccountId, headers) => {
34
+ /** Read public positions; opt into viewer copy state with authentication and an owned account header. */
35
+ public: /* @__PURE__ */ __name(async (tradeAccountId, headers, query) => {
36
36
  return await this.client.fetch(`/traders/${encodeURIComponent(tradeAccountId)}`, {
37
37
  method: "GET",
38
- headers
38
+ headers,
39
+ query
39
40
  });
40
41
  }, "public")
41
42
  };
@@ -861,11 +862,12 @@ class Core {
861
862
  query
862
863
  });
863
864
  }, "stats"),
864
- /** Read subscription history; use copy.state for the current relationship of one account. */
865
- listSubscriptions: /* @__PURE__ */ __name(async (headers) => {
865
+ /** Read subscription history, optionally by status; use copy.state for one account's current relationship. */
866
+ listSubscriptions: /* @__PURE__ */ __name(async (headers, query) => {
866
867
  return await this.client.fetch(`/copy/subscriptions`, {
867
868
  method: "GET",
868
- headers
869
+ headers,
870
+ query
869
871
  });
870
872
  }, "listSubscriptions"),
871
873
  /** Start copying into the account selected by x-trade-account-id, syncing existing positions by default. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/core-sdk",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Pear Protocol Core SDK",
5
5
  "private": false,
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "typecheck": "tsc --noEmit"
27
27
  },
28
28
  "dependencies": {
29
- "@pear-protocol/types": "^2.13.0",
29
+ "@pear-protocol/types": "^2.15.0",
30
30
  "@pear-protocol/utils": "^1.3.0",
31
31
  "qs": "^6.14.0"
32
32
  },