Skip to content

Commit 7494f14

Browse files
committed
Fix parsing response from ibc clientState query api
1 parent acab3a6 commit 7494f14

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@initia/initia.js",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "The JavaScript SDK for Initia",
55
"license": "MIT",
66
"author": "InitiaLabs",

src/client/lcd/api/IbcAPI.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ import {
99
IbcClientParams,
1010
} from '../../../core';
1111

12-
export interface Status {
13-
status: string;
12+
export interface ClientState {
13+
client_state: any;
14+
proof: string | null;
15+
proof_height: Height;
1416
}
1517

16-
export namespace Status {
18+
export namespace ClientState {
1719
export interface Data {
18-
status: string;
20+
client_state: any;
21+
proof: string | null;
22+
proof_height: Height.Data;
1923
}
2024
}
2125

@@ -160,12 +164,17 @@ export class IbcAPI extends BaseAPI {
160164
public async clientState(
161165
client_id: string,
162166
params: APIParams = {}
163-
): Promise<IdentifiedClientState> {
167+
): Promise<ClientState> {
164168
return this.c
165-
.get<{
166-
client_state: IdentifiedClientState.Data;
167-
}>(`/ibc/core/client/v1/client_states/${client_id}`, params)
168-
.then(d => IdentifiedClientState.fromData(d.client_state));
169+
.get<ClientState.Data>(
170+
`/ibc/core/client/v1/client_states/${client_id}`,
171+
params
172+
)
173+
.then(d => ({
174+
client_state: d.client_state,
175+
proof: d.proof,
176+
proof_height: Height.fromData(d.proof_height),
177+
}));
169178
}
170179

171180
/**
@@ -176,12 +185,12 @@ export class IbcAPI extends BaseAPI {
176185
public async clientStatus(
177186
client_id: string,
178187
params: APIParams = {}
179-
): Promise<Status> {
188+
): Promise<string> {
180189
return this.c
181190
.get<{
182-
status: Status.Data;
191+
status: string;
183192
}>(`/ibc/core/client/v1/client_status/${client_id}`, params)
184-
.then();
193+
.then(d => d.status);
185194
}
186195

187196
/**

0 commit comments

Comments
 (0)