Skip to content

Commit

Permalink
fix(utils): add a block height header for time travel requests (but i…
Browse files Browse the repository at this point in the history
…t fails because cosmos/cosmos-sdk#9493)
  • Loading branch information
alexesDev committed Mar 20, 2024
1 parent c549802 commit de29b30
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ export const apiQuery = (node: string, path: string, height?: number) => {
const normalizedPath = path.replace(/^\/custom/, '/agoric');
const url = `${node}${normalizedPath}`;

return fetch(url).then((res) => {
const options: RequestInit = {};

if (height) {
options.headers = {
'X-Cosmos-Block-Height': height.toString(),
};
}

return fetch(url, options).then((res) => {
// probably gave the old rpc url
// https://github.com/Agoric/agoric-sdk/issues/9096
if (res.status === 404) {
Expand Down

0 comments on commit de29b30

Please sign in to comment.