@uniswap/client-trading 0.11.7 → 0.11.9

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
@@ -1239,6 +1249,12 @@ export declare class CheckApproval4337Request extends Message<CheckApproval4337R
1239
1249
  * @generated from field: optional trading.v1.Eip7702Authorization eip7702_auth = 11;
1240
1250
  */
1241
1251
  eip7702Auth?: Eip7702Authorization;
1252
+ /**
1253
+ * See CheckApprovalRequest.bridge_quote.
1254
+ *
1255
+ * @generated from field: optional trading.v1.BridgeQuote bridge_quote = 12;
1256
+ */
1257
+ bridgeQuote?: BridgeQuote;
1242
1258
  constructor(data?: PartialMessage<CheckApproval4337Request>);
1243
1259
  static readonly runtime: typeof proto3;
1244
1260
  static readonly typeName = "trading.v1.CheckApproval4337Request";
@@ -6180,6 +6196,13 @@ export declare class CheckApprovalRequest extends Message<CheckApprovalRequest>
6180
6196
  * @generated from field: optional trading.v1.UrgencyWithOverrides urgency_overrides = 9;
6181
6197
  */
6182
6198
  urgencyOverrides?: UrgencyWithOverrides;
6199
+ /**
6200
+ * The /quote BRIDGE quote this approval is for. Its order's approval spender
6201
+ * replaces the inferred one; a provider quote must be one TAPI issued.
6202
+ *
6203
+ * @generated from field: optional trading.v1.BridgeQuote bridge_quote = 10;
6204
+ */
6205
+ bridgeQuote?: BridgeQuote;
6183
6206
  constructor(data?: PartialMessage<CheckApprovalRequest>);
6184
6207
  static readonly runtime: typeof proto3;
6185
6208
  static readonly typeName = "trading.v1.CheckApprovalRequest";
@@ -8972,54 +8995,9 @@ export declare class MarginQuoteResponse extends Message<MarginQuoteResponse> {
8972
8995
  static equals(a: MarginQuoteResponse | PlainMessage<MarginQuoteResponse> | undefined, b: MarginQuoteResponse | PlainMessage<MarginQuoteResponse> | undefined): boolean;
8973
8996
  }
8974
8997
  /**
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`.
8998
+ * One position: a margin account (owner, sub_id) on one venue and market. Each
8999
+ * open allocates its own sub_id, so a wallet's positions in the same pair are
9000
+ * separate rows, each with its own risk and its own actions.
9023
9001
  *
9024
9002
  * @generated from message trading.v1.MarginPositionRow
9025
9003
  */
@@ -9045,12 +9023,38 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9045
9023
  */
9046
9024
  size: string;
9047
9025
  /**
9048
- * @generated from field: repeated trading.v1.MarginPositionLeg legs = 6;
9026
+ * The account index every quote action key addresses.
9027
+ *
9028
+ * @generated from field: string sub_id = 32;
9029
+ */
9030
+ subId: string;
9031
+ /**
9032
+ * @generated from field: trading.v1.MarginVenue venue = 33;
9033
+ */
9034
+ venue: MarginVenue;
9035
+ /**
9036
+ * The MarginAccount, derived offchain from (owner, sub_id).
9037
+ *
9038
+ * @generated from field: string account = 34;
9039
+ */
9040
+ account: string;
9041
+ /**
9042
+ * ACTIVE only. Raw debt-token units owed now.
9043
+ *
9044
+ * @generated from field: optional string debt_amount = 35;
9049
9045
  */
9050
- legs: MarginPositionLeg[];
9046
+ debtAmount?: string;
9051
9047
  /**
9052
- * COST BASIS, from the position store. Absent rather than zero for a leg the
9053
- * store has not indexed.
9048
+ * Raw collateral-token units deposited over the position's life. Absent when
9049
+ * the store has not indexed the position or its flows went untracked.
9050
+ *
9051
+ * @generated from field: optional string deposited_equity = 36;
9052
+ */
9053
+ depositedEquity?: string;
9054
+ /**
9055
+ * COST BASIS, from the position store. Absent rather than zero for a
9056
+ * position the store has not indexed. In the same terms as `oracle_price`:
9057
+ * counter per exposure, 1e18-scaled, reciprocated on a SHORT.
9054
9058
  *
9055
9059
  * @generated from field: optional string entry_price = 7;
9056
9060
  */
@@ -9074,6 +9078,8 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9074
9078
  */
9075
9079
  unrealizedPnl?: string;
9076
9080
  /**
9081
+ * ACTIVE only. `unrealized_pnl` / `deposited_equity`, 1e18-scaled, signed.
9082
+ *
9077
9083
  * @generated from field: optional string roe = 11;
9078
9084
  */
9079
9085
  roe?: string;
@@ -9093,8 +9099,8 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9093
9099
  */
