Skip to content

Commit

Permalink
chore: add portfolio proto (#110)
Browse files Browse the repository at this point in the history
* chore: add portfolio proto

* chore: minor type fixes

---------

Co-authored-by: vinhphuctadang <[email protected]>
  • Loading branch information
mmeloni and vinhphuctadang authored Feb 22, 2023
1 parent 8a4d2d0 commit cb96f6f
Show file tree
Hide file tree
Showing 6 changed files with 1,556 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ copy-exchange-client:
mkdir -p exchange/explorer_rpc
mkdir -p exchange/spot_exchange_rpc
mkdir -p exchange/derivative_exchange_rpc
mkdir -p exchange/portfolio_rpc

cp -r ../injective-indexer/api/gen/grpc/injective_meta_rpc/pb exchange/meta_rpc/pb
cp -r ../injective-indexer/api/gen/grpc/injective_exchange_rpc/pb exchange/exchange_rpc/pb
Expand All @@ -21,6 +22,7 @@ copy-exchange-client:
cp -r ../injective-indexer/api/gen/grpc/injective_explorer_rpc/pb exchange/explorer_rpc/pb
cp -r ../injective-indexer/api/gen/grpc/injective_spot_exchange_rpc/pb exchange/spot_exchange_rpc/pb
cp -r ../injective-indexer/api/gen/grpc/injective_derivative_exchange_rpc/pb exchange/derivative_exchange_rpc/pb
cp -r ../injective-indexer/api/gen/grpc/injective_portfolio_rpc/pb exchange/portfolio_rpc/pb

.PHONY: copy-exchange-client

Expand Down
16 changes: 8 additions & 8 deletions client/exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ type ExchangeClient interface {
GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error)
GetOracleList(ctx context.Context) (oraclePB.OracleListResponse, error)
StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error)
GetAuction(ctx context.Context, round int64) (auctionPB.AuctionResponse, error)
GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error)
GetAuctions(ctx context.Context) (auctionPB.AuctionsResponse, error)
StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error)
GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error)
GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceResponse, error)
GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error)
StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error)
GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error)
GetSubaccountHistory(ctx context.Context, req accountPB.SubaccountHistoryRequest) (accountPB.SubaccountHistoryResponse, error)
Expand Down Expand Up @@ -554,8 +554,8 @@ func (c *exchangeClient) StreamPrices(ctx context.Context, baseSymbol string, qu

// Auction RPC

func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB.AuctionResponse, error) {
req := auctionPB.AuctionRequest{
func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error) {
req := auctionPB.AuctionEndpointRequest{
Round: round,
}

Expand All @@ -564,7 +564,7 @@ func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB
res, err := c.auctionClient.AuctionEndpoint(ctx, &req, grpc.Header(&header))
if err != nil {
fmt.Println(err)
return auctionPB.AuctionResponse{}, err
return auctionPB.AuctionEndpointResponse{}, err
}
c.setCookie(header)

Expand Down Expand Up @@ -624,8 +624,8 @@ func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress
return *res, nil
}

func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceResponse, error) {
req := accountPB.SubaccountBalanceRequest{
func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error) {
req := accountPB.SubaccountBalanceEndpointRequest{
SubaccountId: subaccountId,
Denom: denom,
}
Expand All @@ -635,7 +635,7 @@ func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId
res, err := c.accountClient.SubaccountBalanceEndpoint(ctx, &req, grpc.Header(&header))
if err != nil {
fmt.Println(err)
return accountPB.SubaccountBalanceResponse{}, err
return accountPB.SubaccountBalanceEndpointResponse{}, err
}
c.setCookie(header)

Expand Down
Loading

0 comments on commit cb96f6f

Please sign in to comment.