Skip to content

Commit

Permalink
chore: run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Nov 2, 2023
1 parent 8d578e9 commit fae2519
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 84 deletions.
5 changes: 3 additions & 2 deletions common/sdk/src/amino/bundles.amino.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { AminoConverters } from "@cosmjs/stargate";
import {
MsgSubmitBundleProposal,
MsgVoteBundleProposal,
MsgClaimUploaderRole,
MsgSkipUploaderRole,
MsgSubmitBundleProposal,
MsgVoteBundleProposal,
} from "@kyvejs/types/client/kyve/bundles/v1beta1/tx";

import { isNotEmpty } from "../utils";

export const createBundlesAminoConverters = (): AminoConverters => {
Expand Down
3 changes: 2 additions & 1 deletion common/sdk/src/amino/delegation.amino.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { AminoConverters } from "@cosmjs/stargate";
import {
MsgDelegate,
MsgWithdrawRewards,
MsgRedelegate,
MsgUndelegate,
MsgWithdrawRewards,
} from "@kyvejs/types/client/kyve/delegation/v1beta1/tx";

import { isNotEmpty } from "../utils";

export const createDelegationAminoConverters = (): AminoConverters => {
Expand Down
53 changes: 28 additions & 25 deletions common/sdk/src/amino/funders.amino.ts
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
import { AminoConverters } from '@cosmjs/stargate';
import { AminoConverters } from "@cosmjs/stargate";
import {
MsgCreateFunder,
MsgDefundPool,
MsgFundPool,
MsgUpdateFunder
} from '@kyvejs/types/client/kyve/funders/v1beta1/tx';
import { isNotEmpty } from '../utils';
MsgUpdateFunder,
} from "@kyvejs/types/client/kyve/funders/v1beta1/tx";

import { isNotEmpty } from "../utils";

export const createFundersAminoConverters = (): AminoConverters => {
return {
'/kyve.funders.v1beta1.MsgFundPool': {
aminoType: 'kyve/funders/MsgFundPool',
"/kyve.funders.v1beta1.MsgFundPool": {
aminoType: "kyve/funders/MsgFundPool",
toAmino: (msg: MsgFundPool) => ({
creator: msg.creator,
...(isNotEmpty(msg.pool_id) && { pool_id: msg.pool_id }),
...(isNotEmpty(msg.amount) && { amount: msg.amount }),
...(isNotEmpty(msg.amount_per_bundle) && { amount_per_bundle: msg.amount_per_bundle })
...(isNotEmpty(msg.amount_per_bundle) && {
amount_per_bundle: msg.amount_per_bundle,
}),
}),
fromAmino: (msg): MsgFundPool => ({
creator: msg.creator,
pool_id: msg.pool_id,
amount: msg.amount,
amount_per_bundle: msg.amount_per_bundle
})
amount_per_bundle: msg.amount_per_bundle,
}),
},
'/kyve.funders.v1beta1.MsgDefundPool': {
aminoType: 'kyve/funders/MsgDefundPool',
"/kyve.funders.v1beta1.MsgDefundPool": {
aminoType: "kyve/funders/MsgDefundPool",
toAmino: (msg: MsgDefundPool) => ({
creator: msg.creator,
...(isNotEmpty(msg.pool_id) && { id: msg.pool_id }),
...(isNotEmpty(msg.amount) && { amount: msg.amount })
...(isNotEmpty(msg.amount) && { amount: msg.amount }),
}),
fromAmino: (msg): MsgDefundPool => ({
creator: msg.creator,
pool_id: msg.pool_id,
amount: msg.amount
})
amount: msg.amount,
}),
},
'/kyve.funders.v1beta1.MsgCreateFunder': {
aminoType: 'kyve/funders/MsgCreateFunder',
"/kyve.funders.v1beta1.MsgCreateFunder": {
aminoType: "kyve/funders/MsgCreateFunder",
toAmino: (msg: MsgCreateFunder) => ({
creator: msg.creator,
...(isNotEmpty(msg.moniker) && { moniker: msg.moniker }),
...(isNotEmpty(msg.description) && { description: msg.description }),
...(isNotEmpty(msg.website) && { website: msg.website }),
...(isNotEmpty(msg.identity) && { identity: msg.identity }),
...(isNotEmpty(msg.contact) && { contact: msg.contact })
...(isNotEmpty(msg.contact) && { contact: msg.contact }),
}),
fromAmino: (msg): MsgCreateFunder => ({
creator: msg.creator,
moniker: msg.moniker,
description: msg.description,
website: msg.website,
identity: msg.identity,
contact: msg.contact
})
contact: msg.contact,
}),
},
'/kyve.funders.v1beta1.MsgUpdateFunder': {
aminoType: 'kyve/funders/MsgUpdateFunder',
"/kyve.funders.v1beta1.MsgUpdateFunder": {
aminoType: "kyve/funders/MsgUpdateFunder",
toAmino: (msg: MsgUpdateFunder) => ({
creator: msg.creator,
...(isNotEmpty(msg.moniker) && { moniker: msg.moniker }),
...(isNotEmpty(msg.description) && { description: msg.description }),
...(isNotEmpty(msg.website) && { website: msg.website }),
...(isNotEmpty(msg.identity) && { identity: msg.identity }),
...(isNotEmpty(msg.contact) && { contact: msg.contact })
...(isNotEmpty(msg.contact) && { contact: msg.contact }),
}),
fromAmino: (msg): MsgUpdateFunder => ({
creator: msg.creator,
moniker: msg.moniker,
description: msg.description,
website: msg.website,
identity: msg.identity,
contact: msg.contact
})
}
contact: msg.contact,
}),
},
};
};
1 change: 1 addition & 0 deletions common/sdk/src/amino/gov.v1.amino.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AminoConverters } from "@cosmjs/stargate";
import { MsgVote } from "@kyvejs/types/client/cosmos/gov/v1/tx";

