@uniswap/client-trading 0.6.0 → 0.7.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 +15 -1
- package/dist/trading/v1/api-tradingService_connectquery.js +15 -1
- package/dist/trading/v1/api_connect.d.ts +11 -1
- package/dist/trading/v1/api_connect.js +11 -1
- package/dist/trading/v1/api_pb.d.ts +736 -1
- package/dist/trading/v1/api_pb.js +702 -0
- package/package.json +1 -1
|
@@ -476,7 +476,14 @@ export declare enum PlanStepType {
|
|
|
476
476
|
*
|
|
477
477
|
* @generated from enum value: PLAN_STEP_TYPE_MARGIN_EXECUTE = 16;
|
|
478
478
|
*/
|
|
479
|
-
MARGIN_EXECUTE = 16
|
|
479
|
+
MARGIN_EXECUTE = 16,
|
|
480
|
+
/**
|
|
481
|
+
* Fused Swap→Bridge: one Universal Router transaction that swaps on the
|
|
482
|
+
* source chain and deposits the output into the Across SpokePool.
|
|
483
|
+
*
|
|
484
|
+
* @generated from enum value: PLAN_STEP_TYPE_SWAP_BRIDGE = 17;
|
|
485
|
+
*/
|
|
486
|
+
SWAP_BRIDGE = 17
|
|
480
487
|
}
|
|
481
488
|
/**
|
|
482
489
|
* Set when the output is a fee taken from the swap; unset for the swapper's
|
|
@@ -706,6 +713,84 @@ export declare enum MarginVenue {
|
|
|
706
713
|
*/
|
|
707
714
|
AAVE_V4 = 2
|
|
708
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* Echoed on the response so a client can tell which action was priced without
|
|
718
|
+
* re-deriving it from the request. Mirrors the request's oneof exactly.
|
|
719
|
+
* Named intent to match the error codes (INTENT_MISMATCH) and the plan step
|
|
720
|
+
* vocabulary, so one word is used end to end.
|
|
721
|
+
*
|
|
722
|
+
* @generated from enum trading.v1.MarginIntent
|
|
723
|
+
*/
|
|
724
|
+
export declare enum MarginIntent {
|
|
725
|
+
/**
|
|
726
|
+
* @generated from enum value: MARGIN_INTENT_OPEN = 0;
|
|
727
|
+
*/
|
|
728
|
+
OPEN = 0,
|
|
729
|
+
/**
|
|
730
|
+
* @generated from enum value: MARGIN_INTENT_CLOSE = 1;
|
|
731
|
+
*/
|
|
732
|
+
CLOSE = 1,
|
|
733
|
+
/**
|
|
734
|
+
* @generated from enum value: MARGIN_INTENT_INCREASE_LEVERAGE = 2;
|
|
735
|
+
*/
|
|
736
|
+
INCREASE_LEVERAGE = 2,
|
|
737
|
+
/**
|
|
738
|
+
* @generated from enum value: MARGIN_INTENT_DECREASE_LEVERAGE = 3;
|
|
739
|
+
*/
|
|
740
|
+
DECREASE_LEVERAGE = 3,
|
|
741
|
+
/**
|
|
742
|
+
* @generated from enum value: MARGIN_INTENT_ADD_EQUITY = 4;
|
|
743
|
+
*/
|
|
744
|
+
ADD_EQUITY = 4,
|
|
745
|
+
/**
|
|
746
|
+
* @generated from enum value: MARGIN_INTENT_WITHDRAW_EQUITY = 5;
|
|
747
|
+
*/
|
|
748
|
+
WITHDRAW_EQUITY = 5,
|
|
749
|
+
/**
|
|
750
|
+
* @generated from enum value: MARGIN_INTENT_ADD_EQUITY_AND_INCREASE_LEVERAGE = 6;
|
|
751
|
+
*/
|
|
752
|
+
ADD_EQUITY_AND_INCREASE_LEVERAGE = 6,
|
|
753
|
+
/**
|
|
754
|
+
* @generated from enum value: MARGIN_INTENT_ADD_EQUITY_AND_DECREASE_LEVERAGE = 7;
|
|
755
|
+
*/
|
|
756
|
+
ADD_EQUITY_AND_DECREASE_LEVERAGE = 7,
|
|
757
|
+
/**
|
|
758
|
+
* @generated from enum value: MARGIN_INTENT_WITHDRAW_EQUITY_AND_INCREASE_LEVERAGE = 8;
|
|
759
|
+
*/
|
|
760
|
+
WITHDRAW_EQUITY_AND_INCREASE_LEVERAGE = 8,
|
|
761
|
+
/**
|
|
762
|
+
* @generated from enum value: MARGIN_INTENT_WITHDRAW_EQUITY_AND_DECREASE_LEVERAGE = 9;
|
|
763
|
+
*/
|
|
764
|
+
WITHDRAW_EQUITY_AND_DECREASE_LEVERAGE = 9
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* One on-chain call inside the router's execute([...actions]) stream. The
|
|
768
|
+
* quote decomposes an action into these; the plan stamps them into calldata.
|
|
769
|
+
*
|
|
770
|
+
* @generated from enum trading.v1.MarginOperationType
|
|
771
|
+
*/
|
|
772
|
+
export declare enum MarginOperationType {
|
|
773
|
+
/**
|
|
774
|
+
* @generated from enum value: INCREASE_POSITION = 0;
|
|
775
|
+
*/
|
|
776
|
+
INCREASE_POSITION = 0,
|
|
777
|
+
/**
|
|
778
|
+
* @generated from enum value: DECREASE_POSITION = 1;
|
|
779
|
+
*/
|
|
780
|
+
DECREASE_POSITION = 1,
|
|
781
|
+
/**
|
|
782
|
+
* @generated from enum value: ADD_COLLATERAL = 2;
|
|
783
|
+
*/
|
|
784
|
+
ADD_COLLATERAL = 2,
|
|
785
|
+
/**
|
|
786
|
+
* @generated from enum value: WITHDRAW = 3;
|
|
787
|
+
*/
|
|
788
|
+
WITHDRAW = 3,
|
|
789
|
+
/**
|
|
790
|
+
* @generated from enum value: SWEEP = 4;
|
|
791
|
+
*/
|
|
792
|
+
SWEEP = 4
|
|
793
|
+
}
|
|
709
794
|
/**
|
|
710
795
|
* @generated from message trading.v1.Encode7702Request
|
|
711
796
|
*/
|
|
@@ -7932,3 +8017,653 @@ export declare class MarginMarketsResponse extends Message<MarginMarketsResponse
|
|
|
7932
8017
|
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginMarketsResponse;
|
|
7933
8018
|
static equals(a: MarginMarketsResponse | PlainMessage<MarginMarketsResponse> | undefined, b: MarginMarketsResponse | PlainMessage<MarginMarketsResponse> | undefined): boolean;
|
|
7934
8019
|
}
|
|
8020
|
+
/**
|
|
8021
|
+
* increaseLeverage, decreaseLeverage. Equity is held, so no amount.
|
|
8022
|
+
*
|
|
8023
|
+
* @generated from message trading.v1.MarginLeverageAction
|
|
8024
|
+
*/
|
|
8025
|
+
export declare class MarginLeverageAction extends Message<MarginLeverageAction> {
|
|
8026
|
+
/**
|
|
8027
|
+
* @generated from field: string position_id = 1;
|
|
8028
|
+
*/
|
|
8029
|
+
positionId: string;
|
|
8030
|
+
/**
|
|
8031
|
+
* Decimal string ("3", "2.55"), never a float.
|
|
8032
|
+
*
|
|
8033
|
+
* @generated from field: string leverage_target = 2;
|
|
8034
|
+
*/
|
|
8035
|
+
leverageTarget: string;
|
|
8036
|
+
constructor(data?: PartialMessage<MarginLeverageAction>);
|
|
8037
|
+
static readonly runtime: typeof proto3;
|
|
8038
|
+
static readonly typeName = "trading.v1.MarginLeverageAction";
|
|
8039
|
+
static readonly fields: FieldList;
|
|
8040
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginLeverageAction;
|
|
8041
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginLeverageAction;
|
|
8042
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginLeverageAction;
|
|
8043
|
+
static equals(a: MarginLeverageAction | PlainMessage<MarginLeverageAction> | undefined, b: MarginLeverageAction | PlainMessage<MarginLeverageAction> | undefined): boolean;
|
|
8044
|
+
}
|
|
8045
|
+
/**
|
|
8046
|
+
* The four composites. Both axes move, so both magnitudes are carried.
|
|
8047
|
+
*
|
|
8048
|
+
* @generated from message trading.v1.MarginEquityLeverageAction
|
|
8049
|
+
*/
|
|
8050
|
+
export declare class MarginEquityLeverageAction extends Message<MarginEquityLeverageAction> {
|
|
8051
|
+
/**
|
|
8052
|
+
* @generated from field: string position_id = 1;
|
|
8053
|
+
*/
|
|
8054
|
+
positionId: string;
|
|
8055
|
+
/**
|
|
8056
|
+
* @generated from field: string leverage_target = 2;
|
|
8057
|
+
*/
|
|
8058
|
+
leverageTarget: string;
|
|
8059
|
+
/**
|
|
8060
|
+
* @generated from field: string amount = 3;
|
|
8061
|
+
*/
|
|
8062
|
+
amount: string;
|
|
8063
|
+
constructor(data?: PartialMessage<MarginEquityLeverageAction>);
|
|
8064
|
+
static readonly runtime: typeof proto3;
|
|
8065
|
+
static readonly typeName = "trading.v1.MarginEquityLeverageAction";
|
|
8066
|
+
static readonly fields: FieldList;
|
|
8067
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginEquityLeverageAction;
|
|
8068
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginEquityLeverageAction;
|
|
8069
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginEquityLeverageAction;
|
|
8070
|
+
static equals(a: MarginEquityLeverageAction | PlainMessage<MarginEquityLeverageAction> | undefined, b: MarginEquityLeverageAction | PlainMessage<MarginEquityLeverageAction> | undefined): boolean;
|
|
8071
|
+
}
|
|
8072
|
+
/**
|
|
8073
|
+
* addEquity, withdrawEquity. Size is held and leverage follows, so no target.
|
|
8074
|
+
*
|
|
8075
|
+
* `amount` is denominated in wallet_token on addEquity, and in the COLLATERAL
|
|
8076
|
+
* token on withdrawEquity. That asymmetry is deliberate, and it is the one
|
|
8077
|
+
* place the "amount is always wallet_token" rule breaks.
|
|
8078
|
+
*
|
|
8079
|
+
* A withdrawal's safety is a property of the position, not of the price its
|
|
8080
|
+
* proceeds fetch: how much collateral can leave before health hits the floor
|
|
8081
|
+
* is answerable from the position alone. Denominating in wallet_token would
|
|
8082
|
+
* make that check depend on a swap quote, so whether a withdrawal is allowed
|
|
8083
|
+
* would move with the funding route. It also matches the on-chain primitive,
|
|
8084
|
+
* which takes a collateral amount, and the max-withdrawable guard, which is
|
|
8085
|
+
* computed in collateral terms.
|
|
8086
|
+
*
|
|
8087
|
+
* @generated from message trading.v1.MarginEquityAction
|
|
8088
|
+
*/
|
|
8089
|
+
export declare class MarginEquityAction extends Message<MarginEquityAction> {
|
|
8090
|
+
/**
|
|
8091
|
+
* @generated from field: string position_id = 1;
|
|
8092
|
+
*/
|
|
8093
|
+
positionId: string;
|
|
8094
|
+
/**
|
|
8095
|
+
* @generated from field: string amount = 2;
|
|
8096
|
+
*/
|
|
8097
|
+
amount: string;
|
|
8098
|
+
constructor(data?: PartialMessage<MarginEquityAction>);
|
|
8099
|
+
static readonly runtime: typeof proto3;
|
|
8100
|
+
static readonly typeName = "trading.v1.MarginEquityAction";
|
|
8101
|
+
static readonly fields: FieldList;
|
|
8102
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginEquityAction;
|
|
8103
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginEquityAction;
|
|
8104
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginEquityAction;
|
|
8105
|
+
static equals(a: MarginEquityAction | PlainMessage<MarginEquityAction> | undefined, b: MarginEquityAction | PlainMessage<MarginEquityAction> | undefined): boolean;
|
|
8106
|
+
}
|
|
8107
|
+
/**
|
|
8108
|
+
* close. The whole position, so structurally neither a target nor an amount.
|
|
8109
|
+
*
|
|
8110
|
+
* @generated from message trading.v1.MarginPositionAction
|
|
8111
|
+
*/
|
|
8112
|
+
export declare class MarginPositionAction extends Message<MarginPositionAction> {
|
|
8113
|
+
/**
|
|
8114
|
+
* @generated from field: string position_id = 1;
|
|
8115
|
+
*/
|
|
8116
|
+
positionId: string;
|
|
8117
|
+
constructor(data?: PartialMessage<MarginPositionAction>);
|
|
8118
|
+
static readonly runtime: typeof proto3;
|
|
8119
|
+
static readonly typeName = "trading.v1.MarginPositionAction";
|
|
8120
|
+
static readonly fields: FieldList;
|
|
8121
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginPositionAction;
|
|
8122
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginPositionAction;
|
|
8123
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginPositionAction;
|
|
8124
|
+
static equals(a: MarginPositionAction | PlainMessage<MarginPositionAction> | undefined, b: MarginPositionAction | PlainMessage<MarginPositionAction> | undefined): boolean;
|
|
8125
|
+
}
|
|
8126
|
+
/**
|
|
8127
|
+
* open. No position_id: the server allocates one at plan create.
|
|
8128
|
+
*
|
|
8129
|
+
* @generated from message trading.v1.MarginOpenAction
|
|
8130
|
+
*/
|
|
8131
|
+
export declare class MarginOpenAction extends Message<MarginOpenAction> {
|
|
8132
|
+
/**
|
|
8133
|
+
* @generated from field: string leverage_target = 1;
|
|
8134
|
+
*/
|
|
8135
|
+
leverageTarget: string;
|
|
8136
|
+
/**
|
|
8137
|
+
* The LENDING allowlist, distinct from `swap_config.protocols` (the AMM
|
|
8138
|
+
* allowlist for the wallet-side swap).
|
|
8139
|
+
*
|
|
8140
|
+
* @generated from field: repeated trading.v1.MarginVenue venues = 2;
|
|
8141
|
+
*/
|
|
8142
|
+
venues: MarginVenue[];
|
|
8143
|
+
/**
|
|
8144
|
+
* @generated from field: string amount = 3;
|
|
8145
|
+
*/
|
|
8146
|
+
amount: string;
|
|
8147
|
+
constructor(data?: PartialMessage<MarginOpenAction>);
|
|
8148
|
+
static readonly runtime: typeof proto3;
|
|
8149
|
+
static readonly typeName = "trading.v1.MarginOpenAction";
|
|
8150
|
+
static readonly fields: FieldList;
|
|
8151
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginOpenAction;
|
|
8152
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginOpenAction;
|
|
8153
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginOpenAction;
|
|
8154
|
+
static equals(a: MarginOpenAction | PlainMessage<MarginOpenAction> | undefined, b: MarginOpenAction | PlainMessage<MarginOpenAction> | undefined): boolean;
|
|
8155
|
+
}
|
|
8156
|
+
/**
|
|
8157
|
+
* EXECUTION POLICY for the wallet-side swap, and nothing else. It names no
|
|
8158
|
+
* token, no chain, no amount and no trade type: identity lives at the top level
|
|
8159
|
+
* in wallet_token / wallet_chain_id, the magnitude lives in the action key, and
|
|
8160
|
+
* exact-in vs exact-out follows from whether that key pays in or pays out.
|
|
8161
|
+
*
|
|
8162
|
+
* Kept separate from wallet_token because the two have different lifetimes.
|
|
8163
|
+
* wallet_token is always meaningful; this block can be moot, since paying in
|
|
8164
|
+
* the collateral token needs no funding swap at all, and whether one is needed
|
|
8165
|
+
* is a routing outcome not knowable at request time.
|
|
8166
|
+
*
|
|
8167
|
+
* @generated from message trading.v1.MarginSwapConfig
|
|
8168
|
+
*/
|
|
8169
|
+
export declare class MarginSwapConfig extends Message<MarginSwapConfig> {
|
|
8170
|
+
/**
|
|
8171
|
+
* @generated from field: optional double slippage_tolerance = 1;
|
|
8172
|
+
*/
|
|
8173
|
+
slippageTolerance?: number;
|
|
8174
|
+
/**
|
|
8175
|
+
* @generated from field: optional trading.v1.AutoSlippage auto_slippage = 2;
|
|
8176
|
+
*/
|
|
8177
|
+
autoSlippage?: AutoSlippage;
|
|
8178
|
+
/**
|
|
8179
|
+
* @generated from field: repeated trading.v1.Protocols protocols = 3;
|
|
8180
|
+
*/
|
|
8181
|
+
protocols: Protocols[];
|
|
8182
|
+
constructor(data?: PartialMessage<MarginSwapConfig>);
|
|
8183
|
+
static readonly runtime: typeof proto3;
|
|
8184
|
+
static readonly typeName = "trading.v1.MarginSwapConfig";
|
|
8185
|
+
static readonly fields: FieldList;
|
|
8186
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginSwapConfig;
|
|
8187
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginSwapConfig;
|
|
8188
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginSwapConfig;
|
|
8189
|
+
static equals(a: MarginSwapConfig | PlainMessage<MarginSwapConfig> | undefined, b: MarginSwapConfig | PlainMessage<MarginSwapConfig> | undefined): boolean;
|
|
8190
|
+
}
|
|
8191
|
+
/**
|
|
8192
|
+
* @generated from message trading.v1.MarginQuoteRequest
|
|
8193
|
+
*/
|
|
8194
|
+
export declare class MarginQuoteRequest extends Message<MarginQuoteRequest> {
|
|
8195
|
+
/**
|
|
8196
|
+
* The chain the POSITION lives on. Named rather than left as a bare chain_id
|
|
8197
|
+
* because two chains are in play: with one of them unqualified, a client
|
|
8198
|
+
* reasonably reads it as "the" chain, sets it to the chain it is paying from,
|
|
8199
|
+
* and silently gets a cross-chain funding flow it never asked for. Both are
|
|
8200
|
+
* named so both have to be stated.
|
|
8201
|
+
*
|
|
8202
|
+
* @generated from field: int32 position_chain_id = 1;
|
|
8203
|
+
*/
|
|
8204
|
+
positionChainId: number;
|
|
8205
|
+
/**
|
|
8206
|
+
* @generated from field: string exposure_token = 2;
|
|
8207
|
+
*/
|
|
8208
|
+
exposureToken: string;
|
|
8209
|
+
/**
|
|
8210
|
+
* @generated from field: string counter_token = 3;
|
|
8211
|
+
*/
|
|
8212
|
+
counterToken: string;
|
|
8213
|
+
/**
|
|
8214
|
+
* @generated from field: trading.v1.MarginDirection direction = 4;
|
|
8215
|
+
*/
|
|
8216
|
+
direction: MarginDirection;
|
|
8217
|
+
/**
|
|
8218
|
+
* @generated from field: string swapper = 5;
|
|
8219
|
+
*/
|
|
8220
|
+
swapper: string;
|
|
8221
|
+
/**
|
|
8222
|
+
* The LEVERAGE leg: the flash-accounted, debt-funded swap inside the router.
|
|
8223
|
+
* Independent of swap_config; neither defaults from the other. Always an
|
|
8224
|
+
* explicit percentage, because it derives max_debt_in / max_collateral_in,
|
|
8225
|
+
* which stamp into calldata as the MEV backstop, and a routing heuristic must
|
|
8226
|
+
* not size a binding fund-safety bound. That is why there is no
|
|
8227
|
+
* auto_slippage here and there is one inside swap_config.
|
|
8228
|
+
*
|
|
8229
|
+
* @generated from field: optional double slippage_tolerance = 6;
|
|
8230
|
+
*/
|
|
8231
|
+
slippageTolerance?: number;
|
|
8232
|
+
/**
|
|
8233
|
+
* Required iff the action has a wallet-side swap, forbidden otherwise; never
|
|
8234
|
+
* genuinely optional. Enforced structurally in Joi (with/without per key).
|
|
8235
|
+
*
|
|
8236
|
+
* @generated from field: optional trading.v1.MarginSwapConfig swap_config = 8;
|
|
8237
|
+
*/
|
|
8238
|
+
swapConfig?: MarginSwapConfig;
|
|
8239
|
+
/**
|
|
8240
|
+
* The token crossing the wallet boundary, and where it sits. Deliberately NOT
|
|
8241
|
+
* named token_in: `withdraw_equity*` and `close` pay OUT, so an "in" name
|
|
8242
|
+
* would be wrong on four of the ten keys. Flow direction is read off the
|
|
8243
|
+
* action key and never restated here. `amount` in the action key is
|
|
8244
|
+
* denominated in this token. Governed by the same per-key rules as
|
|
8245
|
+
* swap_config.
|
|
8246
|
+
*
|
|
8247
|
+
* @generated from field: optional string wallet_token = 9;
|
|
8248
|
+
*/
|
|
8249
|
+
walletToken?: string;
|
|
8250
|
+
/**
|
|
8251
|
+
* Differs from position_chain_id => cross-chain funding (pay-in only).
|
|
8252
|
+
*
|
|
8253
|
+
* @generated from field: optional int32 wallet_chain_id = 10;
|
|
8254
|
+
*/
|
|
8255
|
+
walletChainId?: number;
|
|
8256
|
+
/**
|
|
8257
|
+
* @generated from oneof trading.v1.MarginQuoteRequest.action
|
|
8258
|
+
*/
|
|
8259
|
+
action: {
|
|
8260
|
+
/**
|
|
8261
|
+
* @generated from field: trading.v1.MarginOpenAction open = 20;
|
|
8262
|
+
*/
|
|
8263
|
+
value: MarginOpenAction;
|
|
8264
|
+
case: "open";
|
|
8265
|
+
} | {
|
|
8266
|
+
/**
|
|
8267
|
+
* @generated from field: trading.v1.MarginPositionAction close = 21;
|
|
8268
|
+
*/
|
|
8269
|
+
value: MarginPositionAction;
|
|
8270
|
+
case: "close";
|
|
8271
|
+
} | {
|
|
8272
|
+
/**
|
|
8273
|
+
* @generated from field: trading.v1.MarginLeverageAction increase_leverage = 22;
|
|
8274
|
+
*/
|
|
8275
|
+
value: MarginLeverageAction;
|
|
8276
|
+
case: "increaseLeverage";
|
|
8277
|
+
} | {
|
|
8278
|
+
/**
|
|
8279
|
+
* @generated from field: trading.v1.MarginLeverageAction decrease_leverage = 23;
|
|
8280
|
+
*/
|
|
8281
|
+
value: MarginLeverageAction;
|
|
8282
|
+
case: "decreaseLeverage";
|
|
8283
|
+
} | {
|
|
8284
|
+
/**
|
|
8285
|
+
* @generated from field: trading.v1.MarginEquityAction add_equity = 24;
|
|
8286
|
+
*/
|
|
8287
|
+
value: MarginEquityAction;
|
|
8288
|
+
case: "addEquity";
|
|
8289
|
+
} | {
|
|
8290
|
+
/**
|
|
8291
|
+
* @generated from field: trading.v1.MarginEquityAction withdraw_equity = 25;
|
|
8292
|
+
*/
|
|
8293
|
+
value: MarginEquityAction;
|
|
8294
|
+
case: "withdrawEquity";
|
|
8295
|
+
} | {
|
|
8296
|
+
/**
|
|
8297
|
+
* @generated from field: trading.v1.MarginEquityLeverageAction add_equity_and_increase_leverage = 26;
|
|
8298
|
+
*/
|
|
8299
|
+
value: MarginEquityLeverageAction;
|
|
8300
|
+
case: "addEquityAndIncreaseLeverage";
|
|
8301
|
+
} | {
|
|
8302
|
+
/**
|
|
8303
|
+
* @generated from field: trading.v1.MarginEquityLeverageAction add_equity_and_decrease_leverage = 27;
|
|
8304
|
+
*/
|
|
8305
|
+
value: MarginEquityLeverageAction;
|
|
8306
|
+
case: "addEquityAndDecreaseLeverage";
|
|
8307
|
+
} | {
|
|
8308
|
+
/**
|
|
8309
|
+
* @generated from field: trading.v1.MarginEquityLeverageAction withdraw_equity_and_increase_leverage = 28;
|
|
8310
|
+
*/
|
|
8311
|
+
value: MarginEquityLeverageAction;
|
|
8312
|
+
case: "withdrawEquityAndIncreaseLeverage";
|
|
8313
|
+
} | {
|
|
8314
|
+
/**
|
|
8315
|
+
* @generated from field: trading.v1.MarginEquityLeverageAction withdraw_equity_and_decrease_leverage = 29;
|
|
8316
|
+
*/
|
|
8317
|
+
value: MarginEquityLeverageAction;
|
|
8318
|
+
case: "withdrawEquityAndDecreaseLeverage";
|
|
8319
|
+
} | {
|
|
8320
|
+
case: undefined;
|
|
8321
|
+
value?: undefined;
|
|
8322
|
+
};
|
|
8323
|
+
constructor(data?: PartialMessage<MarginQuoteRequest>);
|
|
8324
|
+
static readonly runtime: typeof proto3;
|
|
8325
|
+
static readonly typeName = "trading.v1.MarginQuoteRequest";
|
|
8326
|
+
static readonly fields: FieldList;
|
|
8327
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginQuoteRequest;
|
|
8328
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginQuoteRequest;
|
|
8329
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginQuoteRequest;
|
|
8330
|
+
static equals(a: MarginQuoteRequest | PlainMessage<MarginQuoteRequest> | undefined, b: MarginQuoteRequest | PlainMessage<MarginQuoteRequest> | undefined): boolean;
|
|
8331
|
+
}
|
|
8332
|
+
/**
|
|
8333
|
+
* The confirmed bounds for one operation. Which fields are set follows from
|
|
8334
|
+
* `type`; they are the numbers that stamp into calldata, so they are in native
|
|
8335
|
+
* token decimals (LTV and leverage are WAD).
|
|
8336
|
+
*
|
|
8337
|
+
* @generated from message trading.v1.MarginOperation
|
|
8338
|
+
*/
|
|
8339
|
+
export declare class MarginOperation extends Message<MarginOperation> {
|
|
8340
|
+
/**
|
|
8341
|
+
* @generated from field: trading.v1.MarginOperationType type = 1;
|
|
8342
|
+
*/
|
|
8343
|
+
type: MarginOperationType;
|
|
8344
|
+
/**
|
|
8345
|
+
* INCREASE_POSITION: exact-out buy, collateral asset.
|
|
8346
|
+
*
|
|
8347
|
+
* @generated from field: optional string collateral_to_buy = 2;
|
|
8348
|
+
*/
|
|
8349
|
+
collateralToBuy?: string;
|
|
8350
|
+
/**
|
|
8351
|
+
* INCREASE_POSITION: binding slippage cap on debt spent. Mandatory non-zero
|
|
8352
|
+
* on-chain; the router refuses a zero bound outright.
|
|
8353
|
+
*
|
|
8354
|
+
* @generated from field: optional string max_debt_in = 3;
|
|
8355
|
+
*/
|
|
8356
|
+
maxDebtIn?: string;
|
|
8357
|
+
/**
|
|
8358
|
+
* DECREASE_POSITION: debt cleared at the venue.
|
|
8359
|
+
*
|
|
8360
|
+
* @generated from field: optional string debt_to_repay = 4;
|
|
8361
|
+
*/
|
|
8362
|
+
debtToRepay?: string;
|
|
8363
|
+
/**
|
|
8364
|
+
* DECREASE_POSITION: cap on collateral sold, round-UP slippage pad.
|
|
8365
|
+
*
|
|
8366
|
+
* @generated from field: optional string max_collateral_in = 5;
|
|
8367
|
+
*/
|
|
8368
|
+
maxCollateralIn?: string;
|
|
8369
|
+
/**
|
|
8370
|
+
* Health assertion where one exists on-chain.
|
|
8371
|
+
*
|
|
8372
|
+
* @generated from field: optional string max_ltv_after = 6;
|
|
8373
|
+
*/
|
|
8374
|
+
maxLtvAfter?: string;
|
|
8375
|
+
/**
|
|
8376
|
+
* ADD_COLLATERAL / WITHDRAW magnitude, in the flow-native asset.
|
|
8377
|
+
*
|
|
8378
|
+
* @generated from field: optional string amount = 7;
|
|
8379
|
+
*/
|
|
8380
|
+
amount?: string;
|
|
8381
|
+
/**
|
|
8382
|
+
* Optional per-hop bound; 0 disables. 18-dec on the wire, X36 at encode.
|
|
8383
|
+
*
|
|
8384
|
+
* @generated from field: optional string min_hop_price = 8;
|
|
8385
|
+
*/
|
|
8386
|
+
minHopPrice?: string;
|
|
8387
|
+
/**
|
|
8388
|
+
* This operation's quoted fill, and the PRICE_DRIFT reference at re-stamp.
|
|
8389
|
+
*
|
|
8390
|
+
* @generated from field: optional string effective_price = 9;
|
|
8391
|
+
*/
|
|
8392
|
+
effectivePrice?: string;
|
|
8393
|
+
constructor(data?: PartialMessage<MarginOperation>);
|
|
8394
|
+
static readonly runtime: typeof proto3;
|
|
8395
|
+
static readonly typeName = "trading.v1.MarginOperation";
|
|
8396
|
+
static readonly fields: FieldList;
|
|
8397
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginOperation;
|
|
8398
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginOperation;
|
|
8399
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginOperation;
|
|
8400
|
+
static equals(a: MarginOperation | PlainMessage<MarginOperation> | undefined, b: MarginOperation | PlainMessage<MarginOperation> | undefined): boolean;
|
|
8401
|
+
}
|
|
8402
|
+
/**
|
|
8403
|
+
* @generated from message trading.v1.MarginExecutionLeg
|
|
8404
|
+
*/
|
|
8405
|
+
export declare class MarginExecutionLeg extends Message<MarginExecutionLeg> {
|
|
8406
|
+
/**
|
|
8407
|
+
* @generated from field: trading.v1.MarginVenue venue = 1;
|
|
8408
|
+
*/
|
|
8409
|
+
venue: MarginVenue;
|
|
8410
|
+
/**
|
|
8411
|
+
* Server-resolved on manage actions; absent on open until plan create
|
|
8412
|
+
* allocates it.
|
|
8413
|
+
*
|
|
8414
|
+
* @generated from field: optional string sub_id = 2;
|
|
8415
|
+
*/
|
|
8416
|
+
subId?: string;
|
|
8417
|
+
/**
|
|
8418
|
+
* Ordered. A composite action populates more than one.
|
|
8419
|
+
*
|
|
8420
|
+
* @generated from field: repeated trading.v1.MarginOperation operations = 3;
|
|
8421
|
+
*/
|
|
8422
|
+
operations: MarginOperation[];
|
|
8423
|
+
constructor(data?: PartialMessage<MarginExecutionLeg>);
|
|
8424
|
+
static readonly runtime: typeof proto3;
|
|
8425
|
+
static readonly typeName = "trading.v1.MarginExecutionLeg";
|
|
8426
|
+
static readonly fields: FieldList;
|
|
8427
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginExecutionLeg;
|
|
8428
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginExecutionLeg;
|
|
8429
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginExecutionLeg;
|
|
8430
|
+
static equals(a: MarginExecutionLeg | PlainMessage<MarginExecutionLeg> | undefined, b: MarginExecutionLeg | PlainMessage<MarginExecutionLeg> | undefined): boolean;
|
|
8431
|
+
}
|
|
8432
|
+
/**
|
|
8433
|
+
* The wallet-side swap as priced, in the same shape /quote uses for an ordinary
|
|
8434
|
+
* swap, so the funding leg reads natively rather than inventing a fourth
|
|
8435
|
+
* swap-quote vocabulary.
|
|
8436
|
+
*
|
|
8437
|
+
* Present IFF a swap was actually priced, so its presence is the signal that
|
|
8438
|
+
* one happened. Absent when the action moves no equity, and absent when the
|
|
8439
|
+
* caller already holds the collateral: paying in the collateral itself needs no
|
|
8440
|
+
* funding swap, and a block whose input and output name the same token and the
|
|
8441
|
+
* same amount describes no trade.
|
|
8442
|
+
*
|
|
8443
|
+
* 7 was auto_slippage: a request-side mode, never an answer. What a caller
|
|
8444
|
+
* needs back is the percent it RESOLVED to, which slippage_tolerance already
|
|
8445
|
+
* carries.
|
|
8446
|
+
* 8 was protocols: an echo of the request that no consumer read, and as a
|
|
8447
|
+
* repeated field it serializes as [] whether the caller named none or the
|
|
8448
|
+
* route used none, so it could not carry its own meaning.
|
|
8449
|
+
*
|
|
8450
|
+
* @generated from message trading.v1.MarginFunding
|
|
8451
|
+
*/
|
|
8452
|
+
export declare class MarginFunding extends Message<MarginFunding> {
|
|
8453
|
+
/**
|
|
8454
|
+
* @generated from field: int32 token_in_chain_id = 1;
|
|
8455
|
+
*/
|
|
8456
|
+
tokenInChainId: number;
|
|
8457
|
+
/**
|
|
8458
|
+
* @generated from field: trading.v1.QuoteInput input = 3;
|
|
8459
|
+
*/
|
|
8460
|
+
input?: QuoteInput;
|
|
8461
|
+
/**
|
|
8462
|
+
* @generated from field: trading.v1.QuoteOutput output = 4;
|
|
8463
|
+
*/
|
|
8464
|
+
output?: QuoteOutput;
|
|
8465
|
+
/**
|
|
8466
|
+
* The tolerance the floor was derived at, which is what POST /plan
|
|
8467
|
+
* re-derives against. Present even when the request asked for auto.
|
|
8468
|
+
*
|
|
8469
|
+
* @generated from field: optional double slippage_tolerance = 6;
|
|
8470
|
+
*/
|
|
8471
|
+
slippageTolerance?: number;
|
|
8472
|
+
/**
|
|
8473
|
+
* Cross-chain pay-in only: the guaranteed bridge floor.
|
|
8474
|
+
*
|
|
8475
|
+
* @generated from field: optional string min_bridge_out = 9;
|
|
8476
|
+
*/
|
|
8477
|
+
minBridgeOut?: string;
|
|
8478
|
+
/**
|
|
8479
|
+
* Percent, as /quote reports it: how far this swap lands from the pool's
|
|
8480
|
+
* price. Reported, never refused. This leg spends the caller's own money at
|
|
8481
|
+
* the tolerance they chose, unlike the leverage leg, whose impact is
|
|
8482
|
+
* multiplied by leverage and is refused past a ceiling.
|
|
8483
|
+
*
|
|
8484
|
+
* @generated from field: optional double price_impact = 10;
|
|
8485
|
+
*/
|
|
8486
|
+
priceImpact?: number;
|
|
8487
|
+
constructor(data?: PartialMessage<MarginFunding>);
|
|
8488
|
+
static readonly runtime: typeof proto3;
|
|
8489
|
+
static readonly typeName = "trading.v1.MarginFunding";
|
|
8490
|
+
static readonly fields: FieldList;
|
|
8491
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginFunding;
|
|
8492
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginFunding;
|
|
8493
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginFunding;
|
|
8494
|
+
static equals(a: MarginFunding | PlainMessage<MarginFunding> | undefined, b: MarginFunding | PlainMessage<MarginFunding> | undefined): boolean;
|
|
8495
|
+
}
|
|
8496
|
+
/**
|
|
8497
|
+
* Everything POST /plan needs, and nothing it does not. This subtree is what a
|
|
8498
|
+
* client echoes back to create a plan; `display` never is.
|
|
8499
|
+
*
|
|
8500
|
+
* @generated from message trading.v1.MarginExecution
|
|
8501
|
+
*/
|
|
8502
|
+
export declare class MarginExecution extends Message<MarginExecution> {
|
|
8503
|
+
/**
|
|
8504
|
+
* @generated from field: int32 position_chain_id = 1;
|
|
8505
|
+
*/
|
|
8506
|
+
positionChainId: number;
|
|
8507
|
+
/**
|
|
8508
|
+
* @generated from field: string swapper = 2;
|
|
8509
|
+
*/
|
|
8510
|
+
swapper: string;
|
|
8511
|
+
/**
|
|
8512
|
+
* @generated from field: string exposure_token = 3;
|
|
8513
|
+
*/
|
|
8514
|
+
exposureToken: string;
|
|
8515
|
+
/**
|
|
8516
|
+
* @generated from field: string counter_token = 4;
|
|
8517
|
+
*/
|
|
8518
|
+
counterToken: string;
|
|
8519
|
+
/**
|
|
8520
|
+
* @generated from field: trading.v1.MarginDirection direction = 5;
|
|
8521
|
+
*/
|
|
8522
|
+
direction: MarginDirection;
|
|
8523
|
+
/**
|
|
8524
|
+
* @generated from field: trading.v1.MarginIntent intent = 6;
|
|
8525
|
+
*/
|
|
8526
|
+
intent: MarginIntent;
|
|
8527
|
+
/**
|
|
8528
|
+
* Absent on open.
|
|
8529
|
+
*
|
|
8530
|
+
* @generated from field: optional string position_id = 7;
|
|
8531
|
+
*/
|
|
8532
|
+
positionId?: string;
|
|
8533
|
+
/**
|
|
8534
|
+
* Present iff the action names a leverage direction.
|
|
8535
|
+
*
|
|
8536
|
+
* @generated from field: optional string leverage_target = 8;
|
|
8537
|
+
*/
|
|
8538
|
+
leverageTarget?: string;
|
|
8539
|
+
/**
|
|
8540
|
+
* The leverage leg's confirmed control, and only the tolerance. There is no
|
|
8541
|
+
* AMM allowlist here: the leverage leg is v4 by construction, since route
|
|
8542
|
+
* discovery keeps only v4 pools and the price is re-quoted through the v4
|
|
8543
|
+
* quoter, so it could not honour one. The wallet-side swap is a real
|
|
8544
|
+
* aggregator swap and carries its own in swap_config.protocols.
|
|
8545
|
+
*
|
|
8546
|
+
* @generated from field: optional double slippage_tolerance = 9;
|
|
8547
|
+
*/
|
|
8548
|
+
slippageTolerance?: number;
|
|
8549
|
+
/**
|
|
8550
|
+
* @generated from field: optional trading.v1.MarginFunding funding = 11;
|
|
8551
|
+
*/
|
|
8552
|
+
funding?: MarginFunding;
|
|
8553
|
+
/**
|
|
8554
|
+
* @generated from field: repeated trading.v1.MarginExecutionLeg legs = 12;
|
|
8555
|
+
*/
|
|
8556
|
+
legs: MarginExecutionLeg[];
|
|
8557
|
+
constructor(data?: PartialMessage<MarginExecution>);
|
|
8558
|
+
static readonly runtime: typeof proto3;
|
|
8559
|
+
static readonly typeName = "trading.v1.MarginExecution";
|
|
8560
|
+
static readonly fields: FieldList;
|
|
8561
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginExecution;
|
|
8562
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginExecution;
|
|
8563
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginExecution;
|
|
8564
|
+
static equals(a: MarginExecution | PlainMessage<MarginExecution> | undefined, b: MarginExecution | PlainMessage<MarginExecution> | undefined): boolean;
|
|
8565
|
+
}
|
|
8566
|
+
/**
|
|
8567
|
+
* What the confirmation modal renders. Projections of the position IF this
|
|
8568
|
+
* action executes; present state lives on GET /margin/positions. Ignored by
|
|
8569
|
+
* POST /plan: projections are not execution inputs.
|
|
8570
|
+
*
|
|
8571
|
+
* @generated from message trading.v1.MarginDisplay
|
|
8572
|
+
*/
|
|
8573
|
+
export declare class MarginDisplay extends Message<MarginDisplay> {
|
|
8574
|
+
/**
|
|
8575
|
+
* Exposure asset, summed across legs.
|
|
8576
|
+
*
|
|
8577
|
+
* @generated from field: optional string size = 1;
|
|
8578
|
+
*/
|
|
8579
|
+
size?: string;
|
|
8580
|
+
/**
|
|
8581
|
+
* Position / equity, decimal string as on the request.
|
|
8582
|
+
*
|
|
8583
|
+
* @generated from field: optional string leverage = 2;
|
|
8584
|
+
*/
|
|
8585
|
+
leverage?: string;
|
|
8586
|
+
/**
|
|
8587
|
+
* Quoted fill incl. fees, impact and slippage. Size-weighted across legs.
|
|
8588
|
+
*
|
|
8589
|
+
* @generated from field: optional string effective_price = 3;
|
|
8590
|
+
*/
|
|
8591
|
+
effectivePrice?: string;
|
|
8592
|
+
/**
|
|
8593
|
+
* Oracle price at which LTV = LLTV. Multi-leg: the nearest leg's, because
|
|
8594
|
+
* legs liquidate independently.
|
|
8595
|
+
*
|
|
8596
|
+
* @generated from field: optional string liquidation_price = 4;
|
|
8597
|
+
*/
|
|
8598
|
+
liquidationPrice?: string;
|
|
8599
|
+
/**
|
|
8600
|
+
* collateral x LLTV / debt; liquidatable below 1. Nearest leg. The one risk
|
|
8601
|
+
* number that normalizes across venues, so it is what the client bands into
|
|
8602
|
+
* Healthy / Caution / Risky. The band thresholds are a product call and stay
|
|
8603
|
+
* client-side.
|
|
8604
|
+
*
|
|
8605
|
+
* @generated from field: optional string health_factor = 6;
|
|
8606
|
+
*/
|
|
8607
|
+
healthFactor?: string;
|
|
8608
|
+
/**
|
|
8609
|
+
* Annualized borrow rate on the debt, size-weighted across legs.
|
|
8610
|
+
*
|
|
8611
|
+
* @generated from field: optional string borrow_rate = 7;
|
|
8612
|
+
*/
|
|
8613
|
+
borrowRate?: string;
|
|
8614
|
+
/**
|
|
8615
|
+
* Venue liquidation-reference price.
|
|
8616
|
+
*
|
|
8617
|
+
* @generated from field: optional string oracle_price = 8;
|
|
8618
|
+
*/
|
|
8619
|
+
oraclePrice?: string;
|
|
8620
|
+
/**
|
|
8621
|
+
* close only.
|
|
8622
|
+
*
|
|
8623
|
+
* @generated from field: optional string collateral_returned = 9;
|
|
8624
|
+
*/
|
|
8625
|
+
collateralReturned?: string;
|
|
8626
|
+
/**
|
|
8627
|
+
* @generated from field: optional string debt_repaid = 10;
|
|
8628
|
+
*/
|
|
8629
|
+
debtRepaid?: string;
|
|
8630
|
+
constructor(data?: PartialMessage<MarginDisplay>);
|
|
8631
|
+
static readonly runtime: typeof proto3;
|
|
8632
|
+
static readonly typeName = "trading.v1.MarginDisplay";
|
|
8633
|
+
static readonly fields: FieldList;
|
|
8634
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginDisplay;
|
|
8635
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginDisplay;
|
|
8636
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginDisplay;
|
|
8637
|
+
static equals(a: MarginDisplay | PlainMessage<MarginDisplay> | undefined, b: MarginDisplay | PlainMessage<MarginDisplay> | undefined): boolean;
|
|
8638
|
+
}
|
|
8639
|
+
/**
|
|
8640
|
+
* @generated from message trading.v1.MarginQuoteResponse
|
|
8641
|
+
*/
|
|
8642
|
+
export declare class MarginQuoteResponse extends Message<MarginQuoteResponse> {
|
|
8643
|
+
/**
|
|
8644
|
+
* @generated from field: string request_id = 1;
|
|
8645
|
+
*/
|
|
8646
|
+
requestId: string;
|
|
8647
|
+
/**
|
|
8648
|
+
* @generated from field: trading.v1.MarginExecution execution = 2;
|
|
8649
|
+
*/
|
|
8650
|
+
execution?: MarginExecution;
|
|
8651
|
+
/**
|
|
8652
|
+
* @generated from field: trading.v1.MarginDisplay display = 3;
|
|
8653
|
+
*/
|
|
8654
|
+
display?: MarginDisplay;
|
|
8655
|
+
/**
|
|
8656
|
+
* Indicative.
|
|
8657
|
+
*
|
|
8658
|
+
* @generated from field: optional trading.v1.GasEstimate gas_estimate = 4;
|
|
8659
|
+
*/
|
|
8660
|
+
gasEstimate?: GasEstimate;
|
|
8661
|
+
constructor(data?: PartialMessage<MarginQuoteResponse>);
|
|
8662
|
+
static readonly runtime: typeof proto3;
|
|
8663
|
+
static readonly typeName = "trading.v1.MarginQuoteResponse";
|
|
8664
|
+
static readonly fields: FieldList;
|
|
8665
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MarginQuoteResponse;
|
|
8666
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): MarginQuoteResponse;
|
|
8667
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): MarginQuoteResponse;
|
|
8668
|
+
static equals(a: MarginQuoteResponse | PlainMessage<MarginQuoteResponse> | undefined, b: MarginQuoteResponse | PlainMessage<MarginQuoteResponse> | undefined): boolean;
|
|
8669
|
+
}
|