Skip to content

Commit 99ba5e4

Browse files
committed
Use the "/status" endpoint to get the latest chain id
1 parent b1c60e8 commit 99ba5e4

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

packages/background/src/updater/service.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,17 @@ export class ChainUpdaterService {
6767
baseURL: chainInfo.rpc,
6868
});
6969

70-
// Get the latest block.
70+
// Get the status to get the chain id.
7171
const result = await instance.get<{
7272
result: {
73-
block: {
74-
header: {
75-
chain_id: string;
76-
};
73+
node_info: {
74+
network: "osmosis-1";
7775
};
7876
};
79-
}>("/block");
77+
}>("/status");
8078

8179
const currentVersion = ChainIdHelper.parse(chainInfo.chainId);
82-
const fetchedChainId = result.data.result.block.header.chain_id;
80+
const fetchedChainId = result.data.result.node_info.network;
8381
const fetchedVersion = ChainIdHelper.parse(fetchedChainId);
8482

8583
if (
@@ -207,18 +205,16 @@ export class ChainUpdaterService {
207205
baseURL: chainInfo.rpc,
208206
});
209207

210-
// Get the latest block.
208+
// Get the status to get the chain id.
211209
const result = await instance.get<{
212210
result: {
213-
block: {
214-
header: {
215-
chain_id: string;
216-
};
211+
node_info: {
212+
network: "osmosis-1";
217213
};
218214
};
219-
}>("/block");
215+
}>("/status");
220216

221-
const resultChainId = result.data.result.block.header.chain_id;
217+
const resultChainId = result.data.result.node_info.network;
222218

223219
const version = ChainIdHelper.parse(chainId);
224220
const fetchedVersion = ChainIdHelper.parse(resultChainId);

0 commit comments

Comments
 (0)