import { isNotEmpty } from "../utils";

export const createGovV1AminoConverters = (): AminoConverters => {
Expand Down
6 changes: 3 additions & 3 deletions common/sdk/src/amino/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from "./gov.v1.amino";
export * from "./bundles.amino";
export * from "./delegation.amino";
export * from "./funders.amino";
export * from "./gov.v1.amino";
export * from "./stakers.amino";
export * from "./delegation.amino";
export * from "./bundles.amino";
9 changes: 5 additions & 4 deletions common/sdk/src/amino/stakers.amino.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { AminoConverters } from "@cosmjs/stargate";
import { Decimal } from "@cosmjs/math";
import { AminoConverters } from "@cosmjs/stargate";
import {
MsgClaimCommissionRewards,
MsgCreateStaker,
MsgUpdateMetadata,
MsgJoinPool,
MsgUpdateCommission,
MsgLeavePool,
MsgClaimCommissionRewards,
MsgUpdateCommission,
MsgUpdateMetadata,
} from "@kyvejs/types/client/kyve/stakers/v1beta1/tx";

import { isNotEmpty } from "../utils";

function protoDecimalToJson(decimal: string): string {
Expand Down
17 changes: 8 additions & 9 deletions common/sdk/src/clients/full-client.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { OfflineAminoSigner } from "@cosmjs/amino/build/signer";
import { OfflineSigner, Registry } from "@cosmjs/proto-signing";
import { AminoTypes, GasPrice, SigningStargateClient } from "@cosmjs/stargate";

import { IConfig } from "../constants";
import * as KyveRegistryTx from "../registry/tx.registry";
import KyveClient from "./rpc-client/client";
import KyveWebClient from "./rpc-client/web.client";
import { createDefaultAminoConverters } from "@cosmjs/stargate";

import {
createFundersAminoConverters,
createStakersAminoConverters,
createDelegationAminoConverters,
createBundlesAminoConverters,
createDelegationAminoConverters,
createFundersAminoConverters,
createGovV1AminoConverters,
createStakersAminoConverters,
} from "../amino";
import { createDefaultAminoConverters } from "@cosmjs/stargate";
import { IConfig } from "../constants";
import * as KyveRegistryTx from "../registry/tx.registry";
import KyveClient from "./rpc-client/client";
import KyveWebClient from "./rpc-client/web.client";

export async function getSigningKyveClient(
config: IConfig,
Expand Down
10 changes: 6 additions & 4 deletions common/sdk/src/clients/lcd-client/query/v1beta1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import paginationQuery from "@kyvejs/types/client/cosmos/base/query/v1beta1/pagi
import kyveQueryAccount from "@kyvejs/types/client/kyve/query/v1beta1/account";
import kyveQueryBundles from "@kyvejs/types/client/kyve/query/v1beta1/bundles";
import kyveQueryDelegation from "@kyvejs/types/client/kyve/query/v1beta1/delegation";
import kyveQueryFunders from "@kyvejs/types/client/kyve/query/v1beta1/funders";
import kyveQueryParamsRes from "@kyvejs/types/client/kyve/query/v1beta1/params";
import kyveQueryPools from "@kyvejs/types/client/kyve/query/v1beta1/pools";
import kyveQueryStakers from "@kyvejs/types/client/kyve/query/v1beta1/stakers";
import kyveQueryAccountRes from "@kyvejs/types/lcd/kyve/query/v1beta1/account";
import kyveQueryBundlesRes from "@kyvejs/types/lcd/kyve/query/v1beta1/bundles";
import kyveQueryDelegationRes from "@kyvejs/types/lcd/kyve/query/v1beta1/delegation";
import kyveQueryFundersRes from "@kyvejs/types/lcd/kyve/query/v1beta1/funders";
import kyveQueryPoolsRes from "@kyvejs/types/lcd/kyve/query/v1beta1/pools";
import kyveQueryStakersRes from "@kyvejs/types/lcd/kyve/query/v1beta1/stakers";
import kyveQueryFunders from "@kyvejs/types/client/kyve/query/v1beta1/funders";
import kyveQueryFundersRes from "@kyvejs/types/lcd/kyve/query/v1beta1/funders";

import {AbstractKyveLCDClient} from "../../lcd-client.abstract";
import { AbstractKyveLCDClient } from "../../lcd-client.abstract";

type NestedPartial<T> = {
[K in keyof T]?: T[K] extends Array<infer R>
Expand Down Expand Up @@ -262,7 +262,9 @@ export class KyveRegistryLCDClient extends AbstractKyveLCDClient {

async funders(
params?: PaginationAllPartialRequestUtilType<kyveQueryFunders.QueryFundersRequest>
): Promise<PaginationResponseTypeUtil<kyveQueryFundersRes.QueryFundersResponse>> {
): Promise<
PaginationResponseTypeUtil<kyveQueryFundersRes.QueryFundersResponse>
> {
const parameters: Record<string, any> = {};
if (typeof params?.pagination !== "undefined") {
parameters.pagination = params.pagination;
Expand Down
8 changes: 6 additions & 2 deletions common/sdk/src/clients/rpc-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { IConfig } from "../../constants";
import KyveBaseMethods from "./kyve/base/v1beta1/base";
import KyveBundlesMethods from "./kyve/bundles/v1beta1/bundles";
import KyveDelegationMethods from "./kyve/delegation/v1beta1/delegation";
import KyveGovMethodsV1 from "./kyve/gov/v1/gov";
import KyveFundersMethods from "./kyve/funders/v1beta1/funders";
import KyveGovMethodsV1 from "./kyve/gov/v1/gov";
import KyveStakersMethods from "./kyve/stakers/v1beta1/stakers";

export default class KyveClient {
Expand Down Expand Up @@ -69,7 +69,11 @@ export default class KyveClient {
v1: new KyveGovMethodsV1(this.nativeClient, this.account, config),
},
funders: {
v1beta1: new KyveFundersMethods(this.nativeClient, this.account, config),
v1beta1: new KyveFundersMethods(
this.nativeClient,
this.account,
config
),
},
stakers: {
v1beta1: new KyveStakersMethods(
Expand Down
34 changes: 17 additions & 17 deletions common/sdk/src/clients/rpc-client/kyve/funders/v1beta1/funders.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { StdFee } from '@cosmjs/amino/build/signdoc';
import { StdFee } from "@cosmjs/amino/build/signdoc";
import {
MsgCreateFunder,
MsgDefundPool,
MsgFundPool,
MsgUpdateFunder
} from '@kyvejs/types/client/kyve/funders/v1beta1/tx';
MsgUpdateFunder,
} from "@kyvejs/types/client/kyve/funders/v1beta1/tx";

import { withTypeUrl } from '../../../../../registry/tx.registry';
import { KyveSigning, PendingTx } from '../../../signing';
import { withTypeUrl } from "../../../../../registry/tx.registry";
import { KyveSigning, PendingTx } from "../../../signing";

export default class KyveFundersMethods extends KyveSigning {
public createFunder(
value: Omit<MsgCreateFunder, 'creator'>,
value: Omit<MsgCreateFunder, "creator">,
options?: {
fee?: StdFee | 'auto' | number;
fee?: StdFee | "auto" | number;
memo?: string;
}
) {
const tx = withTypeUrl.createFunder({
...value,
creator: this.account.address
creator: this.account.address,
});

return new PendingTx({ tx: [tx] }, () =>
Expand All @@ -28,15 +28,15 @@ export default class KyveFundersMethods extends KyveSigning {
}

public updateFunder(
value: Omit<MsgUpdateFunder, 'creator'>,
value: Omit<MsgUpdateFunder, "creator">,
options?: {
fee?: StdFee | 'auto' | number;
fee?: StdFee | "auto" | number;
memo?: string;
}
) {
const tx = withTypeUrl.updateFunder({
...value,
creator: this.account.address
creator: this.account.address,
});

return new PendingTx({ tx: [tx] }, () =>
Expand All @@ -45,15 +45,15 @@ export default class KyveFundersMethods extends KyveSigning {
}

public fundPool(
value: Omit<MsgFundPool, 'creator'>,
value: Omit<MsgFundPool, "creator">,
options?: {
fee?: StdFee | 'auto' | number;
fee?: StdFee | "auto" | number;
memo?: string;
}
) {
const tx = withTypeUrl.fundPool({
...value,
creator: this.account.address
creator: this.account.address,
});

return new PendingTx({ tx: [tx] }, () =>
Expand All @@ -62,15 +62,15 @@ export default class KyveFundersMethods extends KyveSigning {
}

public defundPool(
value: Omit<MsgDefundPool, 'creator'>,
value: Omit<MsgDefundPool, "creator">,
options?: {
fee?: StdFee | 'auto' | number;
fee?: StdFee | "auto" | number;
memo?: string;
}
) {
const tx = withTypeUrl.defundPool({
...value,
creator: this.account.address
creator: this.account.address,
});
return new PendingTx({ tx: [tx] }, () =>
this.getPendingSignedTx(tx, options)
Expand Down
24 changes: 12 additions & 12 deletions common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { StdFee } from '@cosmjs/amino/build/signdoc';
import { coins } from '@cosmjs/stargate';
import { VoteOption } from '@kyvejs/types/client/cosmos/gov/v1/gov';
import { MsgUpdateParams as MsgUpdateParamsBundles } from '@kyvejs/types/client/kyve/bundles/v1beta1/tx';
import { MsgUpdateParams as MsgUpdateParamsDelegation } from '@kyvejs/types/client/kyve/delegation/v1beta1/tx';
import { MsgUpdateParams as MsgUpdateParamsGlobal } from '@kyvejs/types/client/kyve/global/v1beta1/tx';
import { StdFee } from "@cosmjs/amino/build/signdoc";
import { coins } from "@cosmjs/stargate";
import { VoteOption } from "@kyvejs/types/client/cosmos/gov/v1/gov";
import { MsgUpdateParams as MsgUpdateParamsBundles } from "@kyvejs/types/client/kyve/bundles/v1beta1/tx";
import { MsgUpdateParams as MsgUpdateParamsDelegation } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx";
import { MsgUpdateParams as MsgUpdateParamsGlobal } from "@kyvejs/types/client/kyve/global/v1beta1/tx";
import {
MsgCancelRuntimeUpgrade,
MsgCreatePool,
MsgDisablePool,
MsgEnablePool,
MsgScheduleRuntimeUpgrade,
MsgUpdatePool
} from '@kyvejs/types/client/kyve/pool/v1beta1/tx';
import { MsgUpdateParams as MsgUpdateParamsStakers } from '@kyvejs/types/client/kyve/stakers/v1beta1/tx';
MsgUpdatePool,
} from "@kyvejs/types/client/kyve/pool/v1beta1/tx";
import { MsgUpdateParams as MsgUpdateParamsStakers } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx";

import { GOV_AUTHORITY } from '../../../../../constants';
import { encodeTxMsg } from '../../../../../registry/tx.registry';
import { KyveSigning, PendingTx } from '../../../signing';
import { GOV_AUTHORITY } from "../../../../../constants";
import { encodeTxMsg } from "../../../../../registry/tx.registry";
import { KyveSigning, PendingTx } from "../../../signing";

export default class KyveGovMsg extends KyveSigning {
private createGovTx(
Expand Down
Loading

0 comments on commit fae2519

Please sign in to comment.