@dydxprotocol/v4-proto
Advanced tools
Comparing version 3.0.0-dev.0 to 3.0.0-rc.0
{ | ||
"name": "@dydxprotocol/v4-proto", | ||
"version": "3.0.0-dev.0", | ||
"version": "3.0.0-rc.0", | ||
"access": "public", | ||
@@ -5,0 +5,0 @@ "description": "Protos for dYdX v4 protocol", |
import { Rpc } from "../../helpers"; | ||
import * as _m0 from "protobufjs/minimal"; | ||
import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; | ||
import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, AreSubaccountsLiquidatableRequest, AreSubaccountsLiquidatableResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse } from "./query"; | ||
import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse } from "./query"; | ||
/** Query defines the gRPC querier service. */ | ||
@@ -13,5 +13,2 @@ | ||
clobPairAll(request?: QueryAllClobPairRequest): Promise<QueryClobPairAllResponse>; | ||
/** Returns whether a subaccount is liquidatable. */ | ||
areSubaccountsLiquidatable(request: AreSubaccountsLiquidatableRequest): Promise<AreSubaccountsLiquidatableResponse>; | ||
/** Runs the MEV node <> node calculation with the provided parameters. */ | ||
@@ -37,3 +34,2 @@ | ||
this.clobPairAll = this.clobPairAll.bind(this); | ||
this.areSubaccountsLiquidatable = this.areSubaccountsLiquidatable.bind(this); | ||
this.mevNodeToNodeCalculation = this.mevNodeToNodeCalculation.bind(this); | ||
@@ -59,8 +55,2 @@ this.equityTierLimitConfiguration = this.equityTierLimitConfiguration.bind(this); | ||
areSubaccountsLiquidatable(request: AreSubaccountsLiquidatableRequest): Promise<AreSubaccountsLiquidatableResponse> { | ||
const data = AreSubaccountsLiquidatableRequest.encode(request).finish(); | ||
const promise = this.rpc.request("dydxprotocol.clob.Query", "AreSubaccountsLiquidatable", data); | ||
return promise.then(data => AreSubaccountsLiquidatableResponse.decode(new _m0.Reader(data))); | ||
} | ||
mevNodeToNodeCalculation(request: MevNodeToNodeCalculationRequest): Promise<MevNodeToNodeCalculationResponse> { | ||
@@ -103,6 +93,2 @@ const data = MevNodeToNodeCalculationRequest.encode(request).finish(); | ||
areSubaccountsLiquidatable(request: AreSubaccountsLiquidatableRequest): Promise<AreSubaccountsLiquidatableResponse> { | ||
return queryService.areSubaccountsLiquidatable(request); | ||
}, | ||
mevNodeToNodeCalculation(request: MevNodeToNodeCalculationRequest): Promise<MevNodeToNodeCalculationResponse> { | ||
@@ -109,0 +95,0 @@ return queryService.mevNodeToNodeCalculation(request); |
import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; | ||
import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; | ||
import { ValidatorMevMatches, ValidatorMevMatchesSDKType, MevNodeToNodeMetrics, MevNodeToNodeMetricsSDKType } from "./mev"; | ||
@@ -54,48 +53,2 @@ import { ClobPair, ClobPairSDKType } from "./clob_pair"; | ||
/** | ||
* AreSubaccountsLiquidatableRequest is a request message used to check whether | ||
* the given subaccounts are liquidatable. | ||
* The subaccount ids should not contain duplicates. | ||
*/ | ||
export interface AreSubaccountsLiquidatableRequest { | ||
subaccountIds: SubaccountId[]; | ||
} | ||
/** | ||
* AreSubaccountsLiquidatableRequest is a request message used to check whether | ||
* the given subaccounts are liquidatable. | ||
* The subaccount ids should not contain duplicates. | ||
*/ | ||
export interface AreSubaccountsLiquidatableRequestSDKType { | ||
subaccount_ids: SubaccountIdSDKType[]; | ||
} | ||
/** | ||
* AreSubaccountsLiquidatableResponse is a response message that contains the | ||
* liquidation status for each subaccount. | ||
*/ | ||
export interface AreSubaccountsLiquidatableResponse { | ||
results: AreSubaccountsLiquidatableResponse_Result[]; | ||
} | ||
/** | ||
* AreSubaccountsLiquidatableResponse is a response message that contains the | ||
* liquidation status for each subaccount. | ||
*/ | ||
export interface AreSubaccountsLiquidatableResponseSDKType { | ||
results: AreSubaccountsLiquidatableResponse_ResultSDKType[]; | ||
} | ||
/** Result returns whether a subaccount should be liquidated. */ | ||
export interface AreSubaccountsLiquidatableResponse_Result { | ||
subaccountId?: SubaccountId; | ||
isLiquidatable: boolean; | ||
} | ||
/** Result returns whether a subaccount should be liquidated. */ | ||
export interface AreSubaccountsLiquidatableResponse_ResultSDKType { | ||
subaccount_id?: SubaccountIdSDKType; | ||
is_liquidatable: boolean; | ||
} | ||
/** | ||
* MevNodeToNodeCalculationRequest is a request message used to run the | ||
@@ -431,147 +384,2 @@ * MEV node <> node calculation. | ||
function createBaseAreSubaccountsLiquidatableRequest(): AreSubaccountsLiquidatableRequest { | ||
return { | ||
subaccountIds: [] | ||
}; | ||
} | ||
export const AreSubaccountsLiquidatableRequest = { | ||
encode(message: AreSubaccountsLiquidatableRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
for (const v of message.subaccountIds) { | ||
SubaccountId.encode(v!, writer.uint32(10).fork()).ldelim(); | ||
} | ||
return writer; | ||
}, | ||
decode(input: _m0.Reader | Uint8Array, length?: number): AreSubaccountsLiquidatableRequest { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseAreSubaccountsLiquidatableRequest(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.subaccountIds.push(SubaccountId.decode(reader, reader.uint32())); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
fromPartial(object: DeepPartial<AreSubaccountsLiquidatableRequest>): AreSubaccountsLiquidatableRequest { | ||
const message = createBaseAreSubaccountsLiquidatableRequest(); | ||
message.subaccountIds = object.subaccountIds?.map(e => SubaccountId.fromPartial(e)) || []; | ||
return message; | ||
} | ||
}; | ||
function createBaseAreSubaccountsLiquidatableResponse(): AreSubaccountsLiquidatableResponse { | ||
return { | ||
results: [] | ||
}; | ||
} | ||
export const AreSubaccountsLiquidatableResponse = { | ||
encode(message: AreSubaccountsLiquidatableResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
for (const v of message.results) { | ||
AreSubaccountsLiquidatableResponse_Result.encode(v!, writer.uint32(10).fork()).ldelim(); | ||
} | ||
return writer; | ||
}, | ||
decode(input: _m0.Reader | Uint8Array, length?: number): AreSubaccountsLiquidatableResponse { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseAreSubaccountsLiquidatableResponse(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.results.push(AreSubaccountsLiquidatableResponse_Result.decode(reader, reader.uint32())); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
fromPartial(object: DeepPartial<AreSubaccountsLiquidatableResponse>): AreSubaccountsLiquidatableResponse { | ||
const message = createBaseAreSubaccountsLiquidatableResponse(); | ||
message.results = object.results?.map(e => AreSubaccountsLiquidatableResponse_Result.fromPartial(e)) || []; | ||
return message; | ||
} | ||
}; | ||
function createBaseAreSubaccountsLiquidatableResponse_Result(): AreSubaccountsLiquidatableResponse_Result { | ||
return { | ||
subaccountId: undefined, | ||
isLiquidatable: false | ||
}; | ||
} | ||
export const AreSubaccountsLiquidatableResponse_Result = { | ||
encode(message: AreSubaccountsLiquidatableResponse_Result, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
if (message.subaccountId !== undefined) { | ||
SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim(); | ||
} | ||
if (message.isLiquidatable === true) { | ||
writer.uint32(16).bool(message.isLiquidatable); | ||
} | ||
return writer; | ||
}, | ||
decode(input: _m0.Reader | Uint8Array, length?: number): AreSubaccountsLiquidatableResponse_Result { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseAreSubaccountsLiquidatableResponse_Result(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.subaccountId = SubaccountId.decode(reader, reader.uint32()); | ||
break; | ||
case 2: | ||
message.isLiquidatable = reader.bool(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
fromPartial(object: DeepPartial<AreSubaccountsLiquidatableResponse_Result>): AreSubaccountsLiquidatableResponse_Result { | ||
const message = createBaseAreSubaccountsLiquidatableResponse_Result(); | ||
message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; | ||
message.isLiquidatable = object.isLiquidatable ?? false; | ||
return message; | ||
} | ||
}; | ||
function createBaseMevNodeToNodeCalculationRequest(): MevNodeToNodeCalculationRequest { | ||
@@ -578,0 +386,0 @@ return { |
import { SubaccountId, SubaccountIdSDKType } from "../../subaccounts/subaccount"; | ||
import { SubaccountOpenPositionInfo, SubaccountOpenPositionInfoSDKType } from "../../clob/liquidations"; | ||
import * as _m0 from "protobufjs/minimal"; | ||
@@ -12,3 +13,11 @@ import { DeepPartial } from "../../../helpers"; | ||
export interface LiquidateSubaccountsRequest { | ||
subaccountIds: SubaccountId[]; | ||
/** The block height at which the liquidation daemon is processing. */ | ||
blockHeight: number; | ||
/** The list of liquidatable subaccount ids. */ | ||
liquidatableSubaccountIds: SubaccountId[]; | ||
/** The list of subaccount ids with negative total net collateral. */ | ||
negativeTncSubaccountIds: SubaccountId[]; | ||
subaccountOpenPositionInfo: SubaccountOpenPositionInfo[]; | ||
} | ||
@@ -23,3 +32,6 @@ /** | ||
export interface LiquidateSubaccountsRequestSDKType { | ||
subaccount_ids: SubaccountIdSDKType[]; | ||
block_height: number; | ||
liquidatable_subaccount_ids: SubaccountIdSDKType[]; | ||
negative_tnc_subaccount_ids: SubaccountIdSDKType[]; | ||
subaccount_open_position_info: SubaccountOpenPositionInfoSDKType[]; | ||
} | ||
@@ -41,3 +53,6 @@ /** | ||
return { | ||
subaccountIds: [] | ||
blockHeight: 0, | ||
liquidatableSubaccountIds: [], | ||
negativeTncSubaccountIds: [], | ||
subaccountOpenPositionInfo: [] | ||
}; | ||
@@ -48,6 +63,18 @@ } | ||
encode(message: LiquidateSubaccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
for (const v of message.subaccountIds) { | ||
SubaccountId.encode(v!, writer.uint32(10).fork()).ldelim(); | ||
if (message.blockHeight !== 0) { | ||
writer.uint32(8).uint32(message.blockHeight); | ||
} | ||
for (const v of message.liquidatableSubaccountIds) { | ||
SubaccountId.encode(v!, writer.uint32(18).fork()).ldelim(); | ||
} | ||
for (const v of message.negativeTncSubaccountIds) { | ||
SubaccountId.encode(v!, writer.uint32(26).fork()).ldelim(); | ||
} | ||
for (const v of message.subaccountOpenPositionInfo) { | ||
SubaccountOpenPositionInfo.encode(v!, writer.uint32(34).fork()).ldelim(); | ||
} | ||
return writer; | ||
@@ -66,5 +93,17 @@ }, | ||
case 1: | ||
message.subaccountIds.push(SubaccountId.decode(reader, reader.uint32())); | ||
message.blockHeight = reader.uint32(); | ||
break; | ||
case 2: | ||
message.liquidatableSubaccountIds.push(SubaccountId.decode(reader, reader.uint32())); | ||
break; | ||
case 3: | ||
message.negativeTncSubaccountIds.push(SubaccountId.decode(reader, reader.uint32())); | ||
break; | ||
case 4: | ||
message.subaccountOpenPositionInfo.push(SubaccountOpenPositionInfo.decode(reader, reader.uint32())); | ||
break; | ||
default: | ||
@@ -81,3 +120,6 @@ reader.skipType(tag & 7); | ||
const message = createBaseLiquidateSubaccountsRequest(); | ||
message.subaccountIds = object.subaccountIds?.map(e => SubaccountId.fromPartial(e)) || []; | ||
message.blockHeight = object.blockHeight ?? 0; | ||
message.liquidatableSubaccountIds = object.liquidatableSubaccountIds?.map(e => SubaccountId.fromPartial(e)) || []; | ||
message.negativeTncSubaccountIds = object.negativeTncSubaccountIds?.map(e => SubaccountId.fromPartial(e)) || []; | ||
message.subaccountOpenPositionInfo = object.subaccountOpenPositionInfo?.map(e => SubaccountOpenPositionInfo.fromPartial(e)) || []; | ||
return message; | ||
@@ -84,0 +126,0 @@ } |
@@ -241,4 +241,5 @@ import { IndexerSubaccountId, IndexerSubaccountIdSDKType } from "./subaccount"; | ||
* deactivated. Clob pairs in this state do not accept new orders and trading | ||
* is blocked. All open positions are closed by the protocol when the clob | ||
* pair gains this status. | ||
* is blocked. All open positions are closed and open stateful orders canceled | ||
* by the protocol when the clob pair transitions to this status. All | ||
* short-term orders are left to expire. | ||
*/ | ||
@@ -245,0 +246,0 @@ CLOB_PAIR_STATUS_FINAL_SETTLEMENT = 6, |
3027976
81278