9094
9100
  oraclePrice?: string;
9095
9101
  /**
9096
- * Nearest leg. In TRADER terms, so a short's mark and liquidation price are
9097
- * both reciprocated; see `displayRiskPrices`.
9102
+ * In TRADER terms, so a short's mark and liquidation price are both
9103
+ * reciprocated; see `displayRiskPrices`.
9098
9104
  *
9099
9105
  * @generated from field: optional string liquidation_price = 15;
9100
9106
  */
@@ -9108,6 +9114,9 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9108
9114
  */
9109
9115
  healthFactor?: string;
9110
9116
  /**
9117
+ * Annual, 1e18-scaled. Best effort, like the markets feed: absent when the
9118
+ * venue's rate read did not return, never zero.
9119
+ *
9111
9120
  * @generated from field: optional string borrow_rate = 18;
9112
9121
  */
9113
9122
  borrowRate?: string;
@@ -9121,11 +9130,14 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9121
9130
  /**
9122
9131
  * TERMINAL only, and likewise cost-basis derived. `realized_pnl` is raw
9123
9132
  * collateral-token units: collateral returned minus collateral deposited.
9133
+ * On a terminal row `size` is what the position held when it closed.
9124
9134
  *
9125
9135
  * @generated from field: optional int64 closed_at = 20;
9126
9136
  */
9127
9137
  closedAt?: bigint;
9128
9138
  /**
9139
+ * In the same terms as `entry_price`.
9140
+ *
9129
9141
  * @generated from field: optional string exit_price = 21;
9130
9142
  */
9131
9143
  exitPrice?: string;
@@ -9168,13 +9180,13 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
9168
9180
  */
9169
9181
  lastLiquidationTxHash?: string;
9170
9182
  /**
9171
- * Raw collateral-token units held right after the open, summed over legs.
9183
+ * Raw collateral-token units held right after the open.
9172
9184
  *
9173
9185
  * @generated from field: optional string collateral_at_open = 28;
9174
9186
  */
9175
9187
  collateralAtOpen?: string;
9176
9188
  /**
9177
- * Partial decreases, oldest first, the newest 50 per leg.
9189
+ * Partial decreases, oldest first, the newest 50.
9178
9190
  *
9179
9191
  * @generated from field: repeated trading.v1.MarginDecreaseActivity decreases = 29;
9180
9192
  */
@@ -9231,8 +9243,7 @@ export declare class MarginDecreaseActivity extends Message<MarginDecreaseActivi
9231
9243
  */
9232
9244
  collateralSold: string;
9233
9245
  /**
9234
- * Raw debt per raw collateral, 1e18-scaled, like `entry_price`. Absent when
9235
- * nothing was sold.
9246
+ * In the same terms as the row's `entry_price`. Absent when nothing was sold.
9236
9247
  *
9237
9248
  * @generated from field: optional string exit_price = 5;
9238
9249
  */
@@ -9320,12 +9331,13 @@ export declare class MarginPositionsRequest extends Message<MarginPositionsReque
9320
9331
  */
9321
9332
  chainId: number;
9322
9333
  /**
9323
- * Selects the tab. Unset is ACTIVE; explicit presence so the server can tell
9324
- * "not asked" from "asked for ACTIVE".
9334
+ * Selects the tab. Empty means [ACTIVE]. ACTIVE is read on chain and the
9335
+ * finished statuses from the position store, so ACTIVE is requested alone;
9336
+ * any set of finished statuses is served in one page. No duplicates.
9325
9337
  *
9326
- * @generated from field: optional trading.v1.MarginPositionStatus status = 3;
9338
+ * @generated from field: repeated trading.v1.MarginPositionStatus statuses = 6;
9327
9339
  */
