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

Update kyve deps and apply relevant changes #285

Merged
merged 2 commits into from
Sep 2, 2024
Merged
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: 2 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Kyve dependency with breaking change (#285)

## [4.1.1] - 2024-08-23
### Fixed
Expand Down
3 changes: 1 addition & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"@cosmjs/cosmwasm-stargate": "^0.32.4",
"@cosmjs/proto-signing": "^0.32.4",
"@cosmjs/stargate": "^0.32.4",
"@kyvejs/protocol": "^1.0.12",
"@kyvejs/sdk": "^1.2.0",
"@kyvejs/sdk": "^1.3.2",
"@nestjs/common": "^9.4.0",
"@nestjs/core": "^9.4.0",
"@nestjs/event-emitter": "^2.0.0",
Expand Down
16 changes: 7 additions & 9 deletions packages/node/src/utils/kyve/kyve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import { JsonRpcSuccessResponse } from '@cosmjs/json-rpc';
import { Registry } from '@cosmjs/proto-signing';
import { logs } from '@cosmjs/stargate';
import { Responses } from '@cosmjs/tendermint-rpc/build/tendermint37/adaptor'; // adaptor is not exported
import KyveSDK, { KyveLCDClientType } from '@kyvejs/sdk';
import { SupportedChains } from '@kyvejs/sdk/src/constants'; // Currently these types are not exported
import { QueryPoolsResponse } from '@kyvejs/types/lcd/kyve/query/v1beta1/pools';
import KyveSDK, { KyveLCDClientType, constants } from '@kyvejs/sdk';
import { delay, getLogger, IBlock, timeout } from '@subql/node-core';
import { TxData } from '@subql/types-cosmos';
import axios, { AxiosResponse } from 'axios';
Expand Down Expand Up @@ -65,7 +63,7 @@ export class KyveApi {
chainId: string, // chainId for indexing chain
endpoint: string,
storageUrl: string,
kyveChainId: SupportedChains,
kyveChainId: constants.SupportedChains,
tmpCacheDir: string,
removeBuffer: number, // The buffer before a bundle file is removed from disc
): Promise<KyveApi> {
Expand Down Expand Up @@ -95,8 +93,7 @@ export class KyveApi {
chainId: string,
lcdClient: KyveLCDClientType,
): Promise<string> {
const poolsResponse =
(await lcdClient.kyve.query.v1beta1.pools()) as unknown as QueryPoolsResponse;
const poolsResponse = await lcdClient.kyve.query.v1beta1.pools();

for (const p of poolsResponse.pools) {
try {
Expand Down Expand Up @@ -176,7 +173,7 @@ export class KyveApi {
private async getBundleById(bundleId: number): Promise<BundleDetails> {
return (this.cachedBundleDetails[bundleId] ??= (() => {
// logger.debug(`getBundleId ${bundleId}`);
return this.lcdClient.kyve.query.v1beta1.finalizedBundle({
return this.lcdClient.kyve.v1.bundles.finalizedBundle({
pool_id: this.poolId,
id: bundleId.toString(),
}) as Promise<BundleDetails>;
Expand All @@ -190,9 +187,10 @@ export class KyveApi {
private async getLatestBundleId(): Promise<number> {
return parseDecimal(
(
await this.lcdClient.kyve.query.v1beta1.finalizedBundles({
await this.lcdClient.kyve.v1.bundles.finalizedBundles({
pool_id: this.poolId,
index: '1',
// Bad types and index takes perference over pagination to it cant be set
index: undefined as unknown as string,
pagination: {
reverse: true,
limit: '1',
Expand Down
Loading
Loading