From 64d20e2ce772ae57f62c5f87891f04e0a8f02f19 Mon Sep 17 00:00:00 2001 From: jayy04 <103467857+jayy04@users.noreply.github.com> Date: Tue, 14 May 2024 07:16:13 -0400 Subject: [PATCH] [CT-834] new endpoint for stateful orders (#1501) * [CT-834] new endpoint for stateful orders * fix test * indexer (cherry picked from commit c24be3a49245400b353997f4a4704f72ecd37e40) # Conflicts: # indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.rpc.Query.ts # indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts # protocol/x/clob/types/query.pb.go --- .../dydxprotocol/clob/query.rpc.Query.ts | 23 +- .../src/codegen/dydxprotocol/clob/query.ts | 157 +++ proto/dydxprotocol/clob/query.proto | 23 + protocol/mocks/QueryClient.go | 37 + protocol/x/clob/client/cli/query.go | 1 + .../x/clob/client/cli/query_stateful_order.go | 70 ++ .../clob/keeper/grpc_query_stateful_order.go | 43 + .../keeper/grpc_query_stateful_order_test.go | 52 + protocol/x/clob/module_test.go | 3 +- protocol/x/clob/types/query.pb.go | 936 +++++++++++++++++- 10 files changed, 1304 insertions(+), 41 deletions(-) create mode 100644 protocol/x/clob/client/cli/query_stateful_order.go create mode 100644 protocol/x/clob/keeper/grpc_query_stateful_order.go create mode 100644 protocol/x/clob/keeper/grpc_query_stateful_order_test.go diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.rpc.Query.ts index 4b5ccc331b3..4d135a61081 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse, StreamOrderbookUpdatesRequest, StreamOrderbookUpdatesResponse } from "./query"; +import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse, QueryStatefulOrderRequest, QueryStatefulOrderResponse, StreamOrderbookUpdatesRequest, StreamOrderbookUpdatesResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { @@ -22,7 +22,17 @@ export interface Query { /** Queries LiquidationsConfiguration. */ liquidationsConfiguration(request?: QueryLiquidationsConfigurationRequest): Promise; +<<<<<<< HEAD /** Streams orderbook updates. */ +======= + /** Queries the stateful order for a given order id. */ + + statefulOrder(request: QueryStatefulOrderRequest): Promise; + /** + * Streams orderbook updates. Updates contain orderbook data + * such as order placements, updates, and fills. + */ +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) streamOrderbookUpdates(request: StreamOrderbookUpdatesRequest): Promise; } @@ -37,6 +47,7 @@ export class QueryClientImpl implements Query { this.equityTierLimitConfiguration = this.equityTierLimitConfiguration.bind(this); this.blockRateLimitConfiguration = this.blockRateLimitConfiguration.bind(this); this.liquidationsConfiguration = this.liquidationsConfiguration.bind(this); + this.statefulOrder = this.statefulOrder.bind(this); this.streamOrderbookUpdates = this.streamOrderbookUpdates.bind(this); } @@ -78,6 +89,12 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryLiquidationsConfigurationResponse.decode(new _m0.Reader(data))); } + statefulOrder(request: QueryStatefulOrderRequest): Promise { + const data = QueryStatefulOrderRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.clob.Query", "StatefulOrder", data); + return promise.then(data => QueryStatefulOrderResponse.decode(new _m0.Reader(data))); + } + streamOrderbookUpdates(request: StreamOrderbookUpdatesRequest): Promise { const data = StreamOrderbookUpdatesRequest.encode(request).finish(); const promise = this.rpc.request("dydxprotocol.clob.Query", "StreamOrderbookUpdates", data); @@ -113,6 +130,10 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.liquidationsConfiguration(request); }, + statefulOrder(request: QueryStatefulOrderRequest): Promise { + return queryService.statefulOrder(request); + }, + streamOrderbookUpdates(request: StreamOrderbookUpdatesRequest): Promise { return queryService.streamOrderbookUpdates(request); } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts index aa317878209..0794a07b7c7 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts @@ -1,10 +1,15 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; import { ValidatorMevMatches, ValidatorMevMatchesSDKType, MevNodeToNodeMetrics, MevNodeToNodeMetricsSDKType } from "./mev"; +import { OrderId, OrderIdSDKType, LongTermOrderPlacement, LongTermOrderPlacementSDKType, Order, OrderSDKType } from "./order"; import { ClobPair, ClobPairSDKType } from "./clob_pair"; import { EquityTierLimitConfiguration, EquityTierLimitConfigurationSDKType } from "./equity_tier_limit_config"; import { BlockRateLimitConfiguration, BlockRateLimitConfigurationSDKType } from "./block_rate_limit_config"; import { LiquidationsConfig, LiquidationsConfigSDKType } from "./liquidations_config"; import { OffChainUpdateV1, OffChainUpdateV1SDKType } from "../indexer/off_chain_updates/off_chain_updates"; +<<<<<<< HEAD +======= +import { ClobMatch, ClobMatchSDKType } from "./matches"; +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) import * as _m0 from "protobufjs/minimal"; import { DeepPartial, Long } from "../../helpers"; /** QueryGetClobPairRequest is request type for the ClobPair method. */ @@ -171,6 +176,48 @@ export interface QueryBlockRateLimitConfigurationResponse { export interface QueryBlockRateLimitConfigurationResponseSDKType { block_rate_limit_config?: BlockRateLimitConfigurationSDKType; } +/** QueryStatefulOrderRequest is a request message for StatefulOrder. */ + +export interface QueryStatefulOrderRequest { + /** Order id to query. */ + orderId?: OrderId; +} +/** QueryStatefulOrderRequest is a request message for StatefulOrder. */ + +export interface QueryStatefulOrderRequestSDKType { + /** Order id to query. */ + order_id?: OrderIdSDKType; +} +/** + * QueryStatefulOrderResponse is a response message that contains the stateful + * order. + */ + +export interface QueryStatefulOrderResponse { + /** Stateful order placement. */ + orderPlacement?: LongTermOrderPlacement; + /** Fill amounts. */ + + fillAmount: Long; + /** Triggered status. */ + + triggered: boolean; +} +/** + * QueryStatefulOrderResponse is a response message that contains the stateful + * order. + */ + +export interface QueryStatefulOrderResponseSDKType { + /** Stateful order placement. */ + order_placement?: LongTermOrderPlacementSDKType; + /** Fill amounts. */ + + fill_amount: Long; + /** Triggered status. */ + + triggered: boolean; +} /** * QueryLiquidationsConfigurationRequest is a request message for * LiquidationsConfiguration. @@ -783,6 +830,116 @@ export const QueryBlockRateLimitConfigurationResponse = { }; +function createBaseQueryStatefulOrderRequest(): QueryStatefulOrderRequest { + return { + orderId: undefined + }; +} + +export const QueryStatefulOrderRequest = { + encode(message: QueryStatefulOrderRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.orderId !== undefined) { + OrderId.encode(message.orderId, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStatefulOrderRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStatefulOrderRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.orderId = OrderId.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryStatefulOrderRequest { + const message = createBaseQueryStatefulOrderRequest(); + message.orderId = object.orderId !== undefined && object.orderId !== null ? OrderId.fromPartial(object.orderId) : undefined; + return message; + } + +}; + +function createBaseQueryStatefulOrderResponse(): QueryStatefulOrderResponse { + return { + orderPlacement: undefined, + fillAmount: Long.UZERO, + triggered: false + }; +} + +export const QueryStatefulOrderResponse = { + encode(message: QueryStatefulOrderResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.orderPlacement !== undefined) { + LongTermOrderPlacement.encode(message.orderPlacement, writer.uint32(10).fork()).ldelim(); + } + + if (!message.fillAmount.isZero()) { + writer.uint32(16).uint64(message.fillAmount); + } + + if (message.triggered === true) { + writer.uint32(24).bool(message.triggered); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryStatefulOrderResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStatefulOrderResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.orderPlacement = LongTermOrderPlacement.decode(reader, reader.uint32()); + break; + + case 2: + message.fillAmount = (reader.uint64() as Long); + break; + + case 3: + message.triggered = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryStatefulOrderResponse { + const message = createBaseQueryStatefulOrderResponse(); + message.orderPlacement = object.orderPlacement !== undefined && object.orderPlacement !== null ? LongTermOrderPlacement.fromPartial(object.orderPlacement) : undefined; + message.fillAmount = object.fillAmount !== undefined && object.fillAmount !== null ? Long.fromValue(object.fillAmount) : Long.UZERO; + message.triggered = object.triggered ?? false; + return message; + } + +}; + function createBaseQueryLiquidationsConfigurationRequest(): QueryLiquidationsConfigurationRequest { return {}; } diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 37457568948..e97357b941e 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -52,6 +52,10 @@ service Query { option (google.api.http).get = "/dydxprotocol/clob/liquidations_config"; } + // Queries the stateful order for a given order id. + rpc StatefulOrder(QueryStatefulOrderRequest) + returns (QueryStatefulOrderResponse) {} + // GRPC Streams // Streams orderbook updates. @@ -124,6 +128,25 @@ message QueryBlockRateLimitConfigurationResponse { [ (gogoproto.nullable) = false ]; } +// QueryStatefulOrderRequest is a request message for StatefulOrder. +message QueryStatefulOrderRequest { + // Order id to query. + OrderId order_id = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryStatefulOrderResponse is a response message that contains the stateful +// order. +message QueryStatefulOrderResponse { + // Stateful order placement. + LongTermOrderPlacement order_placement = 1 [ (gogoproto.nullable) = false ]; + + // Fill amounts. + uint64 fill_amount = 2; + + // Triggered status. + bool triggered = 3; +} + // QueryLiquidationsConfigurationRequest is a request message for // LiquidationsConfiguration. message QueryLiquidationsConfigurationRequest {} diff --git a/protocol/mocks/QueryClient.go b/protocol/mocks/QueryClient.go index bd9c3832e8e..ad66aec1581 100644 --- a/protocol/mocks/QueryClient.go +++ b/protocol/mocks/QueryClient.go @@ -756,6 +756,43 @@ func (_m *QueryClient) PreviousBlockInfo(ctx context.Context, in *types.QueryPre return r0, r1 } +// StatefulOrder provides a mock function with given fields: ctx, in, opts +func (_m *QueryClient) StatefulOrder(ctx context.Context, in *clobtypes.QueryStatefulOrderRequest, opts ...grpc.CallOption) (*clobtypes.QueryStatefulOrderResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for StatefulOrder") + } + + var r0 *clobtypes.QueryStatefulOrderResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *clobtypes.QueryStatefulOrderRequest, ...grpc.CallOption) (*clobtypes.QueryStatefulOrderResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *clobtypes.QueryStatefulOrderRequest, ...grpc.CallOption) *clobtypes.QueryStatefulOrderResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clobtypes.QueryStatefulOrderResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *clobtypes.QueryStatefulOrderRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // StreamOrderbookUpdates provides a mock function with given fields: ctx, in, opts func (_m *QueryClient) StreamOrderbookUpdates(ctx context.Context, in *clobtypes.StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (clobtypes.Query_StreamOrderbookUpdatesClient, error) { _va := make([]interface{}, len(opts)) diff --git a/protocol/x/clob/client/cli/query.go b/protocol/x/clob/client/cli/query.go index d6dcb9025d7..6c7a49f77ce 100644 --- a/protocol/x/clob/client/cli/query.go +++ b/protocol/x/clob/client/cli/query.go @@ -26,6 +26,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdGetBlockRateLimitConfiguration()) cmd.AddCommand(CmdGetEquityTierLimitConfig()) cmd.AddCommand(CmdGetLiquidationsConfiguration()) + cmd.AddCommand(CmdQueryStatefulOrder()) return cmd } diff --git a/protocol/x/clob/client/cli/query_stateful_order.go b/protocol/x/clob/client/cli/query_stateful_order.go new file mode 100644 index 00000000000..09cf30dc8e2 --- /dev/null +++ b/protocol/x/clob/client/cli/query_stateful_order.go @@ -0,0 +1,70 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" + "github.com/spf13/cast" + "github.com/spf13/cobra" +) + +func CmdQueryStatefulOrder() *cobra.Command { + cmd := &cobra.Command{ + Use: "stateful-order subaccount_owner subaccount_number client_id clob_pair_id order_flags", + Short: "queries a stateful order by id", + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + owner := args[0] + + number, err := cast.ToUint32E(args[1]) + if err != nil { + return err + } + + clientId, err := cast.ToUint32E(args[2]) + if err != nil { + return err + } + + clobPairId, err := cast.ToUint32E(args[3]) + if err != nil { + return err + } + + orderFlag, err := cast.ToUint32E(args[4]) + if err != nil { + return err + } + + req := &types.QueryStatefulOrderRequest{ + OrderId: types.OrderId{ + SubaccountId: satypes.SubaccountId{ + Owner: owner, + Number: number, + }, + ClientId: clientId, + ClobPairId: clobPairId, + OrderFlags: orderFlag, + }, + } + + res, err := queryClient.StatefulOrder(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/protocol/x/clob/keeper/grpc_query_stateful_order.go b/protocol/x/clob/keeper/grpc_query_stateful_order.go new file mode 100644 index 00000000000..5fdb3656950 --- /dev/null +++ b/protocol/x/clob/keeper/grpc_query_stateful_order.go @@ -0,0 +1,43 @@ +package keeper + +import ( + "context" + + "github.com/dydxprotocol/v4-chain/protocol/lib" + "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) StatefulOrder( + c context.Context, + req *types.QueryStatefulOrderRequest, +) (*types.QueryStatefulOrderResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := lib.UnwrapSDKContext(c, types.ModuleName) + + val, found := k.GetLongTermOrderPlacement( + ctx, + req.OrderId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + res := &types.QueryStatefulOrderResponse{ + OrderPlacement: val, + } + + // Get the fill amount + _, fillAmount, _ := k.GetOrderFillAmount(ctx, req.OrderId) + res.FillAmount = fillAmount.ToUint64() + + // Get triggered status for conditional orders + if req.OrderId.IsConditionalOrder() { + res.Triggered = k.IsConditionalOrderTriggered(ctx, req.OrderId) + } + + return res, nil +} diff --git a/protocol/x/clob/keeper/grpc_query_stateful_order_test.go b/protocol/x/clob/keeper/grpc_query_stateful_order_test.go new file mode 100644 index 00000000000..f99791d8387 --- /dev/null +++ b/protocol/x/clob/keeper/grpc_query_stateful_order_test.go @@ -0,0 +1,52 @@ +package keeper_test + +import ( + "testing" + + testApp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + "github.com/stretchr/testify/require" +) + +func TestStatefulOrderTest(t *testing.T) { + tApp := testApp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + + tApp.App.ClobKeeper.SetLongTermOrderPlacement( + ctx, + constants.LongTermOrder_Alice_Num0_Id0_Clob0_Buy100_Price10_GTBT15, + 1, + ) + + tApp.App.ClobKeeper.SetOrderFillAmount( + ctx, + constants.LongTermOrder_Alice_Num0_Id0_Clob0_Buy100_Price10_GTBT15.OrderId, + 5, + 123456789, + ) + + res, err := tApp.App.ClobKeeper.StatefulOrder( + ctx, + &types.QueryStatefulOrderRequest{ + OrderId: constants.LongTermOrder_Alice_Num0_Id0_Clob0_Buy100_Price10_GTBT15.OrderId, + }, + ) + + require.NoError(t, err) + require.Equal( + t, + &types.QueryStatefulOrderResponse{ + OrderPlacement: types.LongTermOrderPlacement{ + Order: constants.LongTermOrder_Alice_Num0_Id0_Clob0_Buy100_Price10_GTBT15, + PlacementIndex: types.TransactionOrdering{ + BlockHeight: 1, + TransactionIndex: 0, + }, + }, + FillAmount: 5, + Triggered: false, + }, + res, + ) +} diff --git a/protocol/x/clob/module_test.go b/protocol/x/clob/module_test.go index 643abde49e9..4217b6eb4df 100644 --- a/protocol/x/clob/module_test.go +++ b/protocol/x/clob/module_test.go @@ -250,12 +250,13 @@ func TestAppModuleBasic_GetQueryCmd(t *testing.T) { cmd := am.GetQueryCmd() require.Equal(t, "clob", cmd.Use) - require.Equal(t, 5, len(cmd.Commands())) + require.Equal(t, 6, len(cmd.Commands())) require.Equal(t, "get-block-rate-limit-config", cmd.Commands()[0].Name()) require.Equal(t, "get-equity-tier-limit-config", cmd.Commands()[1].Name()) require.Equal(t, "get-liquidations-config", cmd.Commands()[2].Name()) require.Equal(t, "list-clob-pair", cmd.Commands()[3].Name()) require.Equal(t, "show-clob-pair", cmd.Commands()[4].Name()) + require.Equal(t, "stateful-order", cmd.Commands()[5].Name()) } func TestAppModule_Name(t *testing.T) { diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index ee500746b53..b392f5d86ca 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -568,6 +568,117 @@ func (m *QueryBlockRateLimitConfigurationResponse) GetBlockRateLimitConfig() Blo return BlockRateLimitConfiguration{} } +// QueryStatefulOrderRequest is a request message for StatefulOrder. +type QueryStatefulOrderRequest struct { + // Order id to query. + OrderId OrderId `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id"` +} + +func (m *QueryStatefulOrderRequest) Reset() { *m = QueryStatefulOrderRequest{} } +func (m *QueryStatefulOrderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStatefulOrderRequest) ProtoMessage() {} +func (*QueryStatefulOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{10} +} +func (m *QueryStatefulOrderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStatefulOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStatefulOrderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryStatefulOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStatefulOrderRequest.Merge(m, src) +} +func (m *QueryStatefulOrderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStatefulOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStatefulOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStatefulOrderRequest proto.InternalMessageInfo + +func (m *QueryStatefulOrderRequest) GetOrderId() OrderId { + if m != nil { + return m.OrderId + } + return OrderId{} +} + +// QueryStatefulOrderResponse is a response message that contains the stateful +// order. +type QueryStatefulOrderResponse struct { + // Stateful order placement. + OrderPlacement LongTermOrderPlacement `protobuf:"bytes,1,opt,name=order_placement,json=orderPlacement,proto3" json:"order_placement"` + // Fill amounts. + FillAmount uint64 `protobuf:"varint,2,opt,name=fill_amount,json=fillAmount,proto3" json:"fill_amount,omitempty"` + // Triggered status. + Triggered bool `protobuf:"varint,3,opt,name=triggered,proto3" json:"triggered,omitempty"` +} + +func (m *QueryStatefulOrderResponse) Reset() { *m = QueryStatefulOrderResponse{} } +func (m *QueryStatefulOrderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStatefulOrderResponse) ProtoMessage() {} +func (*QueryStatefulOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{11} +} +func (m *QueryStatefulOrderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStatefulOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStatefulOrderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryStatefulOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStatefulOrderResponse.Merge(m, src) +} +func (m *QueryStatefulOrderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStatefulOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStatefulOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStatefulOrderResponse proto.InternalMessageInfo + +func (m *QueryStatefulOrderResponse) GetOrderPlacement() LongTermOrderPlacement { + if m != nil { + return m.OrderPlacement + } + return LongTermOrderPlacement{} +} + +func (m *QueryStatefulOrderResponse) GetFillAmount() uint64 { + if m != nil { + return m.FillAmount + } + return 0 +} + +func (m *QueryStatefulOrderResponse) GetTriggered() bool { + if m != nil { + return m.Triggered + } + return false +} + // QueryLiquidationsConfigurationRequest is a request message for // LiquidationsConfiguration. type QueryLiquidationsConfigurationRequest struct { @@ -577,7 +688,7 @@ func (m *QueryLiquidationsConfigurationRequest) Reset() { *m = QueryLiqu func (m *QueryLiquidationsConfigurationRequest) String() string { return proto.CompactTextString(m) } func (*QueryLiquidationsConfigurationRequest) ProtoMessage() {} func (*QueryLiquidationsConfigurationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{10} + return fileDescriptor_3365c195b25c5bc0, []int{12} } func (m *QueryLiquidationsConfigurationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -618,7 +729,7 @@ func (m *QueryLiquidationsConfigurationResponse) Reset() { func (m *QueryLiquidationsConfigurationResponse) String() string { return proto.CompactTextString(m) } func (*QueryLiquidationsConfigurationResponse) ProtoMessage() {} func (*QueryLiquidationsConfigurationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{11} + return fileDescriptor_3365c195b25c5bc0, []int{13} } func (m *QueryLiquidationsConfigurationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -665,7 +776,7 @@ func (m *StreamOrderbookUpdatesRequest) Reset() { *m = StreamOrderbookUp func (m *StreamOrderbookUpdatesRequest) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdatesRequest) ProtoMessage() {} func (*StreamOrderbookUpdatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{12} + return fileDescriptor_3365c195b25c5bc0, []int{14} } func (m *StreamOrderbookUpdatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -722,7 +833,7 @@ func (m *StreamOrderbookUpdatesResponse) Reset() { *m = StreamOrderbookU func (m *StreamOrderbookUpdatesResponse) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdatesResponse) ProtoMessage() {} func (*StreamOrderbookUpdatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{13} + return fileDescriptor_3365c195b25c5bc0, []int{15} } func (m *StreamOrderbookUpdatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -779,6 +890,227 @@ func (m *StreamOrderbookUpdatesResponse) GetExecMode() uint32 { return 0 } +<<<<<<< HEAD +======= +// StreamUpdate is an update that will be pushed through the +// GRPC stream. +type StreamUpdate struct { + // Contains one of an StreamOrderbookUpdate, + // StreamOrderbookFill. + // + // Types that are valid to be assigned to UpdateMessage: + // + // *StreamUpdate_OrderbookUpdate + // *StreamUpdate_OrderFill + UpdateMessage isStreamUpdate_UpdateMessage `protobuf_oneof:"update_message"` +} + +func (m *StreamUpdate) Reset() { *m = StreamUpdate{} } +func (m *StreamUpdate) String() string { return proto.CompactTextString(m) } +func (*StreamUpdate) ProtoMessage() {} +func (*StreamUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{16} +} +func (m *StreamUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamUpdate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StreamUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamUpdate.Merge(m, src) +} +func (m *StreamUpdate) XXX_Size() int { + return m.Size() +} +func (m *StreamUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_StreamUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamUpdate proto.InternalMessageInfo + +type isStreamUpdate_UpdateMessage interface { + isStreamUpdate_UpdateMessage() + MarshalTo([]byte) (int, error) + Size() int +} + +type StreamUpdate_OrderbookUpdate struct { + OrderbookUpdate *StreamOrderbookUpdate `protobuf:"bytes,1,opt,name=orderbook_update,json=orderbookUpdate,proto3,oneof" json:"orderbook_update,omitempty"` +} +type StreamUpdate_OrderFill struct { + OrderFill *StreamOrderbookFill `protobuf:"bytes,2,opt,name=order_fill,json=orderFill,proto3,oneof" json:"order_fill,omitempty"` +} + +func (*StreamUpdate_OrderbookUpdate) isStreamUpdate_UpdateMessage() {} +func (*StreamUpdate_OrderFill) isStreamUpdate_UpdateMessage() {} + +func (m *StreamUpdate) GetUpdateMessage() isStreamUpdate_UpdateMessage { + if m != nil { + return m.UpdateMessage + } + return nil +} + +func (m *StreamUpdate) GetOrderbookUpdate() *StreamOrderbookUpdate { + if x, ok := m.GetUpdateMessage().(*StreamUpdate_OrderbookUpdate); ok { + return x.OrderbookUpdate + } + return nil +} + +func (m *StreamUpdate) GetOrderFill() *StreamOrderbookFill { + if x, ok := m.GetUpdateMessage().(*StreamUpdate_OrderFill); ok { + return x.OrderFill + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*StreamUpdate) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*StreamUpdate_OrderbookUpdate)(nil), + (*StreamUpdate_OrderFill)(nil), + } +} + +// StreamOrderbookUpdate provides information on an orderbook update. Used in +// the full node GRPC stream. +type StreamOrderbookUpdate struct { + // Orderbook updates for the clob pair. Can contain order place, removals, + // or updates. + Updates []types.OffChainUpdateV1 `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` + // Snapshot indicates if the response is from a snapshot of the orderbook. + // This is true for the initial response and false for all subsequent updates. + // Note that if the snapshot is true, then all previous entries should be + // discarded and the orderbook should be resynced. + Snapshot bool `protobuf:"varint,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"` +} + +func (m *StreamOrderbookUpdate) Reset() { *m = StreamOrderbookUpdate{} } +func (m *StreamOrderbookUpdate) String() string { return proto.CompactTextString(m) } +func (*StreamOrderbookUpdate) ProtoMessage() {} +func (*StreamOrderbookUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{17} +} +func (m *StreamOrderbookUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamOrderbookUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamOrderbookUpdate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StreamOrderbookUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamOrderbookUpdate.Merge(m, src) +} +func (m *StreamOrderbookUpdate) XXX_Size() int { + return m.Size() +} +func (m *StreamOrderbookUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_StreamOrderbookUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamOrderbookUpdate proto.InternalMessageInfo + +func (m *StreamOrderbookUpdate) GetUpdates() []types.OffChainUpdateV1 { + if m != nil { + return m.Updates + } + return nil +} + +func (m *StreamOrderbookUpdate) GetSnapshot() bool { + if m != nil { + return m.Snapshot + } + return false +} + +// StreamOrderbookFill provides information on an orderbook fill. Used in +// the full node GRPC stream. +type StreamOrderbookFill struct { + // Clob match. Provides information on which orders were matched + // and the type of order. Fill amounts here are relative. + ClobMatch *ClobMatch `protobuf:"bytes,1,opt,name=clob_match,json=clobMatch,proto3" json:"clob_match,omitempty"` + // All orders involved in the specified clob match. Used to look up + // price of a match through a given maker order id. + Orders []Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders"` + // Resulting fill amounts for each order in the orders array. + FillAmounts []uint64 `protobuf:"varint,3,rep,packed,name=fill_amounts,json=fillAmounts,proto3" json:"fill_amounts,omitempty"` +} + +func (m *StreamOrderbookFill) Reset() { *m = StreamOrderbookFill{} } +func (m *StreamOrderbookFill) String() string { return proto.CompactTextString(m) } +func (*StreamOrderbookFill) ProtoMessage() {} +func (*StreamOrderbookFill) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{18} +} +func (m *StreamOrderbookFill) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamOrderbookFill) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamOrderbookFill.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StreamOrderbookFill) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamOrderbookFill.Merge(m, src) +} +func (m *StreamOrderbookFill) XXX_Size() int { + return m.Size() +} +func (m *StreamOrderbookFill) XXX_DiscardUnknown() { + xxx_messageInfo_StreamOrderbookFill.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamOrderbookFill proto.InternalMessageInfo + +func (m *StreamOrderbookFill) GetClobMatch() *ClobMatch { + if m != nil { + return m.ClobMatch + } + return nil +} + +func (m *StreamOrderbookFill) GetOrders() []Order { + if m != nil { + return m.Orders + } + return nil +} + +func (m *StreamOrderbookFill) GetFillAmounts() []uint64 { + if m != nil { + return m.FillAmounts + } + return nil +} + +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) func init() { proto.RegisterType((*QueryGetClobPairRequest)(nil), "dydxprotocol.clob.QueryGetClobPairRequest") proto.RegisterType((*QueryClobPairResponse)(nil), "dydxprotocol.clob.QueryClobPairResponse") @@ -791,6 +1123,8 @@ func init() { proto.RegisterType((*QueryEquityTierLimitConfigurationResponse)(nil), "dydxprotocol.clob.QueryEquityTierLimitConfigurationResponse") proto.RegisterType((*QueryBlockRateLimitConfigurationRequest)(nil), "dydxprotocol.clob.QueryBlockRateLimitConfigurationRequest") proto.RegisterType((*QueryBlockRateLimitConfigurationResponse)(nil), "dydxprotocol.clob.QueryBlockRateLimitConfigurationResponse") + proto.RegisterType((*QueryStatefulOrderRequest)(nil), "dydxprotocol.clob.QueryStatefulOrderRequest") + proto.RegisterType((*QueryStatefulOrderResponse)(nil), "dydxprotocol.clob.QueryStatefulOrderResponse") proto.RegisterType((*QueryLiquidationsConfigurationRequest)(nil), "dydxprotocol.clob.QueryLiquidationsConfigurationRequest") proto.RegisterType((*QueryLiquidationsConfigurationResponse)(nil), "dydxprotocol.clob.QueryLiquidationsConfigurationResponse") proto.RegisterType((*StreamOrderbookUpdatesRequest)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesRequest") @@ -800,6 +1134,7 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ +<<<<<<< HEAD // 1112 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x4f, 0x24, 0x45, 0x14, 0xa7, 0x00, 0x77, 0xe1, 0xb1, 0x6b, 0xb4, 0x58, 0xd8, 0x71, 0x80, 0x01, 0x5a, 0xf9, 0xdc, @@ -871,6 +1206,97 @@ var fileDescriptor_3365c195b25c5bc0 = []byte{ 0x9b, 0x55, 0xdd, 0xe6, 0x5e, 0x77, 0x32, 0xd1, 0x9d, 0xd7, 0xa5, 0xe0, 0x1a, 0x6d, 0xcb, 0x51, 0x92, 0xa0, 0x38, 0x6e, 0xd0, 0xb0, 0x7a, 0x45, 0x9a, 0x6f, 0x3f, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xed, 0x1e, 0x02, 0x67, 0x0d, 0x00, 0x00, +======= + // 1407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcd, 0x6f, 0xdc, 0x44, + 0x14, 0xdf, 0x49, 0x42, 0xbb, 0x79, 0x49, 0xda, 0x32, 0x69, 0xda, 0xad, 0x93, 0x6e, 0x52, 0x43, + 0x93, 0x4d, 0x4a, 0xd7, 0x4d, 0x5a, 0x55, 0xa5, 0x41, 0x45, 0x49, 0x44, 0x3f, 0xa4, 0x86, 0x06, + 0xf7, 0x83, 0x0a, 0x2a, 0x59, 0x5e, 0x7b, 0xd6, 0xb1, 0x6a, 0x7b, 0x36, 0xf6, 0xec, 0x2a, 0x11, + 0x42, 0x48, 0x1c, 0xb8, 0x00, 0x12, 0x12, 0x07, 0x0e, 0x48, 0x48, 0x88, 0x3f, 0x01, 0x71, 0x44, + 0x94, 0x5b, 0x8f, 0x95, 0xb8, 0x70, 0x40, 0x08, 0xb5, 0x9c, 0xf9, 0x1b, 0x90, 0x67, 0xc6, 0x9b, + 0xdd, 0xd8, 0xde, 0x4d, 0x72, 0xd9, 0xb5, 0xdf, 0xbc, 0x8f, 0xdf, 0x7b, 0xf3, 0x9b, 0x79, 0xcf, + 0x70, 0xd6, 0xde, 0xb1, 0xb7, 0x1b, 0x21, 0x65, 0xd4, 0xa2, 0x9e, 0x66, 0x79, 0xb4, 0xa6, 0x6d, + 0x35, 0x49, 0xb8, 0x53, 0xe5, 0x32, 0xfc, 0x7a, 0xe7, 0x72, 0x35, 0x5e, 0x56, 0x4e, 0x3a, 0xd4, + 0xa1, 0x5c, 0xa4, 0xc5, 0x4f, 0x42, 0x51, 0x99, 0x72, 0x28, 0x75, 0x3c, 0xa2, 0x99, 0x0d, 0x57, + 0x33, 0x83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0x68, 0x10, 0x11, 0x7c, 0x03, 0x86, 0xdb, 0x25, 0xe5, + 0xfa, 0x23, 0x4b, 0x93, 0xd5, 0x14, 0x35, 0xaa, 0x89, 0xdd, 0xea, 0xd0, 0xf3, 0xbf, 0xa7, 0x0b, + 0x7a, 0xd1, 0x92, 0xef, 0xaa, 0x29, 0x31, 0xac, 0x78, 0xde, 0x5e, 0x0c, 0x37, 0x01, 0x76, 0x29, + 0x20, 0x7d, 0xcf, 0x56, 0x05, 0x5f, 0xaa, 0x31, 0x5f, 0xaa, 0x82, 0x8f, 0x92, 0x2f, 0xd5, 0x0d, + 0xd3, 0x21, 0xd2, 0x56, 0xef, 0xb0, 0x54, 0x7f, 0x42, 0x50, 0xea, 0x02, 0xbf, 0xe2, 0x79, 0x79, + 0xf8, 0x07, 0x0f, 0x88, 0x1f, 0xdf, 0xea, 0x02, 0x39, 0xc0, 0x41, 0xce, 0xf5, 0x05, 0x29, 0x82, + 0x77, 0xa1, 0xfc, 0x0b, 0xc1, 0xf4, 0x3a, 0x69, 0xbd, 0x4f, 0x6d, 0xf2, 0x80, 0xc6, 0xbf, 0x6b, + 0xa6, 0x67, 0x35, 0x3d, 0xbe, 0x98, 0x54, 0xe4, 0x09, 0x9c, 0x12, 0x84, 0x6f, 0x84, 0xb4, 0x41, + 0x23, 0x12, 0x1a, 0x92, 0x5a, 0xed, 0xea, 0xa4, 0x91, 0x3f, 0x32, 0xbd, 0x98, 0x5a, 0x34, 0x5c, + 0x27, 0xad, 0x75, 0xa1, 0xad, 0x9f, 0xe4, 0x5e, 0x36, 0xa4, 0x13, 0x29, 0xc5, 0x1f, 0xc3, 0x44, + 0x2b, 0x51, 0x36, 0x7c, 0xd2, 0x32, 0x7c, 0xc2, 0x42, 0xd7, 0x8a, 0xda, 0x59, 0xa5, 0x9d, 0x77, + 0x01, 0x5e, 0x17, 0xea, 0xfa, 0x78, 0xab, 0x33, 0xa4, 0x10, 0xaa, 0xff, 0x21, 0x98, 0xc9, 0x4f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0x32, 0x81, 0xf3, 0x3c, 0x81, 0x69, 0x7c, 0xb6, + 0xe7, 0xe7, 0x23, 0x7e, 0x86, 0xe0, 0x4c, 0x6e, 0x83, 0xc3, 0xd7, 0xf2, 0x10, 0xf4, 0xeb, 0x9e, + 0xca, 0xdb, 0x87, 0xb0, 0x94, 0xc8, 0xab, 0x1c, 0x79, 0x05, 0xcf, 0x6a, 0xfb, 0xfa, 0x64, 0xc4, + 0x01, 0x8c, 0x75, 0xcd, 0x20, 0xf8, 0xad, 0xbc, 0xd8, 0x59, 0x53, 0x90, 0x72, 0x71, 0x9f, 0xda, + 0x12, 0x5d, 0x01, 0x7f, 0x06, 0xa7, 0xb2, 0x7b, 0x29, 0xbe, 0xb4, 0xdf, 0xbe, 0x94, 0xb4, 0x6e, + 0x65, 0xf1, 0x00, 0x16, 0x02, 0xc0, 0x25, 0xb4, 0xba, 0xf1, 0xfc, 0x65, 0x19, 0xbd, 0x78, 0x59, + 0x46, 0xff, 0xbc, 0x2c, 0xa3, 0x6f, 0x5e, 0x95, 0x0b, 0x2f, 0x5e, 0x95, 0x0b, 0x7f, 0xbe, 0x2a, + 0x17, 0x3e, 0xba, 0xea, 0xb8, 0x6c, 0xb3, 0x59, 0xab, 0x5a, 0xd4, 0xef, 0x2e, 0x5e, 0xeb, 0xca, + 0x45, 0xde, 0x56, 0xb4, 0xb6, 0x64, 0x5b, 0x14, 0x94, 0xed, 0x34, 0x48, 0x54, 0x3b, 0xc2, 0xc5, + 0x97, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x63, 0x36, 0x67, 0x96, 0xfd, 0x10, 0x00, 0x00, +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) } // Reference imports to suppress errors if they are not otherwise used. @@ -897,7 +1323,14 @@ type QueryClient interface { BlockRateLimitConfiguration(ctx context.Context, in *QueryBlockRateLimitConfigurationRequest, opts ...grpc.CallOption) (*QueryBlockRateLimitConfigurationResponse, error) // Queries LiquidationsConfiguration. LiquidationsConfiguration(ctx context.Context, in *QueryLiquidationsConfigurationRequest, opts ...grpc.CallOption) (*QueryLiquidationsConfigurationResponse, error) +<<<<<<< HEAD // Streams orderbook updates. +======= + // Queries the stateful order for a given order id. + StatefulOrder(ctx context.Context, in *QueryStatefulOrderRequest, opts ...grpc.CallOption) (*QueryStatefulOrderResponse, error) + // Streams orderbook updates. Updates contain orderbook data + // such as order placements, updates, and fills. +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) } @@ -963,6 +1396,15 @@ func (c *queryClient) LiquidationsConfiguration(ctx context.Context, in *QueryLi return out, nil } +func (c *queryClient) StatefulOrder(ctx context.Context, in *QueryStatefulOrderRequest, opts ...grpc.CallOption) (*QueryStatefulOrderResponse, error) { + out := new(QueryStatefulOrderResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.clob.Query/StatefulOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) { stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[0], "/dydxprotocol.clob.Query/StreamOrderbookUpdates", opts...) if err != nil { @@ -1009,7 +1451,14 @@ type QueryServer interface { BlockRateLimitConfiguration(context.Context, *QueryBlockRateLimitConfigurationRequest) (*QueryBlockRateLimitConfigurationResponse, error) // Queries LiquidationsConfiguration. LiquidationsConfiguration(context.Context, *QueryLiquidationsConfigurationRequest) (*QueryLiquidationsConfigurationResponse, error) +<<<<<<< HEAD // Streams orderbook updates. +======= + // Queries the stateful order for a given order id. + StatefulOrder(context.Context, *QueryStatefulOrderRequest) (*QueryStatefulOrderResponse, error) + // Streams orderbook updates. Updates contain orderbook data + // such as order placements, updates, and fills. +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) StreamOrderbookUpdates(*StreamOrderbookUpdatesRequest, Query_StreamOrderbookUpdatesServer) error } @@ -1035,6 +1484,9 @@ func (*UnimplementedQueryServer) BlockRateLimitConfiguration(ctx context.Context func (*UnimplementedQueryServer) LiquidationsConfiguration(ctx context.Context, req *QueryLiquidationsConfigurationRequest) (*QueryLiquidationsConfigurationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LiquidationsConfiguration not implemented") } +func (*UnimplementedQueryServer) StatefulOrder(ctx context.Context, req *QueryStatefulOrderRequest) (*QueryStatefulOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StatefulOrder not implemented") +} func (*UnimplementedQueryServer) StreamOrderbookUpdates(req *StreamOrderbookUpdatesRequest, srv Query_StreamOrderbookUpdatesServer) error { return status.Errorf(codes.Unimplemented, "method StreamOrderbookUpdates not implemented") } @@ -1151,6 +1603,24 @@ func _Query_LiquidationsConfiguration_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _Query_StatefulOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStatefulOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StatefulOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.clob.Query/StatefulOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StatefulOrder(ctx, req.(*QueryStatefulOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_StreamOrderbookUpdates_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(StreamOrderbookUpdatesRequest) if err := stream.RecvMsg(m); err != nil { @@ -1200,6 +1670,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "LiquidationsConfiguration", Handler: _Query_LiquidationsConfiguration_Handler, }, + { + MethodName: "StatefulOrder", + Handler: _Query_StatefulOrder_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -1591,6 +2065,87 @@ func (m *QueryBlockRateLimitConfigurationResponse) MarshalToSizedBuffer(dAtA []b return len(dAtA) - i, nil } +func (m *QueryStatefulOrderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryStatefulOrderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStatefulOrderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.OrderId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryStatefulOrderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryStatefulOrderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStatefulOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Triggered { + i-- + if m.Triggered { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.FillAmount != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.FillAmount)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.OrderPlacement.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *QueryLiquidationsConfigurationRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1668,27 +2223,86 @@ func (m *StreamOrderbookUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, var l int _ = l if len(m.ClobPairId) > 0 { - dAtA10 := make([]byte, len(m.ClobPairId)*10) - var j9 int + dAtA12 := make([]byte, len(m.ClobPairId)*10) + var j11 int for _, num := range m.ClobPairId { for num >= 1<<7 { - dAtA10[j9] = uint8(uint64(num)&0x7f | 0x80) + dAtA12[j11] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j9++ + j11++ + } + dAtA12[j11] = uint8(num) + j11++ + } + i -= j11 + copy(dAtA[i:], dAtA12[:j11]) + i = encodeVarintQuery(dAtA, i, uint64(j11)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StreamOrderbookUpdatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StreamOrderbookUpdatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamOrderbookUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExecMode != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ExecMode)) + i-- + dAtA[i] = 0x20 + } + if m.BlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x18 + } + if m.Snapshot { + i-- + if m.Snapshot { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Updates) > 0 { + for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - dAtA10[j9] = uint8(num) - j9++ + i-- + dAtA[i] = 0xa } - i -= j9 - copy(dAtA[i:], dAtA10[:j9]) - i = encodeVarintQuery(dAtA, i, uint64(j9)) - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *StreamOrderbookUpdatesResponse) Marshal() (dAtA []byte, err error) { +<<<<<<< HEAD +======= +func (m *StreamOrderbookFill) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1698,40 +2312,38 @@ func (m *StreamOrderbookUpdatesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StreamOrderbookUpdatesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *StreamOrderbookFill) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StreamOrderbookUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *StreamOrderbookFill) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ExecMode != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ExecMode)) - i-- - dAtA[i] = 0x20 - } - if m.BlockHeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x18 - } - if m.Snapshot { - i-- - if m.Snapshot { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.FillAmounts) > 0 { + dAtA16 := make([]byte, len(m.FillAmounts)*10) + var j15 int + for _, num := range m.FillAmounts { + for num >= 1<<7 { + dAtA16[j15] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j15++ + } + dAtA16[j15] = uint8(num) + j15++ } + i -= j15 + copy(dAtA[i:], dAtA16[:j15]) + i = encodeVarintQuery(dAtA, i, uint64(j15)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x1a } - if len(m.Updates) > 0 { - for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1739,12 +2351,25 @@ func (m *StreamOrderbookUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + } + if m.ClobMatch != nil { + { + size, err := m.ClobMatch.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } +>>>>>>> c24be3a4 ([CT-834] new endpoint for stateful orders (#1501)) func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1901,6 +2526,34 @@ func (m *QueryBlockRateLimitConfigurationResponse) Size() (n int) { return n } +func (m *QueryStatefulOrderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OrderId.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryStatefulOrderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OrderPlacement.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.FillAmount != 0 { + n += 1 + sovQuery(uint64(m.FillAmount)) + } + if m.Triggered { + n += 2 + } + return n +} + func (m *QueryLiquidationsConfigurationRequest) Size() (n int) { if m == nil { return 0 @@ -2896,6 +3549,211 @@ func (m *QueryBlockRateLimitConfigurationResponse) Unmarshal(dAtA []byte) error } return nil } +func (m *QueryStatefulOrderRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryStatefulOrderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStatefulOrderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OrderId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryStatefulOrderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryStatefulOrderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStatefulOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderPlacement", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OrderPlacement.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FillAmount", wireType) + } + m.FillAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FillAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Triggered", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Triggered = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryLiquidationsConfigurationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0