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

[WIP] Rapha/feat/chain v1.4.0 upgrade #95

Merged
merged 44 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3e344e7
feat: upgrade yarn
shifty11 Oct 18, 2023
bbd4f89
feat: use buf to generate proto files
shifty11 Oct 18, 2023
0037a05
fix: change some methods from pool to funders module
shifty11 Oct 18, 2023
e87cf97
fix: add import.proto file
shifty11 Oct 18, 2023
2c7b396
chore: update tx.registry
shifty11 Oct 18, 2023
19ddfbc
chore: update yarn.lock
shifty11 Oct 18, 2023
a23dc36
fix: docker volume mount
shifty11 Oct 18, 2023
dda2fcd
fix: typo in buf generators
shifty11 Oct 18, 2023
8303288
feat: add funders query
shifty11 Oct 19, 2023
d993e19
fix: update types package in protocol
shifty11 Oct 19, 2023
9eabc19
chore: merge main
shifty11 Oct 19, 2023
df552ce
fix: update Dockefile
shifty11 Oct 19, 2023
827d712
feat: add new funders queries
shifty11 Oct 19, 2023
8405900
chore: sync chain proto files
shifty11 Oct 24, 2023
412833d
fix: typo
shifty11 Oct 24, 2023
fee576d
feat: add create/update funder methods
shifty11 Oct 26, 2023
c4b4cc8
chore: update protobufs
shifty11 Oct 26, 2023
1da963b
chore: update bignumber.js so that it is the same version everywhere
shifty11 Oct 26, 2023
dd09336
chore: change todo
shifty11 Oct 26, 2023
75f5601
feat: avoid permission issues in proto file generation
shifty11 Oct 30, 2023
06cce76
chore: update gov with new params
shifty11 Nov 1, 2023
196cfd4
chore: sync changes from chain
shifty11 Nov 1, 2023
09462fb
chore: update cosmjs
shifty11 Nov 1, 2023
4fde52d
Merge branch 'main' into rapha/cosmos-sdk-0.47.x-upgrade
shifty11 Nov 2, 2023
f62e422
chore: bump version of kyvejs/types to 1.2.0
shifty11 Nov 2, 2023
faee5c4
feat: add funders amino types
shifty11 Nov 2, 2023
c284827
chore: change yarn settings
shifty11 Nov 2, 2023
79b52af
revert: revert usage of yarn 3
shifty11 Nov 2, 2023
0e7c9a5
Merge branch 'rapha/cosmos-sdk-0.47.x-upgrade' into main
shifty11 Nov 2, 2023
d4a0de5
Revert "Merge branch 'rapha/cosmos-sdk-0.47.x-upgrade' into main"
shifty11 Nov 2, 2023
76d67f6
feat: add all in sdk and types
shifty11 Nov 2, 2023
8d578e9
chore: update protocol and sdk versions
shifty11 Nov 2, 2023
fae2519
chore: run linter
shifty11 Nov 2, 2023
35fa92f
chore: set coinDecimals of korellia to 6
shifty11 Nov 2, 2023
dd6739f
chore: set korellia chainId to korellia-2
shifty11 Nov 2, 2023
4ca1751
chore: upgrade kysor packages
shifty11 Nov 2, 2023
aad98c8
chore: revert versions
shifty11 Nov 6, 2023
8f9ae45
revert: version update in kysor
shifty11 Nov 6, 2023
4a82aab
chore: update axios version in sdk
shifty11 Nov 6, 2023
ff3dabe
revert: update axios version in sdk
shifty11 Nov 6, 2023
e5f4e87
fix: Dockerfile
shifty11 Nov 8, 2023
d2b91cd
chore: generate new pool types with POOL_STATUS_VOTING_POWER_TOO_HIGH
shifty11 Nov 8, 2023
bf9f0f8
Merge remote-tracking branch 'origin/main' into rapha/feat/chain-v1.4…
shifty11 Nov 8, 2023
9aee110
chore: set version to main
shifty11 Nov 8, 2023
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
4 changes: 2 additions & 2 deletions common/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"@cosmjs/proto-signing": "^0.27.1",
"@cosmjs/stargate": "^0.27.1",
"@kyvejs/sdk": "1.0.5",
"@kyvejs/types": "1.0.3",
"@kyvejs/types": "1.1.0",
"@types/cli-progress": "^3.9.2",
"@types/jsonfile": "^6.0.1",
"arweave": "^1.10.17",
"axios": "^0.24.0",
"bignumber.js": "^9.0.1",
"bignumber.js": "^9.1.2",
"clone": "^2.1.2",
"commander": "^9.4.1",
"diff": "^5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion common/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Sdk instance can be configured with a network object.
const network = {
rpc: "https://rpc.korellia.kyve.network",
rest: "https://api.korellia.kyve.network",
chainId: "korellia",
chainId: "korellia-2",
chainName: "Korellia",
}
const sdk = new KyveSDK(network);
Expand Down
18 changes: 9 additions & 9 deletions common/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
"lint:fix": "eslint --fix . --ignore-path ../../.eslintignore --ext ts --ext tsx --ext js --ext jsx"
},
"dependencies": {
"@cosmjs/amino": "^0.30.1",
"@cosmjs/crypto": "^0.30.1",
"@cosmjs/encoding": "^0.30.1",
"@cosmjs/proto-signing": "^0.30.1",
"@cosmjs/stargate": "^0.30.1",
"@cosmjs/tendermint-rpc": "^0.30.1",
"@cosmjs/amino": "^0.31.3",
"@cosmjs/crypto": "^0.31.3",
"@cosmjs/encoding": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.3",
"@cosmostation/extension-client": "^0.0.6",
"@keplr-wallet/cosmos": "^0.11.38",
"@kyvejs/types": "1.0.3",
"@keplr-wallet/cosmos": "^0.12.39",
"@kyvejs/types": "1.1.0",
"axios": "0.25.0",
"bech32": "2.0.0",
"bignumber.js": "9.0.2",
"bignumber.js": "9.1.2",
"humanize-number": "0.0.2",
"qs": "^6.10.5"
},
Expand Down
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
82 changes: 82 additions & 0 deletions common/sdk/src/amino/funders.amino.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { AminoConverters } from "@cosmjs/stargate";
import {
MsgCreateFunder,
MsgDefundPool,
MsgFundPool,
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",
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,
}),
}),
fromAmino: (msg): MsgFundPool => ({
creator: msg.creator,
pool_id: msg.pool_id,
amount: msg.amount,
amount_per_bundle: msg.amount_per_bundle,
}),
},
"/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 }),
}),
fromAmino: (msg): MsgDefundPool => ({
creator: msg.creator,
pool_id: msg.pool_id,
amount: msg.amount,
}),
},
"/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 }),
}),
fromAmino: (msg): MsgCreateFunder => ({
creator: msg.creator,
moniker: msg.moniker,
description: msg.description,
website: msg.website,
identity: msg.identity,
contact: msg.contact,
}),
},
"/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 }),
}),
fromAmino: (msg): MsgUpdateFunder => ({
creator: msg.creator,
moniker: msg.moniker,
description: msg.description,
website: msg.website,
identity: msg.identity,
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 "./bundles.amino";
export * from "./delegation.amino";
export * from "./funders.amino";
export * from "./gov.v1.amino";
export * from "./pool.amino";
export * from "./stakers.amino";
export * from "./delegation.amino";
export * from "./bundles.amino";
37 changes: 0 additions & 37 deletions common/sdk/src/amino/pool.amino.ts

This file was deleted.

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
19 changes: 9 additions & 10 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 {
createPoolAminoConverters,
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 Expand Up @@ -48,7 +47,7 @@ export async function getSigningKyveClient(
aminoTypes: new AminoTypes({
...createDefaultAminoConverters(),
...createGovV1AminoConverters(),
...createPoolAminoConverters(),
...createFundersAminoConverters(),
...createStakersAminoConverters(),
...createDelegationAminoConverters(),
...createBundlesAminoConverters(),
Expand Down
47 changes: 47 additions & 0 deletions common/sdk/src/clients/lcd-client/query/v1beta1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ 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";

Expand Down Expand Up @@ -249,4 +251,49 @@ export class KyveRegistryLCDClient extends AbstractKyveLCDClient {
return await this.request(endpoint);
}
/** End Account **/

/** Funders **/
async funder(
params: kyveQueryFunders.QueryFunderRequest
): Promise<kyveQueryFundersRes.QueryFunderResponse> {
const endpoint = `/kyve/query/v1beta1/funder/${params.address}`;
return await this.request(endpoint);
}

async funders(
params?: PaginationAllPartialRequestUtilType<kyveQueryFunders.QueryFundersRequest>
): Promise<
PaginationResponseTypeUtil<kyveQueryFundersRes.QueryFundersResponse>
> {
const parameters: Record<string, any> = {};
if (typeof params?.pagination !== "undefined") {
parameters.pagination = params.pagination;
}

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

const endpoint = `/kyve/query/v1beta1/funders`;
return await this.request(endpoint, parameters);
}

async fundings_by_funder(
params: PaginationPartialRequestUtilType<kyveQueryFunders.QueryFundingsByFunderRequest>
): Promise<
PaginationResponseTypeUtil<kyveQueryFundersRes.QueryFundingsByFunderResponse>
> {
const endpoint = `/kyve/query/v1beta1/fundings_by_funder/${params.address}`;
return await this.request(endpoint, params);
}

async fundings_by_pool(
params: PaginationPartialRequestUtilType<kyveQueryFunders.QueryFundingsByPoolRequest>
): Promise<
PaginationResponseTypeUtil<kyveQueryFundersRes.QueryFundingsByPoolResponse>
> {
const endpoint = `/kyve/query/v1beta1/fundings_by_pool/${params.pool_id}`;
return await this.request(endpoint, params);
}
/** EndFunders **/
}
14 changes: 9 additions & 5 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 KyveFundersMethods from "./kyve/funders/v1beta1/funders";
import KyveGovMethodsV1 from "./kyve/gov/v1/gov";
import KyvePoolMethods from "./kyve/pool/v1beta1/pool";
import KyveStakersMethods from "./kyve/stakers/v1beta1/stakers";

export default class KyveClient {
Expand All @@ -28,8 +28,8 @@ export default class KyveClient {
delegation: {
v1beta1: KyveDelegationMethods;
};
pool: {
v1beta1: KyvePoolMethods;
funders: {
v1beta1: KyveFundersMethods;
};
stakers: {
v1beta1: KyveStakersMethods;
Expand Down Expand Up @@ -68,8 +68,12 @@ export default class KyveClient {
gov: {
v1: new KyveGovMethodsV1(this.nativeClient, this.account, config),
},
pool: {
v1beta1: new KyvePoolMethods(this.nativeClient, this.account, config),
funders: {
v1beta1: new KyveFundersMethods(
this.nativeClient,
this.account,
config
),
},
stakers: {
v1beta1: new KyveStakersMethods(
Expand Down
Loading