Skip to content

Commit

Permalink
(fix) Fix pre-commit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aarmoa committed Jul 8, 2024
1 parent cea06a1 commit c644192
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
42 changes: 21 additions & 21 deletions client/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ type ChainClient interface {

StreamEventOrderFail(sender string, failEventCh chan map[string]uint)
StreamEventOrderFailWithWebsocket(sender string, websocket *rpchttp.HTTP, failEventCh chan map[string]uint)
StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIds []string, orderbookCh chan exchangetypes.Orderbook)
StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIds []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook)
StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIDs []string, orderbookCh chan exchangetypes.Orderbook)
StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIDs []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook)

ChainStream(ctx context.Context, req chainstreamtypes.StreamRequest) (chainstreamtypes.Stream_StreamClient, error)

Expand Down Expand Up @@ -184,14 +184,14 @@ type ChainClient interface {
FetchSubaccountDeposit(ctx context.Context, subaccountId string, denom string) (*exchangetypes.QuerySubaccountDepositResponse, error)
FetchExchangeBalances(ctx context.Context) (*exchangetypes.QueryExchangeBalancesResponse, error)
FetchAggregateVolume(ctx context.Context, account string) (*exchangetypes.QueryAggregateVolumeResponse, error)
FetchAggregateVolumes(ctx context.Context, accounts []string, marketIds []string) (*exchangetypes.QueryAggregateVolumesResponse, error)
FetchAggregateVolumes(ctx context.Context, accounts []string, marketIDs []string) (*exchangetypes.QueryAggregateVolumesResponse, error)
FetchAggregateMarketVolume(ctx context.Context, marketId string) (*exchangetypes.QueryAggregateMarketVolumeResponse, error)
FetchAggregateMarketVolumes(ctx context.Context, marketIds []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error)
FetchAggregateMarketVolumes(ctx context.Context, marketIDs []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error)
FetchDenomDecimal(ctx context.Context, denom string) (*exchangetypes.QueryDenomDecimalResponse, error)
FetchDenomDecimals(ctx context.Context, denoms []string) (*exchangetypes.QueryDenomDecimalsResponse, error)
FetchChainSpotMarkets(ctx context.Context, status string, marketIds []string) (*exchangetypes.QuerySpotMarketsResponse, error)
FetchChainSpotMarkets(ctx context.Context, status string, marketIDs []string) (*exchangetypes.QuerySpotMarketsResponse, error)
FetchChainSpotMarket(ctx context.Context, marketId string) (*exchangetypes.QuerySpotMarketResponse, error)
FetchChainFullSpotMarkets(ctx context.Context, status string, marketIds []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error)
FetchChainFullSpotMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error)
FetchChainFullSpotMarket(ctx context.Context, marketId string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketResponse, error)
FetchChainSpotOrderbook(ctx context.Context, marketId string, limit uint64, orderSide exchangetypes.OrderSide, limitCumulativeNotional sdkmath.LegacyDec, limitCumulativeQuantity sdkmath.LegacyDec) (*exchangetypes.QuerySpotOrderbookResponse, error)
FetchChainTraderSpotOrders(ctx context.Context, marketId string, subaccountId string) (*exchangetypes.QueryTraderSpotOrdersResponse, error)
Expand All @@ -206,7 +206,7 @@ type ChainClient interface {
FetchChainAccountAddressDerivativeOrders(ctx context.Context, marketId string, address string) (*exchangetypes.QueryAccountAddressDerivativeOrdersResponse, error)
FetchChainDerivativeOrdersByHashes(ctx context.Context, marketId string, subaccountId string, orderHashes []string) (*exchangetypes.QueryDerivativeOrdersByHashesResponse, error)
FetchChainTraderDerivativeTransientOrders(ctx context.Context, marketId string, subaccountId string) (*exchangetypes.QueryTraderDerivativeOrdersResponse, error)
FetchChainDerivativeMarkets(ctx context.Context, status string, marketIds []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error)
FetchChainDerivativeMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error)
FetchChainDerivativeMarket(ctx context.Context, marketId string) (*exchangetypes.QueryDerivativeMarketResponse, error)
FetchDerivativeMarketAddress(ctx context.Context, marketId string) (*exchangetypes.QueryDerivativeMarketAddressResponse, error)
FetchSubaccountTradeNonce(ctx context.Context, subaccountId string) (*exchangetypes.QuerySubaccountTradeNonceResponse, error)
Expand Down Expand Up @@ -1347,7 +1347,7 @@ func (c *chainClient) StreamEventOrderFailWithWebsocket(sender string, websocket
}
}

func (c *chainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIds []string, orderbookCh chan exchangetypes.Orderbook) {
func (c *chainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIDs []string, orderbookCh chan exchangetypes.Orderbook) {
var cometbftClient *rpchttp.HTTP
var err error

Expand All @@ -1369,11 +1369,11 @@ func (c *chainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, m
}
}()

c.StreamOrderbookUpdateEventsWithWebsocket(orderbookType, marketIds, cometbftClient, orderbookCh)
c.StreamOrderbookUpdateEventsWithWebsocket(orderbookType, marketIDs, cometbftClient, orderbookCh)

}

