@uniswap/client-trading 0.11.7 → 0.11.8

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.
@@ -827,18 +827,28 @@ export declare enum MarginOperationType {
827
827
  */
828
828
  export declare enum MarginPositionStatus {
829
829
  /**
830
+ * Still open on chain, including a position that survived a partial
831
+ * liquidation.
832
+ *
830
833
  * @generated from enum value: ACTIVE = 0;
831
834
  */
832
835
  ACTIVE = 0,
833
836
  /**
837
+ * The owner closed it, and it was never liquidated in that epoch.
838
+ *
834
839
  * @generated from enum value: COMPLETED = 1;
835
840
  */
836
841
  COMPLETED = 1,
837
842
  /**
843
+ * A liquidation cleared its debt. Any collateral it left on the account is
844
+ * counted as returned, in `size` and `realized_pnl`.
845
+ *
838
846
  * @generated from enum value: LIQUIDATED = 2;
839
847
  */
840
848
  LIQUIDATED = 2,
841
849
  /**
850
+ * The owner closed it after a partial liquidation earlier in the same epoch.
851
+ *
842
852
  * @generated from enum value: PARTIALLY_LIQUIDATED = 3;
843
853
  */
844
854
  PARTIALLY_LIQUIDATED = 3
@@ -8972,54 +8982,9 @@ export declare class MarginQuoteResponse extends Message<MarginQuoteResponse> {
8972
8982
  static equals(a: MarginQuoteResponse | PlainMessage<MarginQuoteResponse> | undefined, b: MarginQuoteResponse | PlainMessage<MarginQuoteResponse> | undefined): boolean;
8973
8983
  }
8974
8984
  /**
8975
- * One venue's share of a position. Legs are the unit of truth: a logical
8976
- * position is an aggregation performed at read time, and legs liquidate
8977
- * independently, so the row's risk numbers are the NEAREST leg's.
8978
- *
8979
- * @generated from message trading.v1.MarginPositionLeg
8980
- */
8981
- export declare class MarginPositionLeg extends Message<MarginPositionLeg> {
8982
- /**
8983
- * @generated from field: trading.v1.MarginVenue venue = 1;
8984
- */
8985
- venue: MarginVenue;
8986
- /**
8987
- * The `positionId` handle every action key echoes back. Returned whether or
8988
- * not a screen renders it.
8989
- *
8990
- * @generated from field: string sub_id = 2;
8991
- */
8992
- subId: string;
8993
- /**
8994
- * The MarginAccount this leg lives at, derived offchain from (owner, subId).
8995
- *
8996
- * @generated from field: string account = 3;
8997
- */
8998
- account: string;
8999
- /**
9000
- * @generated from field: string debt = 4;
9001
- */
9002
- debt: string;
9003
- /**
9004
- * Best effort, like the markets feed: absent when the venue's rate read did
9005
- * not return, never zero, because an unread rate and a zero rate differ.
9006
- *
9007
- * @generated from field: optional string borrow_rate = 5;
9008
- */
9009
- borrowRate?: string;
9010
- constructor(data?: PartialMessage<MarginPositionLeg>);
9011
- static readonly runtime: typeof proto3;
9012
- static readonly typeName = "trading.v1.MarginPositionLeg";
9013
- static readonly fields: FieldList;
9014
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginPositionLeg;
9015
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginPositionLeg;
9016
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginPositionLeg;
9017
- static equals(a: MarginPositionLeg | PlainMessage<MarginPositionLeg> | undefined, b: MarginPositionLeg | PlainMessage<MarginPositionLeg> | undefined): boolean;
9018
- }
9019
- /**
9020
- * One logical position, keyed (exposure_token, counter_token, direction) — the
9021
- * same key the markets cursor orders on, which is why both endpoints page
9022
- * through `marginMarketCursor`.
8985
+ * One position: a margin account (owner, sub_id) on one venue and market. Each
8986
+ * open allocates its own sub_id, so a wallet's positions in the same pair are
8987
+ * separate rows, each with its own risk and its own actions.
9023
8988
  *
9024
8989
  * @generated from message trading.v1.MarginPositionRow
9025
8990
  */
@@ -9045,12 +9010,38 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9045
9010
  */
9046
9011
  size: string;
9047
9012
  /**
9048
- * @generated from field: repeated trading.v1.MarginPositionLeg legs = 6;
9013
+ * The account index every quote action key addresses.
9014
+ *
9015
+ * @generated from field: string sub_id = 32;
9016
+ */
9017
+ subId: string;
9018
+ /**
9019
+ * @generated from field: trading.v1.MarginVenue venue = 33;
9049
9020
  */
9050
- legs: MarginPositionLeg[];
9021
+ venue: MarginVenue;
9051
9022
  /**
9052
- * COST BASIS, from the position store. Absent rather than zero for a leg the
9053
- * store has not indexed.
9023
+ * The MarginAccount, derived offchain from (owner, sub_id).
9024
+ *
9025
+ * @generated from field: string account = 34;
9026
+ */
9027
+ account: string;
9028
+ /**
9029
+ * ACTIVE only. Raw debt-token units owed now.
9030
+ *
9031
+ * @generated from field: optional string debt_amount = 35;
9032
+ */
9033
+ debtAmount?: string;
9034
+ /**
9035
+ * Raw collateral-token units deposited over the position's life. Absent when
9036
+ * the store has not indexed the position or its flows went untracked.
9037
+ *
9038
+ * @generated from field: optional string deposited_equity = 36;
9039
+ */
9040
+ depositedEquity?: string;
9041
+ /**
9042
+ * COST BASIS, from the position store. Absent rather than zero for a
9043
+ * position the store has not indexed. In the same terms as `oracle_price`:
9044
+ * counter per exposure, 1e18-scaled, reciprocated on a SHORT.
9054
9045
  *
9055
9046
  * @generated from field: optional string entry_price = 7;
9056
9047
  */
@@ -9074,6 +9065,8 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9074
9065
  */
9075
9066
  unrealizedPnl?: string;
9076
9067
  /**
9068
+ * ACTIVE only. `unrealized_pnl` / `deposited_equity`, 1e18-scaled, signed.
9069
+ *
9077
9070
  * @generated from field: optional string roe = 11;
9078
9071
  */
9079
9072
  roe?: string;
@@ -9093,8 +9086,8 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9093
9086
  */
9094
9087
  oraclePrice?: string;
9095
9088
  /**
9096
- * Nearest leg. In TRADER terms, so a short's mark and liquidation price are
9097
- * both reciprocated; see `displayRiskPrices`.
9089
+ * In TRADER terms, so a short's mark and liquidation price are both
9090
+ * reciprocated; see `displayRiskPrices`.
9098
9091
  *
9099
9092
  * @generated from field: optional string liquidation_price = 15;
9100
9093
  */
@@ -9108,6 +9101,9 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9108
9101
  */
9109
9102
  healthFactor?: string;
9110
9103
  /**
9104
+ * Annual, 1e18-scaled. Best effort, like the markets feed: absent when the
9105
+ * venue's rate read did not return, never zero.
9106
+ *
9111
9107
  * @generated from field: optional string borrow_rate = 18;
9112
9108
  */
9113
9109
  borrowRate?: string;
@@ -9121,11 +9117,14 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9121
9117
  /**
9122
9118
  * TERMINAL only, and likewise cost-basis derived. `realized_pnl` is raw
9123
9119
  * collateral-token units: collateral returned minus collateral deposited.
9120
+ * On a terminal row `size` is what the position held when it closed.
9124
9121
  *
9125
9122
  * @generated from field: optional int64 closed_at = 20;
9126
9123
  */
9127
9124
  closedAt?: bigint;
9128
9125
  /**
9126
+ * In the same terms as `entry_price`.
9127
+ *
9129
9128
  * @generated from field: optional string exit_price = 21;
9130
9129
  */
9131
9130
  exitPrice?: string;
@@ -9168,13 +9167,13 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9168
9167
  */
9169
9168
  lastLiquidationTxHash?: string;
9170
9169
  /**
9171
- * Raw collateral-token units held right after the open, summed over legs.
9170
+ * Raw collateral-token units held right after the open.
9172
9171
  *
9173
9172
  * @generated from field: optional string collateral_at_open = 28;
9174
9173
  */
9175
9174
  collateralAtOpen?: string;
9176
9175
  /**
9177
- * Partial decreases, oldest first, the newest 50 per leg.
9176
+ * Partial decreases, oldest first, the newest 50.
9178
9177
  *
9179
9178
  * @generated from field: repeated trading.v1.MarginDecreaseActivity decreases = 29;
9180
9179
  */
@@ -9231,8 +9230,7 @@ export declare class MarginDecreaseActivity extends Message<MarginDecreaseActivi
9231
9230
  */
9232
9231
  collateralSold: string;
9233
9232
  /**
9234
- * Raw debt per raw collateral, 1e18-scaled, like `entry_price`. Absent when
9235
- * nothing was sold.
9233
+ * In the same terms as the row's `entry_price`. Absent when nothing was sold.
9236
9234
  *
9237
9235
  * @generated from field: optional string exit_price = 5;
9238
9236
  */
@@ -9320,12 +9318,13 @@ export declare class MarginPositionsRequest extends Message<MarginPositionsReque
9320
9318
  */
9321
9319
  chainId: number;
9322
9320
  /**
9323
- * Selects the tab. Unset is ACTIVE; explicit presence so the server can tell
9324
- * "not asked" from "asked for ACTIVE".
9321
+ * Selects the tab. Empty means [ACTIVE]. ACTIVE is read on chain and the
9322
+ * finished statuses from the position store, so ACTIVE is requested alone;
9323
+ * any set of finished statuses is served in one page. No duplicates.
9325
9324
  *
9326
- * @generated from field: optional trading.v1.MarginPositionStatus status = 3;
9325
+ * @generated from field: repeated trading.v1.MarginPositionStatus statuses = 6;
9327
9326
  */
9328
- status?: MarginPositionStatus;
9327
+ statuses: MarginPositionStatus[];
9329
9328
  /**
9330
9329
  * Opaque; echo `next_cursor` back verbatim. Keyset over the row order, the
9331
9330
  * same contract `GET /margin/markets` uses.
@@ -1115,18 +1115,28 @@ proto3.util.setEnumType(MarginOperationType, "trading.v1.MarginOperationType", [
1115
1115
  export var MarginPositionStatus;
1116
1116
  (function (MarginPositionStatus) {
1117
1117
  /**
1118
+ * Still open on chain, including a position that survived a partial
1119
+ * liquidation.
1120
+ *
1118
1121
  * @generated from enum value: ACTIVE = 0;
1119
1122
  */
1120
1123
  MarginPositionStatus[MarginPositionStatus["ACTIVE"] = 0] = "ACTIVE";
1121
1124
  /**
1125
+ * The owner closed it, and it was never liquidated in that epoch.
1126
+ *
1122
1127
  * @generated from enum value: COMPLETED = 1;
1123
1128
  */
1124
1129
  MarginPositionStatus[MarginPositionStatus["COMPLETED"] = 1] = "COMPLETED";
1125
1130
  /**
1131
+ * A liquidation cleared its debt. Any collateral it left on the account is
1132
+ * counted as returned, in `size` and `realized_pnl`.
1133
+ *
1126
1134
  * @generated from enum value: LIQUIDATED = 2;
1127
1135
  */
1128
1136
  MarginPositionStatus[MarginPositionStatus["LIQUIDATED"] = 2] = "LIQUIDATED";
1129
1137
  /**
1138
+ * The owner closed it after a partial liquidation earlier in the same epoch.
1139
+ *
1130
1140
  * @generated from enum value: PARTIALLY_LIQUIDATED = 3;
1131
1141
  */
1132
1142
  MarginPositionStatus[MarginPositionStatus["PARTIALLY_LIQUIDATED"] = 3] = "PARTIALLY_LIQUIDATED";
@@ -10275,64 +10285,9 @@ MarginQuoteResponse.fields = proto3.util.newFieldList(() => [
10275
10285
  { no: 4, name: "gas_estimate", kind: "message", T: GasEstimate, opt: true },
10276
10286
  ]);
10277
10287
  /**
10278
- * One venue's share of a position. Legs are the unit of truth: a logical
10279
- * position is an aggregation performed at read time, and legs liquidate
10280
- * independently, so the row's risk numbers are the NEAREST leg's.
10281
- *
10282
- * @generated from message trading.v1.MarginPositionLeg
10283
- */
10284
- export class MarginPositionLeg extends Message {
10285
- constructor(data) {
10286
- super();
10287
- /**
10288
- * @generated from field: trading.v1.MarginVenue venue = 1;
10289
- */
10290
- this.venue = MarginVenue.MORPHO;
10291
- /**
10292
- * The `positionId` handle every action key echoes back. Returned whether or
10293
- * not a screen renders it.
10294
- *
10295
- * @generated from field: string sub_id = 2;
10296
- */
10297
- this.subId = "";
10298
- /**
10299
- * The MarginAccount this leg lives at, derived offchain from (owner, subId).
10300
- *
10301
- * @generated from field: string account = 3;
10302
- */
10303
- this.account = "";
10304
- /**
10305
- * @generated from field: string debt = 4;
10306
- */
10307
- this.debt = "";
10308
- proto3.util.initPartial(data, this);
10309
- }
10310
- static fromBinary(bytes, options) {
10311
- return new MarginPositionLeg().fromBinary(bytes, options);
10312
- }
10313
- static fromJson(jsonValue, options) {
10314
- return new MarginPositionLeg().fromJson(jsonValue, options);
10315
- }
10316
- static fromJsonString(jsonString, options) {
10317
- return new MarginPositionLeg().fromJsonString(jsonString, options);
10318
- }
10319
- static equals(a, b) {
10320
- return proto3.util.equals(MarginPositionLeg, a, b);
10321
- }
10322
- }
10323
- MarginPositionLeg.runtime = proto3;
10324
- MarginPositionLeg.typeName = "trading.v1.MarginPositionLeg";
10325
- MarginPositionLeg.fields = proto3.util.newFieldList(() => [
10326
- { no: 1, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
10327
- { no: 2, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10328
- { no: 3, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10329
- { no: 4, name: "debt", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10330
- { no: 5, name: "borrow_rate", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10331
- ]);
10332
- /**
10333
- * One logical position, keyed (exposure_token, counter_token, direction) — the
10334
- * same key the markets cursor orders on, which is why both endpoints page
10335
- * through `marginMarketCursor`.
10288
+ * One position: a margin account (owner, sub_id) on one venue and market. Each
10289
+ * open allocates its own sub_id, so a wallet's positions in the same pair are
10290
+ * separate rows, each with its own risk and its own actions.
10336
10291
  *
10337
10292
  * @generated from message trading.v1.MarginPositionRow
10338
10293
  */
@@ -10352,11 +10307,23 @@ export class MarginPositionRow extends Message {
10352
10307
  */
10353
10308
  this.size = "";
10354
10309
  /**
10355
- * @generated from field: repeated trading.v1.MarginPositionLeg legs = 6;
10310
+ * The account index every quote action key addresses.
10311
+ *
10312
+ * @generated from field: string sub_id = 32;
10313
+ */
10314
+ this.subId = "";
10315
+ /**
10316
+ * @generated from field: trading.v1.MarginVenue venue = 33;
10356
10317
  */
10357
- this.legs = [];
10318
+ this.venue = MarginVenue.MORPHO;
10319
+ /**
10320
+ * The MarginAccount, derived offchain from (owner, sub_id).
10321
+ *
10322
+ * @generated from field: string account = 34;
10323
+ */
10324
+ this.account = "";
10358
10325
  /**
10359
- * Partial decreases, oldest first, the newest 50 per leg.
10326
+ * Partial decreases, oldest first, the newest 50.
10360
10327
  *
10361
10328
  * @generated from field: repeated trading.v1.MarginDecreaseActivity decreases = 29;
10362
10329
  */
@@ -10384,7 +10351,11 @@ MarginPositionRow.fields = proto3.util.newFieldList(() => [
10384
10351
  { no: 3, name: "exposure_token", kind: "message", T: MarginTokenMetadata },
10385
10352
  { no: 4, name: "counter_token", kind: "message", T: MarginTokenMetadata },
10386
10353
  { no: 5, name: "size", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10387
- { no: 6, name: "legs", kind: "message", T: MarginPositionLeg, repeated: true },
10354
+ { no: 32, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10355
+ { no: 33, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
10356
+ { no: 34, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10357
+ { no: 35, name: "debt_amount", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10358
+ { no: 36, name: "deposited_equity", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10388
10359
  { no: 7, name: "entry_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10389
10360
  { no: 8, name: "opened_at", kind: "scalar", T: 3 /* ScalarType.INT64 */, opt: true },
10390
10361
  { no: 9, name: "accrued_interest", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
@@ -10559,6 +10530,14 @@ export class MarginPositionsRequest extends Message {
10559
10530
  * @generated from field: int32 chain_id = 2;
10560
10531
  */
10561
10532
  this.chainId = 0;
10533
+ /**
10534
+ * Selects the tab. Empty means [ACTIVE]. ACTIVE is read on chain and the
10535
+ * finished statuses from the position store, so ACTIVE is requested alone;
10536
+ * any set of finished statuses is served in one page. No duplicates.
10537
+ *
10538
+ * @generated from field: repeated trading.v1.MarginPositionStatus statuses = 6;
10539
+ */
10540
+ this.statuses = [];
10562
10541
  proto3.util.initPartial(data, this);
10563
10542
  }
10564
10543
  static fromBinary(bytes, options) {
@@ -10579,7 +10558,7 @@ MarginPositionsRequest.typeName = "trading.v1.MarginPositionsRequest";
10579
10558
  MarginPositionsRequest.fields = proto3.util.newFieldList(() => [
10580
10559
  { no: 1, name: "swapper", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10581
10560
  { no: 2, name: "chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
10582
- { no: 3, name: "status", kind: "enum", T: proto3.getEnumType(MarginPositionStatus), opt: true },
10561
+ { no: 6, name: "statuses", kind: "enum", T: proto3.getEnumType(MarginPositionStatus), repeated: true },
10583
10562
  { no: 4, name: "cursor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10584
10563
  { no: 5, name: "limit", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
10585
10564
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniswap/client-trading",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },