Skip to content

Commit

Permalink
chore: updated types and sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Jun 12, 2024
1 parent 16b0359 commit 96837bc
Show file tree
Hide file tree
Showing 150 changed files with 1,290 additions and 573 deletions.
4 changes: 2 additions & 2 deletions common/sdk/src/amino/stakers.amino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ export const createStakersAminoConverters = (): AminoConverters => {
aminoType: "kyve/stakers/MsgClaimCommissionRewards",
toAmino: (msg: MsgClaimCommissionRewards) => ({
creator: msg.creator,
amount: [...msg.amount],
amounts: [...msg.amounts],
}),
fromAmino: (msg): MsgClaimCommissionRewards => ({
creator: msg.creator,
amount: [...msg.amount],
amounts: [...msg.amounts],
}),
},
"/kyve.stakers.v1beta1.MsgJoinPool": {
Expand Down
14 changes: 14 additions & 0 deletions common/sdk/src/clients/lcd-client/bundles/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import paramsRes from "@kyvejs/types/lcd/kyve/bundles/v1beta1/params";

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

export class BundlesModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async params(): Promise<paramsRes.Params> {
const endpoint = `/kyve/bundles/v1beta1/params`;
return await this.request(endpoint);
}
}
60 changes: 57 additions & 3 deletions common/sdk/src/clients/lcd-client/client.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,69 @@
import { KyveRegistryLCDClient } from "./query/v1beta1/query";
import { BundlesModuleLCDClient } from "./bundles/v1beta1/query";
import { DelegationModuleLCDClient } from "./delegation/v1beta1/query";
import { FundersModuleLCDClient } from "./funders/v1beta1/query";
import { GlobalModuleLCDClient } from "./global/v1beta1/query";
import { PoolModuleLCDClient } from "./pool/v1beta1/query";
import { QueryModuleLCDClient } from "./query/v1beta1/query";
import { StakersModuleLCDClient } from "./stakers/v1beta1/query";
import { TeamModuleLCDClient } from "./team/v1beta1/query";
class KyveLCDClient {
public query: { v1beta1: KyveRegistryLCDClient };
public bundles: {
v1beta1: BundlesModuleLCDClient;
};
public delegation: {
v1beta1: DelegationModuleLCDClient;
};
public funders: {
v1beta1: FundersModuleLCDClient;
};
public global: {
v1beta1: GlobalModuleLCDClient;
};
public pool: {
v1beta1: PoolModuleLCDClient;
};
public query: {
v1beta1: QueryModuleLCDClient;
};
public stakers: {
v1beta1: StakersModuleLCDClient;
};
public team: {
v1beta1: TeamModuleLCDClient;
};

constructor(restEndpoint: string) {
this.bundles = {
v1beta1: new BundlesModuleLCDClient(restEndpoint),
};
this.delegation = {
v1beta1: new DelegationModuleLCDClient(restEndpoint),
};
this.funders = {
v1beta1: new FundersModuleLCDClient(restEndpoint),
};
this.global = {
v1beta1: new GlobalModuleLCDClient(restEndpoint),
};
this.pool = {
v1beta1: new PoolModuleLCDClient(restEndpoint),
};
this.query = {
v1beta1: new KyveRegistryLCDClient(restEndpoint),
v1beta1: new QueryModuleLCDClient(restEndpoint),
};
this.stakers = {
v1beta1: new StakersModuleLCDClient(restEndpoint),
};
this.team = {
v1beta1: new TeamModuleLCDClient(restEndpoint),
};
}
}

export type KyveLCDClientType = {
kyve: KyveLCDClient;
};

export function createKyveLCDClient(restEndpoint: string): KyveLCDClientType {
return {
kyve: new KyveLCDClient(restEndpoint),
Expand Down
14 changes: 14 additions & 0 deletions common/sdk/src/clients/lcd-client/delegation/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import paramsRes from "@kyvejs/types/lcd/kyve/delegation/v1beta1/params";

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

export class DelegationModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async params(): Promise<paramsRes.Params> {
const endpoint = `/kyve/delegation/v1beta1/params`;
return await this.request(endpoint);
}
}
14 changes: 14 additions & 0 deletions common/sdk/src/clients/lcd-client/funders/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import paramsRes from "@kyvejs/types/lcd/kyve/funders/v1beta1/params";

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

export class FundersModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async params(): Promise<paramsRes.Params> {
const endpoint = `/kyve/funders/v1beta1/params`;
return await this.request(endpoint);
}
}
14 changes: 14 additions & 0 deletions common/sdk/src/clients/lcd-client/global/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import paramsRes from "@kyvejs/types/lcd/kyve/global/v1beta1/query";

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

export class GlobalModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async params(): Promise<paramsRes.QueryParamsResponse> {
const endpoint = `/kyve/global/v1beta1/params`;
return await this.request(endpoint);
}
}
14 changes: 14 additions & 0 deletions common/sdk/src/clients/lcd-client/pool/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import paramsRes from "@kyvejs/types/lcd/kyve/pool/v1beta1/params";

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

export class PoolModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async params(): Promise<paramsRes.Params> {
const endpoint = `/kyve/pool/v1beta1/params`;
return await this.request(endpoint);
}
}
36 changes: 14 additions & 22 deletions common/sdk/src/clients/lcd-client/query/v1beta1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type PaginationResponseTypeUtil<T> = Overwrite<
{ pagination?: { next_key: string; total: string } }
>;

export class KyveRegistryLCDClient extends AbstractKyveLCDClient {
export class QueryModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}
Expand Down Expand Up @@ -126,28 +126,7 @@ export class KyveRegistryLCDClient extends AbstractKyveLCDClient {
return await this.request(endpoint);
}
/** end stakers **/

// async finalizedBundles(
// params: PaginationPartialRequestUtilType<kyveQueryBundles.QueryFinalizedBundlesRequest>
// ): Promise<
// PaginationResponseTypeUtil<kyveQueryRes.QueryFinalizedBundlesResponse>
// > {
// const parameters: Record<string, any> = {};
//
// if (typeof params?.pagination !== "undefined") {
// parameters.pagination = params.pagination;
// }
// const endpoint = `kyve/query/v1beta1/finalized_bundles/${params.pool_id}`;
// return await this.request(endpoint, parameters);
// }
/** Bundles **/
async finalizedBundle(
params: kyveQueryBundles.QueryFinalizedBundleRequest
): Promise<kyveQueryBundles.QueryFinalizedBundleResponse> {
const endpoint = `/kyve/v1/bundles/${params.pool_id}/${params.id}`;
return await this.request(endpoint);
}

async finalizedBundles(
params: PaginationPartialRequestUtilType<kyveQueryBundles.QueryFinalizedBundlesRequest>
): Promise<
Expand All @@ -158,9 +137,22 @@ export class KyveRegistryLCDClient extends AbstractKyveLCDClient {
if (typeof params?.pagination !== "undefined") {
parameters.pagination = params.pagination;
}

if (typeof params.index !== "undefined") {
parameters.index = params.index;
}

const endpoint = `/kyve/v1/bundles/${params.pool_id}`;
return await this.request(endpoint, parameters);
}

async finalizedBundle(
params: kyveQueryBundles.QueryFinalizedBundleRequest
): Promise<kyveQueryBundles.QueryFinalizedBundleResponse> {
const endpoint = `/kyve/v1/bundles/${params.pool_id}/${params.id}`;
return await this.request(endpoint);
}

async currentVoteStatus(
params: kyveQueryBundles.QueryCurrentVoteStatusRequest
): Promise<kyveQueryBundlesRes.QueryCurrentVoteStatusResponse> {
Expand Down
14 changes: 14 additions & 0 deletions common/sdk/src/clients/lcd-client/stakers/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import paramsRes from "@kyvejs/types/lcd/kyve/stakers/v1beta1/params";

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

export class StakersModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async params(): Promise<paramsRes.Params> {
const endpoint = `/kyve/stakers/v1beta1/params`;
return await this.request(endpoint);
}
}
41 changes: 41 additions & 0 deletions common/sdk/src/clients/lcd-client/team/v1beta1/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import queryReq from "@kyvejs/types/client/kyve/team/v1beta1/query";
import queryRes from "@kyvejs/types/lcd/kyve/team/v1beta1/query";

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

export class TeamModuleLCDClient extends AbstractKyveLCDClient {
constructor(restEndpoint: string) {
super(restEndpoint);
}

async teamInfo(): Promise<queryRes.QueryTeamInfoResponse> {
const endpoint = `/kyve/team/v1beta1/team_info`;
return await this.request(endpoint);
}

async teamVestingAccounts(): Promise<queryRes.QueryTeamVestingAccountsResponse> {
const endpoint = `/kyve/team/v1beta1/team_vesting_accounts`;
return await this.request(endpoint);
}

async teamVestingAccount(
params: queryReq.QueryTeamVestingAccountRequest
): Promise<queryRes.QueryTeamVestingAccountResponse> {
const endpoint = `/kyve/team/v1beta1/team_vesting_account/${params.id}`;
return await this.request(endpoint);
}

async teamVestingStatus(
params: queryReq.QueryTeamVestingStatusRequest
): Promise<queryRes.QueryTeamVestingStatusResponse> {
const endpoint = `/kyve/team/v1beta1/team_vesting_status/${params.id}`;
return await this.request(endpoint);
}

async teamVestingStatusByTime(
params: queryReq.QueryTeamVestingStatusByTimeRequest
): Promise<queryRes.QueryTeamVestingStatusByTimeResponse> {
const endpoint = `/kyve/team/v1beta1/team_vesting_status_by_time/${params.id}/${params.time}`;
return await this.request(endpoint);
}
}
2 changes: 1 addition & 1 deletion common/types/src/client/amino/amino.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: amino/amino.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/cosmos/app/v1alpha1/module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos/app/v1alpha1/module.proto

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos/base/query/v1beta1/pagination.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/cosmos/base/v1beta1/coin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos/base/v1beta1/coin.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/cosmos/gov/v1/gov.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos/gov/v1/gov.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/cosmos/gov/v1/tx.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos/gov/v1/tx.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/cosmos/msg/v1/msg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos/msg/v1/msg.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/cosmos_proto/cosmos.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: cosmos_proto/cosmos.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/gogoproto/gogo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: gogoproto/gogo.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/google/api/annotations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: google/api/annotations.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/google/api/http.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: google/api/http.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/google/protobuf/any.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: google/protobuf/any.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/google/protobuf/duration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: google/protobuf/duration.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/google/protobuf/timestamp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: google/protobuf/timestamp.proto

Expand Down
2 changes: 1 addition & 1 deletion common/types/src/client/kyve/bundles/module/module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.176.1
// protoc-gen-ts_proto v1.178.0
// protoc unknown
// source: kyve/bundles/module/module.proto

Expand Down
Loading

0 comments on commit 96837bc

Please sign in to comment.