diff --git a/common/sdk/src/amino/bundles.amino.ts b/common/sdk/src/amino/bundles.amino.ts index 6ee78902..5d1853c5 100644 --- a/common/sdk/src/amino/bundles.amino.ts +++ b/common/sdk/src/amino/bundles.amino.ts @@ -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 => { diff --git a/common/sdk/src/amino/delegation.amino.ts b/common/sdk/src/amino/delegation.amino.ts index 636a9627..2dd9e774 100644 --- a/common/sdk/src/amino/delegation.amino.ts +++ b/common/sdk/src/amino/delegation.amino.ts @@ -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 => { diff --git a/common/sdk/src/amino/funders.amino.ts b/common/sdk/src/amino/funders.amino.ts index 5ff4afcf..b44310c3 100644 --- a/common/sdk/src/amino/funders.amino.ts +++ b/common/sdk/src/amino/funders.amino.ts @@ -1,51 +1,54 @@ -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, @@ -53,18 +56,18 @@ export const createFundersAminoConverters = (): AminoConverters => { 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, @@ -72,8 +75,8 @@ export const createFundersAminoConverters = (): AminoConverters => { description: msg.description, website: msg.website, identity: msg.identity, - contact: msg.contact - }) - } + contact: msg.contact, + }), + }, }; }; diff --git a/common/sdk/src/amino/gov.v1.amino.ts b/common/sdk/src/amino/gov.v1.amino.ts index 4d8ba947..30a6fd13 100644 --- a/common/sdk/src/amino/gov.v1.amino.ts +++ b/common/sdk/src/amino/gov.v1.amino.ts @@ -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 => { diff --git a/common/sdk/src/amino/index.ts b/common/sdk/src/amino/index.ts index 92254e8d..37e922e7 100644 --- a/common/sdk/src/amino/index.ts +++ b/common/sdk/src/amino/index.ts @@ -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"; diff --git a/common/sdk/src/amino/stakers.amino.ts b/common/sdk/src/amino/stakers.amino.ts index a2df15a8..f55a0d2b 100644 --- a/common/sdk/src/amino/stakers.amino.ts +++ b/common/sdk/src/amino/stakers.amino.ts @@ -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 { diff --git a/common/sdk/src/clients/full-client.ts b/common/sdk/src/clients/full-client.ts index f1a184c7..354659c3 100644 --- a/common/sdk/src/clients/full-client.ts +++ b/common/sdk/src/clients/full-client.ts @@ -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, diff --git a/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts b/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts index 1da5db60..8328525e 100644 --- a/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts +++ b/common/sdk/src/clients/lcd-client/query/v1beta1/query.ts @@ -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 = { [K in keyof T]?: T[K] extends Array @@ -262,7 +262,9 @@ export class KyveRegistryLCDClient extends AbstractKyveLCDClient { async funders( params?: PaginationAllPartialRequestUtilType - ): Promise> { + ): Promise< + PaginationResponseTypeUtil + > { const parameters: Record = {}; if (typeof params?.pagination !== "undefined") { parameters.pagination = params.pagination; diff --git a/common/sdk/src/clients/rpc-client/client.ts b/common/sdk/src/clients/rpc-client/client.ts index 6fd72115..62076124 100644 --- a/common/sdk/src/clients/rpc-client/client.ts +++ b/common/sdk/src/clients/rpc-client/client.ts @@ -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 { @@ -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( diff --git a/common/sdk/src/clients/rpc-client/kyve/funders/v1beta1/funders.ts b/common/sdk/src/clients/rpc-client/kyve/funders/v1beta1/funders.ts index d9d106ff..21cf503d 100644 --- a/common/sdk/src/clients/rpc-client/kyve/funders/v1beta1/funders.ts +++ b/common/sdk/src/clients/rpc-client/kyve/funders/v1beta1/funders.ts @@ -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, + value: Omit, 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] }, () => @@ -28,15 +28,15 @@ export default class KyveFundersMethods extends KyveSigning { } public updateFunder( - value: Omit, + value: Omit, 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] }, () => @@ -45,15 +45,15 @@ export default class KyveFundersMethods extends KyveSigning { } public fundPool( - value: Omit, + value: Omit, 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] }, () => @@ -62,15 +62,15 @@ export default class KyveFundersMethods extends KyveSigning { } public defundPool( - value: Omit, + value: Omit, 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) diff --git a/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts b/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts index ddb75003..e98e48f1 100644 --- a/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts +++ b/common/sdk/src/clients/rpc-client/kyve/gov/v1/gov.ts @@ -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( diff --git a/common/sdk/src/registry/tx.registry.ts b/common/sdk/src/registry/tx.registry.ts index ce2cf538..2a8ed9f5 100644 --- a/common/sdk/src/registry/tx.registry.ts +++ b/common/sdk/src/registry/tx.registry.ts @@ -15,6 +15,8 @@ import { MsgWithdrawRewards } from "@kyvejs/types/client/kyve/delegation/v1beta1 import { MsgRedelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; import { MsgUndelegate } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; import { MsgUpdateParams as MsgUpdateParamsDelegation } from "@kyvejs/types/client/kyve/delegation/v1beta1/tx"; +import { MsgFundPool } from "@kyvejs/types/client/kyve/funders/v1beta1/tx"; +import { MsgDefundPool } from "@kyvejs/types/client/kyve/funders/v1beta1/tx"; /** fees **/ import { MsgUpdateParams as MsgUpdateParamsGlobal } from "@kyvejs/types/client/kyve/global/v1beta1/tx"; import { MsgCreatePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; @@ -23,11 +25,6 @@ import { MsgDisablePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; import { MsgEnablePool } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; import { MsgScheduleRuntimeUpgrade } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; import { MsgCancelRuntimeUpgrade } from "@kyvejs/types/client/kyve/pool/v1beta1/tx"; -/** funders **/ -import { MsgCreateFunder } from '@kyvejs/types/lcd/kyve/funders/v1beta1/tx'; -import { MsgUpdateFunder } from '@kyvejs/types/lcd/kyve/funders/v1beta1/tx'; -import { MsgFundPool } from '@kyvejs/types/client/kyve/funders/v1beta1/tx'; -import { MsgDefundPool } from "@kyvejs/types/client/kyve/funders/v1beta1/tx"; /** stakers **/ import { MsgClaimCommissionRewards, @@ -38,6 +35,9 @@ import { MsgJoinPool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; import { MsgUpdateCommission } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; import { MsgLeavePool } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; import { MsgUpdateParams as MsgUpdateParamsStakers } from "@kyvejs/types/client/kyve/stakers/v1beta1/tx"; +/** funders **/ +import { MsgCreateFunder } from "@kyvejs/types/lcd/kyve/funders/v1beta1/tx"; +import { MsgUpdateFunder } from "@kyvejs/types/lcd/kyve/funders/v1beta1/tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ ...defaultRegistryTypes,