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 d380328 commit 8dcedab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions client/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func NewChainClient(
var txFactory tx.Factory
if opts.TxFactory == nil {
txFactory = NewTxFactory(ctx)
if len(opts.GasPrices) > 0 {
if opts.GasPrices != "" {
txFactory = txFactory.WithGasPrices(opts.GasPrices)
}
} else {
Expand Down Expand Up @@ -1381,9 +1381,9 @@ func (c *chainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType Ord
}

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

filteredOrderbookUpdateCh := make(chan exchangetypes.Orderbook, 10000)
Expand All @@ -1401,7 +1401,7 @@ func (c *chainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType Ord

for _, ob := range allOrderbookUpdates {
id := ethcommon.BytesToHash(ob.MarketId).String()
if marketIdsMap[id] {
if marketIDsMap[id] {
filteredOrderbookUpdateCh <- ob
}
}
Expand Down
8 changes: 4 additions & 4 deletions client/chain/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func InitCosmosKeyring(
cosmosUseLedger bool,
) (cosmtypes.AccAddress, keyring.Keyring, error) {
switch {
case len(cosmosPrivKey) > 0:
case cosmosPrivKey != "":
if cosmosUseLedger {
err := errors.New("cannot combine ledger and privkey options")
return emptyCosmosAddress, nil, err
Expand All @@ -59,7 +59,7 @@ func InitCosmosKeyring(
var keyName string

// check that if cosmos 'From' specified separately, it must match the provided privkey,
if len(cosmosKeyFrom) > 0 {
if cosmosKeyFrom != "" {
addressFrom, err := cosmtypes.AccAddressFromBech32(cosmosKeyFrom)
if err == nil {
if !bytes.Equal(addressFrom.Bytes(), addressFromPk.Bytes()) {
Expand All @@ -80,15 +80,15 @@ func InitCosmosKeyring(
kb, err := KeyringForPrivKey(keyName, cosmosAccPk)
return addressFromPk, kb, err

case len(cosmosKeyFrom) > 0:
case cosmosKeyFrom != "":
var fromIsAddress bool
addressFrom, err := cosmtypes.AccAddressFromBech32(cosmosKeyFrom)
if err == nil {
fromIsAddress = true
}

var passReader io.Reader = os.Stdin
if len(cosmosKeyPassphrase) > 0 {
if cosmosKeyPassphrase != "" {
passReader = newPassReader(cosmosKeyPassphrase)
}

Expand Down
18 changes: 9 additions & 9 deletions client/exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type ExchangeClient interface {
QueryClient() *grpc.ClientConn
GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error)
GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error)
GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error)
GetDerivativeOrderbooksV2(ctx context.Context, marketIDs []string) (*derivativeExchangePB.OrderbooksV2Response, error)
// StreamDerivativeOrderbook deprecated API
StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error)
StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error)
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)
GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error)
GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error)
Expand Down Expand Up @@ -222,9 +222,9 @@ func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId
return res, nil
}

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

res, err := common.ExecuteCall(ctx, c.network.ExchangeCookieAssistant, c.derivativeExchangeClient.OrderbooksV2, &req)
Expand All @@ -236,9 +236,9 @@ func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketId
return res, nil
}

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

stream, err := common.ExecuteStreamCall(ctx, c.network.ExchangeCookieAssistant, c.derivativeExchangeClient.StreamOrderbookV2, &req)
Expand All @@ -251,9 +251,9 @@ func (c *exchangeClient) StreamDerivativeOrderbookV2(ctx context.Context, market
return stream, nil
}

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

stream, err := common.ExecuteStreamCall(ctx, c.network.ExchangeCookieAssistant, c.derivativeExchangeClient.StreamOrderbookUpdate, &req)
Expand Down
6 changes: 3 additions & 3 deletions client/exchange/exchange_test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ func (e *MockExchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marke
return &derivativeExchangePB.OrderbookV2Response{}, nil
}

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

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

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

Expand Down

0 comments on commit 8dcedab

Please sign in to comment.