9328
- status?: MarginPositionStatus;
9340
+ statuses: MarginPositionStatus[];
9329
9341
  /**
9330
9342
  * Opaque; echo `next_cursor` back verbatim. Keyset over the row order, the
9331
9343
  * 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";
@@ -1588,6 +1598,7 @@ CheckApproval4337Request.fields = proto3.util.newFieldList(() => [
1588
1598
  { no: 9, name: "token_out_chain_id", kind: "enum", T: proto3.getEnumType(ChainId), opt: true },
1589
1599
  { no: 10, name: "wallet_execution_context", kind: "message", T: WalletExecutionContext, opt: true },
1590
1600
  { no: 11, name: "eip7702_auth", kind: "message", T: Eip7702Authorization, opt: true },
1601
+ { no: 12, name: "bridge_quote", kind: "message", T: BridgeQuote, opt: true },
1591
1602
  ]);
1592
1603
  /**
1593
1604
  * @generated from message trading.v1.CheckApproval4337Response
@@ -7189,6 +7200,7 @@ CheckApprovalRequest.fields = proto3.util.newFieldList(() => [
7189
7200
  { no: 7, name: "token_out", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
7190
7201
  { no: 8, name: "token_out_chain_id", kind: "enum", T: proto3.getEnumType(ChainId), opt: true },
7191
7202
  { no: 9, name: "urgency_overrides", kind: "message", T: UrgencyWithOverrides, opt: true },
7203
+ { no: 10, name: "bridge_quote", kind: "message", T: BridgeQuote, opt: true },
7192
7204
  ]);
7193
7205
  /**
7194
7206
  * @generated from message trading.v1.CheckApprovalResponse
@@ -10275,64 +10287,9 @@ MarginQuoteResponse.fields = proto3.util.newFieldList(() => [
10275
10287
  { no: 4, name: "gas_estimate", kind: "message", T: GasEstimate, opt: true },
10276
10288
  ]);
10277
10289
  /**
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`.
10290
+ * One position: a margin account (owner, sub_id) on one venue and market. Each
10291
+ * open allocates its own sub_id, so a wallet's positions in the same pair are
10292
+ * separate rows, each with its own risk and its own actions.
10336
10293
  *
10337
10294
  * @generated from message trading.v1.MarginPositionRow
10338
10295
  */
@@ -10352,11 +10309,23 @@ export class MarginPositionRow extends Message {
10352
10309
  */
10353
10310
  this.size = "";
10354
10311
  /**
10355
- * @generated from field: repeated trading.v1.MarginPositionLeg legs = 6;
10312
+ * The account index every quote action key addresses.
10313
+ *
10314
+ * @generated from field: string sub_id = 32;
10315
+ */
10316
+ this.subId = "";
10317
+ /**
10318
+ * @generated from field: trading.v1.MarginVenue venue = 33;
10356
10319
  */
10357
- this.legs = [];
10320
+ this.venue = MarginVenue.MORPHO;
10321
+ /**
10322
+ * The MarginAccount, derived offchain from (owner, sub_id).
10323
+ *
10324
+ * @generated from field: string account = 34;
10325
+ */
10326
+ this.account = "";
10358
10327
  /**
10359
- * Partial decreases, oldest first, the newest 50 per leg.
10328
+ * Partial decreases, oldest first, the newest 50.
10360
10329
  *
10361
10330
  * @generated from field: repeated trading.v1.MarginDecreaseActivity decreases = 29;
10362
10331
  */
@@ -10384,7 +10353,11 @@ MarginPositionRow.fields = proto3.util.newFieldList(() => [
10384
10353
  { no: 3, name: "exposure_token", kind: "message", T: MarginTokenMetadata },
10385
10354
  { no: 4, name: "counter_token", kind: "message", T: MarginTokenMetadata },
10386
10355
  { no: 5, name: "size", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10387
- { no: 6, name: "legs", kind: "message", T: MarginPositionLeg, repeated: true },
10356
+ { no: 32, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10357
+ { no: 33, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
10358
+ { no: 34, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10359
+ { no: 35, name: "debt_amount", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10360
+ { no: 36, name: "deposited_equity", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10388
10361
  { no: 7, name: "entry_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10389
10362
  { no: 8, name: "opened_at", kind: "scalar", T: 3 /* ScalarType.INT64 */, opt: true },
10390
10363
  { no: 9, name: "accrued_interest", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
@@ -10559,6 +10532,14 @@ export class MarginPositionsRequest extends Message {
10559
10532
  * @generated from field: int32 chain_id = 2;
10560
10533
  */
10561
10534
  this.chainId = 0;
10535
+ /**
10536
+ * Selects the tab. Empty means [ACTIVE]. ACTIVE is read on chain and the
10537
+ * finished statuses from the position store, so ACTIVE is requested alone;
10538
+ * any set of finished statuses is served in one page. No duplicates.
10539
+ *
10540
+ * @generated from field: repeated trading.v1.MarginPositionStatus statuses = 6;
10541
+ */
10542
+ this.statuses = [];
10562
10543
  proto3.util.initPartial(data, this);
10563
10544
  }
10564
10545
  static fromBinary(bytes, options) {
@@ -10579,7 +10560,7 @@ MarginPositionsRequest.typeName = "trading.v1.MarginPositionsRequest";
10579
10560
  MarginPositionsRequest.fields = proto3.util.newFieldList(() => [
10580
10561
  { no: 1, name: "swapper", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10581
10562
  { no: 2, name: "chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
10582
- { no: 3, name: "status", kind: "enum", T: proto3.getEnumType(MarginPositionStatus), opt: true },
10563
+ { no: 6, name: "statuses", kind: "enum", T: proto3.getEnumType(MarginPositionStatus), repeated: true },
10583
10564
  { no: 4, name: "cursor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10584
10565
  { no: 5, name: "limit", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
10585
10566
  ]);
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.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },