Skip to content

Commit

Permalink
Update kyve deps and apply relevant changes (#285)
Browse files Browse the repository at this point in the history
* Update kyve deps and apply relevant changes

* Update changelog
  • Loading branch information
stwiname committed Sep 2, 2024
1 parent 1fcf798 commit 597e79c
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 4,055 deletions.
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)

### Fixed
- Bump node-core, fix cron filter issue (#284)
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

0 comments on commit 597e79c

Please sign in to comment.