Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dydxwill committed Dec 12, 2023
1 parent 20eb474 commit 0be2da4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 33 deletions.
85 changes: 53 additions & 32 deletions v4-client-js/src/clients/modules/get.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {
Coin,
} from '@cosmjs/proto-signing';
import { Coin, } from '@cosmjs/proto-signing';

Check failure on line 1 in v4-client-js/src/clients/modules/get.ts

View workflow job for this annotation

GitHub Actions / CI

Unexpected trailing comma
import {
Account,
accountFromAny,
Block,
QueryClient as StargateQueryClient,
TxExtension,
QueryAbciResponse,
} from '@cosmjs/stargate';
import * as AuthModule from 'cosmjs-types/cosmos/auth/v1beta1/query';
import * as BankModule from 'cosmjs-types/cosmos/bank/v1beta1/query';
Expand All @@ -23,12 +22,11 @@ import {
PerpetualsModule,
PricesModule,
RewardsModule,
SubaccountsModule,
StakingModule,
StatsModule,
SubaccountsModule,
} from './proto-includes';
import { TendermintClient } from './tendermintClient';
import { QueryAbciResponse } from '@cosmjs/stargate/build/queryclient/queryclient';

// Required for encoding and decoding queries that are of type Long.
// Must be done once but since the individal modules should be usable without
Expand Down Expand Up @@ -75,7 +73,8 @@ export class Get {
*/
async getFeeTiers(): Promise<FeeTierModule.QueryPerpetualFeeParamsResponse> {
const requestData = Uint8Array.from(
FeeTierModule.QueryPerpetualFeeParamsRequest.encode({}).finish(),
FeeTierModule.QueryPerpetualFeeParamsRequest.encode({})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -92,7 +91,8 @@ export class Get {
*/
async getUserFeeTier(address: string): Promise<FeeTierModule.QueryUserFeeTierResponse> {
const requestData = Uint8Array.from(
FeeTierModule.QueryUserFeeTierRequest.encode({ user: address }).finish(),
FeeTierModule.QueryUserFeeTierRequest.encode({ user: address })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -109,9 +109,10 @@ export class Get {
*/
async getUserStats(
address: string,
): Promise<{ takerNotional: Long, makerNotional: Long } | undefined > {
): Promise<{ takerNotional: Long, makerNotional: Long } | undefined> {
const requestData = Uint8Array.from(
StatsModule.QueryUserStatsRequest.encode({ user: address }).finish(),
StatsModule.QueryUserStatsRequest.encode({ user: address })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -128,7 +129,8 @@ export class Get {
*/
async getAccountBalances(address: string): Promise<Coin[]> {
const requestData: Uint8Array = Uint8Array.from(
BankModule.QueryAllBalancesRequest.encode({ address }).finish(),
BankModule.QueryAllBalancesRequest.encode({ address })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -145,7 +147,11 @@ export class Get {
*/
async getAccountBalance(address: string, denom: string): Promise<Coin | undefined> {
const requestData: Uint8Array = Uint8Array.from(
BankModule.QueryBalanceRequest.encode({ address, denom }).finish(),
BankModule.QueryBalanceRequest.encode({
address,
denom

Check failure on line 152 in v4-client-js/src/clients/modules/get.ts

View workflow job for this annotation

GitHub Actions / CI

Missing trailing comma
})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -161,11 +167,10 @@ export class Get {
*
* @returns All subaccounts
*/
async getSubaccounts(
): Promise<SubaccountsModule.QuerySubaccountAllResponse> {
async getSubaccounts(): Promise<SubaccountsModule.QuerySubaccountAllResponse> {
const requestData: Uint8Array = Uint8Array.from(
SubaccountsModule.QueryAllSubaccountRequest.encode({
}).finish(),
SubaccountsModule.QueryAllSubaccountRequest.encode({})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -188,7 +193,8 @@ export class Get {
SubaccountsModule.QueryGetSubaccountRequest.encode({
owner: address,
number: accountNumber,
}).finish(),
})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -205,7 +211,8 @@ export class Get {
*/
async getRewardsParams(): Promise<RewardsModule.QueryParamsResponse> {
const requestData = Uint8Array.from(
RewardsModule.QueryParamsRequest.encode({}).finish(),
RewardsModule.QueryParamsRequest.encode({})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -222,7 +229,8 @@ export class Get {
*/
async getAllClobPairs(): Promise<ClobModule.QueryClobPairAllResponse> {
const requestData: Uint8Array = Uint8Array.from(
ClobModule.QueryAllClobPairRequest.encode({ pagination: PAGE_REQUEST }).finish(),
ClobModule.QueryAllClobPairRequest.encode({ pagination: PAGE_REQUEST })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -239,7 +247,8 @@ export class Get {
*/
async getClobPair(pairId: number): Promise<ClobModule.QueryClobPairResponse> {
const requestData: Uint8Array = Uint8Array.from(
ClobModule.QueryGetClobPairRequest.encode({ id: pairId }).finish(),
ClobModule.QueryGetClobPairRequest.encode({ id: pairId })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -256,7 +265,8 @@ export class Get {
*/
async getAllPrices(): Promise<PricesModule.QueryAllMarketPricesResponse> {
const requestData: Uint8Array = Uint8Array.from(
PricesModule.QueryAllMarketPricesRequest.encode({ pagination: PAGE_REQUEST }).finish(),
PricesModule.QueryAllMarketPricesRequest.encode({ pagination: PAGE_REQUEST })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -273,7 +283,8 @@ export class Get {
*/
async getPrice(marketId: number): Promise<PricesModule.QueryMarketPriceResponse> {
const requestData: Uint8Array = Uint8Array.from(
PricesModule.QueryMarketPriceRequest.encode({ id: marketId }).finish(),
PricesModule.QueryMarketPriceRequest.encode({ id: marketId })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -290,7 +301,8 @@ export class Get {
*/
async getAllPerpetuals(): Promise<PerpetualsModule.QueryAllPerpetualsResponse> {
const requestData: Uint8Array = Uint8Array.from(
PerpetualsModule.QueryAllPerpetualsRequest.encode({ pagination: PAGE_REQUEST }).finish(),
PerpetualsModule.QueryAllPerpetualsRequest.encode({ pagination: PAGE_REQUEST })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -309,7 +321,8 @@ export class Get {
perpetualId: number,
): Promise<PerpetualsModule.QueryPerpetualResponse> {
const requestData: Uint8Array = Uint8Array.from(
PerpetualsModule.QueryPerpetualRequest.encode({ id: perpetualId }).finish(),
PerpetualsModule.QueryPerpetualRequest.encode({ id: perpetualId })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -328,7 +341,8 @@ export class Get {
*/
async getAccount(address: string): Promise<Account> {
const requestData: Uint8Array = Uint8Array.from(
AuthModule.QueryAccountRequest.encode({ address }).finish(),
AuthModule.QueryAccountRequest.encode({ address })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -349,10 +363,10 @@ export class Get {
*
* @returns Information on all equity tiers that are configured.
*/
async getEquityTierLimitConfiguration(
): Promise<ClobModule.QueryEquityTierLimitConfigurationResponse> {
async getEquityTierLimitConfiguration(): Promise<ClobModule.QueryEquityTierLimitConfigurationResponse> {

Check failure on line 366 in v4-client-js/src/clients/modules/get.ts

View workflow job for this annotation

GitHub Actions / CI

This line has a length of 106. Maximum allowed is 100
const requestData: Uint8Array = Uint8Array.from(
ClobModule.QueryEquityTierLimitConfigurationRequest.encode({}).finish(),
ClobModule.QueryEquityTierLimitConfigurationRequest.encode({})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -375,7 +389,8 @@ export class Get {
StakingModule.QueryDelegatorDelegationsRequest.encode({
delegatorAddr,
pagination: PAGE_REQUEST,
}).finish(),
})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -398,7 +413,8 @@ export class Get {
StakingModule.QueryDelegatorUnbondingDelegationsRequest.encode({
delegatorAddr,
pagination: PAGE_REQUEST,
}).finish(),
})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -417,7 +433,8 @@ export class Get {
address: string = '',
): Promise<BridgeModule.QueryDelayedCompleteBridgeMessagesResponse> {
const requestData: Uint8Array = Uint8Array.from(
BridgeModule.QueryDelayedCompleteBridgeMessagesRequest.encode({ address }).finish(),
BridgeModule.QueryDelayedCompleteBridgeMessagesRequest.encode({ address })
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -437,7 +454,11 @@ export class Get {
): Promise<StakingModule.QueryValidatorsResponse> {
const requestData = Uint8Array.from(
StakingModule.QueryValidatorsRequest
.encode({ status, pagination: PAGE_REQUEST }).finish(),
.encode({
status,
pagination: PAGE_REQUEST

Check failure on line 459 in v4-client-js/src/clients/modules/get.ts

View workflow job for this annotation

GitHub Actions / CI

Missing trailing comma
})
.finish(),
);

const data: Uint8Array = await this.sendQuery(
Expand All @@ -449,7 +470,7 @@ export class Get {

private async sendQuery(requestUrl: string, requestData: Uint8Array): Promise<Uint8Array> {
const resp: QueryAbciResponse = await
this.stargateQueryClient.queryAbci(requestUrl, requestData);
this.stargateQueryClient.queryAbci(requestUrl, requestData);

Check failure on line 473 in v4-client-js/src/clients/modules/get.ts

View workflow job for this annotation

GitHub Actions / CI

Expected indentation of 4 spaces but found 6
return resp.value;
}
}
2 changes: 1 addition & 1 deletion v4-client-js/src/clients/modules/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Composer } from './composer';
import { Get } from './get';
import LocalWallet from './local-wallet';
import {
GasInfo, Order_Side, Order_TimeInForce, Any, MsgPlaceOrder, Order_ConditionType,
Order_Side, Order_TimeInForce, Any, MsgPlaceOrder, Order_ConditionType,
} from './proto-includes';

// Required for encoding and decoding queries that are of type Long.
Expand Down

0 comments on commit 0be2da4

Please sign in to comment.