@uniswap/client-trading 0.6.1 → 0.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.
- package/dist/trading/v1/api-tradingService_connectquery.d.ts +29 -1
- package/dist/trading/v1/api-tradingService_connectquery.js +29 -1
- package/dist/trading/v1/api_connect.d.ts +21 -1
- package/dist/trading/v1/api_connect.js +21 -1
- package/dist/trading/v1/api_pb.d.ts +1065 -0
- package/dist/trading/v1/api_pb.js +1035 -0
- package/package.json +1 -1
|
@@ -967,6 +967,136 @@ proto3.util.setEnumType(MarginVenue, "trading.v1.MarginVenue", [
|
|
|
967
967
|
{ no: 1, name: "AAVE_V3" },
|
|
968
968
|
{ no: 2, name: "AAVE_V4" },
|
|
969
969
|
]);
|
|
970
|
+
/**
|
|
971
|
+
* Echoed on the response so a client can tell which action was priced without
|
|
972
|
+
* re-deriving it from the request. Mirrors the request's oneof exactly.
|
|
973
|
+
* Named intent to match the error codes (INTENT_MISMATCH) and the plan step
|
|
974
|
+
* vocabulary, so one word is used end to end.
|
|
975
|
+
*
|
|
976
|
+
* @generated from enum trading.v1.MarginIntent
|
|
977
|
+
*/
|
|
978
|
+
export var MarginIntent;
|
|
979
|
+
(function (MarginIntent) {
|
|
980
|
+
/**
|
|
981
|
+
* @generated from enum value: MARGIN_INTENT_OPEN = 0;
|
|
982
|
+
*/
|
|
983
|
+
MarginIntent[MarginIntent["OPEN"] = 0] = "OPEN";
|
|
984
|
+
/**
|
|
985
|
+
* @generated from enum value: MARGIN_INTENT_CLOSE = 1;
|
|
986
|
+
*/
|
|
987
|
+
MarginIntent[MarginIntent["CLOSE"] = 1] = "CLOSE";
|
|
988
|
+
/**
|
|
989
|
+
* @generated from enum value: MARGIN_INTENT_INCREASE_LEVERAGE = 2;
|
|
990
|
+
*/
|
|
991
|
+
MarginIntent[MarginIntent["INCREASE_LEVERAGE"] = 2] = "INCREASE_LEVERAGE";
|
|
992
|
+
/**
|
|
993
|
+
* @generated from enum value: MARGIN_INTENT_DECREASE_LEVERAGE = 3;
|
|
994
|
+
*/
|
|
995
|
+
MarginIntent[MarginIntent["DECREASE_LEVERAGE"] = 3] = "DECREASE_LEVERAGE";
|
|
996
|
+
/**
|
|
997
|
+
* @generated from enum value: MARGIN_INTENT_ADD_EQUITY = 4;
|
|
998
|
+
*/
|
|
999
|
+
MarginIntent[MarginIntent["ADD_EQUITY"] = 4] = "ADD_EQUITY";
|
|
1000
|
+
/**
|
|
1001
|
+
* @generated from enum value: MARGIN_INTENT_WITHDRAW_EQUITY = 5;
|
|
1002
|
+
*/
|
|
1003
|
+
MarginIntent[MarginIntent["WITHDRAW_EQUITY"] = 5] = "WITHDRAW_EQUITY";
|
|
1004
|
+
/**
|
|
1005
|
+
* @generated from enum value: MARGIN_INTENT_ADD_EQUITY_AND_INCREASE_LEVERAGE = 6;
|
|
1006
|
+
*/
|
|
1007
|
+
MarginIntent[MarginIntent["ADD_EQUITY_AND_INCREASE_LEVERAGE"] = 6] = "ADD_EQUITY_AND_INCREASE_LEVERAGE";
|
|
1008
|
+
/**
|
|
1009
|
+
* @generated from enum value: MARGIN_INTENT_ADD_EQUITY_AND_DECREASE_LEVERAGE = 7;
|
|
1010
|
+
*/
|
|
1011
|
+
MarginIntent[MarginIntent["ADD_EQUITY_AND_DECREASE_LEVERAGE"] = 7] = "ADD_EQUITY_AND_DECREASE_LEVERAGE";
|
|
1012
|
+
/**
|
|
1013
|
+
* @generated from enum value: MARGIN_INTENT_WITHDRAW_EQUITY_AND_INCREASE_LEVERAGE = 8;
|
|
1014
|
+
*/
|
|
1015
|
+
MarginIntent[MarginIntent["WITHDRAW_EQUITY_AND_INCREASE_LEVERAGE"] = 8] = "WITHDRAW_EQUITY_AND_INCREASE_LEVERAGE";
|
|
1016
|
+
/**
|
|
1017
|
+
* @generated from enum value: MARGIN_INTENT_WITHDRAW_EQUITY_AND_DECREASE_LEVERAGE = 9;
|
|
1018
|
+
*/
|
|
1019
|
+
MarginIntent[MarginIntent["WITHDRAW_EQUITY_AND_DECREASE_LEVERAGE"] = 9] = "WITHDRAW_EQUITY_AND_DECREASE_LEVERAGE";
|
|
1020
|
+
})(MarginIntent || (MarginIntent = {}));
|
|
1021
|
+
// Retrieve enum metadata with: proto3.getEnumType(MarginIntent)
|
|
1022
|
+
proto3.util.setEnumType(MarginIntent, "trading.v1.MarginIntent", [
|
|
1023
|
+
{ no: 0, name: "MARGIN_INTENT_OPEN" },
|
|
1024
|
+
{ no: 1, name: "MARGIN_INTENT_CLOSE" },
|
|
1025
|
+
{ no: 2, name: "MARGIN_INTENT_INCREASE_LEVERAGE" },
|
|
1026
|
+
{ no: 3, name: "MARGIN_INTENT_DECREASE_LEVERAGE" },
|
|
1027
|
+
{ no: 4, name: "MARGIN_INTENT_ADD_EQUITY" },
|
|
1028
|
+
{ no: 5, name: "MARGIN_INTENT_WITHDRAW_EQUITY" },
|
|
1029
|
+
{ no: 6, name: "MARGIN_INTENT_ADD_EQUITY_AND_INCREASE_LEVERAGE" },
|
|
1030
|
+
{ no: 7, name: "MARGIN_INTENT_ADD_EQUITY_AND_DECREASE_LEVERAGE" },
|
|
1031
|
+
{ no: 8, name: "MARGIN_INTENT_WITHDRAW_EQUITY_AND_INCREASE_LEVERAGE" },
|
|
1032
|
+
{ no: 9, name: "MARGIN_INTENT_WITHDRAW_EQUITY_AND_DECREASE_LEVERAGE" },
|
|
1033
|
+
]);
|
|
1034
|
+
/**
|
|
1035
|
+
* One on-chain call inside the router's execute([...actions]) stream. The
|
|
1036
|
+
* quote decomposes an action into these; the plan stamps them into calldata.
|
|
1037
|
+
*
|
|
1038
|
+
* @generated from enum trading.v1.MarginOperationType
|
|
1039
|
+
*/
|
|
1040
|
+
export var MarginOperationType;
|
|
1041
|
+
(function (MarginOperationType) {
|
|
1042
|
+
/**
|
|
1043
|
+
* @generated from enum value: INCREASE_POSITION = 0;
|
|
1044
|
+
*/
|
|
1045
|
+
MarginOperationType[MarginOperationType["INCREASE_POSITION"] = 0] = "INCREASE_POSITION";
|
|
1046
|
+
/**
|
|
1047
|
+
* @generated from enum value: DECREASE_POSITION = 1;
|
|
1048
|
+
*/
|
|
1049
|
+
MarginOperationType[MarginOperationType["DECREASE_POSITION"] = 1] = "DECREASE_POSITION";
|
|
1050
|
+
/**
|
|
1051
|
+
* @generated from enum value: ADD_COLLATERAL = 2;
|
|
1052
|
+
*/
|
|
1053
|
+
MarginOperationType[MarginOperationType["ADD_COLLATERAL"] = 2] = "ADD_COLLATERAL";
|
|
1054
|
+
/**
|
|
1055
|
+
* @generated from enum value: WITHDRAW = 3;
|
|
1056
|
+
*/
|
|
1057
|
+
MarginOperationType[MarginOperationType["WITHDRAW"] = 3] = "WITHDRAW";
|
|
1058
|
+
/**
|
|
1059
|
+
* @generated from enum value: SWEEP = 4;
|
|
1060
|
+
*/
|
|
1061
|
+
MarginOperationType[MarginOperationType["SWEEP"] = 4] = "SWEEP";
|
|
1062
|
+
})(MarginOperationType || (MarginOperationType = {}));
|
|
1063
|
+
// Retrieve enum metadata with: proto3.getEnumType(MarginOperationType)
|
|
1064
|
+
proto3.util.setEnumType(MarginOperationType, "trading.v1.MarginOperationType", [
|
|
1065
|
+
{ no: 0, name: "INCREASE_POSITION" },
|
|
1066
|
+
{ no: 1, name: "DECREASE_POSITION" },
|
|
1067
|
+
{ no: 2, name: "ADD_COLLATERAL" },
|
|
1068
|
+
{ no: 3, name: "WITHDRAW" },
|
|
1069
|
+
{ no: 4, name: "SWEEP" },
|
|
1070
|
+
]);
|
|
1071
|
+
/**
|
|
1072
|
+
* @generated from enum trading.v1.MarginPositionStatus
|
|
1073
|
+
*/
|
|
1074
|
+
export var MarginPositionStatus;
|
|
1075
|
+
(function (MarginPositionStatus) {
|
|
1076
|
+
/**
|
|
1077
|
+
* @generated from enum value: ACTIVE = 0;
|
|
1078
|
+
*/
|
|
1079
|
+
MarginPositionStatus[MarginPositionStatus["ACTIVE"] = 0] = "ACTIVE";
|
|
1080
|
+
/**
|
|
1081
|
+
* @generated from enum value: COMPLETED = 1;
|
|
1082
|
+
*/
|
|
1083
|
+
MarginPositionStatus[MarginPositionStatus["COMPLETED"] = 1] = "COMPLETED";
|
|
1084
|
+
/**
|
|
1085
|
+
* @generated from enum value: LIQUIDATED = 2;
|
|
1086
|
+
*/
|
|
1087
|
+
MarginPositionStatus[MarginPositionStatus["LIQUIDATED"] = 2] = "LIQUIDATED";
|
|
1088
|
+
/**
|
|
1089
|
+
* @generated from enum value: PARTIALLY_LIQUIDATED = 3;
|
|
1090
|
+
*/
|
|
1091
|
+
MarginPositionStatus[MarginPositionStatus["PARTIALLY_LIQUIDATED"] = 3] = "PARTIALLY_LIQUIDATED";
|
|
1092
|
+
})(MarginPositionStatus || (MarginPositionStatus = {}));
|
|
1093
|
+
// Retrieve enum metadata with: proto3.getEnumType(MarginPositionStatus)
|
|
1094
|
+
proto3.util.setEnumType(MarginPositionStatus, "trading.v1.MarginPositionStatus", [
|
|
1095
|
+
{ no: 0, name: "ACTIVE" },
|
|
1096
|
+
{ no: 1, name: "COMPLETED" },
|
|
1097
|
+
{ no: 2, name: "LIQUIDATED" },
|
|
1098
|
+
{ no: 3, name: "PARTIALLY_LIQUIDATED" },
|
|
1099
|
+
]);
|
|
970
1100
|
/**
|
|
971
1101
|
* @generated from message trading.v1.Encode7702Request
|
|
972
1102
|
*/
|
|
@@ -9325,3 +9455,908 @@ MarginMarketsResponse.fields = proto3.util.newFieldList(() => [
|
|
|
9325
9455
|
{ no: 2, name: "markets", kind: "message", T: MarginMarketRow, repeated: true },
|
|
9326
9456
|
{ no: 3, name: "next_cursor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9327
9457
|
]);
|
|
9458
|
+
/**
|
|
9459
|
+
* increaseLeverage, decreaseLeverage. Equity is held, so no amount.
|
|
9460
|
+
*
|
|
9461
|
+
* @generated from message trading.v1.MarginLeverageAction
|
|
9462
|
+
*/
|
|
9463
|
+
export class MarginLeverageAction extends Message {
|
|
9464
|
+
constructor(data) {
|
|
9465
|
+
super();
|
|
9466
|
+
/**
|
|
9467
|
+
* @generated from field: string position_id = 1;
|
|
9468
|
+
*/
|
|
9469
|
+
this.positionId = "";
|
|
9470
|
+
/**
|
|
9471
|
+
* Decimal string ("3", "2.55"), never a float.
|
|
9472
|
+
*
|
|
9473
|
+
* @generated from field: string leverage_target = 2;
|
|
9474
|
+
*/
|
|
9475
|
+
this.leverageTarget = "";
|
|
9476
|
+
proto3.util.initPartial(data, this);
|
|
9477
|
+
}
|
|
9478
|
+
static fromBinary(bytes, options) {
|
|
9479
|
+
return new MarginLeverageAction().fromBinary(bytes, options);
|
|
9480
|
+
}
|
|
9481
|
+
static fromJson(jsonValue, options) {
|
|
9482
|
+
return new MarginLeverageAction().fromJson(jsonValue, options);
|
|
9483
|
+
}
|
|
9484
|
+
static fromJsonString(jsonString, options) {
|
|
9485
|
+
return new MarginLeverageAction().fromJsonString(jsonString, options);
|
|
9486
|
+
}
|
|
9487
|
+
static equals(a, b) {
|
|
9488
|
+
return proto3.util.equals(MarginLeverageAction, a, b);
|
|
9489
|
+
}
|
|
9490
|
+
}
|
|
9491
|
+
MarginLeverageAction.runtime = proto3;
|
|
9492
|
+
MarginLeverageAction.typeName = "trading.v1.MarginLeverageAction";
|
|
9493
|
+
MarginLeverageAction.fields = proto3.util.newFieldList(() => [
|
|
9494
|
+
{ no: 1, name: "position_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9495
|
+
{ no: 2, name: "leverage_target", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9496
|
+
]);
|
|
9497
|
+
/**
|
|
9498
|
+
* The four composites. Both axes move, so both magnitudes are carried.
|
|
9499
|
+
*
|
|
9500
|
+
* @generated from message trading.v1.MarginEquityLeverageAction
|
|
9501
|
+
*/
|
|
9502
|
+
export class MarginEquityLeverageAction extends Message {
|
|
9503
|
+
constructor(data) {
|
|
9504
|
+
super();
|
|
9505
|
+
/**
|
|
9506
|
+
* @generated from field: string position_id = 1;
|
|
9507
|
+
*/
|
|
9508
|
+
this.positionId = "";
|
|
9509
|
+
/**
|
|
9510
|
+
* @generated from field: string leverage_target = 2;
|
|
9511
|
+
*/
|
|
9512
|
+
this.leverageTarget = "";
|
|
9513
|
+
/**
|
|
9514
|
+
* @generated from field: string amount = 3;
|
|
9515
|
+
*/
|
|
9516
|
+
this.amount = "";
|
|
9517
|
+
proto3.util.initPartial(data, this);
|
|
9518
|
+
}
|
|
9519
|
+
static fromBinary(bytes, options) {
|
|
9520
|
+
return new MarginEquityLeverageAction().fromBinary(bytes, options);
|
|
9521
|
+
}
|
|
9522
|
+
static fromJson(jsonValue, options) {
|
|
9523
|
+
return new MarginEquityLeverageAction().fromJson(jsonValue, options);
|
|
9524
|
+
}
|
|
9525
|
+
static fromJsonString(jsonString, options) {
|
|
9526
|
+
return new MarginEquityLeverageAction().fromJsonString(jsonString, options);
|
|
9527
|
+
}
|
|
9528
|
+
static equals(a, b) {
|
|
9529
|
+
return proto3.util.equals(MarginEquityLeverageAction, a, b);
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9532
|
+
MarginEquityLeverageAction.runtime = proto3;
|
|
9533
|
+
MarginEquityLeverageAction.typeName = "trading.v1.MarginEquityLeverageAction";
|
|
9534
|
+
MarginEquityLeverageAction.fields = proto3.util.newFieldList(() => [
|
|
9535
|
+
{ no: 1, name: "position_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9536
|
+
{ no: 2, name: "leverage_target", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9537
|
+
{ no: 3, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9538
|
+
]);
|
|
9539
|
+
/**
|
|
9540
|
+
* addEquity, withdrawEquity. Size is held and leverage follows, so no target.
|
|
9541
|
+
*
|
|
9542
|
+
* `amount` is denominated in wallet_token on addEquity, and in the COLLATERAL
|
|
9543
|
+
* token on withdrawEquity. That asymmetry is deliberate, and it is the one
|
|
9544
|
+
* place the "amount is always wallet_token" rule breaks.
|
|
9545
|
+
*
|
|
9546
|
+
* A withdrawal's safety is a property of the position, not of the price its
|
|
9547
|
+
* proceeds fetch: how much collateral can leave before health hits the floor
|
|
9548
|
+
* is answerable from the position alone. Denominating in wallet_token would
|
|
9549
|
+
* make that check depend on a swap quote, so whether a withdrawal is allowed
|
|
9550
|
+
* would move with the funding route. It also matches the on-chain primitive,
|
|
9551
|
+
* which takes a collateral amount, and the max-withdrawable guard, which is
|
|
9552
|
+
* computed in collateral terms.
|
|
9553
|
+
*
|
|
9554
|
+
* @generated from message trading.v1.MarginEquityAction
|
|
9555
|
+
*/
|
|
9556
|
+
export class MarginEquityAction extends Message {
|
|
9557
|
+
constructor(data) {
|
|
9558
|
+
super();
|
|
9559
|
+
/**
|
|
9560
|
+
* @generated from field: string position_id = 1;
|
|
9561
|
+
*/
|
|
9562
|
+
this.positionId = "";
|
|
9563
|
+
/**
|
|
9564
|
+
* @generated from field: string amount = 2;
|
|
9565
|
+
*/
|
|
9566
|
+
this.amount = "";
|
|
9567
|
+
proto3.util.initPartial(data, this);
|
|
9568
|
+
}
|
|
9569
|
+
static fromBinary(bytes, options) {
|
|
9570
|
+
return new MarginEquityAction().fromBinary(bytes, options);
|
|
9571
|
+
}
|
|
9572
|
+
static fromJson(jsonValue, options) {
|
|
9573
|
+
return new MarginEquityAction().fromJson(jsonValue, options);
|
|
9574
|
+
}
|
|
9575
|
+
static fromJsonString(jsonString, options) {
|
|
9576
|
+
return new MarginEquityAction().fromJsonString(jsonString, options);
|
|
9577
|
+
}
|
|
9578
|
+
static equals(a, b) {
|
|
9579
|
+
return proto3.util.equals(MarginEquityAction, a, b);
|
|
9580
|
+
}
|
|
9581
|
+
}
|
|
9582
|
+
MarginEquityAction.runtime = proto3;
|
|
9583
|
+
MarginEquityAction.typeName = "trading.v1.MarginEquityAction";
|
|
9584
|
+
MarginEquityAction.fields = proto3.util.newFieldList(() => [
|
|
9585
|
+
{ no: 1, name: "position_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9586
|
+
{ no: 2, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9587
|
+
]);
|
|
9588
|
+
/**
|
|
9589
|
+
* close. The whole position, so structurally neither a target nor an amount.
|
|
9590
|
+
*
|
|
9591
|
+
* @generated from message trading.v1.MarginPositionAction
|
|
9592
|
+
*/
|
|
9593
|
+
export class MarginPositionAction extends Message {
|
|
9594
|
+
constructor(data) {
|
|
9595
|
+
super();
|
|
9596
|
+
/**
|
|
9597
|
+
* @generated from field: string position_id = 1;
|
|
9598
|
+
*/
|
|
9599
|
+
this.positionId = "";
|
|
9600
|
+
proto3.util.initPartial(data, this);
|
|
9601
|
+
}
|
|
9602
|
+
static fromBinary(bytes, options) {
|
|
9603
|
+
return new MarginPositionAction().fromBinary(bytes, options);
|
|
9604
|
+
}
|
|
9605
|
+
static fromJson(jsonValue, options) {
|
|
9606
|
+
return new MarginPositionAction().fromJson(jsonValue, options);
|
|
9607
|
+
}
|
|
9608
|
+
static fromJsonString(jsonString, options) {
|
|
9609
|
+
return new MarginPositionAction().fromJsonString(jsonString, options);
|
|
9610
|
+
}
|
|
9611
|
+
static equals(a, b) {
|
|
9612
|
+
return proto3.util.equals(MarginPositionAction, a, b);
|
|
9613
|
+
}
|
|
9614
|
+
}
|
|
9615
|
+
MarginPositionAction.runtime = proto3;
|
|
9616
|
+
MarginPositionAction.typeName = "trading.v1.MarginPositionAction";
|
|
9617
|
+
MarginPositionAction.fields = proto3.util.newFieldList(() => [
|
|
9618
|
+
{ no: 1, name: "position_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9619
|
+
]);
|
|
9620
|
+
/**
|
|
9621
|
+
* open. No position_id: the server allocates one at plan create.
|
|
9622
|
+
*
|
|
9623
|
+
* @generated from message trading.v1.MarginOpenAction
|
|
9624
|
+
*/
|
|
9625
|
+
export class MarginOpenAction extends Message {
|
|
9626
|
+
constructor(data) {
|
|
9627
|
+
super();
|
|
9628
|
+
/**
|
|
9629
|
+
* @generated from field: string leverage_target = 1;
|
|
9630
|
+
*/
|
|
9631
|
+
this.leverageTarget = "";
|
|
9632
|
+
/**
|
|
9633
|
+
* The LENDING allowlist, distinct from `swap_config.protocols` (the AMM
|
|
9634
|
+
* allowlist for the wallet-side swap).
|
|
9635
|
+
*
|
|
9636
|
+
* @generated from field: repeated trading.v1.MarginVenue venues = 2;
|
|
9637
|
+
*/
|
|
9638
|
+
this.venues = [];
|
|
9639
|
+
/**
|
|
9640
|
+
* @generated from field: string amount = 3;
|
|
9641
|
+
*/
|
|
9642
|
+
this.amount = "";
|
|
9643
|
+
proto3.util.initPartial(data, this);
|
|
9644
|
+
}
|
|
9645
|
+
static fromBinary(bytes, options) {
|
|
9646
|
+
return new MarginOpenAction().fromBinary(bytes, options);
|
|
9647
|
+
}
|
|
9648
|
+
static fromJson(jsonValue, options) {
|
|
9649
|
+
return new MarginOpenAction().fromJson(jsonValue, options);
|
|
9650
|
+
}
|
|
9651
|
+
static fromJsonString(jsonString, options) {
|
|
9652
|
+
return new MarginOpenAction().fromJsonString(jsonString, options);
|
|
9653
|
+
}
|
|
9654
|
+
static equals(a, b) {
|
|
9655
|
+
return proto3.util.equals(MarginOpenAction, a, b);
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
MarginOpenAction.runtime = proto3;
|
|
9659
|
+
MarginOpenAction.typeName = "trading.v1.MarginOpenAction";
|
|
9660
|
+
MarginOpenAction.fields = proto3.util.newFieldList(() => [
|
|
9661
|
+
{ no: 1, name: "leverage_target", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9662
|
+
{ no: 2, name: "venues", kind: "enum", T: proto3.getEnumType(MarginVenue), repeated: true },
|
|
9663
|
+
{ no: 3, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9664
|
+
]);
|
|
9665
|
+
/**
|
|
9666
|
+
* EXECUTION POLICY for the wallet-side swap, and nothing else. It names no
|
|
9667
|
+
* token, no chain, no amount and no trade type: identity lives at the top level
|
|
9668
|
+
* in wallet_token / wallet_chain_id, the magnitude lives in the action key, and
|
|
9669
|
+
* exact-in vs exact-out follows from whether that key pays in or pays out.
|
|
9670
|
+
*
|
|
9671
|
+
* Kept separate from wallet_token because the two have different lifetimes.
|
|
9672
|
+
* wallet_token is always meaningful; this block can be moot, since paying in
|
|
9673
|
+
* the collateral token needs no funding swap at all, and whether one is needed
|
|
9674
|
+
* is a routing outcome not knowable at request time.
|
|
9675
|
+
*
|
|
9676
|
+
* @generated from message trading.v1.MarginSwapConfig
|
|
9677
|
+
*/
|
|
9678
|
+
export class MarginSwapConfig extends Message {
|
|
9679
|
+
constructor(data) {
|
|
9680
|
+
super();
|
|
9681
|
+
/**
|
|
9682
|
+
* @generated from field: repeated trading.v1.Protocols protocols = 3;
|
|
9683
|
+
*/
|
|
9684
|
+
this.protocols = [];
|
|
9685
|
+
proto3.util.initPartial(data, this);
|
|
9686
|
+
}
|
|
9687
|
+
static fromBinary(bytes, options) {
|
|
9688
|
+
return new MarginSwapConfig().fromBinary(bytes, options);
|
|
9689
|
+
}
|
|
9690
|
+
static fromJson(jsonValue, options) {
|
|
9691
|
+
return new MarginSwapConfig().fromJson(jsonValue, options);
|
|
9692
|
+
}
|
|
9693
|
+
static fromJsonString(jsonString, options) {
|
|
9694
|
+
return new MarginSwapConfig().fromJsonString(jsonString, options);
|
|
9695
|
+
}
|
|
9696
|
+
static equals(a, b) {
|
|
9697
|
+
return proto3.util.equals(MarginSwapConfig, a, b);
|
|
9698
|
+
}
|
|
9699
|
+
}
|
|
9700
|
+
MarginSwapConfig.runtime = proto3;
|
|
9701
|
+
MarginSwapConfig.typeName = "trading.v1.MarginSwapConfig";
|
|
9702
|
+
MarginSwapConfig.fields = proto3.util.newFieldList(() => [
|
|
9703
|
+
{ no: 1, name: "slippage_tolerance", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, opt: true },
|
|
9704
|
+
{ no: 2, name: "auto_slippage", kind: "enum", T: proto3.getEnumType(AutoSlippage), opt: true },
|
|
9705
|
+
{ no: 3, name: "protocols", kind: "enum", T: proto3.getEnumType(Protocols), repeated: true },
|
|
9706
|
+
]);
|
|
9707
|
+
/**
|
|
9708
|
+
* @generated from message trading.v1.MarginQuoteRequest
|
|
9709
|
+
*/
|
|
9710
|
+
export class MarginQuoteRequest extends Message {
|
|
9711
|
+
constructor(data) {
|
|
9712
|
+
super();
|
|
9713
|
+
/**
|
|
9714
|
+
* The chain the POSITION lives on. Named rather than left as a bare chain_id
|
|
9715
|
+
* because two chains are in play: with one of them unqualified, a client
|
|
9716
|
+
* reasonably reads it as "the" chain, sets it to the chain it is paying from,
|
|
9717
|
+
* and silently gets a cross-chain funding flow it never asked for. Both are
|
|
9718
|
+
* named so both have to be stated.
|
|
9719
|
+
*
|
|
9720
|
+
* @generated from field: int32 position_chain_id = 1;
|
|
9721
|
+
*/
|
|
9722
|
+
this.positionChainId = 0;
|
|
9723
|
+
/**
|
|
9724
|
+
* @generated from field: string exposure_token = 2;
|
|
9725
|
+
*/
|
|
9726
|
+
this.exposureToken = "";
|
|
9727
|
+
/**
|
|
9728
|
+
* @generated from field: string counter_token = 3;
|
|
9729
|
+
*/
|
|
9730
|
+
this.counterToken = "";
|
|
9731
|
+
/**
|
|
9732
|
+
* @generated from field: trading.v1.MarginDirection direction = 4;
|
|
9733
|
+
*/
|
|
9734
|
+
this.direction = MarginDirection.LONG;
|
|
9735
|
+
/**
|
|
9736
|
+
* @generated from field: string swapper = 5;
|
|
9737
|
+
*/
|
|
9738
|
+
this.swapper = "";
|
|
9739
|
+
/**
|
|
9740
|
+
* @generated from oneof trading.v1.MarginQuoteRequest.action
|
|
9741
|
+
*/
|
|
9742
|
+
this.action = { case: undefined };
|
|
9743
|
+
proto3.util.initPartial(data, this);
|
|
9744
|
+
}
|
|
9745
|
+
static fromBinary(bytes, options) {
|
|
9746
|
+
return new MarginQuoteRequest().fromBinary(bytes, options);
|
|
9747
|
+
}
|
|
9748
|
+
static fromJson(jsonValue, options) {
|
|
9749
|
+
return new MarginQuoteRequest().fromJson(jsonValue, options);
|
|
9750
|
+
}
|
|
9751
|
+
static fromJsonString(jsonString, options) {
|
|
9752
|
+
return new MarginQuoteRequest().fromJsonString(jsonString, options);
|
|
9753
|
+
}
|
|
9754
|
+
static equals(a, b) {
|
|
9755
|
+
return proto3.util.equals(MarginQuoteRequest, a, b);
|
|
9756
|
+
}
|
|
9757
|
+
}
|
|
9758
|
+
MarginQuoteRequest.runtime = proto3;
|
|
9759
|
+
MarginQuoteRequest.typeName = "trading.v1.MarginQuoteRequest";
|
|
9760
|
+
MarginQuoteRequest.fields = proto3.util.newFieldList(() => [
|
|
9761
|
+
{ no: 1, name: "position_chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
9762
|
+
{ no: 2, name: "exposure_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9763
|
+
{ no: 3, name: "counter_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9764
|
+
{ no: 4, name: "direction", kind: "enum", T: proto3.getEnumType(MarginDirection) },
|
|
9765
|
+
{ no: 5, name: "swapper", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9766
|
+
{ no: 6, name: "slippage_tolerance", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, opt: true },
|
|
9767
|
+
{ no: 8, name: "swap_config", kind: "message", T: MarginSwapConfig, opt: true },
|
|
9768
|
+
{ no: 9, name: "wallet_token", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9769
|
+
{ no: 10, name: "wallet_chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
|
|
9770
|
+
{ no: 20, name: "open", kind: "message", T: MarginOpenAction, oneof: "action" },
|
|
9771
|
+
{ no: 21, name: "close", kind: "message", T: MarginPositionAction, oneof: "action" },
|
|
9772
|
+
{ no: 22, name: "increase_leverage", kind: "message", T: MarginLeverageAction, oneof: "action" },
|
|
9773
|
+
{ no: 23, name: "decrease_leverage", kind: "message", T: MarginLeverageAction, oneof: "action" },
|
|
9774
|
+
{ no: 24, name: "add_equity", kind: "message", T: MarginEquityAction, oneof: "action" },
|
|
9775
|
+
{ no: 25, name: "withdraw_equity", kind: "message", T: MarginEquityAction, oneof: "action" },
|
|
9776
|
+
{ no: 26, name: "add_equity_and_increase_leverage", kind: "message", T: MarginEquityLeverageAction, oneof: "action" },
|
|
9777
|
+
{ no: 27, name: "add_equity_and_decrease_leverage", kind: "message", T: MarginEquityLeverageAction, oneof: "action" },
|
|
9778
|
+
{ no: 28, name: "withdraw_equity_and_increase_leverage", kind: "message", T: MarginEquityLeverageAction, oneof: "action" },
|
|
9779
|
+
{ no: 29, name: "withdraw_equity_and_decrease_leverage", kind: "message", T: MarginEquityLeverageAction, oneof: "action" },
|
|
9780
|
+
]);
|
|
9781
|
+
/**
|
|
9782
|
+
* The confirmed bounds for one operation. Which fields are set follows from
|
|
9783
|
+
* `type`; they are the numbers that stamp into calldata, so they are in native
|
|
9784
|
+
* token decimals (LTV and leverage are WAD).
|
|
9785
|
+
*
|
|
9786
|
+
* @generated from message trading.v1.MarginOperation
|
|
9787
|
+
*/
|
|
9788
|
+
export class MarginOperation extends Message {
|
|
9789
|
+
constructor(data) {
|
|
9790
|
+
super();
|
|
9791
|
+
/**
|
|
9792
|
+
* @generated from field: trading.v1.MarginOperationType type = 1;
|
|
9793
|
+
*/
|
|
9794
|
+
this.type = MarginOperationType.INCREASE_POSITION;
|
|
9795
|
+
proto3.util.initPartial(data, this);
|
|
9796
|
+
}
|
|
9797
|
+
static fromBinary(bytes, options) {
|
|
9798
|
+
return new MarginOperation().fromBinary(bytes, options);
|
|
9799
|
+
}
|
|
9800
|
+
static fromJson(jsonValue, options) {
|
|
9801
|
+
return new MarginOperation().fromJson(jsonValue, options);
|
|
9802
|
+
}
|
|
9803
|
+
static fromJsonString(jsonString, options) {
|
|
9804
|
+
return new MarginOperation().fromJsonString(jsonString, options);
|
|
9805
|
+
}
|
|
9806
|
+
static equals(a, b) {
|
|
9807
|
+
return proto3.util.equals(MarginOperation, a, b);
|
|
9808
|
+
}
|
|
9809
|
+
}
|
|
9810
|
+
MarginOperation.runtime = proto3;
|
|
9811
|
+
MarginOperation.typeName = "trading.v1.MarginOperation";
|
|
9812
|
+
MarginOperation.fields = proto3.util.newFieldList(() => [
|
|
9813
|
+
{ no: 1, name: "type", kind: "enum", T: proto3.getEnumType(MarginOperationType) },
|
|
9814
|
+
{ no: 2, name: "collateral_to_buy", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9815
|
+
{ no: 3, name: "max_debt_in", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9816
|
+
{ no: 4, name: "debt_to_repay", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9817
|
+
{ no: 5, name: "max_collateral_in", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9818
|
+
{ no: 6, name: "max_ltv_after", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9819
|
+
{ no: 7, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9820
|
+
{ no: 8, name: "min_hop_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9821
|
+
{ no: 9, name: "effective_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9822
|
+
]);
|
|
9823
|
+
/**
|
|
9824
|
+
* @generated from message trading.v1.MarginExecutionLeg
|
|
9825
|
+
*/
|
|
9826
|
+
export class MarginExecutionLeg extends Message {
|
|
9827
|
+
constructor(data) {
|
|
9828
|
+
super();
|
|
9829
|
+
/**
|
|
9830
|
+
* @generated from field: trading.v1.MarginVenue venue = 1;
|
|
9831
|
+
*/
|
|
9832
|
+
this.venue = MarginVenue.MORPHO;
|
|
9833
|
+
/**
|
|
9834
|
+
* Ordered. A composite action populates more than one.
|
|
9835
|
+
*
|
|
9836
|
+
* @generated from field: repeated trading.v1.MarginOperation operations = 3;
|
|
9837
|
+
*/
|
|
9838
|
+
this.operations = [];
|
|
9839
|
+
proto3.util.initPartial(data, this);
|
|
9840
|
+
}
|
|
9841
|
+
static fromBinary(bytes, options) {
|
|
9842
|
+
return new MarginExecutionLeg().fromBinary(bytes, options);
|
|
9843
|
+
}
|
|
9844
|
+
static fromJson(jsonValue, options) {
|
|
9845
|
+
return new MarginExecutionLeg().fromJson(jsonValue, options);
|
|
9846
|
+
}
|
|
9847
|
+
static fromJsonString(jsonString, options) {
|
|
9848
|
+
return new MarginExecutionLeg().fromJsonString(jsonString, options);
|
|
9849
|
+
}
|
|
9850
|
+
static equals(a, b) {
|
|
9851
|
+
return proto3.util.equals(MarginExecutionLeg, a, b);
|
|
9852
|
+
}
|
|
9853
|
+
}
|
|
9854
|
+
MarginExecutionLeg.runtime = proto3;
|
|
9855
|
+
MarginExecutionLeg.typeName = "trading.v1.MarginExecutionLeg";
|
|
9856
|
+
MarginExecutionLeg.fields = proto3.util.newFieldList(() => [
|
|
9857
|
+
{ no: 1, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
|
|
9858
|
+
{ no: 2, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9859
|
+
{ no: 3, name: "operations", kind: "message", T: MarginOperation, repeated: true },
|
|
9860
|
+
]);
|
|
9861
|
+
/**
|
|
9862
|
+
* The wallet-side swap as priced, in the same shape /quote uses for an ordinary
|
|
9863
|
+
* swap, so the funding leg reads natively rather than inventing a fourth
|
|
9864
|
+
* swap-quote vocabulary.
|
|
9865
|
+
*
|
|
9866
|
+
* Present IFF a swap was actually priced, so its presence is the signal that
|
|
9867
|
+
* one happened. Absent when the action moves no equity, and absent when the
|
|
9868
|
+
* caller already holds the collateral: paying in the collateral itself needs no
|
|
9869
|
+
* funding swap, and a block whose input and output name the same token and the
|
|
9870
|
+
* same amount describes no trade.
|
|
9871
|
+
*
|
|
9872
|
+
* 7 was auto_slippage: a request-side mode, never an answer. What a caller
|
|
9873
|
+
* needs back is the percent it RESOLVED to, which slippage_tolerance already
|
|
9874
|
+
* carries.
|
|
9875
|
+
* 8 was protocols: an echo of the request that no consumer read, and as a
|
|
9876
|
+
* repeated field it serializes as [] whether the caller named none or the
|
|
9877
|
+
* route used none, so it could not carry its own meaning.
|
|
9878
|
+
*
|
|
9879
|
+
* @generated from message trading.v1.MarginFunding
|
|
9880
|
+
*/
|
|
9881
|
+
export class MarginFunding extends Message {
|
|
9882
|
+
constructor(data) {
|
|
9883
|
+
super();
|
|
9884
|
+
/**
|
|
9885
|
+
* @generated from field: int32 token_in_chain_id = 1;
|
|
9886
|
+
*/
|
|
9887
|
+
this.tokenInChainId = 0;
|
|
9888
|
+
proto3.util.initPartial(data, this);
|
|
9889
|
+
}
|
|
9890
|
+
static fromBinary(bytes, options) {
|
|
9891
|
+
return new MarginFunding().fromBinary(bytes, options);
|
|
9892
|
+
}
|
|
9893
|
+
static fromJson(jsonValue, options) {
|
|
9894
|
+
return new MarginFunding().fromJson(jsonValue, options);
|
|
9895
|
+
}
|
|
9896
|
+
static fromJsonString(jsonString, options) {
|
|
9897
|
+
return new MarginFunding().fromJsonString(jsonString, options);
|
|
9898
|
+
}
|
|
9899
|
+
static equals(a, b) {
|
|
9900
|
+
return proto3.util.equals(MarginFunding, a, b);
|
|
9901
|
+
}
|
|
9902
|
+
}
|
|
9903
|
+
MarginFunding.runtime = proto3;
|
|
9904
|
+
MarginFunding.typeName = "trading.v1.MarginFunding";
|
|
9905
|
+
MarginFunding.fields = proto3.util.newFieldList(() => [
|
|
9906
|
+
{ no: 1, name: "token_in_chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
9907
|
+
{ no: 3, name: "input", kind: "message", T: QuoteInput },
|
|
9908
|
+
{ no: 4, name: "output", kind: "message", T: QuoteOutput },
|
|
9909
|
+
{ no: 6, name: "slippage_tolerance", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, opt: true },
|
|
9910
|
+
{ no: 9, name: "min_bridge_out", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9911
|
+
{ no: 10, name: "price_impact", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, opt: true },
|
|
9912
|
+
]);
|
|
9913
|
+
/**
|
|
9914
|
+
* Everything POST /plan needs, and nothing it does not. This subtree is what a
|
|
9915
|
+
* client echoes back to create a plan; `display` never is.
|
|
9916
|
+
*
|
|
9917
|
+
* @generated from message trading.v1.MarginExecution
|
|
9918
|
+
*/
|
|
9919
|
+
export class MarginExecution extends Message {
|
|
9920
|
+
constructor(data) {
|
|
9921
|
+
super();
|
|
9922
|
+
/**
|
|
9923
|
+
* @generated from field: int32 position_chain_id = 1;
|
|
9924
|
+
*/
|
|
9925
|
+
this.positionChainId = 0;
|
|
9926
|
+
/**
|
|
9927
|
+
* @generated from field: string swapper = 2;
|
|
9928
|
+
*/
|
|
9929
|
+
this.swapper = "";
|
|
9930
|
+
/**
|
|
9931
|
+
* @generated from field: string exposure_token = 3;
|
|
9932
|
+
*/
|
|
9933
|
+
this.exposureToken = "";
|
|
9934
|
+
/**
|
|
9935
|
+
* @generated from field: string counter_token = 4;
|
|
9936
|
+
*/
|
|
9937
|
+
this.counterToken = "";
|
|
9938
|
+
/**
|
|
9939
|
+
* @generated from field: trading.v1.MarginDirection direction = 5;
|
|
9940
|
+
*/
|
|
9941
|
+
this.direction = MarginDirection.LONG;
|
|
9942
|
+
/**
|
|
9943
|
+
* @generated from field: trading.v1.MarginIntent intent = 6;
|
|
9944
|
+
*/
|
|
9945
|
+
this.intent = MarginIntent.OPEN;
|
|
9946
|
+
/**
|
|
9947
|
+
* @generated from field: repeated trading.v1.MarginExecutionLeg legs = 12;
|
|
9948
|
+
*/
|
|
9949
|
+
this.legs = [];
|
|
9950
|
+
proto3.util.initPartial(data, this);
|
|
9951
|
+
}
|
|
9952
|
+
static fromBinary(bytes, options) {
|
|
9953
|
+
return new MarginExecution().fromBinary(bytes, options);
|
|
9954
|
+
}
|
|
9955
|
+
static fromJson(jsonValue, options) {
|
|
9956
|
+
return new MarginExecution().fromJson(jsonValue, options);
|
|
9957
|
+
}
|
|
9958
|
+
static fromJsonString(jsonString, options) {
|
|
9959
|
+
return new MarginExecution().fromJsonString(jsonString, options);
|
|
9960
|
+
}
|
|
9961
|
+
static equals(a, b) {
|
|
9962
|
+
return proto3.util.equals(MarginExecution, a, b);
|
|
9963
|
+
}
|
|
9964
|
+
}
|
|
9965
|
+
MarginExecution.runtime = proto3;
|
|
9966
|
+
MarginExecution.typeName = "trading.v1.MarginExecution";
|
|
9967
|
+
MarginExecution.fields = proto3.util.newFieldList(() => [
|
|
9968
|
+
{ no: 1, name: "position_chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
9969
|
+
{ no: 2, name: "swapper", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9970
|
+
{ no: 3, name: "exposure_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9971
|
+
{ no: 4, name: "counter_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
9972
|
+
{ no: 5, name: "direction", kind: "enum", T: proto3.getEnumType(MarginDirection) },
|
|
9973
|
+
{ no: 6, name: "intent", kind: "enum", T: proto3.getEnumType(MarginIntent) },
|
|
9974
|
+
{ no: 7, name: "position_id", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9975
|
+
{ no: 8, name: "leverage_target", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
9976
|
+
{ no: 9, name: "slippage_tolerance", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, opt: true },
|
|
9977
|
+
{ no: 11, name: "funding", kind: "message", T: MarginFunding, opt: true },
|
|
9978
|
+
{ no: 12, name: "legs", kind: "message", T: MarginExecutionLeg, repeated: true },
|
|
9979
|
+
]);
|
|
9980
|
+
/**
|
|
9981
|
+
* What the confirmation modal renders. Projections of the position IF this
|
|
9982
|
+
* action executes; present state lives on GET /margin/positions. Ignored by
|
|
9983
|
+
* POST /plan: projections are not execution inputs.
|
|
9984
|
+
*
|
|
9985
|
+
* @generated from message trading.v1.MarginDisplay
|
|
9986
|
+
*/
|
|
9987
|
+
export class MarginDisplay extends Message {
|
|
9988
|
+
constructor(data) {
|
|
9989
|
+
super();
|
|
9990
|
+
proto3.util.initPartial(data, this);
|
|
9991
|
+
}
|
|
9992
|
+
static fromBinary(bytes, options) {
|
|
9993
|
+
return new MarginDisplay().fromBinary(bytes, options);
|
|
9994
|
+
}
|
|
9995
|
+
static fromJson(jsonValue, options) {
|
|
9996
|
+
return new MarginDisplay().fromJson(jsonValue, options);
|
|
9997
|
+
}
|
|
9998
|
+
static fromJsonString(jsonString, options) {
|
|
9999
|
+
return new MarginDisplay().fromJsonString(jsonString, options);
|
|
10000
|
+
}
|
|
10001
|
+
static equals(a, b) {
|
|
10002
|
+
return proto3.util.equals(MarginDisplay, a, b);
|
|
10003
|
+
}
|
|
10004
|
+
}
|
|
10005
|
+
MarginDisplay.runtime = proto3;
|
|
10006
|
+
MarginDisplay.typeName = "trading.v1.MarginDisplay";
|
|
10007
|
+
MarginDisplay.fields = proto3.util.newFieldList(() => [
|
|
10008
|
+
{ no: 1, name: "size", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10009
|
+
{ no: 2, name: "leverage", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10010
|
+
{ no: 3, name: "effective_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10011
|
+
{ no: 4, name: "liquidation_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10012
|
+
{ no: 6, name: "health_factor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10013
|
+
{ no: 7, name: "borrow_rate", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10014
|
+
{ no: 8, name: "oracle_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10015
|
+
{ no: 9, name: "collateral_returned", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10016
|
+
{ no: 10, name: "debt_repaid", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10017
|
+
]);
|
|
10018
|
+
/**
|
|
10019
|
+
* @generated from message trading.v1.MarginQuoteResponse
|
|
10020
|
+
*/
|
|
10021
|
+
export class MarginQuoteResponse extends Message {
|
|
10022
|
+
constructor(data) {
|
|
10023
|
+
super();
|
|
10024
|
+
/**
|
|
10025
|
+
* @generated from field: string request_id = 1;
|
|
10026
|
+
*/
|
|
10027
|
+
this.requestId = "";
|
|
10028
|
+
proto3.util.initPartial(data, this);
|
|
10029
|
+
}
|
|
10030
|
+
static fromBinary(bytes, options) {
|
|
10031
|
+
return new MarginQuoteResponse().fromBinary(bytes, options);
|
|
10032
|
+
}
|
|
10033
|
+
static fromJson(jsonValue, options) {
|
|
10034
|
+
return new MarginQuoteResponse().fromJson(jsonValue, options);
|
|
10035
|
+
}
|
|
10036
|
+
static fromJsonString(jsonString, options) {
|
|
10037
|
+
return new MarginQuoteResponse().fromJsonString(jsonString, options);
|
|
10038
|
+
}
|
|
10039
|
+
static equals(a, b) {
|
|
10040
|
+
return proto3.util.equals(MarginQuoteResponse, a, b);
|
|
10041
|
+
}
|
|
10042
|
+
}
|
|
10043
|
+
MarginQuoteResponse.runtime = proto3;
|
|
10044
|
+
MarginQuoteResponse.typeName = "trading.v1.MarginQuoteResponse";
|
|
10045
|
+
MarginQuoteResponse.fields = proto3.util.newFieldList(() => [
|
|
10046
|
+
{ no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10047
|
+
{ no: 2, name: "execution", kind: "message", T: MarginExecution },
|
|
10048
|
+
{ no: 3, name: "display", kind: "message", T: MarginDisplay },
|
|
10049
|
+
{ no: 4, name: "gas_estimate", kind: "message", T: GasEstimate, opt: true },
|
|
10050
|
+
]);
|
|
10051
|
+
/**
|
|
10052
|
+
* One venue's share of a position. Legs are the unit of truth: a logical
|
|
10053
|
+
* position is an aggregation performed at read time, and legs liquidate
|
|
10054
|
+
* independently, so the row's risk numbers are the NEAREST leg's.
|
|
10055
|
+
*
|
|
10056
|
+
* @generated from message trading.v1.MarginPositionLeg
|
|
10057
|
+
*/
|
|
10058
|
+
export class MarginPositionLeg extends Message {
|
|
10059
|
+
constructor(data) {
|
|
10060
|
+
super();
|
|
10061
|
+
/**
|
|
10062
|
+
* @generated from field: trading.v1.MarginVenue venue = 1;
|
|
10063
|
+
*/
|
|
10064
|
+
this.venue = MarginVenue.MORPHO;
|
|
10065
|
+
/**
|
|
10066
|
+
* The `positionId` handle every action key echoes back. Returned whether or
|
|
10067
|
+
* not a screen renders it.
|
|
10068
|
+
*
|
|
10069
|
+
* @generated from field: string sub_id = 2;
|
|
10070
|
+
*/
|
|
10071
|
+
this.subId = "";
|
|
10072
|
+
/**
|
|
10073
|
+
* The MarginAccount this leg lives at, derived offchain from (owner, subId).
|
|
10074
|
+
*
|
|
10075
|
+
* @generated from field: string account = 3;
|
|
10076
|
+
*/
|
|
10077
|
+
this.account = "";
|
|
10078
|
+
/**
|
|
10079
|
+
* @generated from field: string debt = 4;
|
|
10080
|
+
*/
|
|
10081
|
+
this.debt = "";
|
|
10082
|
+
proto3.util.initPartial(data, this);
|
|
10083
|
+
}
|
|
10084
|
+
static fromBinary(bytes, options) {
|
|
10085
|
+
return new MarginPositionLeg().fromBinary(bytes, options);
|
|
10086
|
+
}
|
|
10087
|
+
static fromJson(jsonValue, options) {
|
|
10088
|
+
return new MarginPositionLeg().fromJson(jsonValue, options);
|
|
10089
|
+
}
|
|
10090
|
+
static fromJsonString(jsonString, options) {
|
|
10091
|
+
return new MarginPositionLeg().fromJsonString(jsonString, options);
|
|
10092
|
+
}
|
|
10093
|
+
static equals(a, b) {
|
|
10094
|
+
return proto3.util.equals(MarginPositionLeg, a, b);
|
|
10095
|
+
}
|
|
10096
|
+
}
|
|
10097
|
+
MarginPositionLeg.runtime = proto3;
|
|
10098
|
+
MarginPositionLeg.typeName = "trading.v1.MarginPositionLeg";
|
|
10099
|
+
MarginPositionLeg.fields = proto3.util.newFieldList(() => [
|
|
10100
|
+
{ no: 1, name: "venue", kind: "enum", T: proto3.getEnumType(MarginVenue) },
|
|
10101
|
+
{ no: 2, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10102
|
+
{ no: 3, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10103
|
+
{ no: 4, name: "debt", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10104
|
+
{ no: 5, name: "borrow_rate", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10105
|
+
]);
|
|
10106
|
+
/**
|
|
10107
|
+
* One logical position, keyed (exposure_token, counter_token, direction) — the
|
|
10108
|
+
* same key the markets cursor orders on, which is why both endpoints page
|
|
10109
|
+
* through `marginMarketCursor`.
|
|
10110
|
+
*
|
|
10111
|
+
* @generated from message trading.v1.MarginPositionRow
|
|
10112
|
+
*/
|
|
10113
|
+
export class MarginPositionRow extends Message {
|
|
10114
|
+
constructor(data) {
|
|
10115
|
+
super();
|
|
10116
|
+
/**
|
|
10117
|
+
* @generated from field: trading.v1.MarginPositionStatus status = 1;
|
|
10118
|
+
*/
|
|
10119
|
+
this.status = MarginPositionStatus.ACTIVE;
|
|
10120
|
+
/**
|
|
10121
|
+
* @generated from field: trading.v1.MarginDirection direction = 2;
|
|
10122
|
+
*/
|
|
10123
|
+
this.direction = MarginDirection.LONG;
|
|
10124
|
+
/**
|
|
10125
|
+
* @generated from field: string size = 5;
|
|
10126
|
+
*/
|
|
10127
|
+
this.size = "";
|
|
10128
|
+
/**
|
|
10129
|
+
* @generated from field: repeated trading.v1.MarginPositionLeg legs = 6;
|
|
10130
|
+
*/
|
|
10131
|
+
this.legs = [];
|
|
10132
|
+
proto3.util.initPartial(data, this);
|
|
10133
|
+
}
|
|
10134
|
+
static fromBinary(bytes, options) {
|
|
10135
|
+
return new MarginPositionRow().fromBinary(bytes, options);
|
|
10136
|
+
}
|
|
10137
|
+
static fromJson(jsonValue, options) {
|
|
10138
|
+
return new MarginPositionRow().fromJson(jsonValue, options);
|
|
10139
|
+
}
|
|
10140
|
+
static fromJsonString(jsonString, options) {
|
|
10141
|
+
return new MarginPositionRow().fromJsonString(jsonString, options);
|
|
10142
|
+
}
|
|
10143
|
+
static equals(a, b) {
|
|
10144
|
+
return proto3.util.equals(MarginPositionRow, a, b);
|
|
10145
|
+
}
|
|
10146
|
+
}
|
|
10147
|
+
MarginPositionRow.runtime = proto3;
|
|
10148
|
+
MarginPositionRow.typeName = "trading.v1.MarginPositionRow";
|
|
10149
|
+
MarginPositionRow.fields = proto3.util.newFieldList(() => [
|
|
10150
|
+
{ no: 1, name: "status", kind: "enum", T: proto3.getEnumType(MarginPositionStatus) },
|
|
10151
|
+
{ no: 2, name: "direction", kind: "enum", T: proto3.getEnumType(MarginDirection) },
|
|
10152
|
+
{ no: 3, name: "exposure_token", kind: "message", T: MarginTokenMetadata },
|
|
10153
|
+
{ no: 4, name: "counter_token", kind: "message", T: MarginTokenMetadata },
|
|
10154
|
+
{ no: 5, name: "size", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10155
|
+
{ no: 6, name: "legs", kind: "message", T: MarginPositionLeg, repeated: true },
|
|
10156
|
+
{ no: 7, name: "entry_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10157
|
+
{ no: 8, name: "opened_at", kind: "scalar", T: 3 /* ScalarType.INT64 */, opt: true },
|
|
10158
|
+
{ no: 9, name: "accrued_interest", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10159
|
+
{ no: 10, name: "unrealized_pnl", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10160
|
+
{ no: 11, name: "roe", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10161
|
+
{ no: 12, name: "equity", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10162
|
+
{ no: 13, name: "leverage", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10163
|
+
{ no: 14, name: "oracle_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10164
|
+
{ no: 15, name: "liquidation_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10165
|
+
{ no: 16, name: "buffer", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10166
|
+
{ no: 17, name: "health_factor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10167
|
+
{ no: 18, name: "borrow_rate", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10168
|
+
{ no: 19, name: "max_withdrawable", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10169
|
+
{ no: 20, name: "closed_at", kind: "scalar", T: 3 /* ScalarType.INT64 */, opt: true },
|
|
10170
|
+
{ no: 21, name: "exit_price", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10171
|
+
{ no: 22, name: "realized_pnl", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10172
|
+
]);
|
|
10173
|
+
/**
|
|
10174
|
+
* Collateral parked at a MarginAccount whose open never completed. Derived from
|
|
10175
|
+
* the chain rather than the plan store, so it survives plan-row expiry and is
|
|
10176
|
+
* visible from any device.
|
|
10177
|
+
*
|
|
10178
|
+
* @generated from message trading.v1.MarginIncompleteOpen
|
|
10179
|
+
*/
|
|
10180
|
+
export class MarginIncompleteOpen extends Message {
|
|
10181
|
+
constructor(data) {
|
|
10182
|
+
super();
|
|
10183
|
+
/**
|
|
10184
|
+
* @generated from field: string account = 1;
|
|
10185
|
+
*/
|
|
10186
|
+
this.account = "";
|
|
10187
|
+
/**
|
|
10188
|
+
* @generated from field: string sub_id = 2;
|
|
10189
|
+
*/
|
|
10190
|
+
this.subId = "";
|
|
10191
|
+
/**
|
|
10192
|
+
* False when the account holds a balance but was never deployed, which is the
|
|
10193
|
+
* window this surface exists for: pre-swap delivered, position not opened.
|
|
10194
|
+
*
|
|
10195
|
+
* @generated from field: bool deployed = 3;
|
|
10196
|
+
*/
|
|
10197
|
+
this.deployed = false;
|
|
10198
|
+
/**
|
|
10199
|
+
* @generated from field: string amount = 5;
|
|
10200
|
+
*/
|
|
10201
|
+
this.amount = "";
|
|
10202
|
+
proto3.util.initPartial(data, this);
|
|
10203
|
+
}
|
|
10204
|
+
static fromBinary(bytes, options) {
|
|
10205
|
+
return new MarginIncompleteOpen().fromBinary(bytes, options);
|
|
10206
|
+
}
|
|
10207
|
+
static fromJson(jsonValue, options) {
|
|
10208
|
+
return new MarginIncompleteOpen().fromJson(jsonValue, options);
|
|
10209
|
+
}
|
|
10210
|
+
static fromJsonString(jsonString, options) {
|
|
10211
|
+
return new MarginIncompleteOpen().fromJsonString(jsonString, options);
|
|
10212
|
+
}
|
|
10213
|
+
static equals(a, b) {
|
|
10214
|
+
return proto3.util.equals(MarginIncompleteOpen, a, b);
|
|
10215
|
+
}
|
|
10216
|
+
}
|
|
10217
|
+
MarginIncompleteOpen.runtime = proto3;
|
|
10218
|
+
MarginIncompleteOpen.typeName = "trading.v1.MarginIncompleteOpen";
|
|
10219
|
+
MarginIncompleteOpen.fields = proto3.util.newFieldList(() => [
|
|
10220
|
+
{ no: 1, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10221
|
+
{ no: 2, name: "sub_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10222
|
+
{ no: 3, name: "deployed", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
10223
|
+
{ no: 4, name: "token", kind: "message", T: MarginTokenMetadata },
|
|
10224
|
+
{ no: 5, name: "amount", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10225
|
+
]);
|
|
10226
|
+
/**
|
|
10227
|
+
* The one plan-store read, and a deliberately weaker guarantee than the rest of
|
|
10228
|
+
* this response: session-scoped and TTL-bound, so absent rather than wrong once
|
|
10229
|
+
* a row ages out. Acceptable only because no funds are at risk in that state.
|
|
10230
|
+
*
|
|
10231
|
+
* @generated from message trading.v1.MarginPendingPlan
|
|
10232
|
+
*/
|
|
10233
|
+
export class MarginPendingPlan extends Message {
|
|
10234
|
+
constructor(data) {
|
|
10235
|
+
super();
|
|
10236
|
+
/**
|
|
10237
|
+
* @generated from field: string plan_id = 1;
|
|
10238
|
+
*/
|
|
10239
|
+
this.planId = "";
|
|
10240
|
+
/**
|
|
10241
|
+
* @generated from field: int64 created_at = 2;
|
|
10242
|
+
*/
|
|
10243
|
+
this.createdAt = protoInt64.zero;
|
|
10244
|
+
/**
|
|
10245
|
+
* @generated from field: int32 current_step = 3;
|
|
10246
|
+
*/
|
|
10247
|
+
this.currentStep = 0;
|
|
10248
|
+
/**
|
|
10249
|
+
* @generated from field: bool cancellable = 4;
|
|
10250
|
+
*/
|
|
10251
|
+
this.cancellable = false;
|
|
10252
|
+
proto3.util.initPartial(data, this);
|
|
10253
|
+
}
|
|
10254
|
+
static fromBinary(bytes, options) {
|
|
10255
|
+
return new MarginPendingPlan().fromBinary(bytes, options);
|
|
10256
|
+
}
|
|
10257
|
+
static fromJson(jsonValue, options) {
|
|
10258
|
+
return new MarginPendingPlan().fromJson(jsonValue, options);
|
|
10259
|
+
}
|
|
10260
|
+
static fromJsonString(jsonString, options) {
|
|
10261
|
+
return new MarginPendingPlan().fromJsonString(jsonString, options);
|
|
10262
|
+
}
|
|
10263
|
+
static equals(a, b) {
|
|
10264
|
+
return proto3.util.equals(MarginPendingPlan, a, b);
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
MarginPendingPlan.runtime = proto3;
|
|
10268
|
+
MarginPendingPlan.typeName = "trading.v1.MarginPendingPlan";
|
|
10269
|
+
MarginPendingPlan.fields = proto3.util.newFieldList(() => [
|
|
10270
|
+
{ no: 1, name: "plan_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10271
|
+
{ no: 2, name: "created_at", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
|
|
10272
|
+
{ no: 3, name: "current_step", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
10273
|
+
{ no: 4, name: "cancellable", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
10274
|
+
]);
|
|
10275
|
+
/**
|
|
10276
|
+
* @generated from message trading.v1.MarginPositionsRequest
|
|
10277
|
+
*/
|
|
10278
|
+
export class MarginPositionsRequest extends Message {
|
|
10279
|
+
constructor(data) {
|
|
10280
|
+
super();
|
|
10281
|
+
/**
|
|
10282
|
+
* @generated from field: string swapper = 1;
|
|
10283
|
+
*/
|
|
10284
|
+
this.swapper = "";
|
|
10285
|
+
/**
|
|
10286
|
+
* @generated from field: int32 chain_id = 2;
|
|
10287
|
+
*/
|
|
10288
|
+
this.chainId = 0;
|
|
10289
|
+
proto3.util.initPartial(data, this);
|
|
10290
|
+
}
|
|
10291
|
+
static fromBinary(bytes, options) {
|
|
10292
|
+
return new MarginPositionsRequest().fromBinary(bytes, options);
|
|
10293
|
+
}
|
|
10294
|
+
static fromJson(jsonValue, options) {
|
|
10295
|
+
return new MarginPositionsRequest().fromJson(jsonValue, options);
|
|
10296
|
+
}
|
|
10297
|
+
static fromJsonString(jsonString, options) {
|
|
10298
|
+
return new MarginPositionsRequest().fromJsonString(jsonString, options);
|
|
10299
|
+
}
|
|
10300
|
+
static equals(a, b) {
|
|
10301
|
+
return proto3.util.equals(MarginPositionsRequest, a, b);
|
|
10302
|
+
}
|
|
10303
|
+
}
|
|
10304
|
+
MarginPositionsRequest.runtime = proto3;
|
|
10305
|
+
MarginPositionsRequest.typeName = "trading.v1.MarginPositionsRequest";
|
|
10306
|
+
MarginPositionsRequest.fields = proto3.util.newFieldList(() => [
|
|
10307
|
+
{ no: 1, name: "swapper", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10308
|
+
{ no: 2, name: "chain_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
10309
|
+
{ no: 3, name: "status", kind: "enum", T: proto3.getEnumType(MarginPositionStatus), opt: true },
|
|
10310
|
+
{ no: 4, name: "cursor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10311
|
+
{ no: 5, name: "limit", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
|
|
10312
|
+
]);
|
|
10313
|
+
/**
|
|
10314
|
+
* @generated from message trading.v1.MarginPositionsResponse
|
|
10315
|
+
*/
|
|
10316
|
+
export class MarginPositionsResponse extends Message {
|
|
10317
|
+
constructor(data) {
|
|
10318
|
+
super();
|
|
10319
|
+
/**
|
|
10320
|
+
* @generated from field: string request_id = 1;
|
|
10321
|
+
*/
|
|
10322
|
+
this.requestId = "";
|
|
10323
|
+
/**
|
|
10324
|
+
* @generated from field: repeated trading.v1.MarginPositionRow positions = 2;
|
|
10325
|
+
*/
|
|
10326
|
+
this.positions = [];
|
|
10327
|
+
/**
|
|
10328
|
+
* Both recovery surfaces serialize as [] when the read ran and found nothing.
|
|
10329
|
+
* They cannot express "not read": a degraded read logs a warning and reports
|
|
10330
|
+
* empty, matching how the markets feed degrades a failed venue.
|
|
10331
|
+
*
|
|
10332
|
+
* @generated from field: repeated trading.v1.MarginIncompleteOpen incomplete_opens = 4;
|
|
10333
|
+
*/
|
|
10334
|
+
this.incompleteOpens = [];
|
|
10335
|
+
/**
|
|
10336
|
+
* @generated from field: repeated trading.v1.MarginPendingPlan pending_plans = 5;
|
|
10337
|
+
*/
|
|
10338
|
+
this.pendingPlans = [];
|
|
10339
|
+
proto3.util.initPartial(data, this);
|
|
10340
|
+
}
|
|
10341
|
+
static fromBinary(bytes, options) {
|
|
10342
|
+
return new MarginPositionsResponse().fromBinary(bytes, options);
|
|
10343
|
+
}
|
|
10344
|
+
static fromJson(jsonValue, options) {
|
|
10345
|
+
return new MarginPositionsResponse().fromJson(jsonValue, options);
|
|
10346
|
+
}
|
|
10347
|
+
static fromJsonString(jsonString, options) {
|
|
10348
|
+
return new MarginPositionsResponse().fromJsonString(jsonString, options);
|
|
10349
|
+
}
|
|
10350
|
+
static equals(a, b) {
|
|
10351
|
+
return proto3.util.equals(MarginPositionsResponse, a, b);
|
|
10352
|
+
}
|
|
10353
|
+
}
|
|
10354
|
+
MarginPositionsResponse.runtime = proto3;
|
|
10355
|
+
MarginPositionsResponse.typeName = "trading.v1.MarginPositionsResponse";
|
|
10356
|
+
MarginPositionsResponse.fields = proto3.util.newFieldList(() => [
|
|
10357
|
+
{ no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
10358
|
+
{ no: 2, name: "positions", kind: "message", T: MarginPositionRow, repeated: true },
|
|
10359
|
+
{ no: 3, name: "next_cursor", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
10360
|
+
{ no: 4, name: "incomplete_opens", kind: "message", T: MarginIncompleteOpen, repeated: true },
|
|
10361
|
+
{ no: 5, name: "pending_plans", kind: "message", T: MarginPendingPlan, repeated: true },
|
|
10362
|
+
]);
|