@uniswap/client-trading 0.8.1 → 0.9.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.
@@ -7249,7 +7249,7 @@ export declare class CreatePlanRequest extends Message<CreatePlanRequest> {
7249
7249
  */
7250
7250
  routing: SwapType;
7251
7251
  /**
7252
- * @generated from field: trading.v1.ChainedQuote quote = 2;
7252
+ * @generated from field: optional trading.v1.ChainedQuote quote = 2;
7253
7253
  */
7254
7254
  quote?: ChainedQuote;
7255
7255
  /**
@@ -7264,6 +7264,15 @@ export declare class CreatePlanRequest extends Message<CreatePlanRequest> {
7264
7264
  * @generated from field: optional trading.v1.EarnIntent earn_intent = 5;
7265
7265
  */
7266
7266
  earnIntent?: EarnIntent;
7267
+ /**
7268
+ * The margin quote, echoed back. Exactly one of `quote` and `margin_quote`
7269
+ * is accepted. Every bound and the pool are re-derived from the venue here
7270
+ * rather than trusted, so this names the shape of the position -- market,
7271
+ * venue, sub-account, operation -- and never the numbers it executes on.
7272
+ *
7273
+ * @generated from field: optional trading.v1.MarginQuoteResponse margin_quote = 6;
7274
+ */
7275
+ marginQuote?: MarginQuoteResponse;
7267
7276
  constructor(data?: PartialMessage<CreatePlanRequest>);
7268
7277
  static readonly runtime: typeof proto3;
7269
7278
  static readonly typeName = "trading.v1.CreatePlanRequest";
@@ -7294,6 +7303,50 @@ export declare class GetPlanRequest extends Message<GetPlanRequest> {
7294
7303
  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetPlanRequest;
7295
7304
  static equals(a: GetPlanRequest | PlainMessage<GetPlanRequest> | undefined, b: GetPlanRequest | PlainMessage<GetPlanRequest> | undefined): boolean;
7296
7305
  }
7306
+ /**
7307
+ * What the plan is doing to which position. The step type stays
7308
+ * MARGIN_EXECUTE for every action key, so `intent` is where a client reads
7309
+ * which of the ten it is.
7310
+ *
7311
+ * @generated from message trading.v1.MarginPlanIntent
7312
+ */
7313
+ export declare class MarginPlanIntent extends Message<MarginPlanIntent> {
7314
+ /**
7315
+ * @generated from field: trading.v1.MarginIntent intent = 1;
7316
+ */
7317
+ intent: MarginIntent;
7318
+ /**
7319
+ * `<collateral>-<debt>-<venue>`. A display key: resolve a market by tokens
7320
+ * and venue, never by parsing this.
7321
+ *
7322
+ * @generated from field: string market_key = 2;
7323
+ */
7324
+ marketKey: string;
7325
+ /**
7326
+ * @generated from field: trading.v1.MarginVenue venue = 3;
7327
+ */
7328
+ venue: MarginVenue;
7329
+ /**
7330
+ * @generated from field: string collateral_token = 4;
7331
+ */
7332
+ collateralToken: string;
7333
+ /**
7334
+ * @generated from field: string debt_token = 5;
7335
+ */
7336
+ debtToken: string;
7337
+ /**
7338
+ * @generated from field: string sub_id = 6;
7339
+ */
7340
+ subId: string;
7341
+ constructor(data?: PartialMessage<MarginPlanIntent>);
7342
+ static readonly runtime: typeof proto3;
7343
+ static readonly typeName = "trading.v1.MarginPlanIntent";
7344
+ static readonly fields: FieldList;
7345
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginPlanIntent;
7346
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginPlanIntent;
7347
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginPlanIntent;
7348
+ static equals(a: MarginPlanIntent | PlainMessage<MarginPlanIntent> | undefined, b: MarginPlanIntent | PlainMessage<MarginPlanIntent> | undefined): boolean;
7349
+ }
7297
7350
  /**
7298
7351
  * @generated from message trading.v1.PlanResponse
7299
7352
  */
@@ -7386,6 +7439,13 @@ export declare class PlanResponse extends Message<PlanResponse> {
7386
7439
  * @generated from field: optional trading.v1.EarnQuoteIntent earn_intent = 22;
7387
7440
  */
7388
7441
  earnIntent?: EarnQuoteIntent;
7442
+ /**
7443
+ * Present iff this plan carries a margin action. Its absence is how a client
7444
+ * tells a margin plan from any other, so it is the whole block or nothing.
7445
+ *
7446
+ * @generated from field: optional trading.v1.MarginPlanIntent margin_intent = 23;
7447
+ */
7448
+ marginIntent?: MarginPlanIntent;
7389
7449
  constructor(data?: PartialMessage<PlanResponse>);
7390
7450
  static readonly runtime: typeof proto3;
7391
7451
  static readonly typeName = "trading.v1.PlanResponse";
@@ -8856,46 +8916,6 @@ export declare class MarginPositionRow extends Message<MarginPositionRow> {
8856
8916
  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginPositionRow;
8857
8917
  static equals(a: MarginPositionRow | PlainMessage<MarginPositionRow> | undefined, b: MarginPositionRow | PlainMessage<MarginPositionRow> | undefined): boolean;
8858
8918
  }
8859
- /**
8860
- * Collateral parked at a MarginAccount whose open never completed. Derived from
8861
- * the chain rather than the plan store, so it survives plan-row expiry and is
8862
- * visible from any device.
8863
- *
8864
- * @generated from message trading.v1.MarginIncompleteOpen
8865
- */
8866
- export declare class MarginIncompleteOpen extends Message<MarginIncompleteOpen> {
8867
- /**
8868
- * @generated from field: string account = 1;
8869
- */
8870
- account: string;
8871
- /**
8872
- * @generated from field: string sub_id = 2;
8873
- */
8874
- subId: string;
8875
- /**
8876
- * False when the account holds a balance but was never deployed, which is the
8877
- * window this surface exists for: pre-swap delivered, position not opened.
8878
- *
8879
- * @generated from field: bool deployed = 3;
8880
- */
8881
- deployed: boolean;
8882
- /**
8883
- * @generated from field: trading.v1.MarginTokenMetadata token = 4;
8884
- */
8885
- token?: MarginTokenMetadata;
8886
- /**
8887
- * @generated from field: string amount = 5;
8888
- */
8889
- amount: string;
8890
- constructor(data?: PartialMessage<MarginIncompleteOpen>);
8891
- static readonly runtime: typeof proto3;
8892
- static readonly typeName = "trading.v1.MarginIncompleteOpen";
8893
- static readonly fields: FieldList;
8894
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginIncompleteOpen;
8895
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginIncompleteOpen;
8896
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginIncompleteOpen;
8897
- static equals(a: MarginIncompleteOpen | PlainMessage<MarginIncompleteOpen> | undefined, b: MarginIncompleteOpen | PlainMessage<MarginIncompleteOpen> | undefined): boolean;
8898
- }
8899
8919
  /**
8900
8920
  * The one plan-store read, and a deliberately weaker guarantee than the rest of
8901
8921
  * this response: session-scoped and TTL-bound, so absent rather than wrong once
@@ -8909,17 +8929,45 @@ export declare class MarginPendingPlan extends Message<MarginPendingPlan> {
8909
8929
  */
8910
8930
  planId: string;
8911
8931
  /**
8932
+ * Epoch milliseconds. proto3 JSON renders an int64 as a string, which is what
8933
+ * the client reads it as; it does not sort on the value.
8934
+ *
8912
8935
  * @generated from field: int64 created_at = 2;
8913
8936
  */
8914
8937
  createdAt: bigint;
8915
8938
  /**
8939
+ * 0-based index of the first step that is not COMPLETE.
8940
+ *
8916
8941
  * @generated from field: int32 current_step = 3;
8917
8942
  */
8918
8943
  currentStep: number;
8919
8944
  /**
8945
+ * False once an in-progress step carries a proof: that transaction may have
8946
+ * landed, so cancelling could strand a position the plan no longer tracks.
8947
+ *
8920
8948
  * @generated from field: bool cancellable = 4;
8921
8949
  */
8922
8950
  cancellable: boolean;
8951
+ /**
8952
+ * @generated from field: string market_key = 5;
8953
+ */
8954
+ marketKey: string;
8955
+ /**
8956
+ * @generated from field: trading.v1.MarginVenue venue = 6;
8957
+ */
8958
+ venue: MarginVenue;
8959
+ /**
8960
+ * @generated from field: string collateral_token = 7;
8961
+ */
8962
+ collateralToken: string;
8963
+ /**
8964
+ * @generated from field: string debt_token = 8;
8965
+ */
8966
+ debtToken: string;
8967
+ /**
8968
+ * @generated from field: int32 step_count = 9;
8969
+ */
8970
+ stepCount: number;
8923
8971
  constructor(data?: PartialMessage<MarginPendingPlan>);
8924
8972
  static readonly runtime: typeof proto3;
8925
8973
  static readonly typeName = "trading.v1.MarginPendingPlan";
@@ -8988,14 +9036,11 @@ export declare class MarginPositionsResponse extends Message<MarginPositionsResp
8988
9036
  */
8989
9037
  nextCursor?: string;
8990
9038
  /**
8991
- * Both recovery surfaces serialize as [] when the read ran and found nothing.
8992
- * They cannot express "not read": a degraded read logs a warning and reports
8993
- * empty, matching how the markets feed degrades a failed venue.
9039
+ * 4 was incomplete_opens, deleted unpopulated before launch (#13445).
9040
+ * Serializes as [] when the read ran and found nothing. It cannot express
9041
+ * "not read": a degraded read logs a warning and reports empty, matching how
9042
+ * the markets feed degrades a failed venue.
8994
9043
  *
8995
- * @generated from field: repeated trading.v1.MarginIncompleteOpen incomplete_opens = 4;
8996
- */
8997
- incompleteOpens: MarginIncompleteOpen[];
8998
- /**
8999
9044
  * @generated from field: repeated trading.v1.MarginPendingPlan pending_plans = 5;
9000
9045
  */
9001
9046
  pendingPlans: MarginPendingPlan[];
@@ -8546,10 +8546,11 @@ CreatePlanRequest.runtime = proto3;
8546
8546
  CreatePlanRequest.typeName = "trading.v1.CreatePlanRequest";
8547
8547
  CreatePlanRequest.fields = proto3.util.newFieldList(() => [
8548
8548
  { no: 1, name: "routing", kind: "enum", T: proto3.getEnumType(SwapType) },
8549
- { no: 2, name: "quote", kind: "message", T: ChainedQuote },
8549
+ { no: 2, name: "quote", kind: "message", T: ChainedQuote, opt: true },
8550
8550
  { no: 3, name: "wallet_execution_context", kind: "message", T: WalletExecutionContext, opt: true },
8551
8551
  { no: 4, name: "urgency_overrides", kind: "message", T: UrgencyWithOverrides, opt: true },
8552
8552
  { no: 5, name: "earn_intent", kind: "message", T: EarnIntent, opt: true },
8553
+ { no: 6, name: "margin_quote", kind: "message", T: MarginQuoteResponse, opt: true },
8553
8554
  ]);
8554
8555
  /**
8555
8556
  * @generated from message trading.v1.GetPlanRequest
@@ -8586,6 +8587,68 @@ GetPlanRequest.fields = proto3.util.newFieldList(() => [
8586
8587
  { no: 1, name: "plan_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
8587
8588
  { no: 2, name: "force_refresh", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
8588
8589
  ]);
8590
+ /**
8591
+ * What the plan is doing to which position. The step type stays
8592
+ * MARGIN_EXECUTE for every action key, so `intent` is where a client reads
8593
+ * which of the ten it is.
8594
+ *
8595
+ * @generated from message trading.v1.MarginPlanIntent
8596
+ */
8597
+ export class MarginPlanIntent extends Message {
8598
+ constructor(data) {
8599
+ super();
8600
+ /**
8601
+ * @generated from field: trading.v1.MarginIntent intent = 1;
8602
+ */
8603
+ this.intent = MarginIntent.OPEN;
8604
+ /**
8605
+ * `<collateral>-<debt>-<venue>`. A display key: resolve a market by tokens
8606
+ * and venue, never by parsing this.
8607
+ *
8608
+ * @generated from field: string market_key = 2;
8609
+ */
8610
+ this.marketKey = "";
8611
+ /**
8612
+ * @generated from field: trading.v1.MarginVenue venue = 3;
8613
+ */
8614
+ this.venue = MarginVenue.MORPHO;
8615
+ /**
8616
+ * @generated from field: string collateral_token = 4;
8617
+ */
8618
+ this.collateralToken = "";
8619
+ /**
8620
+ * @generated from field: string debt_token = 5;
8621
+ */
8622
+ this.debtToken = "";
8623
+ /**
8624
+ * @generated from field: string sub_id = 6;
8625
+ */
8626
+ this.subId = "";
8627
+ proto3.util.initPartial(data, this);
8628
+ }
8629
+ static fromBinary(bytes, options) {
8630
+ return new MarginPlanIntent().fromBinary(bytes, options);
8631
+ }
8632
+ static fromJson(jsonValue, options) {
8633
+ return new MarginPlanIntent().fromJson(jsonValue, options);
8634
+ }
8635
+ static fromJsonString(jsonString, options) {
8636
+ return new MarginPlanIntent().fromJsonString(jsonString, options);
8637
+ }
8638
+ static equals(a, b) {
8639
+ return proto3.util.equals(MarginPlanIntent, a, b);
8640
+ }
8641
+ }
8642
+ MarginPlanIntent.runtime = proto3;
8643
+ MarginPlanIntent.typeName = "trading.v1.MarginPlanIntent";
8644
+ MarginPlanIntent.fields = proto3.util.newFieldList(() => [
8645
+ { no: 1, name: "intent", kind: "enum", T: proto3.getEnumType(MarginIntent) },
8646
+ { no: 2, name: "market_key", kind: "scalar", T: 9 /* ScalarType.STRING */ },
8647
+ { no: 3, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
8648
+ { no: 4, name: "collateral_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
8649
+ { no: 5, name: "debt_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
8650
+ { no: 6, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
8651
+ ]);
8589
8652
  /**
8590
8653
  * @generated from message trading.v1.PlanResponse
8591
8654
  */
@@ -8676,6 +8739,7 @@ PlanResponse.fields = proto3.util.newFieldList(() => [
8676
8739
  { no: 20, name: "auto_slippage", kind: "enum", T: proto3.getEnumType(AutoSlippage), opt: true },
8677
8740
  { no: 21, name: "last_user_action_at", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
8678
8741
  { no: 22, name: "earn_intent", kind: "message", T: EarnQuoteIntent, opt: true },
8742
+ { no: 23, name: "margin_intent", kind: "message", T: MarginPlanIntent, opt: true },
8679
8743
  ]);
8680
8744
  /**
8681
8745
  * @generated from enum trading.v1.PlanResponse.PlanStatus
@@ -10171,59 +10235,6 @@ MarginPositionRow.fields = proto3.util.newFieldList(() => [
10171
10235
  { no: 21, name: "exit_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10172
10236
  { no: 22, name: "realized_pnl", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10173
10237
  ]);
10174
- /**
10175
- * Collateral parked at a MarginAccount whose open never completed. Derived from
10176
- * the chain rather than the plan store, so it survives plan-row expiry and is
10177
- * visible from any device.
10178
- *
10179
- * @generated from message trading.v1.MarginIncompleteOpen
10180
- */
10181
- export class MarginIncompleteOpen extends Message {
10182
- constructor(data) {
10183
- super();
10184
- /**
10185
- * @generated from field: string account = 1;
10186
- */
10187
- this.account = "";
10188
- /**
10189
- * @generated from field: string sub_id = 2;
10190
- */
10191
- this.subId = "";
10192
- /**
10193
- * False when the account holds a balance but was never deployed, which is the
10194
- * window this surface exists for: pre-swap delivered, position not opened.
10195
- *
10196
- * @generated from field: bool deployed = 3;
10197
- */
10198
- this.deployed = false;
10199
- /**
10200
- * @generated from field: string amount = 5;
10201
- */
10202
- this.amount = "";
10203
- proto3.util.initPartial(data, this);
10204
- }
10205
- static fromBinary(bytes, options) {
10206
- return new MarginIncompleteOpen().fromBinary(bytes, options);
10207
- }
10208
- static fromJson(jsonValue, options) {
10209
- return new MarginIncompleteOpen().fromJson(jsonValue, options);
10210
- }
10211
- static fromJsonString(jsonString, options) {
10212
- return new MarginIncompleteOpen().fromJsonString(jsonString, options);
10213
- }
10214
- static equals(a, b) {
10215
- return proto3.util.equals(MarginIncompleteOpen, a, b);
10216
- }
10217
- }
10218
- MarginIncompleteOpen.runtime = proto3;
10219
- MarginIncompleteOpen.typeName = "trading.v1.MarginIncompleteOpen";
10220
- MarginIncompleteOpen.fields = proto3.util.newFieldList(() => [
10221
- { no: 1, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10222
- { no: 2, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10223
- { no: 3, name: "deployed", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
10224
- { no: 4, name: "token", kind: "message", T: MarginTokenMetadata },
10225
- { no: 5, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10226
- ]);
10227
10238
  /**
10228
10239
  * The one plan-store read, and a deliberately weaker guarantee than the rest of
10229
10240
  * this response: session-scoped and TTL-bound, so absent rather than wrong once
@@ -10239,17 +10250,45 @@ export class MarginPendingPlan extends Message {
10239
10250
  */
10240
10251
  this.planId = "";
10241
10252
  /**
10253
+ * Epoch milliseconds. proto3 JSON renders an int64 as a string, which is what
10254
+ * the client reads it as; it does not sort on the value.
10255
+ *
10242
10256
  * @generated from field: int64 created_at = 2;
10243
10257
  */
10244
10258
  this.createdAt = protoInt64.zero;
10245
10259
  /**
10260
+ * 0-based index of the first step that is not COMPLETE.
10261
+ *
10246
10262
  * @generated from field: int32 current_step = 3;
10247
10263
  */
10248
10264
  this.currentStep = 0;
10249
10265
  /**
10266
+ * False once an in-progress step carries a proof: that transaction may have
10267
+ * landed, so cancelling could strand a position the plan no longer tracks.
10268
+ *
10250
10269
  * @generated from field: bool cancellable = 4;
10251
10270
  */
10252
10271
  this.cancellable = false;
10272
+ /**
10273
+ * @generated from field: string market_key = 5;
10274
+ */
10275
+ this.marketKey = "";
10276
+ /**
10277
+ * @generated from field: trading.v1.MarginVenue venue = 6;
10278
+ */
10279
+ this.venue = MarginVenue.MORPHO;
10280
+ /**
10281
+ * @generated from field: string collateral_token = 7;
10282
+ */
10283
+ this.collateralToken = "";
10284
+ /**
10285
+ * @generated from field: string debt_token = 8;
10286
+ */
10287
+ this.debtToken = "";
10288
+ /**
10289
+ * @generated from field: int32 step_count = 9;
10290
+ */
10291
+ this.stepCount = 0;
10253
10292
  proto3.util.initPartial(data, this);
10254
10293
  }
10255
10294
  static fromBinary(bytes, options) {
@@ -10272,6 +10311,11 @@ MarginPendingPlan.fields = proto3.util.newFieldList(() => [
10272
10311
  { no: 2, name: "created_at", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
10273
10312
  { no: 3, name: "current_step", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
10274
10313
  { no: 4, name: "cancellable", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
10314
+ { no: 5, name: "market_key", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10315
+ { no: 6, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
10316
+ { no: 7, name: "collateral_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10317
+ { no: 8, name: "debt_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10318
+ { no: 9, name: "step_count", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
10275
10319
  ]);
10276
10320
  /**
10277
10321
  * @generated from message trading.v1.MarginPositionsRequest
@@ -10326,14 +10370,11 @@ export class MarginPositionsResponse extends Message {
10326
10370
  */
10327
10371
  this.positions = [];
10328
10372
  /**
10329
- * Both recovery surfaces serialize as [] when the read ran and found nothing.
10330
- * They cannot express "not read": a degraded read logs a warning and reports
10331
- * empty, matching how the markets feed degrades a failed venue.
10373
+ * 4 was incomplete_opens, deleted unpopulated before launch (#13445).
10374
+ * Serializes as [] when the read ran and found nothing. It cannot express
10375
+ * "not read": a degraded read logs a warning and reports empty, matching how
10376
+ * the markets feed degrades a failed venue.
10332
10377
  *
10333
- * @generated from field: repeated trading.v1.MarginIncompleteOpen incomplete_opens = 4;
10334
- */
10335
- this.incompleteOpens = [];
10336
- /**
10337
10378
  * @generated from field: repeated trading.v1.MarginPendingPlan pending_plans = 5;
10338
10379
  */
10339
10380
  this.pendingPlans = [];
@@ -10358,6 +10399,5 @@ MarginPositionsResponse.fields = proto3.util.newFieldList(() => [
10358
10399
  { no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
10359
10400
  { no: 2, name: "positions", kind: "message", T: MarginPositionRow, repeated: true },
10360
10401
  { no: 3, name: "next_cursor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
10361
- { no: 4, name: "incomplete_opens", kind: "message", T: MarginIncompleteOpen, repeated: true },
10362
10402
  { no: 5, name: "pending_plans", kind: "message", T: MarginPendingPlan, repeated: true },
10363
10403
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniswap/client-trading",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },