Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpify queries code with object property shorthand #1566

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/stargate/src/modules/auth/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function setupAuthExtension(base: QueryClient): AuthExtension {
return {
auth: {
account: async (address: string) => {
const { account } = await queryService.Account({ address: address });
const { account } = await queryService.Account({ address });
return account ?? null;
},
},
Expand Down
10 changes: 5 additions & 5 deletions packages/stargate/src/modules/authz/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ export function setupAuthzExtension(base: QueryClient): AuthzExtension {
authz: {
grants: async (granter: string, grantee: string, msgTypeUrl: string, paginationKey?: Uint8Array) => {
return await queryService.Grants({
granter: granter,
grantee: grantee,
msgTypeUrl: msgTypeUrl,
granter,
grantee,
msgTypeUrl,
pagination: createPagination(paginationKey),
});
},
granteeGrants: async (grantee: string, paginationKey?: Uint8Array) => {
return await queryService.GranteeGrants({
grantee: grantee,
grantee,
pagination: createPagination(paginationKey),
});
},
granterGrants: async (granter: string, paginationKey?: Uint8Array) => {
return await queryService.GranterGrants({
granter: granter,
granter,
pagination: createPagination(paginationKey),
});
},
Expand Down
8 changes: 3 additions & 5 deletions packages/stargate/src/modules/bank/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ export function setupBankExtension(base: QueryClient): BankExtension {
return {
bank: {
balance: async (address: string, denom: string) => {
const { balance } = await queryService.Balance({ address: address, denom: denom });
const { balance } = await queryService.Balance({ address, denom });
assert(balance);
return balance;
},
allBalances: async (address: string) => {
const { balances } = await queryService.AllBalances(
QueryAllBalancesRequest.fromPartial({ address: address }),
);
const { balances } = await queryService.AllBalances(QueryAllBalancesRequest.fromPartial({ address }));
return balances;
},
totalSupply: async (paginationKey?: Uint8Array) => {
Expand All @@ -48,7 +46,7 @@ export function setupBankExtension(base: QueryClient): BankExtension {
return response;
},
supplyOf: async (denom: string) => {
const { amount } = await queryService.SupplyOf({ denom: denom });
const { amount } = await queryService.SupplyOf({ denom });
assert(amount);
return amount;
},
Expand Down
16 changes: 8 additions & 8 deletions packages/stargate/src/modules/distribution/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ export function setupDistributionExtension(base: QueryClient): DistributionExten
},
delegationRewards: async (delegatorAddress: string, validatorAddress: string) => {
const response = await queryService.DelegationRewards({
delegatorAddress: delegatorAddress,
validatorAddress: validatorAddress,
delegatorAddress,
validatorAddress,
});
return response;
},
delegationTotalRewards: async (delegatorAddress: string) => {
const response = await queryService.DelegationTotalRewards({
delegatorAddress: delegatorAddress,
delegatorAddress,
});
return response;
},
delegatorValidators: async (delegatorAddress: string) => {
const response = await queryService.DelegatorValidators({
delegatorAddress: delegatorAddress,
delegatorAddress,
});
return response;
},
delegatorWithdrawAddress: async (delegatorAddress: string) => {
const response = await queryService.DelegatorWithdrawAddress({
delegatorAddress: delegatorAddress,
delegatorAddress,
});
return response;
},
Expand All @@ -81,13 +81,13 @@ export function setupDistributionExtension(base: QueryClient): DistributionExten
},
validatorCommission: async (validatorAddress: string) => {
const response = await queryService.ValidatorCommission({
validatorAddress: validatorAddress,
validatorAddress,
});
return response;
},
validatorOutstandingRewards: async (validatorAddress: string) => {
const response = await queryService.ValidatorOutstandingRewards({
validatorAddress: validatorAddress,
validatorAddress,
});
return response;
},
Expand All @@ -98,7 +98,7 @@ export function setupDistributionExtension(base: QueryClient): DistributionExten
paginationKey?: Uint8Array,
) => {
const response = await queryService.ValidatorSlashes({
validatorAddress: validatorAddress,
validatorAddress,
startingHeight: BigInt(startingHeight),
endingHeight: BigInt(endingHeight),
pagination: createPagination(paginationKey),
Expand Down
6 changes: 3 additions & 3 deletions packages/stargate/src/modules/feegrant/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export function setupFeegrantExtension(base: QueryClient): FeegrantExtension {
feegrant: {
allowance: async (granter: string, grantee: string) => {
const response = await queryService.Allowance({
granter: granter,
grantee: grantee,
granter,
grantee,
});
return response;
},
allowances: async (grantee: string, paginationKey?: Uint8Array) => {
const response = await queryService.Allowances({
grantee: grantee,
grantee,
pagination: createPagination(paginationKey),
});
return response;
Expand Down
Loading
Loading