func (c *chainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIds []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook) {
func (c *chainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIDs []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook) {
filter := fmt.Sprintf("tm.event='NewBlock' AND %s EXISTS", orderbookType)
eventCh, err := websocket.Subscribe(context.Background(), "OrderbookUpdate", filter, 10000)
if err != nil {
Expand All @@ -1382,7 +1382,7 @@ func (c *chainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType Ord

// turn array into map for convenient lookup
marketIDsMap := map[string]bool{}
for _, id := range marketIds {
for _, id := range marketIDs {
marketIDsMap[id] = true
}

Expand Down Expand Up @@ -1729,10 +1729,10 @@ func (c *chainClient) FetchAggregateVolume(ctx context.Context, account string)
return res, err
}

func (c *chainClient) FetchAggregateVolumes(ctx context.Context, accounts, marketIds []string) (*exchangetypes.QueryAggregateVolumesResponse, error) {
func (c *chainClient) FetchAggregateVolumes(ctx context.Context, accounts, marketIDs []string) (*exchangetypes.QueryAggregateVolumesResponse, error) {
req := &exchangetypes.QueryAggregateVolumesRequest{
Accounts: accounts,
MarketIds: marketIds,
MarketIds: marketIDs,
}
res, err := common.ExecuteCall(ctx, c.network.ChainCookieAssistant, c.exchangeQueryClient.AggregateVolumes, req)

Expand All @@ -1748,9 +1748,9 @@ func (c *chainClient) FetchAggregateMarketVolume(ctx context.Context, marketId s
return res, err
}

func (c *chainClient) FetchAggregateMarketVolumes(ctx context.Context, marketIds []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error) {
func (c *chainClient) FetchAggregateMarketVolumes(ctx context.Context, marketIDs []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error) {
req := &exchangetypes.QueryAggregateMarketVolumesRequest{
MarketIds: marketIds,
MarketIds: marketIDs,
}
res, err := common.ExecuteCall(ctx, c.network.ChainCookieAssistant, c.exchangeQueryClient.AggregateMarketVolumes, req)

Expand All @@ -1775,9 +1775,9 @@ func (c *chainClient) FetchDenomDecimals(ctx context.Context, denoms []string) (
return res, err
}

func (c *chainClient) FetchChainSpotMarkets(ctx context.Context, status string, marketIds []string) (*exchangetypes.QuerySpotMarketsResponse, error) {
func (c *chainClient) FetchChainSpotMarkets(ctx context.Context, status string, marketIDs []string) (*exchangetypes.QuerySpotMarketsResponse, error) {
req := &exchangetypes.QuerySpotMarketsRequest{
MarketIds: marketIds,
MarketIds: marketIDs,
}
if status != "" {
req.Status = status
Expand All @@ -1796,9 +1796,9 @@ func (c *chainClient) FetchChainSpotMarket(ctx context.Context, marketId string)
return res, err
}

func (c *chainClient) FetchChainFullSpotMarkets(ctx context.Context, status string, marketIds []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error) {
func (c *chainClient) FetchChainFullSpotMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error) {
req := &exchangetypes.QueryFullSpotMarketsRequest{
MarketIds: marketIds,
MarketIds: marketIDs,
WithMidPriceAndTob: withMidPriceAndTob,
}
if status != "" {
Expand Down Expand Up @@ -1953,9 +1953,9 @@ func (c *chainClient) FetchChainTraderDerivativeTransientOrders(ctx context.Cont
return res, err
}

func (c *chainClient) FetchChainDerivativeMarkets(ctx context.Context, status string, marketIds []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error) {
func (c *chainClient) FetchChainDerivativeMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error) {
req := &exchangetypes.QueryDerivativeMarketsRequest{
MarketIds: marketIds,
MarketIds: marketIDs,
WithMidPriceAndTob: withMidPriceAndTob,
}
if status != "" {
Expand Down
14 changes: 7 additions & 7 deletions client/chain/chain_test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ func (c *MockChainClient) StreamEventOrderFail(sender string, failEventCh chan m
func (c *MockChainClient) StreamEventOrderFailWithWebsocket(sender string, websocket *rpchttp.HTTP, failEventCh chan map[string]uint) {
}

func (c *MockChainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIds []string, orderbookCh chan exchangetypes.Orderbook) {
func (c *MockChainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIDs []string, orderbookCh chan exchangetypes.Orderbook) {
}

func (c *MockChainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIds []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook) {
func (c *MockChainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIDs []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook) {
}

func (c *MockChainClient) ChainStream(ctx context.Context, req chainstreamtypes.StreamRequest) (chainstreamtypes.Stream_StreamClient, error) {
Expand Down Expand Up @@ -348,15 +348,15 @@ func (c *MockChainClient) FetchAggregateVolume(ctx context.Context, account stri
return &exchangetypes.QueryAggregateVolumeResponse{}, nil
}

func (c *MockChainClient) FetchAggregateVolumes(ctx context.Context, accounts, marketIds []string) (*exchangetypes.QueryAggregateVolumesResponse, error) {
func (c *MockChainClient) FetchAggregateVolumes(ctx context.Context, accounts, marketIDs []string) (*exchangetypes.QueryAggregateVolumesResponse, error) {
return &exchangetypes.QueryAggregateVolumesResponse{}, nil
}

func (c *MockChainClient) FetchAggregateMarketVolume(ctx context.Context, marketId string) (*exchangetypes.QueryAggregateMarketVolumeResponse, error) {
return &exchangetypes.QueryAggregateMarketVolumeResponse{}, nil
}

func (c *MockChainClient) FetchAggregateMarketVolumes(ctx context.Context, marketIds []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error) {
func (c *MockChainClient) FetchAggregateMarketVolumes(ctx context.Context, marketIDs []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error) {
return &exchangetypes.QueryAggregateMarketVolumesResponse{}, nil
}

Expand All @@ -368,15 +368,15 @@ func (c *MockChainClient) FetchDenomDecimals(ctx context.Context, denoms []strin
return &exchangetypes.QueryDenomDecimalsResponse{}, nil
}

func (c *MockChainClient) FetchChainSpotMarkets(ctx context.Context, status string, marketIds []string) (*exchangetypes.QuerySpotMarketsResponse, error) {
func (c *MockChainClient) FetchChainSpotMarkets(ctx context.Context, status string, marketIDs []string) (*exchangetypes.QuerySpotMarketsResponse, error) {
return &exchangetypes.QuerySpotMarketsResponse{}, nil
}

func (c *MockChainClient) FetchChainSpotMarket(ctx context.Context, marketId string) (*exchangetypes.QuerySpotMarketResponse, error) {
return &exchangetypes.QuerySpotMarketResponse{}, nil
}

func (c *MockChainClient) FetchChainFullSpotMarkets(ctx context.Context, status string, marketIds []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error) {
func (c *MockChainClient) FetchChainFullSpotMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error) {
return &exchangetypes.QueryFullSpotMarketsResponse{}, nil
}

Expand Down Expand Up @@ -436,7 +436,7 @@ func (c *MockChainClient) FetchChainTraderDerivativeTransientOrders(ctx context.
return &exchangetypes.QueryTraderDerivativeOrdersResponse{}, nil
}

func (c *MockChainClient) FetchChainDerivativeMarkets(ctx context.Context, status string, marketIds []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error) {
func (c *MockChainClient) FetchChainDerivativeMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error) {
return &exchangetypes.QueryDerivativeMarketsResponse{}, nil
}

Expand Down
12 changes: 6 additions & 6 deletions client/exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ExchangeClient interface {
// StreamDerivativeOrderbook deprecated API
StreamDerivativeOrderbookV2(ctx context.Context, marketIDs []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error)
StreamDerivativeOrderbookUpdate(ctx context.Context, marketIDs []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error)
StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error)
StreamDerivativeMarket(ctx context.Context, marketIDs []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error)
GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error)
GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error)
GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error)
Expand Down Expand Up @@ -69,7 +69,7 @@ type ExchangeClient interface {
StreamSpotOrderbookUpdate(ctx context.Context, marketIDs []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookUpdateClient, error)
GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error)
GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error)
StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error)
StreamSpotMarket(ctx context.Context, marketIDs []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error)
StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error)
GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error)
GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error)
Expand Down Expand Up @@ -290,9 +290,9 @@ func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId strin
return res, nil
}

func (c *exchangeClient) StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) {
func (c *exchangeClient) StreamDerivativeMarket(ctx context.Context, marketIDs []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) {
req := derivativeExchangePB.StreamMarketRequest{
MarketIds: marketIds,
MarketIds: marketIDs,
}

stream, err := common.ExecuteStreamCall(ctx, c.network.ExchangeCookieAssistant, c.derivativeExchangeClient.StreamMarket, &req)
Expand Down Expand Up @@ -741,9 +741,9 @@ func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (*s
return res, nil
}

func (c *exchangeClient) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) {
func (c *exchangeClient) StreamSpotMarket(ctx context.Context, marketIDs []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) {
req := spotExchangePB.StreamMarketsRequest{
MarketIds: marketIds,
MarketIds: marketIDs,
}

stream, err := common.ExecuteStreamCall(ctx, c.network.ExchangeCookieAssistant, c.spotExchangeClient.StreamMarkets, &req)
Expand Down
4 changes: 2 additions & 2 deletions client/exchange/exchange_test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (e *MockExchangeClient) StreamDerivativeOrderbookUpdate(ctx context.Context
return nil, nil
}

func (e *MockExchangeClient) StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) {
func (e *MockExchangeClient) StreamDerivativeMarket(ctx context.Context, marketIDs []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) {
return nil, nil
}

Expand Down Expand Up @@ -230,7 +230,7 @@ func (e *MockExchangeClient) GetSpotMarket(ctx context.Context, marketId string)
return &spotExchangePB.MarketResponse{}, nil
}

func (e *MockExchangeClient) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) {
func (e *MockExchangeClient) StreamSpotMarket(ctx context.Context, marketIDs []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) {
return nil, nil
}

Expand Down

0 comments on commit c644192

Please sign in to comment.